Skip to content

Commit 698ec70

Browse files
committed
0.1.4
1 parent bc4bfb2 commit 698ec70

File tree

7 files changed

+136
-14
lines changed

7 files changed

+136
-14
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# v2ex.min - V2EX 极简风格
22

3-
V2EX 极简风格,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
3+
V2EX 极简风格,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
44

55
![screenshots](assets/v2ex.min-screenshots-01.png)
66
![screenshots](assets/v2ex.min-screenshots-02.png)
@@ -10,14 +10,14 @@ V2EX 极简风格,扁平化 UI,导航栏顶部固定,去除背景图片,
1010

1111
## Installation
1212

13-
- Chrome Extension: TBD
14-
- Firefox Addon: TBD
13+
- Chrome Extension: [Manual Installation](manual-installation.md)
14+
- Edge Extension: [Manual Installation](manual-installation.md)
15+
- Firefox Addon: [Manual Installation](manual-installation.md)
1516
- Userscript: [https://greasyfork.org/scripts/463552-v2ex-min](https://greasyfork.org/scripts/463552-v2ex-min)
16-
- [Manual Installation](manual-installation.md)
1717

1818
## Development
1919

20-
This extension/userscript built from [Browser Extension Starter and Userscript Starter](https://github.com/PipecraftNet/browser-extension-starter)
20+
This extension/userscript is built from [Browser Extension Starter and Userscript Starter](https://github.com/PipecraftNet/browser-extension-starter)
2121

2222
## Features
2323

build/userscript-prod/v2ex.min.user.js

Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// @namespace https://github.com/v2hot/v2ex.min
66
// @homepageURL https://github.com/v2hot/v2ex.min#readme
77
// @supportURL https://github.com/v2hot/v2ex.min/issues
8-
// @version 0.1.3
9-
// @description V2EX 极简风格,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
10-
// @description:en V2EX minimalist style,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
11-
// @description:zh-CN V2EX 极简风格,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
8+
// @version 0.1.4
9+
// @description V2EX 极简风格,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
10+
// @description:en V2EX minimalist style,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
11+
// @description:zh-CN V2EX 极简风格,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
1212
// @icon https://www.v2ex.com/favicon.ico
1313
// @author Pipecraft
1414
// @license MIT
@@ -25,6 +25,8 @@
2525
// ==/UserScript==
2626
//
2727
//// Recent Updates
28+
//// - 0.1.4 2023.04.18
29+
//// - 显示快捷按钮
2830
//// - 0.1.3 2023.04.12
2931
//// - 隐藏最后回复者
3032
//// - 0.1.1 2023.04.12
@@ -229,10 +231,96 @@
229231
'*{box-shadow:unset !important;text-shadow:unset !important}.box,#Main .box,#Top,#Tabs,#Wrapper,#Bottom{background-image:unset !important;border:none !important}.cell,.box,.super.button,.topic_buttons,div[style*=border]{border:unset !important;background-image:unset !important}.count_livid{padding:0 !important;margin-right:0 !important;color:#999 !important;font-family:"Bender" !important;background-color:unset !important}body #Wrapper{background-color:#fff;--topic-link-color: #444444;--topic-link-hover-color: #217dfc;--primary-button-fill-color: #217dfc;--primary-button-text-color: #fff}body #Wrapper.Night{background-color:var(--box-background-color);--topic-link-color: #9caec7;--topic-link-hover-color: #a9bcd6;--primary-button-fill-color: #217dfc;--primary-button-text-color: #fff}a.topic-link:active,a.topic-link:link{color:var(--topic-link-color)}a.topic-link:hover{color:var(--topic-link-hover-color)}img{max-width:100%}body .super.button{background-color:var(--primary-button-fill-color);color:var(--primary-button-text-color);font-weight:400;border:transparent;border-radius:4px}body .super.button+.super.button{border-left:1px solid rgba(255,255,255,.2509803922) !important}body .super.button:not(.disable_now):hover,body .super.button:hover:enabled{background-color:var(--primary-button-fill-color) !important;opacity:85%;color:var(--primary-button-text-color) !important;font-weight:400;text-shadow:unset !important}'
230232
var no_ads_default =
231233
".box:has(>style),div:has(>script),div:has(>.wwads-cn),.box:has(>.sidebar_compliance),div:has(>a>#DigitalOcean){display:none !important}"
234+
var side_nav_default =
235+
'#v2min_sideNav{--background-color: #000;--button-color: #aaa;--button-hover-color: #fff;--button-separator-color: #999;position:fixed;display:flex !important;bottom:0px;right:0px;background-color:var(--background-color);opacity:75%;border-top-left-radius:6px}#v2min_sideNav button{color:var(--button-color);font-size:18px;width:30px;height:30px;background-color:unset;border:none;position:relative}#v2min_sideNav button:hover{color:var(--button-hover-color)}#v2min_sideNav button:disabled{color:#778087;opacity:50%}#v2min_sideNav button::after{content:"";border-left:1px solid var(--button-separator-color);position:absolute;bottom:10px;right:-1px;width:1px;height:10px}#v2min_sideNav button:last-of-type::after{display:none}#v2min_sideNav button.fa-chevron-left,#v2min_sideNav button.fa-chevron-right,#v2min_sideNav button.fa-bell{font-size:14px}'
232236
var sticky_header_default =
233237
'#Top{position:fixed;top:0;width:100%;box-sizing:border-box}#Top .content{max-width:unset !important;width:100% !important}.site-nav .tools{flex:unset}.site-nav a[name=top]{margin-right:auto}#Wrapper::before{content:"";display:block;height:44px}#placeholder{height:38px}#Tabs{position:fixed;top:1px;padding:9px;border:none}#search-container{width:100px}#search-container:has(input:focus){width:300px}body:has(input:focus) #Tabs{display:none}@media only screen and (max-width: 1300px){.site-nav a[name=top]{visibility:hidden}}body{scroll-margin-top:44px}'
234238
var content_default =
235239
"#v2min_settings{position:fixed;top:10px;right:30px;min-width:250px;max-height:90%;overflow-y:auto;overflow-x:hidden;display:none;box-sizing:border-box;padding:10px 15px;background-color:#f3f3f3;z-index:100000;border-radius:5px;-webkit-box-shadow:0px 10px 39px 10px rgba(62,66,66,.22);-moz-box-shadow:0px 10px 39px 10px rgba(62,66,66,.22);box-shadow:0px 10px 39px 10px rgba(62,66,66,.22) !important}#v2min_settings h2{text-align:center;margin:5px 0 0;font-size:18px;font-weight:600;border:none}#v2min_settings footer{text-align:center;font-size:11px;margin:10px auto 0px}#v2min_settings footer a{color:#217dfc}#v2min_settings .option_groups{background-color:#fff;padding:6px 0 6px 15px;border-radius:10px;display:flex;flex-direction:column;margin:10px 0 0}#v2min_settings .option_groups .action{font-size:14px;border-top:1px solid #ccc;padding:6px 15px 6px 0;color:#217dfc;cursor:pointer}#v2min_settings .option_groups:nth-of-type(2){display:none}#v2min_settings .option_groups textarea{margin:10px 15px 10px 0;height:200px;width:300px;border:1px solid #a9a9a9}#v2min_settings .switch_option{display:flex;justify-content:space-between;align-items:center;border-top:1px solid #ccc;padding:6px 15px 6px 0;font-size:14px}#v2min_settings .switch_option:first-of-type,#v2min_settings .option_groups .action:first-of-type{border-top:none}#v2min_settings .container{--button-width: 51px;--button-height: 24px;--toggle-diameter: 20px;--color-off: #e9e9eb;--color-on: #34c759;width:var(--button-width);height:var(--button-height);position:relative}#v2min_settings input[type=checkbox]{opacity:0;width:0;height:0;position:absolute}#v2min_settings .switch{width:100%;height:100%;display:block;background-color:var(--color-off);border-radius:calc(var(--button-height)/2);cursor:pointer;transition:all .2s ease-out}#v2min_settings .slider{width:var(--toggle-diameter);height:var(--toggle-diameter);position:absolute;left:2px;top:calc(50% - var(--toggle-diameter)/2);border-radius:50%;background:#fff;box-shadow:0px 3px 8px rgba(0,0,0,.15),0px 3px 1px rgba(0,0,0,.06);transition:all .2s ease-out;cursor:pointer}#v2min_settings input[type=checkbox]:checked+.switch{background-color:var(--color-on)}#v2min_settings input[type=checkbox]:checked+.switch .slider{left:calc(var(--button-width) - var(--toggle-diameter) - 2px)}"
240+
function showSideNav() {
241+
if (!document.body) {
242+
return
243+
}
244+
if (!$("#v2min_sideNav")) {
245+
const sideNav = addElement(document.body, "div", {
246+
id: "v2min_sideNav",
247+
style: "display: none",
248+
})
249+
addElement(sideNav, "button", {
250+
class: "fa fa-arrow-circle-up",
251+
title: "Back to the top",
252+
onclick() {
253+
window.scrollTo({
254+
top: 0,
255+
behavior: "smooth",
256+
})
257+
},
258+
})
259+
addElement(sideNav, "button", {
260+
class: "fa fa-comments",
261+
title: "Comments",
262+
disabled:
263+
location.href.includes("/t/") && $("#Main > div:nth-child(4)")
264+
? void 0
265+
: true,
266+
onclick() {
267+
window.scrollTo({
268+
top:
269+
$("#Main > div:nth-child(4)").offsetTop -
270+
(getSettingsValue("stickyHeader") ? 44 : 0),
271+
behavior: "smooth",
272+
})
273+
},
274+
})
275+
addElement(sideNav, "button", {
276+
class: "fa fa-edit",
277+
title: "Add comment",
278+
value: "AA",
279+
disabled:
280+
location.href.includes("/t/") && $("#reply_content") ? void 0 : true,
281+
onclick() {
282+
$("#reply_content").focus()
283+
},
284+
})
285+
addElement(sideNav, "button", {
286+
class: "fa fa-chevron-left",
287+
title: "Go to previous page",
288+
disabled: $('*[title="\u4E0A\u4E00\u9875"]') ? void 0 : true,
289+
onclick() {
290+
$('*[title="\u4E0A\u4E00\u9875"]').click()
291+
},
292+
})
293+
addElement(sideNav, "button", {
294+
class: "fa fa-chevron-right",
295+
title: "Go to next page",
296+
disabled: $('*[title="\u4E0B\u4E00\u9875"]') ? void 0 : true,
297+
onclick() {
298+
$('*[title="\u4E0B\u4E00\u9875"]').click()
299+
},
300+
})
301+
addElement(sideNav, "button", {
302+
class: "fa fa-bell",
303+
title: "Notifications",
304+
onclick() {
305+
location.href = "https://www.v2ex.com/notifications"
306+
},
307+
})
308+
addElement(sideNav, "button", {
309+
class: "fa fa-home",
310+
title: "Home",
311+
onclick() {
312+
location.href = "/"
313+
},
314+
})
315+
addElement(sideNav, "button", {
316+
class: "fa fa-cog",
317+
title: "Settings",
318+
onclick() {
319+
setTimeout(showSettings, 1)
320+
},
321+
})
322+
}
323+
}
236324
function createSwitch(options = {}) {
237325
const container = createElement("label", { class: "container" })
238326
const checkbox = createElement(
@@ -254,6 +342,9 @@
254342
div.append(createSwitch(options))
255343
return div
256344
}
345+
var config = {
346+
matches: ["https://*.v2ex.com/*", "https://v2hot.pipecraft.net/*"],
347+
}
257348
var settingsTable = {
258349
minimalist: {
259350
title: "\u6781\u7B80\u98CE\u683C",
@@ -271,6 +362,10 @@
271362
title: "\u589E\u5F3A\u663E\u793A\u8282\u70B9\u540D",
272363
defaultValue: true,
273364
},
365+
showSideNav: {
366+
title: "\u663E\u793A\u5FEB\u6377\u6309\u94AE",
367+
defaultValue: true,
368+
},
274369
bodyBackgroundColor: {
275370
title: "\u53BB\u9664\u9875\u9762\u80CC\u666F\u8272",
276371
defaultValue: false,
@@ -410,6 +505,7 @@ body #Wrapper.Night {
410505
hidePinnedTopics: false,
411506
hideProfilePhoto: false,
412507
customStyle: false,
508+
showSideNav: false,
413509
})
414510
},
415511
})
@@ -457,6 +553,10 @@ body #Wrapper.Night {
457553
}
458554
styles.push(hide_last_replier_default)
459555
}
556+
if (getSettingsValue("showSideNav")) {
557+
styles.push(side_nav_default)
558+
showSideNav()
559+
}
460560
if (getSettingsValue("hidePinnedTopics")) {
461561
styles.push(`/* Hide pinned topics */
462562
#Main > div:nth-child(2) > div[style*="corner"] {
@@ -491,6 +591,7 @@ body #Wrapper.Night {
491591
}
492592
#Tabs > a {
493593
min-width: 3.5em;
594+
text-align: center;
494595
}
495596
`)
496597
}

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "v2ex.min",
33
"displayName": "v2ex.min - V2EX Minimalist (极简风格)",
44
"displayName:zh-CN": "v2ex.min - V2EX 极简风格",
5-
"version": "0.1.3",
6-
"description": "V2EX minimalist style,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。",
7-
"description:zh-CN": "V2EX 极简风格,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。",
5+
"version": "0.1.4",
6+
"description": "V2EX minimalist style,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。",
7+
"description:zh-CN": "V2EX 极简风格,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。",
88
"author": "Pipecraft",
99
"namespace": "https://github.com/v2hot/v2ex.min",
1010
"icon": "https://www.v2ex.com/favicon.ico",

release-notes/readme.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Release Notes
2+
3+
## 0.1.4 (2023.04.18)
4+
5+
- 显示快捷按钮
6+
7+
## 0.1.3 (2023.04.12)
8+
9+
- 隐藏最后回复者
10+
11+
## 0.1.1 (2023.04.12)
12+
13+
- 修改去除页面背景色逻辑
14+
15+
## 0.1.0 (2023.04.11)
16+
17+
- 添加自定义功能选项,自定义样式功能

scripts/userscript/banner.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
// ==/UserScript==
1919
//
2020
//// Recent Updates
21+
//// - 0.1.4 2023.04.18
22+
//// - 显示快捷按钮
2123
//// - 0.1.3 2023.04.12
2224
//// - 隐藏最后回复者
2325
//// - 0.1.1 2023.04.12

userscript-desc/readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# v2ex.min - V2EX Minimalist (极简风格)
22

3-
V2EX minimalist style,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
3+
V2EX minimalist style,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
44

55
> ⚠️ 部分样式在 Firefox 支持的不好。
66
@@ -11,6 +11,7 @@ V2EX minimalist style,扁平化 UI,导航栏顶部固定,去除背景图
1111
- ✅ 自定义功能选项
1212
- ✅ 自定义样式
1313
- ✅ 隐藏最后回复者
14+
- ✅ 快捷按钮
1415
- Theme 切换
1516

1617
## About

userscript-desc/zh-CN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# v2ex.min - V2EX 极简风格
22

3-
V2EX 极简风格,扁平化 UI,导航栏顶部固定,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
3+
V2EX 极简风格,扁平化 UI,导航栏顶部固定,快捷按钮,去除背景图片,支持黑暗模式,去除广告,去除不必要元素,支持隐藏头像,支持自定义样式。
44

55
> ⚠️ 部分样式在 Firefox 支持的不好。
66
@@ -11,6 +11,7 @@ V2EX 极简风格,扁平化 UI,导航栏顶部固定,去除背景图片,
1111
- ✅ 自定义功能选项
1212
- ✅ 自定义样式
1313
- ✅ 隐藏最后回复者
14+
- ✅ 快捷按钮
1415
- Theme 切换
1516

1617
## About

0 commit comments

Comments
 (0)