64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
// 判断是否为移动端
|
|
function isMobile() {
|
|
if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
|
|
return true; // 移动端
|
|
} else {
|
|
return false; // PC端
|
|
}
|
|
}
|
|
|
|
// 文章图片灯箱
|
|
window.ViewImage && ViewImage.init('#writing_content img');
|
|
|
|
//memos图片灯箱
|
|
window.ViewImage && ViewImage.init('.text img , .memos-photo img , .gallery-thumbnail img');
|
|
|
|
// 激活返回顶部插件
|
|
$(function () {
|
|
$.scrollUp({
|
|
animation: 'fade',
|
|
scrollImg: true
|
|
});
|
|
});
|
|
|
|
// loader定时器
|
|
$(document).ready(function () {
|
|
setTimeout(function () {
|
|
$("#loader").addClass("hide");
|
|
}, 30000);
|
|
});
|
|
// 点击进入按钮
|
|
$("#closeloader").click(function () {
|
|
$("#loader").addClass("hide");
|
|
});
|
|
// nav栏样式调整
|
|
$('#libabys').first().attr("style", "margin-left: -5px");
|
|
|
|
$('#libabys').eq(1).attr("style", "margin-left: -5px");
|
|
// 友链列表版样式调整
|
|
$('.itp-index:odd').attr("style", "float: right;width:48%;");
|
|
|
|
//文章图片懒加载
|
|
lazyLoadInit({
|
|
coverColor: "white",
|
|
coverDiv: "<div style='display: flex; justify-content: center; align-items: center; height: 200px;color: #000000;'><span>优世界·一个记录生活点滴的小站</span></div>",
|
|
offsetBottom: 0,
|
|
offsetTopm: 0,
|
|
showTime: 1100
|
|
});
|
|
// 激活评论
|
|
if (is_url == crossUrl) {
|
|
Artalk.loadCountWidget({
|
|
server: 'https://artalk.usj.cc',
|
|
site: '优世界',
|
|
pvEl: '#ArtalkPV',
|
|
countEl: '#ArtalkCount',
|
|
});
|
|
// 将说说页面第一个和最后一个 hr 标签的 display 属性设置为 none
|
|
$("hr").first().css('display', 'none');
|
|
$("hr").last().css('display', 'none');
|
|
}
|
|
// 友链页面默认执行一次钓鱼
|
|
if (is_url == ylUrl) {
|
|
fetchRandomPost();
|
|
} |