创建时间: ' + createtime + '
最后编辑: ' + modifiedtime + '
');
}
}
// 置顶显示时间 - 专栏/文章,来自:https://greasyfork.org/scripts/402808
function topTime_zhuanlan()
{
//隐藏推荐文章
$(".Recommendations-Main").hide();
// 完整显示时间
if(menu_allTime)
{
if( $(".ContentItem-time").text().indexOf("编辑于")>-1 && !$(".ContentItem-time").hasClass("done"))
{
let bianjiyu = $(".ContentItem-time").text();
$(".ContentItem-time").click();
$(".ContentItem-time").text($(".ContentItem-time").text()+","+bianjiyu)
$(".ContentItem-time").addClass("done");
}
}
//发布时间置顶
if(menu_publishTop && $(".Post-Header").find(".ContentItem-time").length==0)
{
$(".ContentItem-time").css({"padding":"0px 0px 0px 0px","margin-top": "14px"});
$(".ContentItem-time").appendTo($(".Post-Header"))
}
}
// 置顶显示时间 - 搜索结果页,来自:https://greasyfork.org/scripts/402808
function topTime_search()
{
$(".ContentItem.AnswerItem, .ContentItem.ArticleItem").each(function(){
if( !($(this).find(".ContentItem-time").hasClass("full")) && $(this).find(".ContentItem-time").length>0 && $(this).find(".ContentItem-time").find("span").text() != null)
{
// 完整显示时间
if(menu_allTime)
{
if($(this).find(".ContentItem-time").text().indexOf("发布于")==-1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") > -1) //只有"编辑于"时,增加具体发布时间data-tooltip
{
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
var oldtext =$(this).find(".ContentItem-time").find("span").text();
$(this).find(".ContentItem-time").find("span").text(data_tooltip+","+oldtext);
$(this).find(".ContentItem-time").addClass("full");
}
else if($(this).find(".ContentItem-time").text().indexOf("发布于") > -1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") == -1) //只有"发布于"时替换为具体发布时间data-tooltip
{
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
$(this).find(".ContentItem-time").find("span").text(data_tooltip);
$(this).find(".ContentItem-time").addClass("full");
}
}
//发布时间置顶
if(menu_publishTop)
{
if(!$(this).find(".ContentItem-time").parent().hasClass("SearchItem-meta"))
{
let temp_time = $(this).find(".ContentItem-time").clone();
$(this).find(".RichContent .ContentItem-time").hide();
$(this).find(".SearchItem-meta").append(temp_time);
}
}
}
})
}
// 置顶显示时间 - 用户主页,来自:https://greasyfork.org/scripts/402808
function topTime_people()
{
$(".ContentItem.AnswerItem, .ContentItem.ArticleItem").each(function(){
if( !($(this).find(".ContentItem-time").hasClass("full")) && $(this).find(".ContentItem-time").length>0 && $(this).find(".ContentItem-time").find("span").text() != null)
{
// 完整显示时间
if(menu_allTime)
{
if($(this).find(".ContentItem-time").text().indexOf("发布于")==-1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") > -1) //只有"编辑于"时增加具体发布时间data-tooltip
{
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
var oldtext =$(this).find(".ContentItem-time").find("span").text();
$(this).find(".ContentItem-time").find("span").text(data_tooltip+","+oldtext);
$(this).find(".ContentItem-time").addClass("full");
}
else if($(this).find(".ContentItem-time").text().indexOf("发布于") > -1 && $(this).find(".ContentItem-time").text().indexOf("编辑于") == -1) //只有"发布于"时替换为具体发布时间data-tooltip
{
let data_tooltip = $(this).find(".ContentItem-time").find("span").attr("data-tooltip");
$(this).find(".ContentItem-time").find("span").text(data_tooltip);
$(this).find(".ContentItem-time").addClass("full");
}
}
//发布时间置顶
if(menu_publishTop)
{
if(!$(this).find(".ContentItem-time").parent().hasClass("ContentItem-meta"))
{
let temp_time = $(this).find(".ContentItem-time").clone();
$(this).find(".RichContent .ContentItem-time").hide();
$(this).find(".ContentItem-meta").append(temp_time);
}
}
}
})
}
// 默认站外直链,来自:https://greasyfork.org/scripts/402808
function directLink () {
var equal, colon, external_href, protocol, path, new_href;
//文字链接
$("a[class*=\'external\']").each(function () {
if ($(this).find("span").length > 0) {
new_href = $(this).text();
$(this).attr("href", new_href);
}
else if ($(this).attr("href").indexOf("link.zhihu.com/?target=") > -1) {
external_href = $(this).attr("href");
new_href = external_href.substring(external_href = $(this).attr("href").indexOf("link.zhihu.com/?target=") + "link.zhihu.com/?target=".length);
//console.log(`${new_href}`)
$(this).attr("href", decodeURIComponent(new_href));
}
else {
external_href = $(this).attr("href");
if (external_href.lastIndexOf("https%3A"))
new_href = $(this).attr("href").substring($(this).attr("href").lastIndexOf("https%3A"));
else if (external_href.lastIndexOf("http%3A%2F%2F"))
new_href = $(this).attr("href").substring($(this).attr("href").lastIndexOf("http%3A"));
$(this).attr("href", decodeURIComponent(new_href));
}
});
//卡片链接
$("a[class*=\'LinkCard\']:not([class*=\'MCNLinkCard\']):not([class*=\'ZVideoLinkCard\'])").each(function () {
if ($(this).find("LinkCard-title").length > 0 && $(this).find("LinkCard-title").indexOf("http") > -1) {
new_href = $(this).find("LinkCard-title").text();
$(this).attr("href", new_href);
}
else if ($(this).attr("href").indexOf("link.zhihu.com/?target=") > -1) {
external_href = $(this).attr("href");
new_href = external_href.substring(external_href = $(this).attr("href").indexOf("link.zhihu.com/?target=") + "link.zhihu.com/?target=".length);
$(this).attr("href", decodeURIComponent(new_href));
}
else {
external_href = $(this).attr("href");
if (external_href.lastIndexOf("https%3A"))
new_href = $(this).attr("href").substring($(this).attr("href").lastIndexOf("https%3A"));
else if (external_href.lastIndexOf("http%3A%2F%2F"))
new_href = $(this).attr("href").substring($(this).attr("href").lastIndexOf("http%3A"));
$(this).attr("href", decodeURIComponent(new_href));
}
});
//旧版视频卡片链接
$("a.VideoCard-link").each(function () {
if ($(this).attr("href").indexOf("link.zhihu.com/?target=") > -1) {
external_href = $(this).attr("href");
equal = external_href.lastIndexOf("http");
colon = external_href.lastIndexOf("%3A");
protocol = external_href.substring(equal, colon);
path = external_href.substring(colon + 5, external_href.length);
new_href = protocol + "://" + path;
$(this).attr("href", decodeURIComponent(new_href));
}
});
//隐藏首页广告卡片
$(".TopstoryItem--advertCard").hide();
}
// 默认高清原图,来自:https://greasyfork.org/scripts/402808
function originalPic(){
$("img").each(function(){
if($(this).attr("data-original")!=undefined && !$(this).hasClass("comment_sticker"))
{
if($(this).attr("src") != $(this).attr("data-original"))
$(this).attr("src",$(this).attr("data-original"))
}
})
$(".Modal-inner").css({"overflow-y":"hidden"})
}
// 一键收起回答
function collapsedAnswer(){
if(menu_collapsedAnswer){
let button_Add = `