From fe16664c885c52d1d69f575511c7b2ce7dc6ffd6 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 19 Jun 2018 12:36:27 +0800 Subject: [PATCH 001/254] Add nanid and plugin.js file. --- package.json | 1 + src/options/options.js | 8 ++++++++ src/service/plugin.js | 35 +++++++++++++++++++++++++++++++++++ webpack.config.js | 2 ++ 4 files changed, 46 insertions(+) create mode 100644 src/service/plugin.js diff --git a/package.json b/package.json index b4d11afb7..7e0fda073 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "expose-loader": "^0.7.1", "file-loader": "^0.9.0", "minimatch": "^3.0.4", + "nanoid": "1.0.3", "postcss-cssnext": "^2.10.0", "postcss-loader": "^1.3.3", "react": "^0.14.8", diff --git a/src/options/options.js b/src/options/options.js index 645f4c685..884679108 100644 --- a/src/options/options.js +++ b/src/options/options.js @@ -29,6 +29,7 @@ import LabsOpt from 'labsopt'; import About from 'about'; import Unrdist from 'unrdist'; import * as welc from 'welcome'; +import * as plug from 'plugin'; import PureRead from 'puread'; @@ -261,6 +262,13 @@ function sidebarRender() { ReactDOM.render( sidebar, $( ".sidebar" )[0] ); } +/** + * set user uid + */ +function setUserUID() { + // TO-DO +} + /** * Pure Read */ diff --git a/src/service/plugin.js b/src/service/plugin.js new file mode 100644 index 000000000..dc3d4cd9a --- /dev/null +++ b/src/service/plugin.js @@ -0,0 +1,35 @@ + +import nanoid from 'nanoid'; + +/** + * Generate ID + * + * @param {string} generate id, include: user id( uuid v4 ), plugin id( like t.co/cKPFh3Qsh4 ) + */ +function generateID( type ) { + if ( type == "user" ) { + const random = "0123456789abcdefghijklmnopqrstuvwxyz", + first = nanoid( random, 8 ), + second = nanoid( random, 4 ), + third = nanoid( random, 4 ), + fourth = nanoid( random, 4 ), + fifth = nanoid( random, 12 ); + return `${first}-${second}-${third}-${fourth}-${fifth}`; + } else if ( type == "plugin" ) { + return nanoid( "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 10 ); + } +} + +function install( id ) { + +} + +function exec( str ) { + +} + +export { + install as Install, + exec as Exec, + generateID as ID, +} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index 9daab3a10..64b5f8d01 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -224,6 +224,7 @@ const webpack = require( 'webpack' ), markdown : __dirname + '/node_modules/to-markdown/dist/to-markdown.js', epubpress : __dirname + '/node_modules/epub-press-js/build/index.js', + nanoid : __dirname + '/node_modules/nanoid/generate.js', jquery : __dirname + '/src/vender/jquery-2.1.1.min.js', mousetrap : __dirname + '/src/vender/mousetrap.min.js', @@ -248,6 +249,7 @@ const webpack = require( 'webpack' ), export : __dirname + '/src/service/export.js', highlight : __dirname + '/src/service/highlight.js', output : __dirname + '/src/service/output.js', + plugin : __dirname + '/src/service/plugin.js', focus : __dirname + '/src/focus/focus.js', controlbar : __dirname + '/src/focus/controlbar.jsx', From 6f43212171da42f91c36f2910541935295a91b40 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 19 Jun 2018 15:20:57 +0800 Subject: [PATCH 002/254] Update to version 1.1.2 and add user system. --- src/manifest.json | 2 +- src/options/options.js | 8 +++++++- src/service/storage.js | 20 +++++++++++++++++++- src/service/version.js | 7 +++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/manifest.json b/src/manifest.json index 4d5d1aa82..95fc026a3 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "name" : "__MSG_extension_name__", "default_locale" : "en", - "version" : "1.1.1", + "version" : "1.1.2", "short_name" : "SimpRead", "description" : "__MSG_extension_desc__", "homepage_url" : "http://ksria.com/simpread", diff --git a/src/options/options.js b/src/options/options.js index 884679108..45ae464ce 100644 --- a/src/options/options.js +++ b/src/options/options.js @@ -88,6 +88,8 @@ storage.Read( first => { mainRender( tabsItemID ); tt.Render( "body" ); waves.Render({ root: "body" }); + // hack code. usage 1.1.2 + storage.user.uid == "" && setUserUID(); // only firefox and only usage 1.1.0.3024 //if ( br.isFirefox() && ver.sub_ver == "3024" && !localStorage["opt-3024"] ) { // welcomeRender( true ); @@ -266,7 +268,11 @@ function sidebarRender() { * set user uid */ function setUserUID() { - // TO-DO + storage.user.uid = plug.ID( "user" ); + storage.Write( () => { + console.log( "current user info create!" ) + watch.SendMessage( "option", true ); + }, storage.simpread ); } /** diff --git a/src/service/storage.js b/src/service/storage.js index b1864fea9..a0b4ff352 100644 --- a/src/service/storage.js +++ b/src/service/storage.js @@ -143,6 +143,13 @@ const name = "simpread", "temp" : 0, } }, + user = { + uid : "", + name : "", + email : "", + avatar : "", + permission: "", + }, unread = { idx : 0, create : "", @@ -166,7 +173,8 @@ let current = {}, custom : [], local : [], // include focus.sites and read.sites }, - statistics + statistics, + user, }, secret = { version : "2017-11-22", @@ -286,6 +294,15 @@ class Storage { return simpread.statistics; } + /** + * Get user info + * + * @return {object} user object + */ + get user() { + return simpread.user; + } + /** * Get secret data structure * @@ -649,6 +666,7 @@ class Storage { read : { ...this.read }, websites: { ...this.websites }, statistics: { ...this.statistics }, + user : { ...this.user }, unrdist : this.unrdist, }; this.option.secret && ( download.secret = { ...secret }); diff --git a/src/service/version.js b/src/service/version.js index d573d9d6e..e64eaa80a 100644 --- a/src/service/version.js +++ b/src/service/version.js @@ -17,6 +17,7 @@ const version = browser.runtime.getManifest().version.replace( /.\d{2,}/, "" ), [ "1.0.6", "Thu Dec 07 2017 14:48:44 GMT+0800 (CST)" ], [ "1.1.0", "Sat Dec 23 2017 15:09:30 GMT+0800 (CST)" ], [ "1.1.1", "Mon Jun 11 2018 15:10:12 GMT+0800 (CST)" ], + [ "1.1.2", "Tue Jun 19 2018 14:15:12 GMT+0800 (CST)" ], ]), details = new Map([ [ "1.0.0", "" ], @@ -28,6 +29,7 @@ const version = browser.runtime.getManifest().version.replace( /.\d{2,}/, "" ), [ "1.0.6", "新增「添加新站到阅读模式,导入第三方适配站点等」," ], [ "1.1.0", "新增「站点编辑器,站点适配源,站点管理器等」," ], [ "1.1.1", "新增「黑名单,全新的控制栏面板,更丰富的中文定制化,无障碍阅读等」," ], + [ "1.1.2", "新增「扩展中心,站点集市等」," ], ]); /** @@ -144,6 +146,11 @@ function Verify( curver, data ) { curver = "1.1.1"; } + if ( curver == "1.1.1" ) { + data.user = { "uid": "","name": "","email": "","avatar": "","permission": "" }; + curver = "1.1.2"; + } + /* if ( curver == "1.0.1" ) { data.option.pocket = { "consumer": "", "access": "" }; From ebd109ea182a141dfdd678fbc95f72e9fe0025f5 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 19 Jun 2018 16:07:54 +0800 Subject: [PATCH 003/254] Add exec logic and SR_addStyle(). --- src/service/plugin.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/service/plugin.js b/src/service/plugin.js index dc3d4cd9a..4e33c446b 100644 --- a/src/service/plugin.js +++ b/src/service/plugin.js @@ -25,7 +25,30 @@ function install( id ) { } function exec( str ) { + ( function ( $$version, $title, $desc, $content, $footer, $process, $toc, SR_addStyle ) { + const count = $content.text().length, + styles= `sr-plugin-count { + position: fixed; + display: block; + left: 5px; + bottom: 5px; + font-size: 12px; + }`, + html = ` + 共计:${count} 个字 + `; + $content.append( html ); + SR_addStyle( styles ); + })( "0.0.1", $( "sr-rd-title" ), $( "sr-rd-desc" ), $( "sr-rd-content" ), $( "sr-rd-footer" ), $( "read-process" ), $( "toc" ), addStyle ); +} +/** + * Add style + * + * @param {string} add css to head + */ +function addStyle( str ) { + $( "head" ).append(``); } export { From e6cd585dc00f5e6be75ce83d04e6e55e0e35a4fd Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 19 Jun 2018 17:00:47 +0800 Subject: [PATCH 004/254] Add exec() and func() logic. --- src/service/plugin.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/service/plugin.js b/src/service/plugin.js index 4e33c446b..df1beff3e 100644 --- a/src/service/plugin.js +++ b/src/service/plugin.js @@ -24,22 +24,25 @@ function install( id ) { } -function exec( str ) { - ( function ( $$version, $title, $desc, $content, $footer, $process, $toc, SR_addStyle ) { - const count = $content.text().length, - styles= `sr-plugin-count { - position: fixed; - display: block; - left: 5px; - bottom: 5px; - font-size: 12px; - }`, - html = ` - 共计:${count} 个字 - `; - $content.append( html ); - SR_addStyle( styles ); - })( "0.0.1", $( "sr-rd-title" ), $( "sr-rd-desc" ), $( "sr-rd-content" ), $( "sr-rd-footer" ), $( "read-process" ), $( "toc" ), addStyle ); +/** + * Execute + * + * @param {object} plugin object + */ +function exec( plugin ) { + new Function( func( plugin.script ) )(); + plugin.style != "" && addStyle( plugin.style ); +} + +/** + * Contact (function(){})() string + * + * @param {string} source + */ +function func( source ) { + return `( function ( $$version, $title, $desc, $content, $footer, $process, $toc ) { + ${ source } + })( "0.0.1", $( "sr-rd-title" ), $( "sr-rd-desc" ), $( "sr-rd-content" ), $( "sr-rd-footer" ), $( "read-process" ), $( "toc" ) );` } /** From 3f3aa0e1f05f7fa692380df946c02f799e56fd3f Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 19 Jun 2018 17:01:13 +0800 Subject: [PATCH 005/254] Add plug.exec() test source. --- src/read/read.jsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/read/read.jsx b/src/read/read.jsx index 9d078e16f..7d8a89366 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -14,6 +14,7 @@ import * as ss from 'stylesheet'; import {browser} from 'browser'; import * as msg from 'message'; import * as highlight from 'highlight'; +import * as plug from 'plugin'; import * as tooltip from 'tooltip'; import * as waves from 'waves'; @@ -83,6 +84,27 @@ class Read extends React.Component { tooltip.Render( rdclsjq ); waves.Render({ root: rdclsjq }); storage.Statistics( "read" ); + + // test code + const plugin = { + user : { + uid : "vdmq0t08-ehpe-v5x6-168w-r9e2xg25lung", + name : "Kenshin Wang", + email : "kenshin@ksria.com", + }, + version : "0.0.1", + id : "kw36BtjGu0", + name : "为阅读模式增加字数统计。", + icon : { + type : "", + bgColor : "#2196f3", + }, + category : 0, + site : "", + style : "sr-plugin-count{position:fixed;display:block;left:5px;bottom:5px;font-size:12px}", + script : "var count=$content.text().length,html=' 共计:'+count+' 个字 ';$content.append(html);", + }; + plug.Exec( plugin ); } } From e2514aca78d71f45763ab5c393125c8feae5aa90 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 19 Jun 2018 17:08:58 +0800 Subject: [PATCH 006/254] Format source. --- src/read/read.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/read/read.jsx b/src/read/read.jsx index 7d8a89366..47605dd62 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -99,6 +99,9 @@ class Read extends React.Component { type : "", bgColor : "#2196f3", }, + create : "Tue Jun 19 2018 17:08:18 GMT+0800 (CST)", + update : "", + global : true, category : 0, site : "", style : "sr-plugin-count{position:fixed;display:block;left:5px;bottom:5px;font-size:12px}", From 6231c90fb545a677e661f8f0399dc86128488210 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 19 Jun 2018 18:25:40 +0800 Subject: [PATCH 007/254] Add install() logic. --- src/read/read.jsx | 1 + src/service/plugin.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/read/read.jsx b/src/read/read.jsx index 47605dd62..9dec8d1fb 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -107,6 +107,7 @@ class Read extends React.Component { style : "sr-plugin-count{position:fixed;display:block;left:5px;bottom:5px;font-size:12px}", script : "var count=$content.text().length,html=' 共计:'+count+' 个字 ';$content.append(html);", }; + plug.Install( "kw36BtjGu0" ); plug.Exec( plugin ); } } diff --git a/src/service/plugin.js b/src/service/plugin.js index df1beff3e..da1476b31 100644 --- a/src/service/plugin.js +++ b/src/service/plugin.js @@ -20,8 +20,15 @@ function generateID( type ) { } } +/** + * Install plugin + * + * @param {string} plugin id. e.g. kw36BtjGu0 + */ function install( id ) { - + $.get( `http://simpread.ksria.cn/plugins/${id}.srplug`, result => { + console.log( "adfadfadf", result ) + }); } /** From 59f1845aaafa807cd0802df35eea87e804f40c9d Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 20 Jun 2018 10:31:34 +0800 Subject: [PATCH 008/254] Change plugin to runtime. --- src/options/options.js | 4 ++-- src/read/read.jsx | 6 +++--- src/service/{plugin.js => runtime.js} | 1 + webpack.config.js | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) rename src/service/{plugin.js => runtime.js} (97%) diff --git a/src/options/options.js b/src/options/options.js index 45ae464ce..cdf9fb8d7 100644 --- a/src/options/options.js +++ b/src/options/options.js @@ -29,7 +29,7 @@ import LabsOpt from 'labsopt'; import About from 'about'; import Unrdist from 'unrdist'; import * as welc from 'welcome'; -import * as plug from 'plugin'; +import * as run from 'runtime'; import PureRead from 'puread'; @@ -268,7 +268,7 @@ function sidebarRender() { * set user uid */ function setUserUID() { - storage.user.uid = plug.ID( "user" ); + storage.user.uid = run.ID( "user" ); storage.Write( () => { console.log( "current user info create!" ) watch.SendMessage( "option", true ); diff --git a/src/read/read.jsx b/src/read/read.jsx index 9dec8d1fb..697224402 100644 --- a/src/read/read.jsx +++ b/src/read/read.jsx @@ -14,7 +14,7 @@ import * as ss from 'stylesheet'; import {browser} from 'browser'; import * as msg from 'message'; import * as highlight from 'highlight'; -import * as plug from 'plugin'; +import * as run from 'runtime'; import * as tooltip from 'tooltip'; import * as waves from 'waves'; @@ -107,8 +107,8 @@ class Read extends React.Component { style : "sr-plugin-count{position:fixed;display:block;left:5px;bottom:5px;font-size:12px}", script : "var count=$content.text().length,html=' 共计:'+count+' 个字 ';$content.append(html);", }; - plug.Install( "kw36BtjGu0" ); - plug.Exec( plugin ); + run.Install( "kw36BtjGu0" ); + run.Exec( plugin ); } } diff --git a/src/service/plugin.js b/src/service/runtime.js similarity index 97% rename from src/service/plugin.js rename to src/service/runtime.js index da1476b31..e28636d2b 100644 --- a/src/service/plugin.js +++ b/src/service/runtime.js @@ -1,3 +1,4 @@ +console.log( "=== simpread runtime load ===" ) import nanoid from 'nanoid'; diff --git a/webpack.config.js b/webpack.config.js index 64b5f8d01..b74e2dff2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -249,7 +249,7 @@ const webpack = require( 'webpack' ), export : __dirname + '/src/service/export.js', highlight : __dirname + '/src/service/highlight.js', output : __dirname + '/src/service/output.js', - plugin : __dirname + '/src/service/plugin.js', + runtime : __dirname + '/src/service/runtime.js', focus : __dirname + '/src/focus/focus.js', controlbar : __dirname + '/src/focus/controlbar.jsx', From 7b089ef778678fb40994d3b531e9f44855dd249e Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 20 Jun 2018 10:54:14 +0800 Subject: [PATCH 009/254] Add plugins to option page. --- src/assets/css/options_page.css | 2 +- src/assets/images/plugins_icon.png | Bin 0 -> 333 bytes src/module/plugins.jsx | 25 +++++++++++++++++++++++++ src/options/options.js | 6 +++++- src/service/config.js | 15 +++++++++++---- webpack.config.js | 1 + 6 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 src/assets/images/plugins_icon.png create mode 100644 src/module/plugins.jsx diff --git a/src/assets/css/options_page.css b/src/assets/css/options_page.css index b991c0a2d..32d16b17e 100644 --- a/src/assets/css/options_page.css +++ b/src/assets/css/options_page.css @@ -3,7 +3,7 @@ --text-color: #333; --secondary-color: color(#333 alpha(-30%)); --background-color: #fff; - --width: 740px; + --width: 835px; } * { diff --git a/src/assets/images/plugins_icon.png b/src/assets/images/plugins_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..e4204fe69a1591830960bd2d6240708564894ce3 GIT binary patch literal 333 zcmV-T0kZyyP)GfkDz&H5lk5T>y8#4qR)YAHY7d?kwAFDX5XO zle7a)kD!uXV(cT}-hxvf7cTx4XN7b#sBKd8r1{wZbW2cQ2|WVC^PmPk0k3PJ$@$M) zX8?^gcq?hjRes45ad=6isc(B9)Yz@fnv9do$6V*cincXS%Y3dnlc=wRwvs|_amqII z-#~X$qYa84csF3N5bU|V`PshC#g+=dP&_Qmtfeki`7Yh~KZ=@wK8~|BZd0nAL1V=; f +
全局
+
+ +
+ +
管理
+
+ +
+ + + ) + } +} diff --git a/src/options/options.js b/src/options/options.js index cdf9fb8d7..4fad45225 100644 --- a/src/options/options.js +++ b/src/options/options.js @@ -26,6 +26,7 @@ import FocusOpt from 'focusopt'; import ReadOpt from 'readopt'; import CommonOpt from 'commonopt'; import LabsOpt from 'labsopt'; +import PluginsOpt from 'pluginsopt'; import About from 'about'; import Unrdist from 'unrdist'; import * as welc from 'welcome'; @@ -181,7 +182,7 @@ function welcomeRender( first, version ) { function mainRender( idx ) { $( ".top" ).css( "background-color", conf.topColors[idx] ); $( ".header" ).css( "background-color", conf.topColors[idx] ).find( ".title" ).text( conf.tabsItem[idx].name ); - ( idx == 3 || idx == 5 ) ? $( '.main' ).addClass( "main_labs" ) : $( '.main' ).removeClass( "main_labs" ); + ( idx == 3 || idx == 4 || idx == 6 ) ? $( '.main' ).addClass( "main_labs" ) : $( '.main' ).removeClass( "main_labs" ); tabsRender( conf.headerColors[ idx ] ); } @@ -218,6 +219,9 @@ function tabsRender( color ) {
save(s) } />
+
+ +
{ return { ...item }} ) } />
welcomeRender(true)}/>
, diff --git a/src/service/config.js b/src/service/config.js index 378cec879..3ac9418ee 100644 --- a/src/service/config.js +++ b/src/service/config.js @@ -566,6 +566,10 @@ const tabsItem = [{ name: "高级设定", value: "labs", route: "#labs", + },{ + name: "插件管理", + value: "plugins", + route: "#plugins", },{ name: "稍后读", value: "later", @@ -579,8 +583,8 @@ const tabsItem = [{ value: "help", route: "https://github.com/kenshin/simpread/wiki", }], - headerColors = [ "#64B5F6", "#81C784", "#9575CD", "#7986CB", "#BA68C8", "#4DB6AC" ], - topColors = [ "#2196F3", "#4CAF50", "#673AB7", "#3F51B5", "#9C27B0", "#009688" ], + headerColors = [ "#64B5F6", "#81C784", "#9575CD", "#7986CB", "#56d1d8", "#BA68C8", "#4DB6AC" ], + topColors = [ "#2196F3", "#4CAF50", "#673AB7", "#3F51B5", "#61ccd2", "#9C27B0", "#009688" ], menuItem = tabsItem.map( ( item, idx ) => { const menu = { ...item }; switch ( idx ) { @@ -598,12 +602,15 @@ const tabsItem = [{ menu.icon = ss.IconPath( "labs_icon" ); break; case 4: - menu.icon = ss.IconPath( "read_later_icon" ); + menu.icon = ss.IconPath( "plugins_icon" ); break; case 5: - menu.icon = ss.IconPath( "about_icon" ); + menu.icon = ss.IconPath( "read_later_icon" ); break; case 6: + menu.icon = ss.IconPath( "about_icon" ); + break; + case 7: menu.icon = ss.IconPath( "help_icon" ); break; } diff --git a/webpack.config.js b/webpack.config.js index b74e2dff2..7826f1f7c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -265,6 +265,7 @@ const webpack = require( 'webpack' ), focusopt : __dirname + '/src/module/focus.jsx', readopt : __dirname + '/src/module/read.jsx', commonopt : __dirname + '/src/module/common.jsx', + pluginsopt : __dirname + '/src/module/plugins.jsx', labsopt : __dirname + '/src/module/labs.jsx', about : __dirname + '/src/module/about.jsx', unrdist : __dirname + '/src/module/unrdist.jsx', From af89e4f8899414694331a2b143996f311ffaad37 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 20 Jun 2018 11:02:40 +0800 Subject: [PATCH 010/254] Update slider width. --- src/module/focus.jsx | 2 +- src/module/read.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/module/focus.jsx b/src/module/focus.jsx index 632567c4e..2936b8dfd 100644 --- a/src/module/focus.jsx +++ b/src/module/focus.jsx @@ -29,7 +29,7 @@ export default class FocusOpt extends React.Component { } render() { - const slider_width = location.protocol.includes( "extension" ) ? "565.8px" : undefined; + const slider_width = location.protocol.includes( "extension" ) ? "660.09px" : undefined; return ( diff --git a/src/module/read.jsx b/src/module/read.jsx index 9e5a58dbb..afd1b352f 100644 --- a/src/module/read.jsx +++ b/src/module/read.jsx @@ -76,7 +76,7 @@ export default class ReadOpt extends React.Component { } render() { - const slider_width = location.protocol.includes( "extension" ) ? "565.8px" : undefined; + const slider_width = location.protocol.includes( "extension" ) ? "660.09px" : undefined; return ( From 94c74a9cd41879b9b340e763f891933b8abd383f Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 20 Jun 2018 11:18:46 +0800 Subject: [PATCH 011/254] Update plugins colors. --- src/service/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/service/config.js b/src/service/config.js index 3ac9418ee..8f36b77b2 100644 --- a/src/service/config.js +++ b/src/service/config.js @@ -583,8 +583,8 @@ const tabsItem = [{ value: "help", route: "https://github.com/kenshin/simpread/wiki", }], - headerColors = [ "#64B5F6", "#81C784", "#9575CD", "#7986CB", "#56d1d8", "#BA68C8", "#4DB6AC" ], - topColors = [ "#2196F3", "#4CAF50", "#673AB7", "#3F51B5", "#61ccd2", "#9C27B0", "#009688" ], + headerColors = [ "#64B5F6", "#81C784", "#9575CD", "#7986CB", "#4DD0E1", "#BA68C8", "#4DB6AC" ], + topColors = [ "#2196F3", "#4CAF50", "#673AB7", "#3F51B5", "#00BCD4", "#9C27B0", "#009688" ], menuItem = tabsItem.map( ( item, idx ) => { const menu = { ...item }; switch ( idx ) { From 0008288063cdff380b369a984737aa3fe786ac26 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 20 Jun 2018 11:19:55 +0800 Subject: [PATCH 012/254] Update some icons. --- src/assets/images/update_icon.png | Bin 0 -> 192 bytes src/assets/images/website_icon.png | Bin 393 -> 0 bytes src/module/common.jsx | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/assets/images/update_icon.png delete mode 100644 src/assets/images/website_icon.png diff --git a/src/assets/images/update_icon.png b/src/assets/images/update_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ee947b109130f42a4101fdac2ba3319d2226d5e8 GIT binary patch literal 192 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`Gj?Vc`obuapnzYl8g-jk>l)s86aD~)q&T#$5rt_0$T7v2F zo$Lu&n-8SMaaLTPx1P<#@PKUugWAW5sl}ruln5QKLtfD-5cQUUIO&_O!DbPzgl38sV4fvJGdfvF&&g3D|oGaijB3E2$y#~xd{ z@3i+2@yAB_H?s=B{lctwlHCB<0;mD(7lPaYXh?3yfQqC}GTY3o1JDHlW~P%oL@3WB z_s)rV>pn@=DZtT5r6_#c0B9ANnd$w;TcD`B6hKkE$cgWLywS|0^Od*ei)6nPz?VlX zRZg`CAXW(}fO7DmDwxQ@tIL5T^iLs)+7w{zdLk60;I-4a4J3I-vWWs_H^F5xMEgKL zOUK3=$#n{#^1CiP$#K+#lbsx@?_Az@4q%Q%s<6$!C%FM|o2!YpPMxed6|JJs5X
管理
From 2231e63104cc82fbf51540a0ff8d8e8e00ac925f Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 20 Jun 2018 13:52:44 +0800 Subject: [PATCH 019/254] Add Clear plugins logic. --- src/module/plugins.jsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/module/plugins.jsx b/src/module/plugins.jsx index 33476b11a..98cb77338 100644 --- a/src/module/plugins.jsx +++ b/src/module/plugins.jsx @@ -38,6 +38,21 @@ export default class PluginsOpt extends React.Component { } } + clear() { + new Notify().Render({ mode: "snackbar", content: "是否清除本地全部插件?", action: "是的", cancel: "取消", callback: type => { + if ( type == "action" ) { + storage.option.plugins = []; + storage.Write(); + storage.Plugins( () => { + new Notify().Render( "snackbar", "清除成功,此页面需刷新后才能生效!", "刷新 ", ()=>{ + location.href = location.origin + location.pathname + "#plugins"; + location.reload(); + }); + }, {} ); + } + }}); + } + componentWillMount() { storage.Plugins( () => { storage.option.plugins = Object.keys( storage.plugins ); @@ -64,7 +79,7 @@ export default class PluginsOpt extends React.Component { icon={ ss.IconPath( "clear_icon" ) } color="#fff" backgroundColor="#757575" waves="md-waves-effect md-waves-button" - /> + onClick={ ()=>this.clear() } /> From dbd29dfeee26885462ee6ee1a2d2b0e90f16072c Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 20 Jun 2018 13:55:35 +0800 Subject: [PATCH 020/254] Format source. --- src/module/plugins.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/module/plugins.jsx b/src/module/plugins.jsx index 98cb77338..56331fc0a 100644 --- a/src/module/plugins.jsx +++ b/src/module/plugins.jsx @@ -16,7 +16,11 @@ export default class PluginsOpt extends React.Component { const install = () => { storage.plugins[result.id] = result; storage.Plugins( result => { - new Notify().Render( "当前插件已安装成功。" ); + new Notify().Render( "当前插件已安装成功,2 秒后自动刷新当前页面。" ); + setTimeout( ()=> { + location.href = location.origin + location.pathname + "#plugins"; + location.reload(); + }, 2000 ); }, storage.plugins ); }; result = JSON.parse( result ); @@ -75,7 +79,7 @@ export default class PluginsOpt extends React.Component { color="#fff" backgroundColor="#FF5252" waves="md-waves-effect md-waves-button" /> -