Skip to content

Instantly share code, notes, and snippets.

{
"diffEditor.renderSideBySide": false, // Git の差分を行内に表示
"editor.colorDecorators": false, // カラーデコレーターを非表示
"editor.formatOnPaste": false, // ペースト時に自動でフォーマット
"editor.formatOnSave": false, // ファイル保存時に自動でフォーマット
"editor.formatOnType": false, // 入力した行を自動でフォーマット
"editor.minimap.renderCharacters": false, // ミニマップの表示文字をブロックに変更
"editor.minimap.showSlider": "always", // 表示領域をミニマップで常にハイライト
"editor.multiCursorModifier": "ctrlCmd", // マウスでの複数選択時の修飾キーを変更
"editor.renderControlCharacters": true, // 制御文字を表示
@tak-dcxi
tak-dcxi / initializeForm.ts
Created February 29, 2024 16:55
initializeForm
declare const AjaxZip3: any
const initializeForm = (form: HTMLFormElement): void => {
if (!form) throw new Error('form要素が提供されていません')
const inputElements: NodeListOf<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement> =
form.querySelectorAll('input, select, textarea')
const inputFileComponents: NodeListOf<HTMLElement> = form.querySelectorAll('.js-input-file')
const zipButton: HTMLElement | null = form.querySelector('#js-zip-button')
const inputDates: NodeListOf<HTMLInputElement> = form.querySelectorAll('[type="date"]')
@tak-dcxi
tak-dcxi / initializeTabs.ts
Last active May 7, 2024 02:37
initializeTabs
export type TabsOptions = {
tablistSelector: string | undefined
tabSelector: string | undefined
tabpanelSelector: string | undefined
firstView?: number
}
const defaultOptions: TabsOptions = {
tablistSelector: undefined,
tabSelector: undefined,
@tak-dcxi
tak-dcxi / initializeSmoothScroll.ts
Last active April 23, 2024 12:19
initializeSmoothScroll
const initializeSmoothScroll = (): void => {
// クリックイベントのリスナーを追加
document.addEventListener('click', handleClick, { capture: true })
}
// 固定配置のヘッダーのブロックサイズを取得
const getHeaderBlockSize = (): string => {
const header = document.querySelector('[data-fixed-header]') as HTMLElement
if (!header) return '0'
@tak-dcxi
tak-dcxi / initializeObserveAnimation.ts
Last active August 12, 2025 08:15
initializeObserveAnimation
export type ObserverOptions = {
root?: HTMLElement | null;
rootMargin?: string;
threshold?: number | number[];
};
const defaultOptions: ObserverOptions = {
root: null,
rootMargin: "0px",
threshold: 0
@tak-dcxi
tak-dcxi / initializeSplitText.ts
Last active April 26, 2024 07:37
initializeSplitText
type AccordionOptions = {
duration?: number
easing?: string
}
const defaultOptions: AccordionOptions = {
duration: 300,
easing: 'ease-in-out',
}
@tak-dcxi
tak-dcxi / initializeAnchorPositioning.ts
Last active April 28, 2024 12:57
initializeAnchorPositioning
const initializeAnchorPositioning = (): void => {
const anchorElements = document.querySelectorAll('[data-anchor]') as NodeListOf<HTMLElement>
anchorElements.forEach((anchorElement) => {
const targetId = anchorElement.getAttribute('data-anchor')
if (!targetId) return
const anchorTarget = document.getElementById(targetId) as HTMLElement
if (!anchorTarget) return
@tak-dcxi
tak-dcxi / initializeDetailsAccordion.ts
Last active April 30, 2024 08:43
initializeDetailsAccordion
export type AccordionOptions = {
duration?: number
easing?: string
printAll?: boolean
}
const defaultOptions: AccordionOptions = {
duration: 300,
easing: 'ease-in-out',
printAll: false,
@tak-dcxi
tak-dcxi / initializeAccordion.ts
Last active May 7, 2024 02:17
initializeAccordion
export type AccordionOptions = {
buttonSelector: string | undefined
panelSelector: string | undefined
duration?: number
easing?: string
printAll?: boolean
}
const defaultOptions: AccordionOptions = {
buttonSelector: undefined,
@tak-dcxi
tak-dcxi / backfaceFixed.ts
Last active April 30, 2024 14:43
backfaceFixed
const backfaceFixed = (fixed: boolean): void => {
const scrollBarWidth = getScrollBarSize()
const scrollPosition = getScrollPosition(fixed)
document.body.style.borderInlineEnd = fixed ? `${scrollBarWidth}px solid transparent` : ''
applyStyles(scrollPosition, fixed)
if (!fixed) restorePosition(scrollPosition)
}
const isWritingModeVertical = (): boolean => {