Deploying to gh-pages from @ fishjar/kiss-translator@7b6148302d 🚀
This commit is contained in:
@@ -58227,7 +58227,7 @@ var DarkMode = __webpack_require__(45);
|
||||
;// CONCATENATED MODULE: ./src/views/Options/DarkModeButton.js
|
||||
function DarkModeButton(){var _useDarkMode=useDarkMode(),darkMode=_useDarkMode.darkMode,toggleDarkMode=_useDarkMode.toggleDarkMode;return/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{onClick:toggleDarkMode,color:"inherit",children:darkMode?/*#__PURE__*/(0,jsx_runtime.jsx)(LightMode/* default */.Z,{}):/*#__PURE__*/(0,jsx_runtime.jsx)(DarkMode/* default */.Z,{})});}
|
||||
;// CONCATENATED MODULE: ./src/views/Options/Header.js
|
||||
function Header(props){var i18n=useI18n();var onDrawerToggle=props.onDrawerToggle;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppBar_AppBar,{color:"primary",position:"sticky",sx:{zIndex:1300},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Toolbar_Toolbar,{variant:"dense",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{sx:{display:{sm:"none",xs:"block"}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{color:"inherit","aria-label":"open drawer",onClick:onDrawerToggle,edge:"start",children:/*#__PURE__*/(0,jsx_runtime.jsx)(icons_material_Menu/* default */.Z,{})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{sx:{flexGrow:1},children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{underline:"none",color:"inherit",href:"https://github.com/fishjar/kiss-translator",target:"_blank",children:"".concat(i18n("app_name")," v").concat("1.6.9")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]})});}/* harmony default export */ var Options_Header = (Header);
|
||||
function Header(props){var i18n=useI18n();var onDrawerToggle=props.onDrawerToggle;return/*#__PURE__*/(0,jsx_runtime.jsx)(AppBar_AppBar,{color:"primary",position:"sticky",sx:{zIndex:1300},children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Toolbar_Toolbar,{variant:"dense",children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{sx:{display:{sm:"none",xs:"block"}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(IconButton_IconButton,{color:"inherit","aria-label":"open drawer",onClick:onDrawerToggle,edge:"start",children:/*#__PURE__*/(0,jsx_runtime.jsx)(icons_material_Menu/* default */.Z,{})})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{sx:{flexGrow:1},children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{underline:"none",color:"inherit",href:"https://github.com/fishjar/kiss-translator",target:"_blank",children:"".concat(i18n("app_name")," v").concat("1.6.10")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(DarkModeButton,{})]})});}/* harmony default export */ var Options_Header = (Header);
|
||||
;// CONCATENATED MODULE: ./src/views/Options/Layout.js
|
||||
function Layout(){var navWidth=256;var location=dist_useLocation();var theme=useTheme_useTheme();var _useState=(0,react.useState)(false),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),open=_useState2[0],setOpen=_useState2[1];var isSm=useMediaQuery(theme.breakpoints.up("sm"));var handleDrawerToggle=function handleDrawerToggle(){setOpen(!open);};(0,react.useEffect)(function(){setOpen(false);},[location]);return/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(CssBaseline_CssBaseline,{}),/*#__PURE__*/(0,jsx_runtime.jsx)(Options_Header,{onDrawerToggle:handleDrawerToggle}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Box_Box,{sx:{display:"flex"},children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{component:"nav",sx:{width:{sm:navWidth},flexShrink:{sm:0}},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Navigator,{PaperProps:{style:{width:navWidth}},variant:isSm?"permanent":"temporary",open:isSm?true:open,onClose:handleDrawerToggle})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Box_Box,{component:"main",sx:{flex:1,p:2},children:/*#__PURE__*/(0,jsx_runtime.jsx)(Outlet,{})})]})]});}
|
||||
;// CONCATENATED MODULE: ./src/hooks/Sync.js
|
||||
@@ -58585,7 +58585,7 @@ Divider.muiSkipListHighlight = true;
|
||||
var gm_ref;var MSG_GM_xmlHttpRequest="xmlHttpRequest";var MSG_GM_setValue="setValue";var MSG_GM_getValue="getValue";var MSG_GM_deleteValue="deleteValue";var MSG_GM_info="info";/**
|
||||
* 注入页面的脚本,请求并接受GM接口信息
|
||||
* @param {*} param0
|
||||
*/var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.6.9",eventName:ping};};/**
|
||||
*/var injectScript=function injectScript(ping){window.APP_INFO={name:"KISS Translator",version:"1.6.10",eventName:ping};};/**
|
||||
* 适配GM脚本
|
||||
*/var adaptScript=function adaptScript(ping){var _getInfo;var promiseGM=function promiseGM(action,args){var timeout=arguments.length>2&&arguments[2]!==undefined?arguments[2]:5000;return new Promise(function(resolve,reject){var pong=genEventName();var handleEvent=function handleEvent(e){window.removeEventListener(pong,handleEvent);var _e$detail=e.detail,data=_e$detail.data,error=_e$detail.error;if(error){reject(new Error(error));}else{resolve(data);}};window.addEventListener(pong,handleEvent);window.dispatchEvent(new CustomEvent(ping,{detail:{action:action,args:args,pong:pong}}));setTimeout(function(){window.removeEventListener(pong,handleEvent);reject(new Error("timeout"));},timeout);});};window.KISS_GM={fetch:function fetch(input,init){return promiseGM(MSG_GM_xmlHttpRequest,{input:input,init:init});},setValue:function setValue(key,val){return promiseGM(MSG_GM_setValue,{key:key,val:val});},getValue:function getValue(key){return promiseGM(MSG_GM_getValue,{key:key});},deleteValue:function deleteValue(key){return promiseGM(MSG_GM_deleteValue,{key:key});},getInfo:function getInfo(){return(_getInfo=_getInfo||asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(){return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(window.GM_info){_context.next=4;break;}_context.next=3;return promiseGM(MSG_GM_info);case 3:window.GM_info=_context.sent;case 4:return _context.abrupt("return",window.GM_info);case 5:case"end":return _context.stop();}},_callee);}))).apply(this,arguments);}};};/**
|
||||
* 监听并回应页面对GM接口的请求
|
||||
@@ -58634,9 +58634,9 @@ function Webfix_ApiFields(_ref){var site=_ref.site;var selector=site.selector,ro
|
||||
;// CONCATENATED MODULE: ./src/views/Options/index.js
|
||||
function Options(){var _useState=(0,react.useState)(""),_useState2=(0,slicedToArray/* default */.Z)(_useState,2),error=_useState2[0],setError=_useState2[1];var _useState3=(0,react.useState)(false),_useState4=(0,slicedToArray/* default */.Z)(_useState3,2),ready=_useState4[0],setReady=_useState4[1];(0,react.useEffect)(function(){asyncToGenerator_asyncToGenerator(/*#__PURE__*/regeneratorRuntime_regeneratorRuntime().mark(function _callee(){var i,_window,_window$APP_INFO,_window$APP_INFO2,version,eventName;return regeneratorRuntime_regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!isGm){_context.next=21;break;}// 等待GM注入
|
||||
i=0;case 2:if(!(((_window=window)===null||_window===void 0?void 0:(_window$APP_INFO=_window.APP_INFO)===null||_window$APP_INFO===void 0?void 0:_window$APP_INFO.name)==="KISS Translator")){_context.next=12;break;}_window$APP_INFO2=window.APP_INFO,version=_window$APP_INFO2.version,eventName=_window$APP_INFO2.eventName;// 检查版本是否一致
|
||||
if(!(version!=="1.6.9")){_context.next=7;break;}setError("The version of the script(v".concat(version,") and this page(v").concat("1.6.9",") are inconsistent."));return _context.abrupt("break",19);case 7:if(eventName){// 注入GM接口
|
||||
if(!(version!=="1.6.10")){_context.next=7;break;}setError("The version of the script(v".concat(version,") and this page(v").concat("1.6.10",") are inconsistent."));return _context.abrupt("break",19);case 7:if(eventName){// 注入GM接口
|
||||
adaptScript(eventName);}// 同步数据
|
||||
_context.next=10;return trySyncSettingAndRules();case 10:setReady(true);return _context.abrupt("break",19);case 12:if(!(++i>8)){_context.next=15;break;}setError("Time out.");return _context.abrupt("break",19);case 15:_context.next=17;return sleep(1000);case 17:_context.next=2;break;case 19:_context.next=24;break;case 21:_context.next=23;return trySyncSettingAndRules();case 23:setReady(true);case 24:case"end":return _context.stop();}},_callee);}))();},[]);if(error){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Alert_Alert,{severity:"error",children:error}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.6.9")})}),/*#__PURE__*/(0,jsx_runtime.jsx)("h2",{children:"Please confirm whether to install or enable KISS Translator GreaseMonkey script?"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install Userscript 1"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://kiss-translator.rayjar.com/kiss-translator.user.js",children:"Install Userscript 2"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install Userscript Safari 1"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js",children:"Install Userscript Safari 2"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/options.html",children:"Open Options Page 1"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://kiss-translator.rayjar.com/options",children:"Open Options Page 2"})]})]});}if(!ready){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.6.9")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})]});}return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Theme,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(AlertProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(HashRouter,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Routes,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Route,{path:"/",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Layout,{}),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{index:true,element:/*#__PURE__*/(0,jsx_runtime.jsx)(Settings,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"rules",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Rules,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"apis",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Apis,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"sync",element:/*#__PURE__*/(0,jsx_runtime.jsx)(SyncSetting,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"webfix",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Webfix,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"about",element:/*#__PURE__*/(0,jsx_runtime.jsx)(About,{})})]})})})})})});}
|
||||
_context.next=10;return trySyncSettingAndRules();case 10:setReady(true);return _context.abrupt("break",19);case 12:if(!(++i>8)){_context.next=15;break;}setError("Time out.");return _context.abrupt("break",19);case 15:_context.next=17;return sleep(1000);case 17:_context.next=2;break;case 19:_context.next=24;break;case 21:_context.next=23;return trySyncSettingAndRules();case 23:setReady(true);case 24:case"end":return _context.stop();}},_callee);}))();},[]);if(error){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Alert_Alert,{severity:"error",children:error}),/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.6.10")})}),/*#__PURE__*/(0,jsx_runtime.jsx)("h2",{children:"Please confirm whether to install or enable KISS Translator GreaseMonkey script?"}),/*#__PURE__*/(0,jsx_runtime.jsxs)(Stack_Stack,{spacing:2,children:[/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator.user.js",children:"Install Userscript 1"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://kiss-translator.rayjar.com/kiss-translator.user.js",children:"Install Userscript 2"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/kiss-translator-ios-safari.user.js",children:"Install Userscript Safari 1"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://kiss-translator.rayjar.com/kiss-translator-ios-safari.user.js",children:"Install Userscript Safari 2"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://fishjar.github.io/kiss-translator/options.html",children:"Open Options Page 1"}),/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://kiss-translator.rayjar.com/options",children:"Open Options Page 2"})]})]});}if(!ready){return/*#__PURE__*/(0,jsx_runtime.jsxs)("center",{children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Divider_Divider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(material_Link_Link,{href:"https://github.com/fishjar/kiss-translator",children:"KISS Translator v".concat("1.6.10")})}),/*#__PURE__*/(0,jsx_runtime.jsx)(CircularProgress_CircularProgress,{})]});}return/*#__PURE__*/(0,jsx_runtime.jsx)(SettingProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Theme,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(AlertProvider,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(HashRouter,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Routes,{children:/*#__PURE__*/(0,jsx_runtime.jsxs)(Route,{path:"/",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Layout,{}),children:[/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{index:true,element:/*#__PURE__*/(0,jsx_runtime.jsx)(Settings,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"rules",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Rules,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"apis",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Apis,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"sync",element:/*#__PURE__*/(0,jsx_runtime.jsx)(SyncSetting,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"webfix",element:/*#__PURE__*/(0,jsx_runtime.jsx)(Webfix,{})}),/*#__PURE__*/(0,jsx_runtime.jsx)(Route,{path:"about",element:/*#__PURE__*/(0,jsx_runtime.jsx)(About,{})})]})})})})})});}
|
||||
;// CONCATENATED MODULE: ./src/options.js
|
||||
var options_root=client.createRoot(document.getElementById("root"));options_root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode,{children:/*#__PURE__*/(0,jsx_runtime.jsx)(Options,{})}));
|
||||
}();
|
||||
|
||||
Reference in New Issue
Block a user