Deploying to gh-pages from @ fishjar/kiss-translator@2650e5cf7c 🚀

This commit is contained in:
fishjar
2025-11-22 13:21:39 +00:00
parent 61cdd92214
commit 73ba693d31
9 changed files with 144 additions and 433 deletions

10
main.js
View File

@@ -34881,7 +34881,7 @@ function objectWithoutProperties_objectWithoutProperties(source, excluded) {
const Fetch_excluded=(/* unused pure expression or super */ null && (["execute"])),Fetch_excluded2=["execute"],Fetch_excluded3=["get"];const useAsync=()=>{const[data,setData]=(0,react.useState)(null);const[loading,setLoading]=(0,react.useState)(false);const[error,setError]=(0,react.useState)(null);const execute=(0,react.useCallback)(async function(fn){if(!fn){return;}setLoading(true);setError(null);try{for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key];}const res=await fn(...args);setData(res);setLoading(false);return res;}catch(err){setError((err===null||err===void 0?void 0:err.message)||"An unknown error occurred");setLoading(false);// throw err;
}},[]);const reset=(0,react.useCallback)(()=>{setData(null);setLoading(false);setError(null);},[]);return{data,loading,error,execute,reset};};const useAsyncNow=(fn,arg)=>{const _useAsync=useAsync(),{execute}=_useAsync,asyncState=_objectWithoutProperties(_useAsync,Fetch_excluded);useEffect(()=>{if(fn){execute(fn,arg);}},[execute,fn,arg]);return _objectSpread({},asyncState);};const useFetch=()=>{const _useAsync2=useAsync(),{execute}=_useAsync2,asyncState=objectWithoutProperties_objectWithoutProperties(_useAsync2,Fetch_excluded2);const requester=(0,react.useCallback)(async(url,options)=>{var _response$headers$get;const response=await fetch(url,options);if(!response.ok){const errorInfo=await response.text();throw new Error("Request failed: ".concat(response.status," ").concat(response.statusText," - ").concat(errorInfo));}if(response.status===204){return null;}if((_response$headers$get=response.headers.get("Content-Type"))!==null&&_response$headers$get!==void 0&&_response$headers$get.includes("json")){return response.json();}return response.text();},[]);const get=(0,react.useCallback)(async function(url){let options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};try{const result=await execute(requester,url,_objectSpread2(_objectSpread2({},options),{},{method:"GET"}));return result;}catch(err){return null;}},[execute,requester]);const post=(0,react.useCallback)(async function(url,body){let options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{const result=await execute(requester,url,_objectSpread2(_objectSpread2({},options),{},{method:"POST",headers:_objectSpread2({"Content-Type":"application/json"},options.headers),body:JSON.stringify(body)}));return result;}catch(err){return null;}},[execute,requester]);const put=(0,react.useCallback)(async function(url,body){let options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};try{const result=await execute(requester,url,_objectSpread2(_objectSpread2({},options),{},{method:"PUT",headers:_objectSpread2({"Content-Type":"application/json"},options.headers),body:JSON.stringify(body)}));return result;}catch(err){return null;}},[execute,requester]);const del=(0,react.useCallback)(async function(url){let options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};try{const result=await execute(requester,url,_objectSpread2(_objectSpread2({},options),{},{method:"DELETE"}));return result;}catch(err){return null;}},[execute,requester]);return _objectSpread2(_objectSpread2({},asyncState),{},{get,post,put,del});};const useGet=url=>{const _useFetch=useFetch(),{get}=_useFetch,fetchState=objectWithoutProperties_objectWithoutProperties(_useFetch,Fetch_excluded3);(0,react.useEffect)(()=>{if(url)get(url);},[url,get]);return _objectSpread2({},fetchState);};
;// CONCATENATED MODULE: ./src/config/app.js
const APP_NAME="KISS Translator".trim().split(/\s+/).join("-");const APP_LCNAME=APP_NAME.toLowerCase();const APP_UPNAME=APP_NAME.toUpperCase();const APP_CONSTS={fabID:"".concat(APP_LCNAME,"-fab"),boxID:"".concat(APP_LCNAME,"-box"),popupID:"".concat(APP_LCNAME,"-popup")};const APP_VERSION="2.0.11".split(".");const THEME_LIGHT="light";const THEME_DARK="dark";
const APP_NAME="KISS Translator".trim().split(/\s+/).join("-");const APP_LCNAME=APP_NAME.toLowerCase();const APP_UPNAME=APP_NAME.toUpperCase();const APP_CONSTS={fabID:"".concat(APP_LCNAME,"-fab"),boxID:"".concat(APP_LCNAME,"-box"),popupID:"".concat(APP_LCNAME,"-popup")};const APP_VERSION="2.0.12".split(".");const THEME_LIGHT="light";const THEME_DARK="dark";
;// CONCATENATED MODULE: ./src/config/api.js
const DEFAULT_HTTP_TIMEOUT=10000;// 调用超时时间
const DEFAULT_FETCH_LIMIT=10;// 默认最大任务数量
@@ -34988,9 +34988,7 @@ const OPT_STYLE_COLORFUL="colorful";// 多彩
const OPT_STYLE_ALL=[OPT_STYLE_NONE,OPT_STYLE_LINE,OPT_STYLE_DOTLINE,OPT_STYLE_DASHLINE,OPT_STYLE_DASHLINE_BOLD,OPT_STYLE_WAVYLINE,OPT_STYLE_WAVYLINE_BOLD,OPT_STYLE_DASHBOX,OPT_STYLE_DASHBOX_BOLD,OPT_STYLE_MARKER,OPT_STYLE_GRADIENT_MARKER,OPT_STYLE_FUZZY,OPT_STYLE_HIGHLIGHT,OPT_STYLE_BLOCKQUOTE,OPT_STYLE_GRADIENT,OPT_STYLE_BLINK,OPT_STYLE_GLOW,OPT_STYLE_COLORFUL];const DEFAULT_CUSTOM_STYLES=[{styleSlug:"custom",styleName:"Custom Style",styleCode:"color: #209CEE;"}];
;// CONCATENATED MODULE: ./src/config/rules.js
const GLOBAL_KEY="*";const REMAIN_KEY="-";const SHADOW_KEY=">>>";const DEFAULT_COLOR="#209CEE";// 默认高亮背景色/线条颜色
const DEFAULT_TRANS_TAG="font";// export const DEFAULT_SELECT_STYLE =
// "-webkit-line-clamp: unset; max-height: none; height: auto;";
const OPT_TIMING_PAGESCROLL="mk_pagescroll";// 滚动加载翻译
const DEFAULT_TRANS_TAG="font";const DEFAULT_SELECT_STYLE="-webkit-line-clamp: unset; max-height: none; height: auto;";const OPT_TIMING_PAGESCROLL="mk_pagescroll";// 滚动加载翻译
const OPT_TIMING_PAGEOPEN="mk_pageopen";// 直接翻译到底
const OPT_TIMING_MOUSEOVER="mk_mouseover";const OPT_TIMING_CONTROL="mk_ctrlKey";const OPT_TIMING_SHIFT="mk_shiftKey";const OPT_TIMING_ALT="mk_altKey";const OPT_TIMING_ALL=[OPT_TIMING_PAGESCROLL,OPT_TIMING_PAGEOPEN,OPT_TIMING_MOUSEOVER,OPT_TIMING_CONTROL,OPT_TIMING_SHIFT,OPT_TIMING_ALT];const OPT_SPLIT_PARAGRAPH_DISABLE="split_disable";const OPT_SPLIT_PARAGRAPH_TEXTLENGTH="split_textlength";const OPT_SPLIT_PARAGRAPH_PUNCTUATION="split_punctuation";const OPT_SPLIT_PARAGRAPH_ALL=[OPT_SPLIT_PARAGRAPH_DISABLE,OPT_SPLIT_PARAGRAPH_PUNCTUATION,OPT_SPLIT_PARAGRAPH_TEXTLENGTH];const OPT_HIGHLIGHT_WORDS_DISABLE="highlight_disable";const OPT_HIGHLIGHT_WORDS_BEFORETRANS="highlight_beforetrans";const OPT_HIGHLIGHT_WORDS_AFTERTRANS="highlight_aftertrans";const OPT_HIGHLIGHT_WORDS_ALL=[OPT_HIGHLIGHT_WORDS_DISABLE,OPT_HIGHLIGHT_WORDS_BEFORETRANS,OPT_HIGHLIGHT_WORDS_AFTERTRANS];const DEFAULT_SELECTOR="h1, h2, h3, h4, h5, h6, li, p, dd, blockquote, figcaption, label, legend";const DEFAULT_IGNORE_SELECTOR="button, footer, pre, mark, nav";const DEFAULT_KEEP_SELECTOR="code, cite, math, .math, a:has(code)";const DEFAULT_RULE={pattern:"",// 匹配网址
selector:"",// 选择器
@@ -35048,7 +35046,7 @@ transOpen:"false",// 开启翻译
textExtStyle:"",// 译文附加样式
termsStyle:"font-weight: bold;",// 专业术语样式
highlightStyle:"color: red;",// 高亮词汇样式
selectStyle:"",// 选择器节点样式
selectStyle:DEFAULT_SELECT_STYLE,// 选择器节点样式
parentStyle:"",// 选择器父节点样式
grandStyle:"",// 选择器祖节点样式
injectJs:"",// 注入JS
@@ -35217,7 +35215,7 @@ const CLIENT_WEB="web";const CLIENT_CHROME="chrome";const CLIENT_EDGE="edge";con
;// CONCATENATED MODULE: ./src/config/index.js
;// CONCATENATED MODULE: ./src/index.js
function App(){var _I18N$about_md;const[lang,setLang]=(0,react.useState)("zh");const{data,loading,error}=useGet("".concat(URL_RAW_PREFIX,"/").concat(I18N===null||I18N===void 0?void 0:(_I18N$about_md=I18N["about_md"])===null||_I18N$about_md===void 0?void 0:_I18N$about_md[lang]));return/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{sx:{padding:2,margin:2},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:()=>{setLang(pre=>pre==="zh"?"en":"zh");},children:lang==="zh"?"ENGLISH":"中文"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("2.0.11")})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install/Update Userscript for Tampermonkey/Violentmonkey"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install/Update Userscript for iOS Safari"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/options.html",children:"Open Options Page"})]}),loading?/*#__PURE__*/(0,jsx_runtime.jsx)("center",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown,{children:error||data})]});}const src_root=client.createRoot(document.getElementById("root"));src_root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})}));
function App(){var _I18N$about_md;const[lang,setLang]=(0,react.useState)("zh");const{data,loading,error}=useGet("".concat(URL_RAW_PREFIX,"/").concat(I18N===null||I18N===void 0?void 0:(_I18N$about_md=I18N["about_md"])===null||_I18N$about_md===void 0?void 0:_I18N$about_md[lang]));return/*#__PURE__*/(0,jsx_runtime.jsxs)(Paper_Paper,{sx:{padding:2,margin:2},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Stack_Stack,{spacing:2,direction:"row",justifyContent:"flex-end",children:/*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button,{variant:"text",onClick:()=>{setLang(pre=>pre==="zh"?"en":"zh");},children:lang==="zh"?"ENGLISH":"中文"})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("2.0.12")})}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install/Update Userscript for Tampermonkey/Violentmonkey"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install/Update Userscript for iOS Safari"}),/*#__PURE__*/(0,jsx_runtime.jsx)(Link_Link,{href:"https://fishjar.github.io/kiss-translator/options.html",children:"Open Options Page"})]}),loading?/*#__PURE__*/(0,jsx_runtime.jsx)("center",{children:/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})}):/*#__PURE__*/(0,jsx_runtime.jsx)(ReactMarkdown,{children:error||data})]});}const src_root=client.createRoot(document.getElementById("root"));src_root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(App,{})}));
})();
/******/ })()