Skip to content

Commit

Permalink
zmfs: 拆分代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ipcjs committed Sep 19, 2021
1 parent 8501cd2 commit 323e67b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 61 deletions.
7 changes: 7 additions & 0 deletions packages/zhihu_mobile_style/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import css from './src/main.scss'
import main from './src/main'

log = GM_info.script.name.endsWith('.dev') ? console.debug.bind(console) : () => { }

GM.addStyle(css)
main({ log })
3 changes: 1 addition & 2 deletions packages/zhihu_mobile_style/index.user.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
// ==UserScript==
// @name Fuck ZhiHu Mobile Style
// @namespace https://github.com/ipcjs
// @version 2.1.4
// @version 2.1.5
// @description 日他娘的逼乎手机网页版 样式ver; 针对电脑版进行修改,适配手机屏幕;
// @author ipcjs
// @compatible chrome
// @compatible firefox
// @include https://www.zhihu.com/*
// @include https://zhuanlan.zhihu.com/*
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @require https://greasyfork.org/scripts/373283-ipcjs-lib-js/code/ipcjslibjs.js?version=647820
// @grant GM_addStyle
// @grant GM.addStyle
// ==/UserScript==
Expand Down
45 changes: 0 additions & 45 deletions packages/zhihu_mobile_style/src/index.js

This file was deleted.

9 changes: 2 additions & 7 deletions packages/zhihu_mobile_style/src/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import css from './index.scss'

GM.addStyle(css)

ipcjs.installInto(({ log, html, $ }) => {
log = GM_info.script.name.endsWith('.dev') ? log : () => { }
export default function ({ log }) {
removeThankButton(document)
new MutationObserver((mutations, observer) => {
// log(mutations)
Expand Down Expand Up @@ -42,4 +37,4 @@ ipcjs.installInto(({ log, html, $ }) => {
log(`modify: ${count}`)
}
}
})
}
15 changes: 8 additions & 7 deletions scripts/zhihu_mobile_fuck_style.user.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
// ==UserScript==
// @name Fuck ZhiHu Mobile Style
// @namespace https://github.com/ipcjs
// @version 2.1.4
// @version 2.1.5
// @description 日他娘的逼乎手机网页版 样式ver; 针对电脑版进行修改,适配手机屏幕;
// @author ipcjs
// @compatible chrome
// @compatible firefox
// @include https://www.zhihu.com/*
// @include https://zhuanlan.zhihu.com/*
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @require https://greasyfork.org/scripts/373283-ipcjs-lib-js/code/ipcjslibjs.js?version=647820
// @grant GM_addStyle
// @grant GM.addStyle
// ==/UserScript==

// @template-contentvar css = "@charset \"UTF-8\";\n/* Header */\n.AppHeader {\n min-width: inherit; }\n .AppHeader .ZhihuLogoLink,\n .AppHeader .SearchBar {\n display: none; }\n .AppHeader-inner {\n width: 100%;\n min-width: inherit; }\n .AppHeader-Tabs {\n margin-left: 0px;\n margin-right: 4px; }\n .AppHeader-Tab {\n padding: 0 4px !important; }\n .AppHeader-messages, .AppHeader-notifications {\n margin-right: 16px; }\n .AppHeader-userInfo {\n margin-left: 0px !important;\n margin-right: 32px; }\n .AppHeader-navItem {\n padding: 0 5px; }\n .AppHeader-nav {\n margin-left: 16px;\n margin-right: 16px; }\n\n.TopstoryPageHeader-main {\n margin-left: 16px; }\n\n/* 通用列表 */\n.Topstory-container,\n.Question-main,\n.Profile-main {\n display: block;\n width: 100%;\n padding: 0px; }\n\n.Topstory-mainColumn,\n.Question-mainColumn,\n.Profile-mainColumn {\n width: 100%; }\n\n.Question-sideColumn,\n.Profile-sideColumn {\n width: 100%; }\n\n/* 回答页面的Header */\n.QuestionHeader .QuestionHeader-content {\n width: 100%;\n display: block;\n padding: 0px; }\n\n.QuestionHeader .QuestionHeader-main {\n width: 100%; }\n\n.QuestionHeader .QuestionHeader-side {\n width: 100%; }\n\n.QuestionHeader .NumberBoard {\n margin: auto; }\n\n.QuestionHeader {\n min-width: inherit; }\n\n.PageHeader .QuestionHeader-content {\n width: 100%; }\n\n.PageHeader .QuestionHeader-main {\n width: 100%;\n padding: 0px; }\n\n.PageHeader .QuestionHeader-side {\n display: none; }\n\n.AuthorInfo {\n overflow-x: hidden; }\n\n/* 个人主页 */\n.ProfileHeader {\n width: 100%;\n padding: 0px; }\n .ProfileHeader-buttons {\n position: static; }\n .ProfileHeader-contentHead {\n padding-right: 0px; }\n\n.ProfileMain-tabs {\n overflow: scroll; }\n .ProfileMain-tabs::-webkit-scrollbar {\n display: none; }\n\n/* 列表Item上的按钮 */\n.ShareMenu {\n display: none; }\n\n.ContentItem-action {\n margin-left: 8px; }\n\n/* 专栏页面 */\n.Post-NormalMain .Post-Header,\n.Post-NormalMain > div {\n width: 100%; }\n\n.ColumnPageHeader-content {\n width: 100%; }\n\n/* 弹窗 */\n.Modal-closeButton {\n position: static;\n margin-left: auto;\n margin-right: auto; }\n\n.Modal {\n width: 100%; }\n";

GM.addStyle(css);

ipcjs.installInto(({ log, html, $ }) => {
log = GM_info.script.name.endsWith('.dev') ? log : () => { };
function main ({ log }) {
removeThankButton(document);
new MutationObserver((mutations, observer) => {
// log(mutations)
Expand Down Expand Up @@ -58,5 +54,10 @@ ipcjs.installInto(({ log, html, $ }) => {
log(`modify: ${count}`);
}
}
});
}

log = GM_info.script.name.endsWith('.dev') ? console.debug.bind(console) : () => { };

GM.addStyle(css);
main({ log });

Expand Down

0 comments on commit 323e67b

Please sign in to comment.