@vdegenne/links 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH;;GAEG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,UAE5C;AACD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,QAE7C;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,UAI/C;AACD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,QAEhD;AAED;;GAEG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,UAErC;AACD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,QAEtC;AAGD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,UAKnC;AACD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,QAEpC;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,UAEtC;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,QAEvC;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAExC;AACD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,QAEzC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH;;GAEG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,UAI5C;AACD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,QAE7C;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,UAI/C;AACD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,QAEhD;AAED;;GAEG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,UAErC;AACD,wBAAg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CAAC,KAAK,CAAC,EAAE,CAAC;AAChE,CAAC;AACD,MAAM,UAAU,SAAS,CAAC,KAAa;IACtC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,MAAM;AACN,MAAM,UAAU,MAAM,CAAC,KAAa;IACnC,2EAA2E;IAC3E,OAAO,yCAAyC,kBAAkB,CACjE,KAAK,CACL,OAAO,CAAC;AACV,CAAC;AACD,MAAM,UAAU,OAAO,CAAC,KAAa;IACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,SAAS;AACT,MAAM,UAAU,SAAS,CAAC,KAAa;IACtC,OAAO,iCAAiC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AACrE,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,WAAW;AACX,MAAM,UAAU,WAAW,CAAC,KAAa;IACxC,OAAO,4BAA4B,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AAChE,CAAC;AACD,MAAM,UAAU,YAAY,CAAC,KAAa;IACzC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * @license\n * Copyright (c) 2023 Valentin Degenne\n * SPDX-License-Identifier: MIT\n */\n\nfunction open(url: string, newTab = true) {\n\tif (newTab) {\n\t\twindow.open(url, '_blank');\n\t} else {\n\t\twindow.open(url);\n\t}\n}\n\n/**\n * Google related links\n */\n// google images\nexport function googleImagesUrl(input: string) {\n\treturn `http://www.google.com/search?q=${encodeURIComponent(input)}&tbm=isch`;\n}\nexport function googleImagesOpen(input: string) {\n\topen(googleImagesUrl(input));\n}\n\n// google translate\nexport function googleTranslateUrl(input: string) {\n\treturn `https://translate.google.com/?sl=auto&tl=en&text=${encodeURIComponent(\n\t\tinput\n\t)}&op=translate`;\n}\nexport function googleTranslateOpen(input: string) {\n\topen(googleTranslateUrl(input));\n}\n\n/**\n * Japanese related\n */\n// jisho\nexport function jishoUrl(input: string) {\n\treturn `https://jisho.org/search/${encodeURIComponent(input)}`;\n}\nexport function jishoOpen(input: string) {\n\topen(jishoUrl(input));\n}\n\n// goo\nexport function gooUrl(input: string) {\n\t// return `https://dictionary.goo.ne.jp/word/${encodeURIComponent(word)}/`;\n\treturn `https://dictionary.goo.ne.jp/srch/all/${encodeURIComponent(\n\t\tinput\n\t)}/m0u/`;\n}\nexport function gooOpen(input: string) {\n\topen(gooUrl(input));\n}\n\n// weblio\nexport function weblioUrl(input: string) {\n\treturn `https://www.weblio.jp/content/${encodeURIComponent(input)}`;\n}\nexport function weblioOpen(input: string) {\n\topen(weblioUrl(input));\n}\n\n// kotobank\nexport function kotobankUrl(input: string) {\n\treturn `https://kotobank.jp/word/${encodeURIComponent(input)}`;\n}\nexport function kotobankOpen(input: string) {\n\topen(kotobankUrl(input));\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,SAAS,IAAI,CAAC,GAAW,EAAE,MAAM,GAAG,IAAI;IACvC,IAAI,MAAM,EAAE;QACX,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;KAC3B;SAAM;QACN,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;AACF,CAAC;AAED;;GAEG;AACH,gBAAgB;AAChB,MAAM,UAAU,eAAe,CAAC,KAAa;IAC5C,OAAO,kCAAkC,kBAAkB,CAC1D,KAAK,CACL,WAAW,CAAC;AACd,CAAC;AACD,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC7C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED,mBAAmB;AACnB,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC/C,OAAO,oDAAoD,kBAAkB,CAC5E,KAAK,CACL,eAAe,CAAC;AAClB,CAAC;AACD,MAAM,UAAU,mBAAmB,CAAC,KAAa;IAChD,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,QAAQ;AACR,MAAM,UAAU,QAAQ,CAAC,KAAa;IACrC,OAAO,4BAA4B,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AAChE,CAAC;AACD,MAAM,UAAU,SAAS,CAAC,KAAa;IACtC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,MAAM;AACN,MAAM,UAAU,MAAM,CAAC,KAAa;IACnC,2EAA2E;IAC3E,OAAO,yCAAyC,kBAAkB,CACjE,KAAK,CACL,OAAO,CAAC;AACV,CAAC;AACD,MAAM,UAAU,OAAO,CAAC,KAAa;IACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACrB,CAAC;AAED,SAAS;AACT,MAAM,UAAU,SAAS,CAAC,KAAa;IACtC,OAAO,iCAAiC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AACrE,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,WAAW;AACX,MAAM,UAAU,WAAW,CAAC,KAAa;IACxC,OAAO,4BAA4B,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AAChE,CAAC;AACD,MAAM,UAAU,YAAY,CAAC,KAAa;IACzC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * @license\n * Copyright (c) 2023 Valentin Degenne\n * SPDX-License-Identifier: MIT\n */\n\nfunction open(url: string, newTab = true) {\n\tif (newTab) {\n\t\twindow.open(url, '_blank');\n\t} else {\n\t\twindow.open(url);\n\t}\n}\n\n/**\n * Google related links\n */\n// google images\nexport function googleImagesUrl(input: string) {\n\treturn `http://www.google.com/search?q=${encodeURIComponent(\n\t\tinput,\n\t)}&tbm=isch`;\n}\nexport function googleImagesOpen(input: string) {\n\topen(googleImagesUrl(input));\n}\n\n// google translate\nexport function googleTranslateUrl(input: string) {\n\treturn `https://translate.google.com/?sl=auto&tl=en&text=${encodeURIComponent(\n\t\tinput,\n\t)}&op=translate`;\n}\nexport function googleTranslateOpen(input: string) {\n\topen(googleTranslateUrl(input));\n}\n\n/**\n * Japanese related\n */\n// jisho\nexport function jishoUrl(input: string) {\n\treturn `https://jisho.org/search/${encodeURIComponent(input)}`;\n}\nexport function jishoOpen(input: string) {\n\topen(jishoUrl(input));\n}\n\n// goo\nexport function gooUrl(input: string) {\n\t// return `https://dictionary.goo.ne.jp/word/${encodeURIComponent(word)}/`;\n\treturn `https://dictionary.goo.ne.jp/srch/all/${encodeURIComponent(\n\t\tinput,\n\t)}/m0u/`;\n}\nexport function gooOpen(input: string) {\n\topen(gooUrl(input));\n}\n\n// weblio\nexport function weblioUrl(input: string) {\n\treturn `https://www.weblio.jp/content/${encodeURIComponent(input)}`;\n}\nexport function weblioOpen(input: string) {\n\topen(weblioUrl(input));\n}\n\n// kotobank\nexport function kotobankUrl(input: string) {\n\treturn `https://kotobank.jp/word/${encodeURIComponent(input)}`;\n}\nexport function kotobankOpen(input: string) {\n\topen(kotobankUrl(input));\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function naverOpen(word: string): Promise<void>;
2
+ //# sourceMappingURL=naver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naver.d.ts","sourceRoot":"","sources":["../../src/obscure/naver.ts"],"names":[],"mappings":"AAGA,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,iBAa3C"}
@@ -0,0 +1,14 @@
1
+ import { isFullChinese } from 'asian-regexps';
2
+ // naver
3
+ export async function naverOpen(word) {
4
+ let url;
5
+ if (word.length == 1 && isFullChinese(word)) {
6
+ const response = await fetch(`https://assiets.vdegenne.com/chinese/naver/${word}`);
7
+ url = `https://hanja.dict.naver.com/${await response.text()}/learning`;
8
+ }
9
+ else {
10
+ url = `https://ja.dict.naver.com/#/search?query=${encodeURIComponent(word)}&range=all`;
11
+ }
12
+ window.open(url, '_blank');
13
+ }
14
+ //# sourceMappingURL=naver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"naver.js","sourceRoot":"","sources":["../../src/obscure/naver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,QAAQ;AACR,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAY;IAC3C,IAAI,GAAG,CAAC;IACR,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;QAC5C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC3B,8CAA8C,IAAI,EAAE,CACpD,CAAC;QACF,GAAG,GAAG,gCAAgC,MAAM,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;KACvE;SAAM;QACN,GAAG,GAAG,4CAA4C,kBAAkB,CACnE,IAAI,CACJ,YAAY,CAAC;KACd;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import {isFullChinese} from 'asian-regexps';\n\n// naver\nexport async function naverOpen(word: string) {\n\tlet url;\n\tif (word.length == 1 && isFullChinese(word)) {\n\t\tconst response = await fetch(\n\t\t\t`https://assiets.vdegenne.com/chinese/naver/${word}`,\n\t\t);\n\t\turl = `https://hanja.dict.naver.com/${await response.text()}/learning`;\n\t} else {\n\t\turl = `https://ja.dict.naver.com/#/search?query=${encodeURIComponent(\n\t\t\tword,\n\t\t)}&range=all`;\n\t}\n\twindow.open(url, '_blank');\n}\n"]}
package/package.json CHANGED
@@ -1,11 +1,16 @@
1
1
  {
2
2
  "name": "@vdegenne/links",
3
- "version": "1.0.2",
4
- "main": "lib/index.js",
5
- "module": "lib/index.js",
6
- "type": "module",
3
+ "version": "1.0.3",
7
4
  "author": "Valentin Degenne <vdegenne@gmail.com>",
8
5
  "license": "MIT",
6
+ "type": "module",
7
+ "main": "lib/index.js",
8
+ "module": "lib/index.js",
9
+ "types": "lib/index.d.ts",
10
+ "exports": {
11
+ ".": "./lib/index.js",
12
+ "./obscure": "./lib/obscure/naver.js"
13
+ },
9
14
  "repository": {
10
15
  "type": "git",
11
16
  "url": "https://github.com/vdegenne/vdegenne-links.git"
@@ -28,6 +33,8 @@
28
33
  },
29
34
  "devDependencies": {
30
35
  "@changesets/cli": "^2.26.2",
36
+ "asian-regexps": "^5.0.0",
37
+ "prettier": "^3.1.1",
31
38
  "typescript": "^5.2.2",
32
39
  "wireit": "^0.14.0"
33
40
  },