@vdegenne/links 1.8.0 → 1.8.2
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.
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -158,7 +158,7 @@ export function lensHistoryOpen(input, local = false) {
|
|
|
158
158
|
* You need the extension: https://chromewebstore.google.com/detail/chatgpt-hash/dammfmpccfehndicnhkmjjiipkhongfa
|
|
159
159
|
*/
|
|
160
160
|
export function chatGptUrl(question) {
|
|
161
|
-
return `https://chatgpt.com
|
|
161
|
+
return `https://chatgpt.com/?q=${encodeURIComponent(question)}`;
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* You need the extension: https://chromewebstore.google.com/detail/chatgpt-hash/dammfmpccfehndicnhkmjjiipkhongfa
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5B,CAAC;SAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC;AACF,CAAC;AAwCD,MAAM,UAAU,eAAe,CAC9B,KAAa,EACb,OAA6B;IAK7B,OAAO,KAAK,EAAE,CAAC;IAEf,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,8BAA8B,CAAC,CAAC;IACrD,IAAI,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACnC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7B,IAAI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AAM,UAAU,SAAS,CAAC,KAAa;IACtC,OAAO,mCAAmC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AACvE,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,KAAiB;IACxD,OAAO,gCAAgC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,KAAiB;IACzD,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAW;IACtC,OAAO,sCAAsC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;AACxE,CAAC;AACD,MAAM,UAAU,YAAY,CAAC,GAAW;IACvC,IAAI,CAAC,GAAG,CAAC,CAAC;AACX,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 type GoogleImagesSize =\n\t| 'l'\n\t| 'm'\n\t| 'i'\n\t| 'qsvga'\n\t| 'vga'\n\t| 'svga'\n\t| 'xga'\n\t| '2mp'\n\t| '4mp'\n\t| '6mp'\n\t| '8mp'\n\t| '10mp'\n\t| '12mp'\n\t| '15mp'\n\t| '20mp'\n\t| '40mp'\n\t| '70mp';\n\nexport type GoogleImagesDate = 'd' | 'w' | 'm' | 'y';\nexport type GoogleImagesType =\n\t| 'animated'\n\t| 'face'\n\t| 'clipart'\n\t| 'lineart'\n\t| 'photo';\n\nexport interface GoogleImagesOptions {\n\tsize?: GoogleImagesSize;\n\tdate?: GoogleImagesDate;\n\ttype?: GoogleImagesType;\n\texcludedWords?: string[];\n}\n\nexport function googleImagesUrl(\n\tinput: string,\n\toptions?: GoogleImagesOptions,\n\t// size?: GoogleImagesSize,\n\t// date?: GoogleImagesDate,\n\t// excludeWords?: string[],\n) {\n\toptions ??= {};\n\n\tconst base = new URL('http://www.google.com/search');\n\tlet params = new URLSearchParams();\n\tparams.append('udm', '2');\n\tparams.append('as_q', input);\n\tif (options.excludedWords && options.excludedWords.length) {\n\t\tparams.append('as_eq', options.excludedWords.join(' '));\n\t}\n\n\tlet tbsParams = [];\n\tif (options.size) {\n\t\tif (!['s', 'm', 'l'].includes(options.size)) {\n\t\t\ttbsParams.push('isz:lt');\n\t\t\ttbsParams.push(`islt:${options.size}`);\n\t\t} else {\n\t\t\ttbsParams.push(`isz:${options.size}`);\n\t\t}\n\t}\n\tif (options.date) {\n\t\ttbsParams.push(`qdr:${options.date}`);\n\t}\n\tif (options.type) {\n\t\ttbsParams.push(`itp:${options.type}`);\n\t}\n\n\tif (tbsParams.length > 0) {\n\t\tparams.append('tbs', tbsParams.join(','));\n\t}\n\n\tbase.search = params.toString();\n\treturn base.toString();\n}\n\nexport function googleImagesOpen(\n\tinput: string,\n\toptions?: GoogleImagesOptions,\n\t// size?: GoogleImagesSize,\n\t// date?: GoogleImagesDate,\n\t// excludeWords?: string[],\n) {\n\topen(googleImagesUrl(input, options));\n}\n\nexport interface GoogleImagesSearchContext extends GoogleImagesOptions {\n\tquery: string[];\n\t// excluded: string[];\n\t// size?: GoogleImagesSize;\n\t// date?: GoogleImagesDate;\n\t// type?: GoogleImagesType;\n}\n\nexport function googleImagesUrlAnalyzer(\n\tgImgUrl: string,\n): GoogleImagesSearchContext {\n\tconst url = new URL(gImgUrl);\n\tconst info: GoogleImagesSearchContext = {\n\t\tquery: [],\n\t\texcludedWords: [],\n\t};\n\tconst params = url.searchParams;\n\tif (!params.get('udm') || params.get('udm') !== '2') {\n\t\tthrow new Error('Not a Google Images search');\n\t}\n\tconst getKeywords = (paramName: string) =>\n\t\t(params.get(paramName) || '').split(' ').filter((v) => v);\n\tconst keywords = [\n\t\t...getKeywords('q'),\n\t\t...getKeywords('as_q'),\n\t\t...getKeywords('as_eq').map((v) => `-${v}`),\n\t];\n\n\t// Search keywords\n\tinfo.query = keywords.filter((v) => !v.startsWith('-'));\n\t// Excluded search keywords\n\tinfo.excludedWords = keywords\n\t\t.filter((v) => v.startsWith('-'))\n\t\t.map((v) => v.slice(1));\n\n\tconst tbs = params.get('tbs');\n\tif (tbs) {\n\t\tconst tbsInfo = Object.fromEntries(\n\t\t\ttbs.split(',').map((p) => p.split(':')),\n\t\t);\n\t\tif (tbsInfo.isz) {\n\t\t\tinfo.size =\n\t\t\t\ttbsInfo.isz === 'lt' && tbsInfo.islt\n\t\t\t\t\t? tbsInfo.islt\n\t\t\t\t\t: tbsInfo.isz;\n\t\t}\n\t\tif (tbsInfo.qdr) {\n\t\t\tinfo.date = tbsInfo.qdr;\n\t\t}\n\t\tif (tbsInfo.itp) {\n\t\t\tinfo.type = tbsInfo.itp;\n\t\t}\n\t}\n\treturn info;\n}\n\n// google translate\nexport function googleTranslateUrl(\n\tinput: string,\n\tlang = 'en',\n\tsource = 'auto',\n) {\n\treturn `https://translate.google.com/?sl=${source}&tl=${lang}&text=${encodeURIComponent(\n\t\tinput,\n\t)}&op=translate`;\n}\nexport function googleTranslateOpen(\n\tinput: string,\n\tlang?: string,\n\tsource?: string,\n) {\n\topen(googleTranslateUrl(input, lang, source));\n}\n\nexport function youtubeUrl(id: string, time?: number) {\n\tconst t = Math.floor(time || 0);\n\treturn `https://www.youtube.com/watch?v=${id}${t ? `&t=${t}s` : ''}`;\n}\nexport function youtubeOpen(id: string, time?: number) {\n\topen(youtubeUrl(id, time));\n}\n\nexport function youtubeSearchUrl(input: string) {\n\treturn `https://www.youtube.com/results?search_query=${encodeURIComponent(\n\t\tinput,\n\t)}`;\n}\nexport function youtubeSearchOpen(input: string) {\n\topen(youtubeSearchUrl(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\n// Mdbg\ninterface MdbgOptions {\n\ttype: 'simplified' | 'traditional';\n}\n\nexport function mdbgUrl(input: string, options?: Partial<MdbgOptions>) {\n\tconst defaults: MdbgOptions = {type: 'traditional'};\n\toptions = Object.assign({}, defaults, options);\n\treturn `https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=${options.type === 'simplified' ? 0 : 1}&wdqb=${encodeURIComponent(\n\t\tinput,\n\t)}`;\n}\nexport function mdbgOpen(input: string, options?: Partial<MdbgOptions>) {\n\topen(mdbgUrl(input, options));\n}\n\nexport function lensHistoryUrl(input: string, local = false) {\n\tif (local) {\n\t\treturn `http://localhost:5177/#search=${input}`;\n\t}\n\treturn `https://vdegenne.github.io/japanese-lens-history/#search=${input}`;\n}\nexport function lensHistoryOpen(input: string, local = false) {\n\topen(lensHistoryUrl(input, local));\n}\n\n/**\n * You need the extension: https://chromewebstore.google.com/detail/chatgpt-hash/dammfmpccfehndicnhkmjjiipkhongfa\n */\nexport function chatGptUrl(question: string) {\n\treturn `https://chatgpt.com/#${encodeURIComponent(question)}`;\n}\n/**\n * You need the extension: https://chromewebstore.google.com/detail/chatgpt-hash/dammfmpccfehndicnhkmjjiipkhongfa\n */\nexport function chatGptOpen(question: string) {\n\topen(chatGptUrl(question));\n}\n\nexport function googleUrl(input: string): string {\n\treturn `https://www.google.com/search?q=${encodeURIComponent(input)}`;\n}\nexport function googleOpen(input: string) {\n\topen(googleUrl(input));\n}\n\nexport function lichessUrl(fen: string, color?: 'w' | 'b') {\n\treturn `https://lichess.org/analysis/${fen}${color ? `_${color}` : ''}?color=white`;\n}\n\nexport function openLichess(fen: string, color?: 'w' | 'b') {\n\topen(lichessUrl(fen, color));\n}\n\nexport function chesscomUrl(fen: string) {\n\treturn `https://www.chess.com/analysis?fen=${encodeURIComponent(fen)}`;\n}\nexport function chesscomOpen(fen: string) {\n\topen(fen);\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,CAAC;QACZ,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC5B,CAAC;SAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClB,CAAC;AACF,CAAC;AAwCD,MAAM,UAAU,eAAe,CAC9B,KAAa,EACb,OAA6B;IAK7B,OAAO,KAAK,EAAE,CAAC;IAEf,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,8BAA8B,CAAC,CAAC;IACrD,IAAI,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACnC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC1B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC7B,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,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C,OAAO,mCAAmC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AACvE,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,KAAiB;IACxD,OAAO,gCAAgC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,KAAiB;IACzD,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAW;IACtC,OAAO,sCAAsC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC;AACxE,CAAC;AACD,MAAM,UAAU,YAAY,CAAC,GAAW;IACvC,IAAI,CAAC,GAAG,CAAC,CAAC;AACX,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 type GoogleImagesSize =\n\t| 'l'\n\t| 'm'\n\t| 'i'\n\t| 'qsvga'\n\t| 'vga'\n\t| 'svga'\n\t| 'xga'\n\t| '2mp'\n\t| '4mp'\n\t| '6mp'\n\t| '8mp'\n\t| '10mp'\n\t| '12mp'\n\t| '15mp'\n\t| '20mp'\n\t| '40mp'\n\t| '70mp';\n\nexport type GoogleImagesDate = 'd' | 'w' | 'm' | 'y';\nexport type GoogleImagesType =\n\t| 'animated'\n\t| 'face'\n\t| 'clipart'\n\t| 'lineart'\n\t| 'photo';\n\nexport interface GoogleImagesOptions {\n\tsize?: GoogleImagesSize;\n\tdate?: GoogleImagesDate;\n\ttype?: GoogleImagesType;\n\texcludedWords?: string[];\n}\n\nexport function googleImagesUrl(\n\tinput: string,\n\toptions?: GoogleImagesOptions,\n\t// size?: GoogleImagesSize,\n\t// date?: GoogleImagesDate,\n\t// excludeWords?: string[],\n) {\n\toptions ??= {};\n\n\tconst base = new URL('http://www.google.com/search');\n\tlet params = new URLSearchParams();\n\tparams.append('udm', '2');\n\tparams.append('as_q', input);\n\tif (options.excludedWords && options.excludedWords.length) {\n\t\tparams.append('as_eq', options.excludedWords.join(' '));\n\t}\n\n\tlet tbsParams = [];\n\tif (options.size) {\n\t\tif (!['s', 'm', 'l'].includes(options.size)) {\n\t\t\ttbsParams.push('isz:lt');\n\t\t\ttbsParams.push(`islt:${options.size}`);\n\t\t} else {\n\t\t\ttbsParams.push(`isz:${options.size}`);\n\t\t}\n\t}\n\tif (options.date) {\n\t\ttbsParams.push(`qdr:${options.date}`);\n\t}\n\tif (options.type) {\n\t\ttbsParams.push(`itp:${options.type}`);\n\t}\n\n\tif (tbsParams.length > 0) {\n\t\tparams.append('tbs', tbsParams.join(','));\n\t}\n\n\tbase.search = params.toString();\n\treturn base.toString();\n}\n\nexport function googleImagesOpen(\n\tinput: string,\n\toptions?: GoogleImagesOptions,\n\t// size?: GoogleImagesSize,\n\t// date?: GoogleImagesDate,\n\t// excludeWords?: string[],\n) {\n\topen(googleImagesUrl(input, options));\n}\n\nexport interface GoogleImagesSearchContext extends GoogleImagesOptions {\n\tquery: string[];\n\t// excluded: string[];\n\t// size?: GoogleImagesSize;\n\t// date?: GoogleImagesDate;\n\t// type?: GoogleImagesType;\n}\n\nexport function googleImagesUrlAnalyzer(\n\tgImgUrl: string,\n): GoogleImagesSearchContext {\n\tconst url = new URL(gImgUrl);\n\tconst info: GoogleImagesSearchContext = {\n\t\tquery: [],\n\t\texcludedWords: [],\n\t};\n\tconst params = url.searchParams;\n\tif (!params.get('udm') || params.get('udm') !== '2') {\n\t\tthrow new Error('Not a Google Images search');\n\t}\n\tconst getKeywords = (paramName: string) =>\n\t\t(params.get(paramName) || '').split(' ').filter((v) => v);\n\tconst keywords = [\n\t\t...getKeywords('q'),\n\t\t...getKeywords('as_q'),\n\t\t...getKeywords('as_eq').map((v) => `-${v}`),\n\t];\n\n\t// Search keywords\n\tinfo.query = keywords.filter((v) => !v.startsWith('-'));\n\t// Excluded search keywords\n\tinfo.excludedWords = keywords\n\t\t.filter((v) => v.startsWith('-'))\n\t\t.map((v) => v.slice(1));\n\n\tconst tbs = params.get('tbs');\n\tif (tbs) {\n\t\tconst tbsInfo = Object.fromEntries(\n\t\t\ttbs.split(',').map((p) => p.split(':')),\n\t\t);\n\t\tif (tbsInfo.isz) {\n\t\t\tinfo.size =\n\t\t\t\ttbsInfo.isz === 'lt' && tbsInfo.islt\n\t\t\t\t\t? tbsInfo.islt\n\t\t\t\t\t: tbsInfo.isz;\n\t\t}\n\t\tif (tbsInfo.qdr) {\n\t\t\tinfo.date = tbsInfo.qdr;\n\t\t}\n\t\tif (tbsInfo.itp) {\n\t\t\tinfo.type = tbsInfo.itp;\n\t\t}\n\t}\n\treturn info;\n}\n\n// google translate\nexport function googleTranslateUrl(\n\tinput: string,\n\tlang = 'en',\n\tsource = 'auto',\n) {\n\treturn `https://translate.google.com/?sl=${source}&tl=${lang}&text=${encodeURIComponent(\n\t\tinput,\n\t)}&op=translate`;\n}\nexport function googleTranslateOpen(\n\tinput: string,\n\tlang?: string,\n\tsource?: string,\n) {\n\topen(googleTranslateUrl(input, lang, source));\n}\n\nexport function youtubeUrl(id: string, time?: number) {\n\tconst t = Math.floor(time || 0);\n\treturn `https://www.youtube.com/watch?v=${id}${t ? `&t=${t}s` : ''}`;\n}\nexport function youtubeOpen(id: string, time?: number) {\n\topen(youtubeUrl(id, time));\n}\n\nexport function youtubeSearchUrl(input: string) {\n\treturn `https://www.youtube.com/results?search_query=${encodeURIComponent(\n\t\tinput,\n\t)}`;\n}\nexport function youtubeSearchOpen(input: string) {\n\topen(youtubeSearchUrl(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\n// Mdbg\ninterface MdbgOptions {\n\ttype: 'simplified' | 'traditional';\n}\n\nexport function mdbgUrl(input: string, options?: Partial<MdbgOptions>) {\n\tconst defaults: MdbgOptions = {type: 'traditional'};\n\toptions = Object.assign({}, defaults, options);\n\treturn `https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=${options.type === 'simplified' ? 0 : 1}&wdqb=${encodeURIComponent(\n\t\tinput,\n\t)}`;\n}\nexport function mdbgOpen(input: string, options?: Partial<MdbgOptions>) {\n\topen(mdbgUrl(input, options));\n}\n\nexport function lensHistoryUrl(input: string, local = false) {\n\tif (local) {\n\t\treturn `http://localhost:5177/#search=${input}`;\n\t}\n\treturn `https://vdegenne.github.io/japanese-lens-history/#search=${input}`;\n}\nexport function lensHistoryOpen(input: string, local = false) {\n\topen(lensHistoryUrl(input, local));\n}\n\n/**\n * You need the extension: https://chromewebstore.google.com/detail/chatgpt-hash/dammfmpccfehndicnhkmjjiipkhongfa\n */\nexport function chatGptUrl(question: string) {\n\treturn `https://chatgpt.com/?q=${encodeURIComponent(question)}`;\n}\n/**\n * You need the extension: https://chromewebstore.google.com/detail/chatgpt-hash/dammfmpccfehndicnhkmjjiipkhongfa\n */\nexport function chatGptOpen(question: string) {\n\topen(chatGptUrl(question));\n}\n\nexport function googleUrl(input: string): string {\n\treturn `https://www.google.com/search?q=${encodeURIComponent(input)}`;\n}\nexport function googleOpen(input: string) {\n\topen(googleUrl(input));\n}\n\nexport function lichessUrl(fen: string, color?: 'w' | 'b') {\n\treturn `https://lichess.org/analysis/${fen}${color ? `_${color}` : ''}?color=white`;\n}\n\nexport function openLichess(fen: string, color?: 'w' | 'b') {\n\topen(lichessUrl(fen, color));\n}\n\nexport function chesscomUrl(fen: string) {\n\treturn `https://www.chess.com/analysis?fen=${encodeURIComponent(fen)}`;\n}\nexport function chesscomOpen(fen: string) {\n\topen(fen);\n}\n"]}
|