Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ Put current timestamp to the `t` query parameter

Reopen currently playing music as video in normal YouTube

### [入力中の値を全角に変換](https://raw.githubusercontent.com/mkobayashime/bookmarklets/main/dist/zenkaku.js)

フォームなどで入力欄に入力中の値のうち、半角の数値などを全角に変換します

### [調整さん I'm free](https://raw.githubusercontent.com/mkobayashime/bookmarklets/main/dist/chouseisanImFree.js)

調整さんの全日程候補で○を選択します
1 change: 1 addition & 0 deletions dist/zenkaku.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions src/zenkaku.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @title 入力中の値を全角に変換
* @description フォームなどで入力欄に入力中の値のうち、半角の数値などを全角に変換します
*/

const toZenkaku = (str: string) =>
str
.replaceAll(/[A-Za-z0-9]/g, (s: string) =>
String.fromCharCode(s.charCodeAt(0) + 0xfee0),
)
.replaceAll(" ", " ")
.replaceAll("-", "-");

void (() => {
const { activeElement } = document;

if (!(activeElement instanceof HTMLInputElement)) return;

activeElement.value = toZenkaku(activeElement.value);
})();