console.log( "=== simpread option modals ===" ) import FocusOpt from 'focusopt'; import ReadOpt from 'readopt'; import { storage, STORAGE_MODE } from 'storage'; import * as msg from 'message'; import {browser} from 'browser'; import th from 'theme'; import Notify from 'notify'; import * as ss from 'stylesheet'; import * as watch from 'watch'; import Button from 'button'; import * as tooltip from 'tooltip'; import * as waves from 'waves'; import * as dia from 'dialog'; const root = "simpread-option-root", rootjq = `.${root}`; let callback; /** * Modals Rect component */ class Modals extends React.Component { // close modals close( restore = rollback() ) { dia.Close(); } // save modals focus option save() { console.log( "modals click submit button.", storage.current ) watch.Verify( ( state, result ) => { if ( state ) { console.log( "watch.Lock()", result ); new Notify().Render( "配置文件已更新,刷新当前页面后才能生效。", "刷新", ()=>window.location.reload() ); } else { storage.Setcur( storage.current.mode ); browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.shortcuts, { url: window.location.href } )); watch.SendMessage( "site", true ); new Notify().Render( 0, "更新成功,刷新当前页面后才能生效!" ) this.close( false ); } }); } siteeditor() { callback(); this.close(); } constructor( props ) { super( props ); } componentDidMount() { waves.Render({ root: rootjq }); tooltip.Render( rootjq ); } render() { const Option = storage.current.mode == STORAGE_MODE.focus ? FocusOpt : ReadOpt; return (