diff --git a/README.md b/README.md index 704c6ec..2067440 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@

Pake

-
很简单的用 Rust 打包网页生成很小的 Mac App,底层使用 Tauri,支持微信读书、Twitter、语雀、RunCode、Witeboard、Flomo、Vercel 等,详细小白开发教程可见底部。
+
很简单的用 Rust 打包网页生成很小的 Mac App,底层使用 Tauri,支持微信读书、Twitter、语雀、RunCode、Witeboard、Flomo、Vercel、V2EX 等,详细小白开发教程可见底部。

## 特征 diff --git a/README_EN.md b/README_EN.md index cf79435..cd89771 100644 --- a/README_EN.md +++ b/README_EN.md @@ -2,7 +2,7 @@

Pake

-
A simple way to package a web page with Rust to create Mac App, using Tauri as underlying layer, supporting WeRead、Twitter、YuQue、RunCode、Flomo、Witeboard、Vercel, detailed development tutorial can be seen at the bottom.
+
A simple way to package a web page with Rust to create Mac App, using Tauri as underlying layer, supporting WeRead、Twitter、YuQue、RunCode、Flomo、Witeboard、Vercel、V2EX, detailed development tutorial can be seen at the bottom.

## Features diff --git a/src-tauri/icons/v2ex.icns b/src-tauri/icons/v2ex.icns new file mode 100644 index 0000000..3b7819d Binary files /dev/null and b/src-tauri/icons/v2ex.icns differ diff --git a/src-tauri/src/pake.js b/src-tauri/src/pake.js index 380da2d..ef02261 100644 --- a/src-tauri/src/pake.js +++ b/src-tauri/src/pake.js @@ -1,7 +1,8 @@ window.addEventListener('DOMContentLoaded', (_event) => { - const style = document.createElement('style'); - style.innerHTML = ` + const style = document.createElement('style'); + style.innerHTML = ` // mini twitter 代码存到 dist 下面,为了防止干扰,需要的时候 copy 过来即可 + .panel.give_me .nav_view { top: 154px !important; } @@ -18,10 +19,26 @@ window.addEventListener('DOMContentLoaded', (_event) => { .drawing-board .toolbar .toolbar-action, .c-swiper-container, .download_entry, - .lang, .copyright { + .lang, .copyright, + .wwads-cn, .adsbygoogle, + #Bottom > div.content > div.inner, + #Rightbar .sep20:nth-of-type(5), + #Rightbar > div.box:nth-child(4), + #Main > div.box:nth-child(8) > div + #Wrapper > div.sep20, + #Main > div.box:nth-child(8) { display: none !important; } + #Wrapper{ + background-color: #F8F8F8 !important; + background-image:none !important; + } + + #Top { + border-bottom: none; + } + .container-with-note #home, .container-with-note #switcher{ top: 30px; } @@ -49,62 +66,61 @@ window.addEventListener('DOMContentLoaded', (_event) => { cursor: -webkit-grab; } `; - document.head.append(style); - const topDom = document.createElement("div"); - topDom.id = "pack-top-dom" - document.body.appendChild(topDom); + document.head.append(style); + const topDom = document.createElement('div'); + topDom.id = 'pack-top-dom'; + document.body.appendChild(topDom); - const domEl = document.getElementById('pack-top-dom'); + const domEl = document.getElementById('pack-top-dom'); - domEl.addEventListener('mousedown', (e) => { - if (e.buttons === 1 && e.detail !== 2) { - window.ipc.postMessage('drag_window'); - } - }) + domEl.addEventListener('mousedown', (e) => { + if (e.buttons === 1 && e.detail !== 2) { + window.ipc.postMessage('drag_window'); + } + }); - domEl.addEventListener('touchstart', (e) => { - window.ipc.postMessage('drag_window'); - }) + domEl.addEventListener('touchstart', (e) => { + window.ipc.postMessage('drag_window'); + }); - domEl.addEventListener('dblclick', (e) => { - window.ipc.postMessage('fullscreen'); - }) + domEl.addEventListener('dblclick', (e) => { + window.ipc.postMessage('fullscreen'); + }); - document.addEventListener('keyup', function (event) { - if (event.key === "ArrowUp" && event.metaKey){ - scrollTo(0,0); - } - if (event.key === "ArrowDown" && event.metaKey){ - window.scrollTo(0, document.body.scrollHeight); - } - if (event.key === "[" && event.metaKey){ - window.history.go(-1); - } - if (event.key === "]" && event.metaKey){ - window.history.go(1); - } - if (event.key === "r" && event.metaKey){ - window.location.reload(); - } - if (event.key === "-" && event.metaKey){ - zoomOut(); - } - if (event.key === "=" && event.metaKey){ - zoomIn(); - } - if (event.key === "0" && event.metaKey){ - zoomCommon(() => '100%'); - } - }) - - document.addEventListener('click', e => { - const origin = e.target.closest('a'); - const href = origin.href; - if (href) { - origin.target = "_self" - } - }); + document.addEventListener('keyup', function (event) { + if (event.key === 'ArrowUp' && event.metaKey) { + scrollTo(0, 0); + } + if (event.key === 'ArrowDown' && event.metaKey) { + window.scrollTo(0, document.body.scrollHeight); + } + if (event.key === '[' && event.metaKey) { + window.history.go(-1); + } + if (event.key === ']' && event.metaKey) { + window.history.go(1); + } + if (event.key === 'r' && event.metaKey) { + window.location.reload(); + } + if (event.key === '-' && event.metaKey) { + zoomOut(); + } + if (event.key === '=' && event.metaKey) { + zoomIn(); + } + if (event.key === '0' && event.metaKey) { + zoomCommon(() => '100%'); + } + }); + document.addEventListener('click', (e) => { + const origin = e.target.closest('a'); + const href = origin.href; + if (href) { + origin.target = '_self'; + } + }); }); setDefaultZoom(); @@ -117,18 +133,21 @@ function setDefaultZoom() { } function zoomCommon(callback) { - const htmlZoom = window.localStorage.getItem('htmlZoom') || '100%'; - const html = document.getElementsByTagName('html')[0]; - const zoom = callback(htmlZoom); - html.style.zoom = zoom; - window.localStorage.setItem('htmlZoom', zoom); + const htmlZoom = window.localStorage.getItem('htmlZoom') || '100%'; + const html = document.getElementsByTagName('html')[0]; + const zoom = callback(htmlZoom); + html.style.zoom = zoom; + window.localStorage.setItem('htmlZoom', zoom); } function zoomIn() { - zoomCommon(htmlZoom => parseInt(htmlZoom) < 200 ? (parseInt(htmlZoom) + 10 +'%') : '200%'); + zoomCommon((htmlZoom) => + parseInt(htmlZoom) < 200 ? parseInt(htmlZoom) + 10 + '%' : '200%', + ); } function zoomOut() { - zoomCommon(htmlZoom => parseInt(htmlZoom) > 30 ? (parseInt(htmlZoom) - 10 +'%') : '30%'); + zoomCommon((htmlZoom) => + parseInt(htmlZoom) > 30 ? parseInt(htmlZoom) - 10 + '%' : '30%', + ); } -