This commit is contained in:
181
KirinShiKi/js/kirin.js
Normal file
181
KirinShiKi/js/kirin.js
Normal file
@@ -0,0 +1,181 @@
|
||||
/* ***
|
||||
|
||||
* 神代綺凜式魔改js
|
||||
* By: Sanakey
|
||||
* Last Update: 2020.08.11
|
||||
|
||||
神代綺凜式魔改js文件。
|
||||
|
||||
本代码为神代綺凜(https://moe.best)原创,Sanakey(https://keymoe.com)魔改,JeffersonQin(https://gyrojeff.top)再度魔改,并遵守 GPL 2.0 开源协议。
|
||||
|
||||
*** */
|
||||
|
||||
$(document).ready(function() {
|
||||
// 神代綺凜原js部分
|
||||
(function() {
|
||||
var b = !0;
|
||||
// window.setInterval(, 300);
|
||||
function scrolling() {
|
||||
0 < $("body.compensate-for-scrollbar").length && b && (b = !1, $(
|
||||
"body.compensate-for-scrollbar #bg").attr("style", "transition-duration:0s"),
|
||||
setTimeout('$("#bg").attr("style","");cfsFlag=true', 2E3));
|
||||
// var a = $("#sidebar").children();
|
||||
var a = $("#sidebar").find("section");
|
||||
if (0 < a.length) {
|
||||
var c = $(a[a.length - 1]);
|
||||
a = $(window).scrollTop();
|
||||
c = c.offset().top + Math.abs(c.height());
|
||||
a -= c;
|
||||
c = $("aside.col.w-md.no-border-xs");
|
||||
0 < a ? c.css("opacity", "0") : c.css("opacity", "1")
|
||||
}
|
||||
300 > $(document).scrollTop() ? $("#kotori").addClass("hidekotori") : $("#kotori").removeClass(
|
||||
"hidekotori")
|
||||
}
|
||||
var timer = null;
|
||||
|
||||
$(document).scroll(function() {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {
|
||||
scrolling();
|
||||
}, 30)
|
||||
});
|
||||
console.log("\n %c handsome modified %c by \u795e\u4ee3\u7eee\u51db moe.best \n",
|
||||
"color:#444;background:#eee;padding:5px 0;", "color:#fff;background:#876;padding:5px 0;");
|
||||
console.log("\n %c handsome modified %c by Sanakey | www.keymoe.com \n",
|
||||
"color:#444;background:#eee;padding:5px 0;", "color:#fff;background:#71bef1;padding:5px 0;");
|
||||
console.log("\n %c handsome modified %c by JeffersonQin | gyrojeff.top \n",
|
||||
"color:#444;background:#eee;padding:5px 0;", "color:#fff;background:#7266ba;padding:5px 0;");
|
||||
console.log("%c ",
|
||||
"background:url(https://api.btstu.cn/sjbz/?lx=dongman) no-repeat center;background-size:cover;padding-left:100%;padding-bottom:55%;overflow:hidden;border-radius:10px;margin:5px 0"
|
||||
);
|
||||
window.setInterval(function() {
|
||||
if (document.getElementById("aboutPage")) {
|
||||
var a = document.getElementById("aboutPage"),
|
||||
b = a.contentWindow.document.getElementById("mainc");
|
||||
try {
|
||||
a.style.height = b.scrollHeight + "px"
|
||||
} catch (e) {}
|
||||
}
|
||||
}, 300);
|
||||
|
||||
})();
|
||||
|
||||
|
||||
// <div id="bg"></div> 添加背景div
|
||||
$('#header').before('<div id="mybg"></div>');
|
||||
$('#alllayout').before('<div id="mybg"></div>');
|
||||
|
||||
// 优化主页面无法点击图片进入文章
|
||||
// if (!$('.post-meta .ahover').length > 0) {
|
||||
// setHref(getHref());
|
||||
// }
|
||||
|
||||
// 添加右侧栏折叠
|
||||
var toggleStr = '<div class="nav navbar-nav hidden-xs">\n' +
|
||||
' <a id="aside-btn" href="#" class="btn no-shadow navbar-btn" ui-toggle-class="app-aside-folded" target=".app">\n' +
|
||||
' <i class="fontello fontello-dedent text icon-fw"></i>\n' +
|
||||
' <i class="fontello fontello-indent icon-fw text-active"></i>\n' +
|
||||
' </a>\n' +
|
||||
' </div>'
|
||||
$('#header .navbar-collapse').prepend(toggleStr);
|
||||
|
||||
})
|
||||
|
||||
|
||||
$(window).load(function() {
|
||||
1 < location.hash.length && $('.tocify-item[data-unique="' + decodeURI(location.hash.substr(1)) + '"]').click()
|
||||
});
|
||||
|
||||
function updateLiveStatus(b) {
|
||||
1 == b.data.liveStatus && $("#bilibili-live").removeClass("hide")
|
||||
};
|
||||
|
||||
function getHref() {
|
||||
var hrefArr = [];
|
||||
$('.post-meta .index-post-title>a').each(function() {
|
||||
hrefArr.push($(this).attr('href'));
|
||||
$(this).find('span').addClass('sticky');
|
||||
});
|
||||
// console.log(hrefArr);
|
||||
return hrefArr;
|
||||
}
|
||||
|
||||
function setHref(arr) {
|
||||
$('.post-meta').each(function(index) {
|
||||
$(this).append('<a href="' + arr[index] + '" class="ahover"></a>')
|
||||
});
|
||||
}
|
||||
|
||||
// 彩色标签云
|
||||
function colorfulTags() {
|
||||
var tags = document.querySelectorAll("#tag_cloud-2 a");
|
||||
var colorArr = ["#428BCA", "#AEDCAE", "#ECA9A7", "#DA99FF", "#FFB380", "#D9B999", "#3bca6e", "#f23232", "#834e75", "#23b7e5", "#f60"];
|
||||
tags.forEach(tag => {
|
||||
tagsColor = colorArr[Math.floor(Math.random() * colorArr.length)];
|
||||
tag.style.backgroundColor = tagsColor;
|
||||
});
|
||||
}
|
||||
|
||||
// 标题卖萌
|
||||
function moeTitle() {
|
||||
var OriginTitile = document.title;
|
||||
var d;
|
||||
document.addEventListener("visibilitychange", function() {
|
||||
document.hidden ? (clearTimeout(d), d = setTimeout(function() {
|
||||
document.title =
|
||||
"|\uff65\u03c9\uff65\uff40\u0029\u4f60\u770b\u4e0d\u89c1\u6211\u2026\u2026"
|
||||
}, 500)) : (document.title = "_(:3\u300d\u300d\u8fd8\u662f\u88ab\u53d1\u73b0\u4e86", d =
|
||||
setTimeout(function() {
|
||||
document.title = OriginTitile
|
||||
}, 2E3))
|
||||
})
|
||||
}
|
||||
|
||||
// 复制
|
||||
function copyTips(text) {
|
||||
var timer = null;
|
||||
var dialog = {
|
||||
msg: function(msg, time) {
|
||||
var time = time || 3000;
|
||||
var dialogElement = $('#my-dialog-layer');
|
||||
var dom = '<div id="my-dialog-layer" style="z-index: 99999; max-width: 360px; min-width:100px; background-color: rgba(0,0,0,.6); color: #fff;position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); ">\n' +
|
||||
' <div class="layer-content" style="padding: 12px 25px; font-size:14px; text-align: center; line-height: 24px;overflow-x: hidden; overflow-y: auto;">' + msg + '</div>\n' +
|
||||
'</div>'
|
||||
if (dialogElement.length == 0) {
|
||||
$('body').append(dom);
|
||||
timer = setTimeout(function() {
|
||||
$('#my-dialog-layer').remove();
|
||||
}, time)
|
||||
}
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(function() {
|
||||
$('#my-dialog-layer').remove();
|
||||
}, time)
|
||||
|
||||
}
|
||||
}
|
||||
document.addEventListener("copy", function() {
|
||||
dialog.msg(text || '复制成功,如需转载请注明出处!', 3000);
|
||||
})
|
||||
}
|
||||
|
||||
function setCopyright(type) {
|
||||
// 页脚添加版权信息 ' | Theme modified by <a href="https://moe.best" target="_blank">Jindai Kirin</a> | '
|
||||
|
||||
var badgeInfo = ' | \n' +
|
||||
'<div class="github-badge">\n' +
|
||||
' <a href="https://gyrojeff.top/" target="_blank" title="由JindaiKirin/JeffersonQin魔改">\n' +
|
||||
' <span class="badge-subject">Modified</span><span class="badge-value bg-red">JindaiKirin/JeffersonQin</span>\n' +
|
||||
' </a>\n' +
|
||||
'</div>' +
|
||||
' \n';
|
||||
|
||||
var textInfo = ' | \n' +
|
||||
' <a href="https://gyrojeff.top/" target="_blank" title="handsome主题由JindaiKirin/JeffersonQin魔改">\n' +
|
||||
' Modified JindaiKirin/JeffersonQin\n' +
|
||||
' </a>\n';
|
||||
' \n';
|
||||
// var copyrightInfo = type?textInfo:badgeInfo;
|
||||
$('#footer span.pull-right').append(type ? textInfo : badgeInfo);
|
||||
}
|
||||
1
KirinShiKi/js/kirin.min.js
vendored
Normal file
1
KirinShiKi/js/kirin.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
function updateLiveStatus(e){1==e.data.liveStatus&&$("#bilibili-live").removeClass("hide")}function getHref(){var e=[];return $(".post-meta .index-post-title>a").each(function(){e.push($(this).attr("href")),$(this).find("span").addClass("sticky")}),e}function setHref(e){$(".post-meta").each(function(n){$(this).append('<a href="'+e[n]+'" class="ahover"></a>')})}function colorfulTags(){var e=document.querySelectorAll("#tag_cloud-2 a"),n=["#428BCA","#AEDCAE","#ECA9A7","#DA99FF","#FFB380","#D9B999","#3bca6e","#f23232","#834e75","#23b7e5","#f60"];e.forEach(e=>{tagsColor=n[Math.floor(Math.random()*n.length)],e.style.backgroundColor=tagsColor})}function moeTitle(){var e,n=document.title;document.addEventListener("visibilitychange",function(){document.hidden?(clearTimeout(e),e=setTimeout(function(){document.title="|・ω・`)你看不见我……"},500)):(document.title="_(:3」」还是被发现了",e=setTimeout(function(){document.title=n},2e3))})}function copyTips(e){var n=null,o=function(e,o){o=o||3e3;var t='<div id="my-dialog-layer" style="z-index: 99999; max-width: 360px; min-width:100px; background-color: rgba(0,0,0,.6); color: #fff;position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); ">\n <div class="layer-content" style="padding: 12px 25px; font-size:14px; text-align: center; line-height: 24px;overflow-x: hidden; overflow-y: auto;">'+e+"</div>\n</div>";0==$("#my-dialog-layer").length&&($("body").append(t),n=setTimeout(function(){$("#my-dialog-layer").remove()},o)),clearTimeout(n),n=setTimeout(function(){$("#my-dialog-layer").remove()},o)};document.addEventListener("copy",function(){o(e||"复制成功,如需转载请注明出处!",3e3)})}function setCopyright(e){$("#footer span.pull-right").append(e?' | \n <a href="https://gyrojeff.top/" target="_blank" title="handsome主题由JindaiKirin/JeffersonQin魔改">\n Modified JindaiKirin/JeffersonQin\n </a>\n':' | \n<div class="github-badge">\n <a href="https://gyrojeff.top/" target="_blank" title="由JindaiKirin/JeffersonQin魔改">\n <span class="badge-subject">Modified</span><span class="badge-value bg-red">JindaiKirin/JeffersonQin</span>\n </a>\n</div> \n')}$(document).ready(function(){!function(){var e=!0;var n=null;$(document).scroll(function(){clearTimeout(n),n=setTimeout(function(){!function(){0<$("body.compensate-for-scrollbar").length&&e&&(e=!1,$("body.compensate-for-scrollbar #bg").attr("style","transition-duration:0s"),setTimeout('$("#bg").attr("style","");cfsFlag=true',2e3));var n=$("#sidebar").find("section");if(0<n.length){var o=$(n[n.length-1]);n=$(window).scrollTop(),n-=o=o.offset().top+Math.abs(o.height()),o=$("aside.col.w-md.no-border-xs"),0<n?o.css("opacity","0"):o.css("opacity","1")}300>$(document).scrollTop()?$("#kotori").addClass("hidekotori"):$("#kotori").removeClass("hidekotori")}()},30)}),console.log("\n %c handsome modified %c by 神代绮凛 moe.best \n","color:#444;background:#eee;padding:5px 0;","color:#fff;background:#876;padding:5px 0;"),console.log("\n %c handsome modified %c by Sanakey | www.keymoe.com \n","color:#444;background:#eee;padding:5px 0;","color:#fff;background:#71bef1;padding:5px 0;"),console.log("\n %c handsome modified %c by JeffersonQin | gyrojeff.top \n","color:#444;background:#eee;padding:5px 0;","color:#fff;background:#7266ba;padding:5px 0;"),console.log("%c ","background:url(https://api.btstu.cn/sjbz/?lx=dongman) no-repeat center;background-size:cover;padding-left:100%;padding-bottom:55%;overflow:hidden;border-radius:10px;margin:5px 0"),window.setInterval(function(){if(document.getElementById("aboutPage")){var e=document.getElementById("aboutPage"),n=e.contentWindow.document.getElementById("mainc");try{e.style.height=n.scrollHeight+"px"}catch(e){}}},300)}(),$("#header").before('<div id="mybg"></div>'),$("#alllayout").before('<div id="mybg"></div>');$("#header .navbar-collapse").prepend('<div class="nav navbar-nav hidden-xs">\n <a id="aside-btn" href="#" class="btn no-shadow navbar-btn" ui-toggle-class="app-aside-folded" target=".app">\n <i class="fontello fontello-dedent text icon-fw"></i>\n <i class="fontello fontello-indent icon-fw text-active"></i>\n </a>\n </div>')}),$(window).load(function(){1<location.hash.length&&$('.tocify-item[data-unique="'+decodeURI(location.hash.substr(1))+'"]').click()});
|
||||
Reference in New Issue
Block a user