init: 从宝塔同步到 Gitea
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
(function flexible (window, document) {
|
||||
var docEl = document.documentElement
|
||||
var dpr = window.devicePixelRatio || 1
|
||||
// console.log(dpr)
|
||||
// adjust body font size
|
||||
function setBodyFontSize () {
|
||||
if (document.body) {
|
||||
document.body.style.fontSize = (12 * dpr) + 'px'
|
||||
}
|
||||
else {
|
||||
document.addEventListener('DOMContentLoaded', setBodyFontSize)
|
||||
}
|
||||
}
|
||||
setBodyFontSize();
|
||||
|
||||
// set 1rem = viewWidth / 10
|
||||
function setRemUnit () {
|
||||
var rem = docEl.clientWidth / 10
|
||||
docEl.style.fontSize = rem + 'px'
|
||||
}
|
||||
|
||||
setRemUnit()
|
||||
|
||||
// reset rem unit on page resize
|
||||
window.addEventListener('resize', setRemUnit)
|
||||
window.addEventListener('pageshow', function (e) {
|
||||
if (e.persisted) {
|
||||
setRemUnit()
|
||||
}
|
||||
})
|
||||
|
||||
// detect 0.5px supports
|
||||
if (dpr >= 2) {
|
||||
var fakeBody = document.createElement('body')
|
||||
var testElement = document.createElement('div')
|
||||
testElement.style.border = '.5px solid transparent'
|
||||
fakeBody.appendChild(testElement)
|
||||
docEl.appendChild(fakeBody)
|
||||
if (testElement.offsetHeight === 1) {
|
||||
docEl.classList.add('hairlines')
|
||||
}
|
||||
docEl.removeChild(fakeBody)
|
||||
}
|
||||
}(window, document))
|
||||
|
||||
|
||||
// 定时器弹窗提示
|
||||
function alert_box(ale_dynamic,d_time){
|
||||
$(".a_lert").remove();
|
||||
$("body").append('<div class="a_lert"><div class="a_box"><p></p></div></div>');
|
||||
$(".a_lert .a_box p").append(ale_dynamic);
|
||||
var d_time = d_time || 3000;
|
||||
setTimeout(function(){
|
||||
$(".a_lert").remove();
|
||||
},d_time);
|
||||
}
|
||||
|
||||
|
||||
var pop=new Object
|
||||
pop.alert=function (i){
|
||||
$(".pop").remove();
|
||||
if(i.btn == undefined){
|
||||
i.btn = '确定';
|
||||
}
|
||||
$("body").append(
|
||||
'<div class="pop"> <div class="pop-box">'+
|
||||
'<p class="txt">'+i.content+'</p>'+
|
||||
'<button class="btn off-btn">'+i.btn+'</button> </div>'+
|
||||
'</div>')
|
||||
$(document).on("click",".off-btn",function(){
|
||||
var transmit=i.yes
|
||||
if(transmit!=undefined && transmit!=""){
|
||||
transmit();
|
||||
}
|
||||
$(".pop").remove();
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(function(){
|
||||
$(".play .video-box .linechange").click(function(){
|
||||
$(this).fadeOut(100,function(){
|
||||
$(".play .video-box .linebox").css("display","block");
|
||||
$(".play .video-box .linebox").stop().animate({"left":"0"},300)
|
||||
})
|
||||
})
|
||||
$(".video-canvas").click(function(){
|
||||
$(".play .video-box .linebox").stop().animate({"left":"-100%"},300).fadeOut()
|
||||
$(".play .video-box .linechange").fadeIn()
|
||||
})
|
||||
|
||||
$(".play .video-box .linebox span").click(function(){
|
||||
$(this).addClass("active").siblings("span").removeClass("active")
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user