From 6a0ba06b96c3a03074badbde3a93345edfc1f269 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 14:17:53 +0800 Subject: [PATCH 01/27] Update user script to 1.1.2.5005. --- src/userscript/simpread.js | 48 +++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 541ad2d..b4b8c67 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -1,19 +1,18 @@ // ==UserScript== // @name 简悦( SimpRead ) · 轻阅版 // @namespace http://ksria.com/simpread/ -// @version 1.1.1.1025 +// @version 1.1.2.5005 // @description 简悦 - 让你瞬间进入沉浸式阅读的 User Script 扩展 // @author Kenshin // @include http://*/* // @include https://*/* // @require https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js -// @require https://greasyfork.org/scripts/40244-mduikit/code/MDUIKit.js?version=264103 -// @require https://greasyfork.org/scripts/40236-notify/code/Notify.js?version=263047 +// @require https://greasyfork.org/scripts/40244-mduikit/code/MDUIKit.js?version=697886 +// @require https://greasyfork.org/scripts/40236-notify/code/Notify.js?version=697887 // @require https://greasyfork.org/scripts/40172-mousetrap/code/Mousetrap.js?version=262594 -// @require https://greasyfork.org/scripts/39995-pureread/code/PureRead.js?version=261636 -// @require https://greasyfork.org/scripts/39997-puplugin/code/PuPlugin.js?version=262834 -// @resource global_sites http://sr.ksria.cn/website_list_v3.json?data=0402 -// @resource origins http://sr.ksria.cn/website_list_origins.json +// @require https://greasyfork.org/scripts/39995-pureread/code/PureRead.js?version=697882 +// @require https://greasyfork.org/scripts/39997-puplugin/code/PuPlugin.js?version=697883 +// @resource global_sites http://sr.ksria.cn/website_list_v4.json?data=0514 // @resource notify_style http://sr.ksria.cn/puread/notify.css // @resource main_style http://sr.ksria.cn/puread/simpread.css // @resource option_style http://sr.ksria.cn/puread/option.css @@ -66,6 +65,8 @@ const pr = new PureRead(), }, read = { version : "2017-03-16", + cleanup : true, + pure : true, auto : false, controlbar: true, highlight : true, @@ -182,9 +183,19 @@ const pr = new PureRead(), # 支持 minimatch,域名 和 name,例如: "v2ex.com", "http://www.ifanr.com/**/*" # 默认为空,每个名单由小写 , 分隔 set_whitelist: + + # 是否启用增强解析模式? + # 增强解析模式会对版面重新设计,包括:去除多余空格、优化版面结构等,此功能为测试版,遇到解析失败时,请关闭此功能。 + # 默认为 true,取值范围 true | false + set_cleanup: true + + # 是否启用纯粹模式? + # 比【增强解析模式】还要彻底优化版本,包括:字形、颜色、字号、代码段等,专治页面及不规范,如:微信订阅号,CSDN 等。 + # 默认为 true,取值范围 true | false + set_pure: true `; let current_state = "", // include: focus, read, option - simpread = { version: "1.1.1", focus, read, option }, + simpread = { version: "1.1.2", focus, read, option }, org_simp = { ...simpread }; /**************************** @@ -210,6 +221,8 @@ if ( !blacklist() ) { pr.Addsites( JSON.parse( global_sites )); GM_setValue( "simpread_db", pr.sites ); } + pr.cleanup = simpread.read.cleanup; + pr.pure = simpread.read.pure; pr.AddPlugin( puplugin.Plugin() ); pr.Getsites(); @@ -383,7 +396,7 @@ function controlbar() { */ function entryMode( type ) { type = type == "focus" ? "focus" : "read"; - if ( [ "none", "temp" ].includes( pr.state ) ) { + if ( [ "none" ].includes( pr.state ) ) { if ( simpread[type].highlight == true ) tempMode( type ); else new Notify().Render( `当前未启用 临时阅读模式,并当前站点也未适配,如需要适配请提交到 此页面` ); } else type == "focus" ? focusMode() : readMode(); @@ -549,6 +562,23 @@ function readMode() { } }; + if ( pr.isMathJax() && pr.state == "temp" ) { + console.warn( '=== MathJax Mode ===' ) + const dom = pr.MathJaxMode(); + console.log( 'current get dom is ', dom ) + if ( typeof dom == "undefined" ) { + new Notify().Render( "智能感知失败,请移动鼠标框选。" ); + highlight().done( dom => { + storage.pr.TempMode( "read", dom ); + Render( false ); + }); + } else if ( typeof dom == "string" ) { + const html = pr.GetDom( dom, "html" ); + pr.Newsite( "read", html ); + } else { + pr.TempMode( "read", dom[0] ); + } + } pr.ReadMode(); if ( special() ) return; From 166e0fac50049134dd3f2c158053d99d013d2d50 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 14:24:31 +0800 Subject: [PATCH 02/27] Add lower config upload auto update data structure logic. --- src/userscript/simpread.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index b4b8c67..7bc1f3d 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -713,20 +713,21 @@ function optionMode() { if ( event && event.target && event.target.result ) { try { const json = JSON.parse( event.target.result ); - if ( json.version && json.version.replace( /\./g, "" ) >= simpread.version.replace( /\./g, "" ) ) { - Object.keys( simpread.focus ).forEach( key => { json.focus[key] != undefined && (simpread.focus[key] = json.focus[key] )}); - Object.keys( simpread.read ).forEach( key => { json.read[key] != undefined && (simpread.read[key] = json.read[key] )}); - Object.keys( simpread.option ).forEach( key => { json.option[key] != undefined && (simpread.option[key] = json.option[key] )}); - GM_setValue( "simpread", simpread ); - if ( json.websites ) { - pr.sites.custom = [ ...json.websites.custom ]; - pr.sites.local = [ ...json.websites.local ]; - GM_setValue( "simpread_db", pr.sites ); - new Notify().Render( `已导入本地适配源:${ pr.sites.local.length} 条;官方次适配源:${pr.sites.custom.length} 条。` ); - console.log( "new simpread db", pr.sites ) - } - new Notify().Render( "导入成功,请刷新当前页面,以便新配置文件生效。" ); - } else new Notify().Render( 2, "上传的版本太低,请重新上传!" ); + if ( json.version && json.version.replace( /\./g, "" ) <= simpread.version.replace( /\./g, "" ) ) { + new Notify().Render( 2, "上传的版本太低,已转换为最新版版本!" ); + } + Object.keys( simpread.focus ).forEach( key => { json.focus[key] != undefined && (simpread.focus[key] = json.focus[key] )}); + Object.keys( simpread.read ).forEach( key => { json.read[key] != undefined && (simpread.read[key] = json.read[key] )}); + Object.keys( simpread.option ).forEach( key => { json.option[key] != undefined && (simpread.option[key] = json.option[key] )}); + GM_setValue( "simpread", simpread ); + if ( json.websites ) { + pr.sites.custom = [ ...json.websites.custom ]; + pr.sites.local = [ ...json.websites.local ]; + GM_setValue( "simpread_db", pr.sites ); + new Notify().Render( `已导入本地适配源:${ pr.sites.local.length} 条;官方次适配源:${pr.sites.custom.length} 条。` ); + console.log( "new simpread db", pr.sites ) + } + new Notify().Render( "导入成功,请刷新当前页面,以便新配置文件生效。" ); } catch ( error ) { new Notify().Render( 2, "上传失败,配置文件解析失败,请重新确认。" ); } } }; From 405bc1dbbed90c5ee6090b5ffa7245f04c0c3c00 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 14:25:18 +0800 Subject: [PATCH 03/27] Format source. --- src/userscript/simpread.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 7bc1f3d..e69a833 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -191,6 +191,7 @@ const pr = new PureRead(), # 是否启用纯粹模式? # 比【增强解析模式】还要彻底优化版本,包括:字形、颜色、字号、代码段等,专治页面及不规范,如:微信订阅号,CSDN 等。 + # 此功能在 cleanup = true 时才会生效 # 默认为 true,取值范围 true | false set_pure: true `; From e66d2deef0edd726888c71d7ee6078472efe2d4d Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 14:34:17 +0800 Subject: [PATCH 04/27] Update about page. --- src/userscript/simpread.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index e69a833..30fc38a 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -885,7 +885,11 @@ function aboutMode() { 关于

-
+
你好,我是 简悦 · 轻阅版 的开发者 Kenshin,很高兴看到你能使用它。
From 39c209ad8810147bde21e0598a1a625606a5b7d2 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 15:01:55 +0800 Subject: [PATCH 05/27] Update wiki links. --- src/userscript/simpread.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 30fc38a..bbdcefe 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -399,7 +399,7 @@ function entryMode( type ) { type = type == "focus" ? "focus" : "read"; if ( [ "none" ].includes( pr.state ) ) { if ( simpread[type].highlight == true ) tempMode( type ); - else new Notify().Render( `当前未启用 临时阅读模式,并当前站点也未适配,如需要适配请提交到 此页面` ); + else new Notify().Render( `当前未启用 临时阅读模式,并当前站点也未适配,如需要适配请提交到 此页面` ); } else type == "focus" ? focusMode() : readMode(); } @@ -642,7 +642,7 @@ function readMode() { * @param {string} include: focus, read */ function tempMode( mode = "read" ) { - new Notify().Render( "当前并未适配阅读模式,请移动鼠标手动生成 临时阅读模式。" ); + new Notify().Render( "当前并未适配阅读模式,请移动鼠标手动生成 临时阅读模式。" ); highlight().done( dom => { if ( mode == "read" ) { pr.TempMode( mode, dom.outerHTML ); @@ -896,7 +896,7 @@ function aboutMode() { 它是一个阅读模式类的油猴脚本,也是 简悦 的轻量级版本。
拥有 简悦的一切特性,更具有「加载速度快 · 只关注阅读模式呈现」等 特点
简悦的初衷:还原一个干净的阅读空间,提升你的阅读体验。
- 截至到目前为止,简悦已经适配了 ${ pr.sites.global.length }个 网址,详细请看 这里
+ 截至到目前为止,简悦已经精准适配了 ${ pr.sites.global.length }个 网址,详细请看 这里
简悦是一个免费且开源的项目,占用了我绝大多数的业余时间。
如果觉得它还不错,希望可以给我 投票请我喝杯咖啡,这是对简悦的最大鼓励。
现在就加入 Telegram 群,获取简悦的第一手资料。
From a09c6eb655f4183a39940a947a8183c73ad9bcad Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 15:08:42 +0800 Subject: [PATCH 06/27] Update some resource. --- src/userscript/simpread.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index bbdcefe..4f7a976 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -12,21 +12,21 @@ // @require https://greasyfork.org/scripts/40172-mousetrap/code/Mousetrap.js?version=262594 // @require https://greasyfork.org/scripts/39995-pureread/code/PureRead.js?version=697882 // @require https://greasyfork.org/scripts/39997-puplugin/code/PuPlugin.js?version=697883 -// @resource global_sites http://sr.ksria.cn/website_list_v4.json?data=0514 -// @resource notify_style http://sr.ksria.cn/puread/notify.css -// @resource main_style http://sr.ksria.cn/puread/simpread.css -// @resource option_style http://sr.ksria.cn/puread/option.css +// @resource global_sites http://sr.ksria.cn/website_list_v4.json?data=1.1.2.5005 +// @resource notify_style http://sr.ksria.cn/puread/notify.css?version=1.1.2.5005 +// @resource main_style http://sr.ksria.cn/puread/simpread.css?version=1.1.2.5005 +// @resource option_style http://sr.ksria.cn/puread/option.css?version=1.1.2.5005 // @resource user_style https://gist.github.com/Kenshin/365a91c61bad550b5900247539113f06/raw/3e666bee279f249e5b59140d8a777192ecb121cd/simpread_user.css -// @resource theme_common http://sr.ksria.cn/puread/theme_common.css -// @resource theme_dark http://sr.ksria.cn/puread/theme_dark.css -// @resource theme_github http://sr.ksria.cn/puread/theme_github.css -// @resource theme_gothic http://sr.ksria.cn/puread/theme_gothic.css -// @resource theme_night http://sr.ksria.cn/puread/theme_night.css -// @resource theme_pixyii http://sr.ksria.cn/puread/theme_pixyii.css -// @resource theme_engwrite http://sr.ksria.cn/puread/theme_engwrite.css -// @resource theme_monospace http://sr.ksria.cn/puread/theme_monospace.css -// @resource theme_newsprint http://sr.ksria.cn/puread/theme_newsprint.css -// @resource theme_octopress http://sr.ksria.cn/puread/theme_octopress.css +// @resource theme_common http://sr.ksria.cn/puread/theme_common.css?version=1.1.2.5005 +// @resource theme_dark http://sr.ksria.cn/puread/theme_dark.css?version=1.1.2.5005 +// @resource theme_github http://sr.ksria.cn/puread/theme_github.css?version=1.1.2.5005 +// @resource theme_gothic http://sr.ksria.cn/puread/theme_gothic.css?version=1.1.2.5005 +// @resource theme_night http://sr.ksria.cn/puread/theme_night.css?version=1.1.2.5005 +// @resource theme_pixyii http://sr.ksria.cn/puread/theme_pixyii.css?version=1.1.2.5005 +// @resource theme_engwrite http://sr.ksria.cn/puread/theme_engwrite.css?version=1.1.2.5005 +// @resource theme_monospace http://sr.ksria.cn/puread/theme_monospace.css?version=1.1.2.5005 +// @resource theme_newsprint http://sr.ksria.cn/puread/theme_newsprint.css?version=1.1.2.5005 +// @resource theme_octopress http://sr.ksria.cn/puread/theme_octopress.css?version=1.1.2.5005 // @grant GM_getResourceText // @grant GM_addStyle // @grant GM_getValue From 8260801208b9532d36ed9e799165bbae6eac4645 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 15:17:12 +0800 Subject: [PATCH 07/27] Update footer style. --- src/userscript/simpread.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 4f7a976..b86d18b 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -15,6 +15,7 @@ // @resource global_sites http://sr.ksria.cn/website_list_v4.json?data=1.1.2.5005 // @resource notify_style http://sr.ksria.cn/puread/notify.css?version=1.1.2.5005 // @resource main_style http://sr.ksria.cn/puread/simpread.css?version=1.1.2.5005 +// @resource mntips_style http://sr.ksria.cn/puread/mintooltip.css?version=1.1.2.5005 // @resource option_style http://sr.ksria.cn/puread/option.css?version=1.1.2.5005 // @resource user_style https://gist.github.com/Kenshin/365a91c61bad550b5900247539113f06/raw/3e666bee279f249e5b59140d8a777192ecb121cd/simpread_user.css // @resource theme_common http://sr.ksria.cn/puread/theme_common.css?version=1.1.2.5005 @@ -42,6 +43,7 @@ const pr = new PureRead(), global_sites = GM_getResourceText( "global_sites" ), notify_style = GM_getResourceText( "notify_style" ), main_style = GM_getResourceText( "main_style" ), + mntips_style = GM_getResourceText( "mntips_style" ), option_style = GM_getResourceText( "option_style" ), user_style = GM_getResourceText( "user_style" ), theme_common = GM_getResourceText( "theme_common" ), @@ -211,6 +213,7 @@ if ( !blacklist() ) { // add simpread style GM_addStyle( notify_style ); GM_addStyle( main_style ); + GM_addStyle( mntips_style ); GM_addStyle( option_style ); GM_addStyle( user_style ); GM_addStyle( theme_common ); @@ -510,11 +513,24 @@ function readMode() { - 全文完 + + + 全文完 + + - 本文由 简悦 SimpRead 优化,用以提升阅读体验。 +
本文由 简悦 SimpRead 优化,用以提升阅读体验
+
使用了 全新的简悦词法分析引擎beta点击查看详细说明
+
-
+ From 200e042682cf903a68103cdc64d4f756c07a5a49 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 15:30:05 +0800 Subject: [PATCH 08/27] Add code highlight logic. --- src/userscript/simpread.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index b86d18b..b199162 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -7,6 +7,7 @@ // @include http://*/* // @include https://*/* // @require https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js // @require https://greasyfork.org/scripts/40244-mduikit/code/MDUIKit.js?version=697886 // @require https://greasyfork.org/scripts/40236-notify/code/Notify.js?version=697887 // @require https://greasyfork.org/scripts/40172-mousetrap/code/Mousetrap.js?version=262594 @@ -636,6 +637,8 @@ function readMode() { style.FontSize( simpread.read.fontsize ); style.Layout( simpread.read.layout ); + pr.pure && codehighlight(); + // exit $( ".simpread-read-root sr-rd-crlbar fab" ).one( "click", event => { $( ".simpread-read-root" ).animate( { opacity: 0 }, { @@ -703,6 +706,17 @@ function highlight() { return dtd; } +/** + * Code highlight + */ +function codehighlight() { + $("head").append('') + $("head").append( '' ) + $("sr-rd-content").find( 'pre' ).map( function(idx,item){ + hljs.highlightBlock(item); + }); +} + /** * Option Mode */ From e310ab75f71993c77e3c94437dfd5b46c6cdbfc0 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Tue, 14 May 2019 17:43:34 +0800 Subject: [PATCH 09/27] Add wheel menu buttons. --- src/userscript/simpread.js | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index b199162..b00a33e 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -11,6 +11,7 @@ // @require https://greasyfork.org/scripts/40244-mduikit/code/MDUIKit.js?version=697886 // @require https://greasyfork.org/scripts/40236-notify/code/Notify.js?version=697887 // @require https://greasyfork.org/scripts/40172-mousetrap/code/Mousetrap.js?version=262594 +// @require https://greasyfork.org/scripts/383025-bloomingmenu/code/BloomingMenu.js?version=697997 // @require https://greasyfork.org/scripts/39995-pureread/code/PureRead.js?version=697882 // @require https://greasyfork.org/scripts/39997-puplugin/code/PuPlugin.js?version=697883 // @resource global_sites http://sr.ksria.cn/website_list_v4.json?data=1.1.2.5005 @@ -532,9 +533,11 @@ function readMode() {
+ + ==> `, multiple = ( include, avatar ) => { @@ -638,6 +641,7 @@ function readMode() { style.Layout( simpread.read.layout ); pr.pure && codehighlight(); + wheelmenu(); // exit $( ".simpread-read-root sr-rd-crlbar fab" ).one( "click", event => { @@ -892,6 +896,45 @@ function optionMode() { } } +/** + * Wheel menu buttons + */ +function wheelmenu() { + const menu = new BloomingMenu({ + startAngle: -190, + endAngle: 0, + radius: 200, + itemsNum: 6, + itemAnimationDelay: 0.08 + }); + menu.render(); + menu.props.elements.items.forEach(function (item, index) { + item.addEventListener('click', function () { + //TO-DO + }) + }); + const style = ` + .sr-rd-trigger { + position: fixed; + right: 77px; + bottom: 98px; + } + .blooming-menu__container { + transform: rotate(-100deg); + } + .blooming-menu__main { + background-color: rgba(244, 67, 54, 1); + transform: rotate(100deg); + } + `; + $( "head" ).append( `` ); + setTimeout( ()=> { + $(".simpread-read-root").append( `
` ); + $(".sr-rd-trigger").append( $(".blooming-menu__container") ); + $( "body" ).find( ".blooming-menu__container" ).remove(); + }, 1000); +} + /** * About Mode */ From 208cceb35346f10a40209b0174918b206d212be8 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 10:57:23 +0800 Subject: [PATCH 10/27] Optimize wheel menu logic. --- src/userscript/simpread.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index b00a33e..384b163 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -11,7 +11,7 @@ // @require https://greasyfork.org/scripts/40244-mduikit/code/MDUIKit.js?version=697886 // @require https://greasyfork.org/scripts/40236-notify/code/Notify.js?version=697887 // @require https://greasyfork.org/scripts/40172-mousetrap/code/Mousetrap.js?version=262594 -// @require https://greasyfork.org/scripts/383025-bloomingmenu/code/BloomingMenu.js?version=697997 +// @require https://greasyfork.org/scripts/383025-bloomingmenu/code/BloomingMenu.js?version=698175 // @require https://greasyfork.org/scripts/39995-pureread/code/PureRead.js?version=697882 // @require https://greasyfork.org/scripts/39997-puplugin/code/PuPlugin.js?version=697883 // @resource global_sites http://sr.ksria.cn/website_list_v4.json?data=1.1.2.5005 @@ -901,13 +901,15 @@ function optionMode() { */ function wheelmenu() { const menu = new BloomingMenu({ - startAngle: -190, + startAngle: -180, endAngle: 0, - radius: 200, - itemsNum: 6, - itemAnimationDelay: 0.08 + radius: 120, + itemsNum: 7, + itemAnimationDelay: 0.08, + isAutoClose: false }); menu.render(); + setTimeout( () => menu.open(), 500 ); menu.props.elements.items.forEach(function (item, index) { item.addEventListener('click', function () { //TO-DO @@ -916,15 +918,15 @@ function wheelmenu() { const style = ` .sr-rd-trigger { position: fixed; - right: 77px; - bottom: 98px; + right: 50%; + bottom: 35px; } .blooming-menu__container { - transform: rotate(-100deg); + /*transform: rotate(-100deg);*/ } .blooming-menu__main { background-color: rgba(244, 67, 54, 1); - transform: rotate(100deg); + /*transform: rotate(100deg);*/ } `; $( "head" ).append( `` ); From f504e4e6e161c3e03d9304275e76e92362e82ba0 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 10:58:48 +0800 Subject: [PATCH 11/27] Restore fab controlbar. --- src/userscript/simpread.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 384b163..9a17369 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -533,11 +533,9 @@ function readMode() { - - ==> `, multiple = ( include, avatar ) => { @@ -641,7 +639,6 @@ function readMode() { style.Layout( simpread.read.layout ); pr.pure && codehighlight(); - wheelmenu(); // exit $( ".simpread-read-root sr-rd-crlbar fab" ).one( "click", event => { From a0304d1e9163fdb499f0f53566ba13a63735aa57 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 11:15:19 +0800 Subject: [PATCH 12/27] Optimize read mode controlbar. --- src/userscript/simpread.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 9a17369..1f87a6d 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -534,6 +534,7 @@ function readMode() { + @@ -641,7 +642,7 @@ function readMode() { pr.pure && codehighlight(); // exit - $( ".simpread-read-root sr-rd-crlbar fab" ).one( "click", event => { + $( ".simpread-read-root sr-rd-crlbar fab:not(.setting)" ).one( "click", event => { $( ".simpread-read-root" ).animate( { opacity: 0 }, { delay: 100, complete: () => { @@ -654,6 +655,15 @@ function readMode() { } }).addClass( "simpread-read-root-hide" ); }); + $( ".simpread-read-root sr-rd-crlbar fab:not(.setting)" ).mouseover( () => { + $( ".simpread-read-root sr-rd-crlbar fab.setting" ).addClass( "show" ); + }); + $( ".simpread-read-root sr-rd-crlbar" ).mouseleave( () => { + $( "sr-rd-crlbar fab.setting" ).removeClass( "show" ); + }); + $( ".simpread-read-root sr-rd-crlbar fab.setting" ).click( () => { + wheelmenu(); + }); }; /** From c0935549abcf1e5865a4e0489212718913f275f3 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 11:17:59 +0800 Subject: [PATCH 13/27] Format source. --- src/userscript/simpread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 1f87a6d..7f4cf6b 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -533,7 +533,7 @@ function readMode() { - + From c05b23ce75e2ab0f016a737aa35c1c88bf913623 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 12:37:37 +0800 Subject: [PATCH 14/27] Add wheelo menu style. --- src/userscript/simpread.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 7f4cf6b..cc411ad 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -916,10 +916,14 @@ function wheelmenu() { isAutoClose: false }); menu.render(); - setTimeout( () => menu.open(), 500 ); + menu.open() menu.props.elements.items.forEach(function (item, index) { item.addEventListener('click', function () { - //TO-DO + switch ( index ) { + case 6: + menu.remove(); + break; + } }) }); const style = ` @@ -935,11 +939,33 @@ function wheelmenu() { background-color: rgba(244, 67, 54, 1); /*transform: rotate(100deg);*/ } + .blooming-menu__item-btn-wrapper { + background-color: #03a9f4!important; + } + .blooming-menu__main.is-active { + transform: rotate(0); + -webkit-transform: rotate(0); + } + .blooming-menu__item:nth-of-type(3) button, + .blooming-menu__item:nth-of-type(4) button { + transform: rotate(90deg); + } + .blooming-menu__item:nth-of-type(6) button { + transform: rotate(180deg); + } `; $( "head" ).append( `` ); setTimeout( ()=> { $(".simpread-read-root").append( `
` ); $(".sr-rd-trigger").append( $(".blooming-menu__container") ); + $(".simpread-read-root .blooming-menu__main-content").html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[0]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[1]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[2]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[3]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[4]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[5]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[6]).html( `` ); $( "body" ).find( ".blooming-menu__container" ).remove(); }, 1000); } From 1d0dc42425d1f307f9afa62e2ada8e3258b91149 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 14:23:08 +0800 Subject: [PATCH 15/27] Add wheel menu close logic. --- src/userscript/simpread.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index cc411ad..5746cf9 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -912,7 +912,7 @@ function wheelmenu() { endAngle: 0, radius: 120, itemsNum: 7, - itemAnimationDelay: 0.08, + itemAnimationDelay: 0, isAutoClose: false }); menu.render(); @@ -922,6 +922,8 @@ function wheelmenu() { switch ( index ) { case 6: menu.remove(); + $(".sr-rd-trigger").remove(); + $("head #blooming-menu__root").remove(); break; } }) @@ -954,7 +956,7 @@ function wheelmenu() { transform: rotate(180deg); } `; - $( "head" ).append( `` ); + $( "head" ).append( `` ); setTimeout( ()=> { $(".simpread-read-root").append( `
` ); $(".sr-rd-trigger").append( $(".blooming-menu__container") ); From 780408aa6af13005036d9b762bc4e6d5dea2e264 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 14:36:18 +0800 Subject: [PATCH 16/27] Add wheel menu design. --- src/userscript/simpread.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 5746cf9..606eed7 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -935,11 +935,10 @@ function wheelmenu() { bottom: 35px; } .blooming-menu__container { - /*transform: rotate(-100deg);*/ + transition: all 1s cubic-bezier(.23,1,.32,1) .1s!important; } .blooming-menu__main { background-color: rgba(244, 67, 54, 1); - /*transform: rotate(100deg);*/ } .blooming-menu__item-btn-wrapper { background-color: #03a9f4!important; @@ -970,6 +969,17 @@ function wheelmenu() { $($(".simpread-read-root .blooming-menu__item-btn")[6]).html( `` ); $( "body" ).find( ".blooming-menu__container" ).remove(); }, 1000); + + let preScroll = 0; + $(document).scroll( () => { + if ( $(document).scrollTop() > preScroll ) { + $(".blooming-menu__container").css({transform: 'translate(-50%, 20%)', opacity: 0.5 }); + menu.close(); + } else { + $(".blooming-menu__container").css({transform: 'translate(-50%, -50%)', opacity: 1 }); + } + preScroll = $(document).scrollTop(); + }); } /** From 685726d94fe722af5ec6f472f6388e3c9ce5f7f0 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 14:58:06 +0800 Subject: [PATCH 17/27] Add wheel menu fontsize layout logic. --- src/userscript/simpread.js | 43 +++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 606eed7..f46588c 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -920,6 +920,20 @@ function wheelmenu() { menu.props.elements.items.forEach(function (item, index) { item.addEventListener('click', function () { switch ( index ) { + case 0: + case 1: + const size = parseFloat( simpread.read.fontsize ) + ( index == 0 ? 3 : -3 ); + simpread.read.fontsize = `${size}%`; + style.FontSize( simpread.read.fontsize ); + GM_setValue( "simpread", simpread ); + break; + case 2: + case 3: + const layout = parseFloat( simpread.read.layout ) + ( index == 3 ? 3 : -3 ); + simpread.read.layout = `${layout}%`; + style.Layout( simpread.read.layout ); + GM_setValue( "simpread", simpread ); + break; case 6: menu.remove(); $(".sr-rd-trigger").remove(); @@ -928,7 +942,7 @@ function wheelmenu() { } }) }); - const style = ` + const css = ` .sr-rd-trigger { position: fixed; right: 50%; @@ -955,7 +969,7 @@ function wheelmenu() { transform: rotate(180deg); } `; - $( "head" ).append( `` ); + $( "head" ).append( `` ); setTimeout( ()=> { $(".simpread-read-root").append( `
` ); $(".sr-rd-trigger").append( $(".blooming-menu__container") ); @@ -1041,4 +1055,27 @@ function aboutMode() { $("dialog-gp").animate({height: h2 - 80 }); } }}); -} \ No newline at end of file +} + +/** + * Set read mode font size for read mode + * + * @param {string} font size, e.g. 70% 62.5% + */ +let html_style_bal = "-1"; +function fontSize( value ) { + if ( html_style_bal == "-1" ) { + html_style_bal = $( "html" ).attr( "style" ); + html_style_bal == undefined && ( html_style_bal = "" ); + } + value ? $( "html" ).attr( "style", `font-size: ${value}!important;${html_style_bal}` ) : $( "html" ).attr( "style", html_style_bal ); +} + +/** + * Set read mode layout width for read mode + * + * @param {string} layout width + */ +function layout( width ) { + $( "sr-read" ).css( "margin", width ? `20px ${width}` : "" ); +} From ff44d0f6dd703be2dba037d4f0bd9effbb58f141 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 15:26:35 +0800 Subject: [PATCH 18/27] Add wheel menu theme logic. --- src/userscript/simpread.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index f46588c..a4d8f3f 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -58,7 +58,7 @@ const pr = new PureRead(), theme_monospace = GM_getResourceText( "theme_monospace" ), theme_newsprint = GM_getResourceText( "theme_newsprint" ), theme_octopress = GM_getResourceText( "theme_octopress" ), - theme = { theme_dark, theme_github, theme_gothic, theme_night, theme_pixyii, theme_engwrite, theme_monospace, theme_newsprint, theme_octopress }, + theme = { theme_github, theme_newsprint, theme_gothic, theme_engwrite, theme_octopress, theme_pixyii, theme_monospace, theme_night, theme_dark }, focus = { version : "2016-12-29", bgcolor : "rgba( 235, 235, 235, 0.9 )", @@ -934,6 +934,30 @@ function wheelmenu() { style.Layout( simpread.read.layout ); GM_setValue( "simpread", simpread ); break; + case 4: + case 5: + const arr = Object.keys( theme ), + len = arr.length; + let idx = arr.indexOf( `theme_${simpread.read.theme}` ) + + ( index == 4 ? 1 : -1 ); + if ( idx == len ) { + idx = 0; + } else if ( idx == -1 ) { + idx = len -1; + } + // remove old theme + $( "head" ).find( "style" ).map( (index, item) => { + const $target = $(item), + css = $target.text(); + if ( css.startsWith( "sr-rd-theme-" + simpread.read.theme ) ) { + console.log( item ) + $target.remove(); + } + }); + // add new theme + simpread.read.theme = arr[idx].replace( "theme_", "" ); + GM_setValue( "simpread", simpread ); + GM_addStyle( theme[`theme_${simpread.read.theme}`] ); + break; case 6: menu.remove(); $(".sr-rd-trigger").remove(); From e8df7cdc74115659c7079132d6c616ad45072919 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 15:28:32 +0800 Subject: [PATCH 19/27] Format source. --- src/userscript/simpread.js | 259 +++++++++++++++++-------------------- 1 file changed, 118 insertions(+), 141 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index a4d8f3f..cd0d29b 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -728,6 +728,123 @@ function codehighlight() { }); } +/** + * Wheel menu buttons + */ +function wheelmenu() { + const menu = new BloomingMenu({ + startAngle: -180, + endAngle: 0, + radius: 120, + itemsNum: 7, + itemAnimationDelay: 0, + isAutoClose: false + }); + menu.render(); + menu.open() + menu.props.elements.items.forEach(function (item, index) { + item.addEventListener('click', function () { + switch ( index ) { + case 0: + case 1: + const size = parseFloat( simpread.read.fontsize ) + ( index == 0 ? 3 : -3 ); + simpread.read.fontsize = `${size}%`; + style.FontSize( simpread.read.fontsize ); + GM_setValue( "simpread", simpread ); + break; + case 2: + case 3: + const layout = parseFloat( simpread.read.layout ) + ( index == 3 ? 3 : -3 ); + simpread.read.layout = `${layout}%`; + style.Layout( simpread.read.layout ); + GM_setValue( "simpread", simpread ); + break; + case 4: + case 5: + const arr = Object.keys( theme ), + len = arr.length; + let idx = arr.indexOf( `theme_${simpread.read.theme}` ) + + ( index == 4 ? 1 : -1 ); + if ( idx == len ) { + idx = 0; + } else if ( idx == -1 ) { + idx = len -1; + } + // remove old theme + $( "head" ).find( "style" ).map( (index, item) => { + const $target = $(item), + css = $target.text(); + if ( css.startsWith( "sr-rd-theme-" + simpread.read.theme ) ) { + console.log( item ) + $target.remove(); + } + }); + // add new theme + simpread.read.theme = arr[idx].replace( "theme_", "" ); + GM_setValue( "simpread", simpread ); + GM_addStyle( theme[`theme_${simpread.read.theme}`] ); + break; + case 6: + menu.remove(); + $(".sr-rd-trigger").remove(); + $("head #blooming-menu__root").remove(); + break; + } + }) + }); + const css = ` + .sr-rd-trigger { + position: fixed; + right: 50%; + bottom: 35px; + } + .blooming-menu__container { + transition: all 1s cubic-bezier(.23,1,.32,1) .1s!important; + } + .blooming-menu__main { + background-color: rgba(244, 67, 54, 1); + } + .blooming-menu__item-btn-wrapper { + background-color: #03a9f4!important; + } + .blooming-menu__main.is-active { + transform: rotate(0); + -webkit-transform: rotate(0); + } + .blooming-menu__item:nth-of-type(3) button, + .blooming-menu__item:nth-of-type(4) button { + transform: rotate(90deg); + } + .blooming-menu__item:nth-of-type(6) button { + transform: rotate(180deg); + } + `; + $( "head" ).append( `` ); + setTimeout( ()=> { + $(".simpread-read-root").append( `
` ); + $(".sr-rd-trigger").append( $(".blooming-menu__container") ); + $(".simpread-read-root .blooming-menu__main-content").html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[0]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[1]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[2]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[3]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[4]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[5]).html( `` ); + $($(".simpread-read-root .blooming-menu__item-btn")[6]).html( `` ); + $( "body" ).find( ".blooming-menu__container" ).remove(); + }, 1000); + + let preScroll = 0; + $(document).scroll( () => { + if ( $(document).scrollTop() > preScroll ) { + $(".blooming-menu__container").css({transform: 'translate(-50%, 20%)', opacity: 0.5 }); + menu.close(); + } else { + $(".blooming-menu__container").css({transform: 'translate(-50%, -50%)', opacity: 1 }); + } + preScroll = $(document).scrollTop(); + }); +} + /** * Option Mode */ @@ -903,123 +1020,6 @@ function optionMode() { } } -/** - * Wheel menu buttons - */ -function wheelmenu() { - const menu = new BloomingMenu({ - startAngle: -180, - endAngle: 0, - radius: 120, - itemsNum: 7, - itemAnimationDelay: 0, - isAutoClose: false - }); - menu.render(); - menu.open() - menu.props.elements.items.forEach(function (item, index) { - item.addEventListener('click', function () { - switch ( index ) { - case 0: - case 1: - const size = parseFloat( simpread.read.fontsize ) + ( index == 0 ? 3 : -3 ); - simpread.read.fontsize = `${size}%`; - style.FontSize( simpread.read.fontsize ); - GM_setValue( "simpread", simpread ); - break; - case 2: - case 3: - const layout = parseFloat( simpread.read.layout ) + ( index == 3 ? 3 : -3 ); - simpread.read.layout = `${layout}%`; - style.Layout( simpread.read.layout ); - GM_setValue( "simpread", simpread ); - break; - case 4: - case 5: - const arr = Object.keys( theme ), - len = arr.length; - let idx = arr.indexOf( `theme_${simpread.read.theme}` ) + + ( index == 4 ? 1 : -1 ); - if ( idx == len ) { - idx = 0; - } else if ( idx == -1 ) { - idx = len -1; - } - // remove old theme - $( "head" ).find( "style" ).map( (index, item) => { - const $target = $(item), - css = $target.text(); - if ( css.startsWith( "sr-rd-theme-" + simpread.read.theme ) ) { - console.log( item ) - $target.remove(); - } - }); - // add new theme - simpread.read.theme = arr[idx].replace( "theme_", "" ); - GM_setValue( "simpread", simpread ); - GM_addStyle( theme[`theme_${simpread.read.theme}`] ); - break; - case 6: - menu.remove(); - $(".sr-rd-trigger").remove(); - $("head #blooming-menu__root").remove(); - break; - } - }) - }); - const css = ` - .sr-rd-trigger { - position: fixed; - right: 50%; - bottom: 35px; - } - .blooming-menu__container { - transition: all 1s cubic-bezier(.23,1,.32,1) .1s!important; - } - .blooming-menu__main { - background-color: rgba(244, 67, 54, 1); - } - .blooming-menu__item-btn-wrapper { - background-color: #03a9f4!important; - } - .blooming-menu__main.is-active { - transform: rotate(0); - -webkit-transform: rotate(0); - } - .blooming-menu__item:nth-of-type(3) button, - .blooming-menu__item:nth-of-type(4) button { - transform: rotate(90deg); - } - .blooming-menu__item:nth-of-type(6) button { - transform: rotate(180deg); - } - `; - $( "head" ).append( `` ); - setTimeout( ()=> { - $(".simpread-read-root").append( `
` ); - $(".sr-rd-trigger").append( $(".blooming-menu__container") ); - $(".simpread-read-root .blooming-menu__main-content").html( `` ); - $($(".simpread-read-root .blooming-menu__item-btn")[0]).html( `` ); - $($(".simpread-read-root .blooming-menu__item-btn")[1]).html( `` ); - $($(".simpread-read-root .blooming-menu__item-btn")[2]).html( `` ); - $($(".simpread-read-root .blooming-menu__item-btn")[3]).html( `` ); - $($(".simpread-read-root .blooming-menu__item-btn")[4]).html( `` ); - $($(".simpread-read-root .blooming-menu__item-btn")[5]).html( `` ); - $($(".simpread-read-root .blooming-menu__item-btn")[6]).html( `` ); - $( "body" ).find( ".blooming-menu__container" ).remove(); - }, 1000); - - let preScroll = 0; - $(document).scroll( () => { - if ( $(document).scrollTop() > preScroll ) { - $(".blooming-menu__container").css({transform: 'translate(-50%, 20%)', opacity: 0.5 }); - menu.close(); - } else { - $(".blooming-menu__container").css({transform: 'translate(-50%, -50%)', opacity: 1 }); - } - preScroll = $(document).scrollTop(); - }); -} - /** * About Mode */ @@ -1079,27 +1079,4 @@ function aboutMode() { $("dialog-gp").animate({height: h2 - 80 }); } }}); -} - -/** - * Set read mode font size for read mode - * - * @param {string} font size, e.g. 70% 62.5% - */ -let html_style_bal = "-1"; -function fontSize( value ) { - if ( html_style_bal == "-1" ) { - html_style_bal = $( "html" ).attr( "style" ); - html_style_bal == undefined && ( html_style_bal = "" ); - } - value ? $( "html" ).attr( "style", `font-size: ${value}!important;${html_style_bal}` ) : $( "html" ).attr( "style", html_style_bal ); -} - -/** - * Set read mode layout width for read mode - * - * @param {string} layout width - */ -function layout( width ) { - $( "sr-read" ).css( "margin", width ? `20px ${width}` : "" ); -} +} \ No newline at end of file From 033c45c8864f50c332011de74cf24999cd489553 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 15:58:35 +0800 Subject: [PATCH 20/27] Add toc. --- src/userscript/simpread.js | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index cd0d29b..394fb35 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -640,6 +640,7 @@ function readMode() { style.Layout( simpread.read.layout ); pr.pure && codehighlight(); + toc(); // exit $( ".simpread-read-root sr-rd-crlbar fab:not(.setting)" ).one( "click", event => { @@ -845,6 +846,53 @@ function wheelmenu() { }); } +/** + * toc + */ +function toc() { + const table = [], + cls = simpread.read.toc_hide ? "toc-bg-hidden" : ""; + $("sr-read").find( "h1, h2, h3, h4" ).map( ( idx, item) => { + const $item = $( item ), + tag = $item[0].tagName.toLowerCase(), + value = $item.text(); + let id = $item.attr( "id" ); + id = id == undefined ? `sr-toc-${idx}` : `${id}-${idx}` + $item.attr( "id", id ); + value && table.push({ + level: `toc-level-${tag}`, + id, + value, + }); + }); + console.log( "current toc is ", table ) + let tmpl = ""; + table.forEach( ( item, idx ) => { + tmpl += ` + + ${ item.value } + `; + }); + $("sr-read").append( `${tmpl}` ); + let is_click = false; + $("sr-read toc outline a").on( "click", event => { + is_click = true; + const $target = $( event.target ).parent(); + $target.parent().find( "active" ).removeClass( "toc-outline-active" ); + $target.find( "active" ).addClass( "toc-outline-active" ); + + const href = $( event.target ).attr("href"), + offsetTop = href === "#" ? 0 : $(href).offset().top - 5; + $( "html" ).stop().animate({ + scrollTop: offsetTop + }, 300, () => { + setTimeout( ()=>is_click = false, 500 ); + }); + event.preventDefault(); + }) + simpread.read.toc_hide && $('head').append( `` ); +} + /** * Option Mode */ From 0ea7742d77de777b2119f72fd642ee3d7d3c8790 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 16:07:26 +0800 Subject: [PATCH 21/27] Add 'toc' and 'toc_hide' to data. --- src/userscript/simpread.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 394fb35..cc3a8aa 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -83,6 +83,8 @@ const pr = new PureRead(), ], fontsize : "62.5%", layout : "20%", + toc : true, + toc_hide : true, }, option = { version : "2017-04-03", @@ -198,6 +200,17 @@ const pr = new PureRead(), # 此功能在 cleanup = true 时才会生效 # 默认为 true,取值范围 true | false set_pure: true + + # 是否自动生成大纲(目录)? + # 只整理 h1, h2, h3, h4 的内容为大纲 + # 默认为 true,取值范围 true | false + set_toc: true + + # 大纲(目录)是否开启「鼠标移动到左上角」自动显示? + # 关闭意味着「一直显示」 + # 此功能在 toc = true 时才会生效 + # 默认为 true,取值范围 true | false + set_toc_hide: true `; let current_state = "", // include: focus, read, option simpread = { version: "1.1.2", focus, read, option }, @@ -640,7 +653,7 @@ function readMode() { style.Layout( simpread.read.layout ); pr.pure && codehighlight(); - toc(); + simpread.read.toc && toc(); // exit $( ".simpread-read-root sr-rd-crlbar fab:not(.setting)" ).one( "click", event => { From bf0afd6c47601e172faf86a4a537d64463b90f0d Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 16:15:52 +0800 Subject: [PATCH 22/27] Fix import config bug. --- src/userscript/simpread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index cc3a8aa..25a3f88 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -933,7 +933,7 @@ function optionMode() { if ( event && event.target && event.target.result ) { try { const json = JSON.parse( event.target.result ); - if ( json.version && json.version.replace( /\./g, "" ) <= simpread.version.replace( /\./g, "" ) ) { + if ( json.version && json.version.replace( /\./g, "" ) < simpread.version.replace( /\./g, "" ) ) { new Notify().Render( 2, "上传的版本太低,已转换为最新版版本!" ); } Object.keys( simpread.focus ).forEach( key => { json.focus[key] != undefined && (simpread.focus[key] = json.focus[key] )}); From 26dd950e4f85af2a10dbdcfe230fe292b1d60638 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 16:23:20 +0800 Subject: [PATCH 23/27] Fix import adapter site url bug. --- src/userscript/simpread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 25a3f88..50b3f43 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -970,7 +970,7 @@ function optionMode() { new Notify().Render( `请勿在 https 下面使用此功能,请前往 http 的页面,如: 点击这里` ); return; } - $.getJSON( "http://sr.ksria.cn/website_list_v3.json" + "?_=" + Math.round(+new Date()), result => { + $.getJSON( "http://sr.ksria.cn/website_list_v4.json" + "?_=" + Math.round(+new Date()), result => { const count = pr.Addsites( result ); count == 0 ? new Notify().Render( "适配列表已同步至最新版本。" ) : new Notify().Render( 0, `适配列表已同步成功,本次新增 ${ count } 个站点。` ); }); From 5dbf55753f1516214402d2ce3e50fb1f9b63f422 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 16:25:53 +0800 Subject: [PATCH 24/27] Fix footer link error. --- src/userscript/simpread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 50b3f43..5bf6aca 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -540,7 +540,7 @@ function readMode() { - + From 9367a5c0f826e58c0f571822c0393c996b6bc390 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 16:30:52 +0800 Subject: [PATCH 25/27] Update jquery version. --- src/userscript/simpread.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 5bf6aca..14bc823 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -6,7 +6,7 @@ // @author Kenshin // @include http://*/* // @include https://*/* -// @require https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js +// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js // @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js // @require https://greasyfork.org/scripts/40244-mduikit/code/MDUIKit.js?version=697886 // @require https://greasyfork.org/scripts/40236-notify/code/Notify.js?version=697887 From 60ab50337d0b76c0f99d4f4066919f8d97dfd7e7 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 16:35:20 +0800 Subject: [PATCH 26/27] Format source. --- src/userscript/simpread.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/userscript/simpread.js b/src/userscript/simpread.js index 14bc823..69385dc 100644 --- a/src/userscript/simpread.js +++ b/src/userscript/simpread.js @@ -598,7 +598,6 @@ function readMode() { if ( pr.isMathJax() && pr.state == "temp" ) { console.warn( '=== MathJax Mode ===' ) const dom = pr.MathJaxMode(); - console.log( 'current get dom is ', dom ) if ( typeof dom == "undefined" ) { new Notify().Render( "智能感知失败,请移动鼠标框选。" ); highlight().done( dom => { @@ -788,7 +787,6 @@ function wheelmenu() { const $target = $(item), css = $target.text(); if ( css.startsWith( "sr-rd-theme-" + simpread.read.theme ) ) { - console.log( item ) $target.remove(); } }); From dca939d9ec9a6ac30c03294001414cd649e6f852 Mon Sep 17 00:00:00 2001 From: Kenshin Date: Wed, 15 May 2019 16:41:10 +0800 Subject: [PATCH 27/27] Update README.md. --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1cb25f2..6b8883b 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,15 @@ - [阅读模式](http://ksria.com/simpread/docs/#/阅读模式): 简悦 `原创` 功能,逐一适配了 [数百种类型](https://simpread.ksria.cn/sites/) 的网站,自动提取 `标题` `描述` `正文` `媒体资源( 图片/ 视频 )` 等,生成 `符合中文阅读` 的页面 - * 支持 `自动生成目录` [TXT 阅读器](http://ksria.com/simpread/docs/#/TXT-阅读器) [论坛类页面及分页](http://ksria.com/simpread/docs/#/论坛类页面及分页) 如:知乎 · 百度贴吧等 + * 支持 `自动生成目录` + + * 支持 [TXT 阅读器](http://ksria.com/simpread/docs/#/TXT-阅读器) + + * 支持 [论坛类页面及分页](http://ksria.com/simpread/docs/#/论坛类页面及分页) 如:知乎 · 百度贴吧等 + + * ![new纯色.png](https://i.loli.net/2018/09/05/5b8f718046acb.png) 支持 [代码段的高亮](http://ksria.com/simpread/docs/#/代码段的高亮),包含了大部分常见的网站 + + * ![new纯色.png](https://i.loli.net/2018/09/05/5b8f718046acb.png) 支持 [LaTeX 解析](http://ksria.com/simpread/docs/#/LaTeX-阅读器) · [Markdown 阅读器](http://ksria.com/simpread/docs/#/Markdown-阅读器) * 更符合 `中文阅读` 习惯的设置,包括:`字间距` `行间距` 等 以及 `自定义 CSS` ,详细请看 [自定义样式](http://ksria.com/simpread/docs/#/自定义样式) @@ -56,7 +64,9 @@ 通过简单的一个步骤,就可以让 `非适配页面` 支持阅读模式,详细请看 [主动适配](http://ksria.com/simpread/docs/#/主动适配阅读模式) 以及 [操作](http://ksria.com/simpread/welcome/version_1.0.5.html#mate-read-mode) - 智能适配: - 自动识别出 Wordpress · Hexo · Ghost · Discuz 等博客 / 论坛的页面以及只要是结构良好的页面,(无需适配)自动生成阅读模式,详细请看 [智能适配](http://ksria.com/simpread/docs/#/智能适配模式) + + * ![new纯色.png](https://i.loli.net/2018/09/05/5b8f718046acb.png) 全新的 `词法分析引擎`,更智能、更精准的提取正文,辅以精准适配,任意网页均「不在话下」,不仅能自动识别出 Wordpress · Hexo · Ghost · Discuz 等博客 / 论坛的页面,甚至于只要是结构良好的页面,(无需适配)自动生成阅读模式,详细请看 [词法分析引擎](http://ksria.com/simpread/docs/#/词法分析引擎) + - 导入 / 导出 / 同步适配列表 / 初始化数据,以及(相对简悦来说)适度的设置选项;