commit
6734edfc52
|
@ -245,27 +245,27 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
* 需要 jQuery
|
* 需要 jQuery
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// let detectJgJsLoad = false
|
let detectJgJsLoad = false
|
||||||
// const runJustifiedGallery = function (ele) {
|
const runJustifiedGallery = function (ele) {
|
||||||
// const $justifiedGallery = $(ele)
|
const $justifiedGallery = $(ele)
|
||||||
// const $imgList = $justifiedGallery.find('img')
|
const $imgList = $justifiedGallery.find('img')
|
||||||
// $imgList.unwrap()
|
$imgList.unwrap()
|
||||||
// if ($imgList.length) {
|
if ($imgList.length) {
|
||||||
// $imgList.each(function (i, o) {
|
$imgList.each(function (i, o) {
|
||||||
// if ($(o).attr('data-lazy-src')) $(o).attr('src', $(o).attr('data-lazy-src'))
|
if ($(o).attr('data-lazy-src')) $(o).attr('src', $(o).attr('data-lazy-src'))
|
||||||
// $(o).wrap('<div></div>')
|
$(o).wrap('<div></div>')
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (detectJgJsLoad) btf.initJustifiedGallery($justifiedGallery)
|
if (detectJgJsLoad) btf.initJustifiedGallery($justifiedGallery)
|
||||||
// else {
|
else {
|
||||||
// $('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.source.justifiedGallery.css}">`)
|
$('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.source.justifiedGallery.css}">`)
|
||||||
// $.getScript(`${GLOBAL_CONFIG.source.justifiedGallery.js}`, function () {
|
$.getScript(`${GLOBAL_CONFIG.source.justifiedGallery.js}`, function () {
|
||||||
// btf.initJustifiedGallery($justifiedGallery)
|
btf.initJustifiedGallery($justifiedGallery)
|
||||||
// })
|
})
|
||||||
// detectJgJsLoad = true
|
detectJgJsLoad = true
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fancybox和 mediumZoom
|
* fancybox和 mediumZoom
|
||||||
|
@ -317,7 +317,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
const jqLoadAndRun = () => {
|
const jqLoadAndRun = () => {
|
||||||
const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox'
|
const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox'
|
||||||
? document.querySelectorAll('#article-container :not(a):not(.gallery-group) > img, #article-container > img,.bber-content-img > img')
|
? document.querySelectorAll('#article-container :not(a):not(.gallery-group):not(.site-card-avatar) > img, #article-container > img,.bber-content-img > img')
|
||||||
: []
|
: []
|
||||||
const fbLengthNoZero = $fancyboxEle.length > 0
|
const fbLengthNoZero = $fancyboxEle.length > 0
|
||||||
const $jgEle = document.querySelectorAll('#article-container .justified-gallery')
|
const $jgEle = document.querySelectorAll('#article-container .justified-gallery')
|
||||||
|
@ -891,7 +891,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||||
sidebarFn()
|
sidebarFn()
|
||||||
GLOBAL_CONFIG.isHome && scrollDownInIndex()
|
GLOBAL_CONFIG.isHome && scrollDownInIndex()
|
||||||
// addHighlightTool()
|
// addHighlightTool()
|
||||||
// GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption()
|
//GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption()
|
||||||
scrollFn()
|
scrollFn()
|
||||||
addTableWrap()
|
addTableWrap()
|
||||||
clickFnOfTagHide()
|
clickFnOfTagHide()
|
||||||
|
|
|
@ -36,43 +36,102 @@ var btf = {
|
||||||
return result;
|
return result;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// loadLightbox: ele => {
|
||||||
|
// const service = GLOBAL_CONFIG.lightbox;
|
||||||
|
|
||||||
|
// if (service === "mediumZoom") {
|
||||||
|
// const zoom = mediumZoom(ele);
|
||||||
|
// zoom.on("open", e => {
|
||||||
|
// const photoBg = document.documentElement.getAttribute("data-theme") === "dark" ? "#121212" : "#fff";
|
||||||
|
// zoom.update({
|
||||||
|
// background: photoBg,
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (service === "fancybox") {
|
||||||
|
// ele.forEach(i => {
|
||||||
|
// if (i.parentNode.tagName !== "A") {
|
||||||
|
// const dataSrc = i.dataset.lazySrc || i.src;
|
||||||
|
// const dataCaption = i.title || i.alt || "";
|
||||||
|
// btf.wrap(i, "a", {
|
||||||
|
// href: dataSrc,
|
||||||
|
// "data-fancybox": "gallery",
|
||||||
|
// "data-caption": dataCaption,
|
||||||
|
// "data-thumb": dataSrc,
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// if (!window.fancyboxRun) {
|
||||||
|
// Fancybox.bind("[data-fancybox]", {
|
||||||
|
// Hash: false,
|
||||||
|
// Thumbs: {
|
||||||
|
// autoStart: false,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// window.fancyboxRun = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
loadLightbox: ele => {
|
loadLightbox: ele => {
|
||||||
const service = GLOBAL_CONFIG.lightbox;
|
|
||||||
|
|
||||||
if (service === "mediumZoom") {
|
const jqLoadAndRun = () => {
|
||||||
const zoom = mediumZoom(ele);
|
const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox'
|
||||||
zoom.on("open", e => {
|
? ele
|
||||||
const photoBg = document.documentElement.getAttribute("data-theme") === "dark" ? "#121212" : "#fff";
|
: []
|
||||||
zoom.update({
|
const fbLengthNoZero = $fancyboxEle.length > 0
|
||||||
background: photoBg,
|
|
||||||
});
|
if (fbLengthNoZero) {
|
||||||
});
|
btf.isJqueryLoad(() => {
|
||||||
|
fbLengthNoZero && addFancybox($fancyboxEle)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service === "fancybox") {
|
|
||||||
ele.forEach(i => {
|
|
||||||
if (i.parentNode.tagName !== "A") {
|
|
||||||
const dataSrc = i.dataset.lazySrc || i.src;
|
|
||||||
const dataCaption = i.title || i.alt || "";
|
|
||||||
btf.wrap(i, "a", {
|
|
||||||
href: dataSrc,
|
|
||||||
"data-fancybox": "gallery",
|
|
||||||
"data-caption": dataCaption,
|
|
||||||
"data-thumb": dataSrc,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!window.fancyboxRun) {
|
|
||||||
Fancybox.bind("[data-fancybox]", {
|
|
||||||
Hash: false,
|
/**
|
||||||
Thumbs: {
|
* fancybox
|
||||||
autoStart: false,
|
*/
|
||||||
},
|
const addFancybox = function (ele) {
|
||||||
});
|
const runFancybox = (ele) => {
|
||||||
window.fancyboxRun = true;
|
ele.each(function (i, o) {
|
||||||
|
const $this = $(o)
|
||||||
|
const lazyloadSrc = $this.attr('data-lazy-src') || $this.attr('src')
|
||||||
|
const lazyloadSrc1600 = lazyloadSrc + '_1600w'
|
||||||
|
const dataCaption = $this.attr('alt') || ''
|
||||||
|
if (lazyloadSrc.indexOf('!blogimg') != -1) {
|
||||||
|
$this.wrap(`<a href="${lazyloadSrc}" data-fancybox="images" data-caption="${dataCaption}" class="fancybox" data-srcset="${lazyloadSrc1600} 1600w"></a>`)
|
||||||
|
} else {
|
||||||
|
$this.wrap(`<a href="${lazyloadSrc}" data-fancybox="images" data-caption="${dataCaption}" class="fancybox" data-srcset="${lazyloadSrc} 1600w"></a>`)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
$().fancybox({
|
||||||
|
selector: '[data-fancybox]',
|
||||||
|
loop: true,
|
||||||
|
transitionEffect: 'slide',
|
||||||
|
protect: true,
|
||||||
|
buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'],
|
||||||
|
hash: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof $.fancybox === 'undefined') {
|
||||||
|
$('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.source.fancybox.css}">`)
|
||||||
|
$.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function () {
|
||||||
|
runFancybox($(ele))
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
runFancybox($(ele))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jqLoadAndRun()
|
||||||
|
|
||||||
},
|
},
|
||||||
debounce: function (func, wait, immediate) {
|
debounce: function (func, wait, immediate) {
|
||||||
let timeout
|
let timeout
|
||||||
|
|
|
@ -174,6 +174,17 @@
|
||||||
allPlaylist: [[${theme.config.other.nav_music.all_playlist}]],
|
allPlaylist: [[${theme.config.other.nav_music.all_playlist}]],
|
||||||
navMusicEnable:[[${theme.config.other.nav_musicEnable}]],
|
navMusicEnable:[[${theme.config.other.nav_musicEnable}]],
|
||||||
isMusic: [[${ htmlType == 'music'}]],
|
isMusic: [[${ htmlType == 'music'}]],
|
||||||
|
source: {
|
||||||
|
jQuery: 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js',
|
||||||
|
justifiedGallery: {
|
||||||
|
js: 'https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js',
|
||||||
|
css: 'https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/css/justifiedGallery.min.css'
|
||||||
|
},
|
||||||
|
fancybox: {
|
||||||
|
js: 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.js',
|
||||||
|
css: 'https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.css'
|
||||||
|
}
|
||||||
|
},
|
||||||
date_suffix: {
|
date_suffix: {
|
||||||
just: '刚刚',
|
just: '刚刚',
|
||||||
min: '分钟前',
|
min: '分钟前',
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
envId: [[${theme.config.comments.twikoos.envId}]],
|
envId: [[${theme.config.comments.twikoos.envId}]],
|
||||||
region: '',
|
region: '',
|
||||||
onCommentLoaded: function () {
|
onCommentLoaded: function () {
|
||||||
//- btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.vemoji)'))
|
btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.vemoji)'))
|
||||||
$("input").focus(function () {
|
$("input").focus(function () {
|
||||||
heo_intype = true;
|
heo_intype = true;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue