Skip to content

Commit 89505d4

Browse files
committed
update
1 parent 2b4807c commit 89505d4

6 files changed

Lines changed: 359 additions & 2 deletions

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
1-
# UserScript
2-
🔨 一些乱七八糟的油猴脚本
1+
# XIU2/UserScript
2+
3+
[![GitHub license](https://img.shields.io/github/license/XIU2/UserScript.svg?style=flat-square&color=4285dd)](https://github.com/XIU2/UserScript/blob/master/LICENSE)
4+
[![GitHub Star](https://img.shields.io/github/stars/XIU2/UserScript.svg?style=flat-square&label=Star&color=4285dd)](https://github.com/XIU2/UserScript/stargazers)
5+
[![GitHub Fork](https://img.shields.io/github/forks/XIU2/UserScript.svg?style=flat-square&label=Fork&color=4285dd)](https://github.com/XIU2/UserScript/network/members)
6+
7+
🔨 自用的一些乱七八糟油猴脚本,有什么问题请发 [Issues](https://github.com/XIU2/UserScript/issues/new/choose),觉得好用请点个⭐~
8+
9+
## 使用说明
10+
11+
* [知乎增强 - 宽屏显示](https://greasyfork.org/scripts/412212)
12+
* [知乎增强 - 一键收起长篇回答](https://greasyfork.org/scripts/412205)
13+
* [知乎增强 - 默认显示高清原图](https://greasyfork.org/scripts/412217)
14+
* [知乎增强 - 置顶显示发布/编辑时间](https://greasyfork.org/scripts/412216)
15+
16+
****
17+
18+
## 许可证
19+
20+
The GPL-3.0 License.
21+
22+
本软件仅供学习交流,请勿用于商用。
23+
24+
软件所有权归 X.I.U(XIU2) 所有。

SteamWorkshopImageRepair.user.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ==UserScript==
2+
// @name Steam Workshop Image Repair
3+
// @name:zh-CN Steam 创意工坊大图修复
4+
// @name:zh-TW Steam 創意工坊大圖修復
5+
// @author X.I.U
6+
// @description Fixed Steam Workshop image not showing
7+
// @description:zh-CN 修复 Steam 创意工坊预览大图无法显示的问题。
8+
// @description:zh-TW 修復 Steam 創意工坊預覽大圖無法顯示的問題。
9+
// @include *://steamcommunity.com/sharedfiles/filedetails/*
10+
// @include *://steamcommunity.com/workshop/filedetails/*
11+
// @version 1.0
12+
// @icon https://store.steampowered.com/favicon.ico
13+
// @run-at document-end
14+
// @namespace https://greasyfork.org/scripts/397666
15+
// ==/UserScript==
16+
17+
18+
if(typeof onYouTubeIframeAPIReady == 'function') {
19+
onYouTubeIframeAPIReady();
20+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ==UserScript==
2+
// @name 知乎增强 - 一键收起回答
3+
// @name:zh-CN 知乎增强 - 一键收起回答
4+
// @name:zh-TW 知乎增強 - 壹鍵收起回答
5+
// @author X.I.U
6+
// @description 在知乎右下角添加「一键收起回答」按钮,点击后可以收起所有长篇回答。
7+
// @description:zh-CN 在知乎右下角添加「一键收起回答」按钮,点击后可以收起所有长篇回答。
8+
// @description:zh-TW 在知乎右下角添加「壹鍵收起回答」按鈕,點擊後可以收起所有長篇回答。
9+
// @include *://www.zhihu.com/question/*
10+
// @version 1.0.0
11+
// @icon https://static.zhihu.com/static/favicon.ico
12+
// @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
13+
// @run-at document-end
14+
// @namespace https://greasyfork.org/scripts/412205
15+
// ==/UserScript==
16+
17+
(function() {
18+
var button_Add = `<button id="collapsed-button" data-tooltip="收起回答" data-tooltip-position="left" data-tooltip-will-hide-on-click="false" aria-label="收起回答" type="button" class="Button CornerButton Button--plain"><svg class="ContentItem-arrowIcon is-active" aria-label="收起回答" fill="currentColor" viewBox="0 0 24 24" width="24" height="24"><path d="M16.036 19.59a1 1 0 0 1-.997.995H9.032a.996.996 0 0 1-.997-.996v-7.005H5.03c-1.1 0-1.36-.633-.578-1.416L11.33 4.29a1.003 1.003 0 0 1 1.412 0l6.878 6.88c.782.78.523 1.415-.58 1.415h-3.004v7.005z"></path></svg></button>`
19+
var style_Add = document.createElement('style');
20+
style_Add.innerHTML = '.CornerButton{margin-bottom:8px !important;}.CornerButtons{bottom:45px !important;}';
21+
document.head.appendChild(style_Add);
22+
$(".CornerAnimayedFlex").prepend(button_Add);
23+
$("#collapsed-button").on("click", function () {
24+
document.querySelectorAll('.ContentItem-rightButton').forEach(function (el) {
25+
if (el.attributes[0].name === "data-zop-retract-question") {
26+
el.click()
27+
}
28+
});
29+
})
30+
})();

ZhihuEnhanced-HD-Pictures.user.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// ==UserScript==
2+
// @name 知乎增强 - 默认显示高清原图
3+
// @version 1.0.0
4+
// @description 回答和文章默认显示高清原图
5+
// @author X.I.U
6+
// @match *://www.zhihu.com/*
7+
// @match https://zhuanlan.zhihu.com/*
8+
// @icon https://static.zhihu.com/static/favicon.ico
9+
// @require https://cdn.bootcdn.net/ajax/libs/jquery/3.1.1/jquery.min.js
10+
// @connect zhihu.com
11+
// @run-at document-end
12+
// @namespace https://greasyfork.org/scripts/412217
13+
// ==/UserScript==
14+
15+
//图片调整到最高清晰度
16+
function originalPic()
17+
{
18+
$("img").each(function(){
19+
if($(this).attr("data-original")!=undefined && !$(this).hasClass("comment_sticker"))
20+
{
21+
if($(this).attr("src") != $(this).attr("data-original"))
22+
$(this).attr("src",$(this).attr("data-original"))
23+
}
24+
})
25+
$(".Modal-inner").css({"overflow-y":"hidden"})
26+
}
27+
28+
(function() {
29+
//图片调整到最高清晰度
30+
setInterval(originalPic,100)
31+
})();

ZhihuEnhanced-Time.user.js

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
// ==UserScript==
2+
// @name 知乎增强 - 置顶显示发布/编辑时间
3+
// @version 1.0.0
4+
// @description 回答和文章置顶显示发布时间、编辑时间
5+
// @author X.I.U
6+
// @match *://www.zhihu.com/*
7+
// @match https://zhuanlan.zhihu.com/*
8+
// @icon https://static.zhihu.com/static/favicon.ico
9+
// @require https://cdn.bootcdn.net/ajax/libs/jquery/3.1.1/jquery.min.js
10+
// @connect zhihu.com
11+
// @grant unsafeWindow
12+
// @run-at document-end
13+
// @namespace https://greasyfork.org/scripts/412216
14+
// ==/UserScript==
15+
16+
var publishTop=1; //置顶回答时间
17+
18+
//首页
19+
function index()
20+
{
21+
$(".TopstoryItem").each(function(){
22+
if( !($(this).find(".ContentItem-time").hasClass("full")) && $(this).find(".ContentItem-time").length>0 && $(this).find(".ContentItem-time").find("span").text() != null)
23+
{
24+
if($(this).find(".ContentItem-time").text().indexOf("发布于")==-1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") > -1) //只有"编辑于"时增加具体发布时间data-tooltip
25+
{
26+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
27+
var oldtext =$(this).find(".ContentItem-time").find("span").text();
28+
$(this).find(".ContentItem-time").find("span").text(data_tooltip+","+oldtext);
29+
$(this).find(".ContentItem-time").addClass("full");
30+
}
31+
else if($(this).find(".ContentItem-time").text().indexOf("发布于") > -1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") == -1) //只有"发布于"时替换为具体发布时间data-tooltip
32+
{
33+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
34+
$(this).find(".ContentItem-time").find("span").text(data_tooltip);
35+
$(this).find(".ContentItem-time").addClass("full");
36+
}
37+
38+
//发布时间置顶
39+
if(publishTop==1)
40+
{
41+
if(!$(this).find(".ContentItem-time").parent().hasClass("ContentItem-meta"))
42+
{
43+
let temp_time = $(this).find(".ContentItem-time").clone();
44+
$(this).find(".RichContent .ContentItem-time").hide();
45+
$(this).find(".ContentItem-meta").append(temp_time);
46+
}
47+
48+
}
49+
}
50+
51+
})
52+
}
53+
54+
//回答页
55+
function question()
56+
{
57+
//回答的发布时间
58+
$(".ContentItem.AnswerItem").each(function(){
59+
if( !($(this).find(".ContentItem-time").hasClass("full")) && $(this).find(".ContentItem-time").length>0 && $(this).find(".ContentItem-time").find("span").text() != null)
60+
{
61+
if($(this).find(".ContentItem-time").text().indexOf("发布于")==-1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") > -1) //只有"编辑于"时增加具体发布时间data-tooltip
62+
{
63+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
64+
var oldtext =$(this).find(".ContentItem-time").find("span").text();
65+
$(this).find(".ContentItem-time").find("span").text(data_tooltip+","+oldtext);
66+
$(this).find(".ContentItem-time").addClass("full");
67+
}
68+
else if($(this).find(".ContentItem-time").text().indexOf("发布于") > -1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") == -1) //只有"发布于"时替换为具体发布时间data-tooltip
69+
{
70+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
71+
$(this).find(".ContentItem-time").find("span").text(data_tooltip);
72+
$(this).find(".ContentItem-time").addClass("full");
73+
}
74+
75+
//发布时间置顶
76+
if(publishTop==1)
77+
{
78+
if(!$(this).find(".ContentItem-time").parent().hasClass("ContentItem-meta"))
79+
{
80+
let temp_time = $(this).find(".ContentItem-time").clone();
81+
$(this).find(".RichContent .ContentItem-time").hide();
82+
$(this).find(".ContentItem-meta").append(temp_time);
83+
}
84+
}
85+
}
86+
87+
})
88+
89+
$(".Pc-card.Card").attr("style","display:none")
90+
}
91+
92+
//专栏/文章
93+
function zhuanlan()
94+
{
95+
//隐藏推荐文章
96+
$(".Recommendations-Main").hide();
97+
98+
99+
//有"编辑于"时,增加发布时间
100+
if( $(".ContentItem-time").text().indexOf("编辑于")>-1 && !$(".ContentItem-time").hasClass("done"))
101+
{
102+
let bianjiyu = $(".ContentItem-time").text();
103+
$(".ContentItem-time").click();
104+
$(".ContentItem-time").text($(".ContentItem-time").text()+","+bianjiyu)
105+
$(".ContentItem-time").addClass("done");
106+
}
107+
108+
//发布时间置顶
109+
if(publishTop==1 && $(".Post-Header").find(".ContentItem-time").length==0)
110+
{
111+
$(".ContentItem-time").css({"padding":"0px 0px 0px 0px","margin-top": "14px"});
112+
$(".ContentItem-time").appendTo($(".Post-Header"))
113+
}
114+
}
115+
116+
//搜索结果页
117+
function search()
118+
{
119+
$(".ContentItem.AnswerItem, .ContentItem.ArticleItem").each(function(){
120+
console.log($(this).find(".ContentItem-time"))
121+
if( !($(this).find(".ContentItem-time").hasClass("full")) && $(this).find(".ContentItem-time").length>0 && $(this).find(".ContentItem-time").find("span").text() != null)
122+
{
123+
if($(this).find(".ContentItem-time").text().indexOf("发布于")==-1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") > -1) //只有"编辑于"时,增加具体发布时间data-tooltip
124+
{
125+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
126+
var oldtext =$(this).find(".ContentItem-time").find("span").text();
127+
$(this).find(".ContentItem-time").find("span").text(data_tooltip+","+oldtext);
128+
$(this).find(".ContentItem-time").addClass("full");
129+
}
130+
else if($(this).find(".ContentItem-time").text().indexOf("发布于") > -1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") == -1) //只有"发布于"时替换为具体发布时间data-tooltip
131+
{
132+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
133+
$(this).find(".ContentItem-time").find("span").text(data_tooltip);
134+
$(this).find(".ContentItem-time").addClass("full");
135+
}
136+
137+
//发布时间置顶
138+
if(publishTop==1)
139+
{
140+
if(!$(this).find(".ContentItem-time").parent().hasClass("SearchItem-meta"))
141+
{
142+
let temp_time = $(this).find(".ContentItem-time").clone();
143+
$(this).find(".RichContent .ContentItem-time").hide();
144+
$(this).find(".SearchItem-meta").append(temp_time);
145+
}
146+
}
147+
}
148+
149+
})
150+
151+
//隐藏相关推荐的卡片,仅保留问题卡片
152+
$(".RelevantQuery").closest(".Card.SearchResult-Card").hide();
153+
$(".KfeCollection-PcCollegeCard-wrapper").closest(".Card.SearchResult-Card").hide();
154+
if(getQueryVariable("type")=="content")
155+
{
156+
$('.Card.SearchResult-Card[data-za-detail-view-path-module="UserItem"]').hide();
157+
}
158+
159+
}
160+
161+
//用户主页
162+
function people()
163+
{
164+
$(".ContentItem.AnswerItem").each(function(){
165+
if( !($(this).find(".ContentItem-time").hasClass("full")) && $(this).find(".ContentItem-time").length>0 && $(this).find(".ContentItem-time").find("span").text() != null)
166+
{
167+
if($(this).find(".ContentItem-time").text().indexOf("发布于")==-1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") > -1) //只有"编辑于"时增加具体发布时间data-tooltip
168+
{
169+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
170+
var oldtext =$(this).find(".ContentItem-time").find("span").text();
171+
$(this).find(".ContentItem-time").find("span").text(data_tooltip+","+oldtext);
172+
$(this).find(".ContentItem-time").addClass("full");
173+
}
174+
else if($(this).find(".ContentItem-time").text().indexOf("发布于") > -1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") == -1) //只有"发布于"时替换为具体发布时间data-tooltip
175+
{
176+
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
177+
$(this).find(".ContentItem-time").find("span").text(data_tooltip);
178+
$(this).find(".ContentItem-time").addClass("full");
179+
}
180+
181+
//发布时间置顶
182+
if(publishTop==1)
183+
{
184+
if(!$(this).find(".ContentItem-time").parent().hasClass("ContentItem-meta"))
185+
{
186+
let temp_time = $(this).find(".ContentItem-time").clone();
187+
$(this).find(".RichContent .ContentItem-time").hide();
188+
$(this).find(".ContentItem-meta").append(temp_time);
189+
}
190+
}
191+
}
192+
193+
})
194+
}
195+
196+
(function() {
197+
//折叠谢邀
198+
let timer=setInterval(function(){
199+
if($(".QuestionInvitation-content").text().indexOf("更多推荐结果") > -1)
200+
{
201+
clearInterval(timer);
202+
$(".QuestionInvitation-content").addClass("hide");
203+
$(".QuestionInvitation-content").hide();
204+
205+
$(".QuestionInvitation-title").html($(".QuestionInvitation-title").text()+'<span style="color:#8590A6;">(点击此处展开/折叠)</span>')
206+
207+
$(".Topbar").click(function(){
208+
209+
if(($(".QuestionInvitation-content").hasClass("hide")))
210+
{
211+
$(".QuestionInvitation-content").removeClass("hide").addClass("show");
212+
$(".QuestionInvitation-content").show();
213+
}
214+
else
215+
{
216+
$(".QuestionInvitation-content").removeClass("show").addClass("hide");
217+
$(".QuestionInvitation-content").hide();
218+
}
219+
})
220+
}
221+
})
222+
223+
//每个页面对应的功能函数
224+
if(window.location.href.indexOf("question") > -1) //回答页
225+
setInterval(question, 300);
226+
else if(window.location.href.indexOf("search") > -1) //搜索结果页
227+
setInterval(search, 300);
228+
else if(window.location.href.indexOf("zhuanlan") > -1) //专栏/文章
229+
setInterval(zhuanlan, 300);
230+
else if(window.location.href.indexOf("people") > -1 || window.location.href.indexOf("org") > -1) //用户主页
231+
setInterval(people, 300);
232+
else
233+
setInterval(index, 300); //首页
234+
})();

ZhihuEnhanced-Widescreen.user.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ==UserScript==
2+
// @name 知乎增强 - 宽屏显示
3+
// @name:zh-CN 知乎增强 - 宽屏显示
4+
// @name:zh-TW 知乎增強 - 寬屏顯示
5+
// @author X.I.U
6+
// @description 将知乎首页、热榜、搜索等页面由窄屏改为宽屏显示。
7+
// @description:zh-CN 将知乎首页、热榜、搜索等页面由窄屏改为宽屏显示。
8+
// @description:zh-TW 將知乎首頁、熱榜、搜索等頁面由窄屏改為寬屏顯示。
9+
// @include *://www.zhihu.com/*
10+
// @version 1.0.0
11+
// @icon https://static.zhihu.com/static/favicon.ico
12+
// @run-at document-start
13+
// @namespace https://greasyfork.org/scripts/412212
14+
// ==/UserScript==
15+
16+
(function() {
17+
var style_Add = document.createElement('style');
18+
style_Add.innerHTML = '.GlobalSideBar,.Question-sideColumn,.ContentLayout-sideColumn,.SearchSideBar{display:none;}.Topstory-mainColumn,.Question-mainColumn,.ContentLayout-mainColumn,.SearchMain{width: 1000px;}.ImageMessage-ImageView{z-index:999 !important;}';
19+
document.head.appendChild(style_Add);
20+
})();

0 commit comments

Comments
 (0)