upload all
This commit is contained in:
14
config/js/OwO.js
Normal file
14
config/js/OwO.js
Normal file
@@ -0,0 +1,14 @@
|
||||
Smilies = {
|
||||
dom: function(id) {
|
||||
return document.getElementById(id);
|
||||
},
|
||||
grin: function(tag) {
|
||||
tag = ' ' + tag + ' ';
|
||||
myField = this.dom("textarea");
|
||||
document.selection ? (myField.focus(), sel = document.selection.createRange(), sel.text = tag, myField.focus()) : this.insertTag(tag);
|
||||
},
|
||||
insertTag: function(tag) {
|
||||
myField = Smilies.dom("textarea");
|
||||
myField.selectionStart || myField.selectionStart == "0" ? (startPos = myField.selectionStart, endPos = myField.selectionEnd, cursorPos = startPos, myField.value = myField.value.substring(0, startPos) + tag + myField.value.substring(endPos, myField.value.length), cursorPos += tag.length, myField.focus(), myField.selectionStart = cursorPos, myField.selectionEnd = cursorPos) : (myField.value += tag, myField.focus());
|
||||
}
|
||||
}
|
44
config/js/customStyle.js
Normal file
44
config/js/customStyle.js
Normal file
@@ -0,0 +1,44 @@
|
||||
$(document).ready(function() {
|
||||
let fontSize = localStorage.getItem("fontSize") ? parseInt(localStorage.getItem("fontSize")) : 18;
|
||||
let serif = localStorage.getItem("fontFamily") ? localStorage.getItem("fontFamily") === "serif" : true;
|
||||
|
||||
function applySettings() {
|
||||
$(".mdui-typo p").css({
|
||||
"font-size": fontSize + "px",
|
||||
});
|
||||
$("body").css({
|
||||
"font-family": serif ? "'Noto Serif SC', serif" : "sans-serif"
|
||||
});
|
||||
$("span").css({
|
||||
"font-family": serif ? "'Noto Serif SC', serif" : "sans-serif"
|
||||
});
|
||||
$("a").css({
|
||||
"font-family": serif ? "'Noto Serif SC', serif" : "sans-serif"
|
||||
});
|
||||
$("#fontSize").text(fontSize);
|
||||
}
|
||||
|
||||
$("#decrease").click(function() {
|
||||
if (fontSize > 12) {
|
||||
fontSize--;
|
||||
localStorage.setItem("fontSize", fontSize);
|
||||
applySettings();
|
||||
}
|
||||
});
|
||||
|
||||
$("#increase").click(function() {
|
||||
if (fontSize < 25) {
|
||||
fontSize++;
|
||||
localStorage.setItem("fontSize", fontSize);
|
||||
applySettings();
|
||||
}
|
||||
});
|
||||
|
||||
$("#toggleFont").click(function() {
|
||||
serif = !serif;
|
||||
localStorage.setItem("fontFamily", serif ? "serif" : "sans-serif");
|
||||
applySettings();
|
||||
});
|
||||
|
||||
applySettings();
|
||||
});
|
13
config/js/jquery.fancybox.min.js
vendored
Normal file
13
config/js/jquery.fancybox.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
config/js/jquery.min.js
vendored
Normal file
4
config/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
38
config/js/listLazyload.js
Normal file
38
config/js/listLazyload.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
|
||||
if (entry.isIntersecting) {
|
||||
const element = entry.target;
|
||||
const bgUrl = element.getAttribute('data-bg');
|
||||
|
||||
if (bgUrl) {
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
element.style.backgroundImage = `url(${bgUrl})`;
|
||||
};
|
||||
img.src = bgUrl;
|
||||
observer.unobserve(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, {
|
||||
// 配置项
|
||||
rootMargin: '50px 0px',
|
||||
threshold: 0.01
|
||||
});
|
||||
|
||||
const lazyLoadElements = document.querySelectorAll('.AKAROMlazyload');
|
||||
|
||||
lazyLoadElements.forEach(element => {
|
||||
observer.observe(element);
|
||||
});
|
||||
|
||||
const styles = `
|
||||
.AKAROMlazyload {
|
||||
background-color: Aquamarine;
|
||||
}
|
||||
`;
|
||||
|
||||
const styleSheet = document.createElement('style');
|
||||
styleSheet.textContent = styles;
|
||||
document.head.appendChild(styleSheet);
|
31
config/js/loading.js
Normal file
31
config/js/loading.js
Normal file
@@ -0,0 +1,31 @@
|
||||
//Loading页面
|
||||
document.onreadystatechange = function () {
|
||||
if (document.readyState == "complete") {
|
||||
loadingFade();
|
||||
}
|
||||
}
|
||||
|
||||
function loadingFade() {
|
||||
var opacity = 1;
|
||||
var fadeSpeed = 0.05; // 渐变速度
|
||||
var loadingBackground = document.getElementById('loading_bg');
|
||||
var loadingBox = document.getElementById('loading');
|
||||
|
||||
if (!loadingBackground || !loadingBox) {
|
||||
return;
|
||||
}
|
||||
|
||||
function fade() {
|
||||
if (opacity <= 0) {
|
||||
$('#loading').remove();
|
||||
return;
|
||||
}
|
||||
|
||||
loadingBackground.style.opacity = opacity;
|
||||
loadingBox.style.opacity = opacity;
|
||||
opacity -= fadeSpeed;
|
||||
requestAnimationFrame(fade); // 使用requestAnimationFrame来提高动画性能
|
||||
}
|
||||
|
||||
fade();
|
||||
}
|
17
config/js/prism.highlight.js
Normal file
17
config/js/prism.highlight.js
Normal file
File diff suppressed because one or more lines are too long
106
config/js/returntop.js
Normal file
106
config/js/returntop.js
Normal file
@@ -0,0 +1,106 @@
|
||||
var scrolltotop={
|
||||
|
||||
//startline: Integer. Number of pixels from top of doc scrollbar is scrolled before showing control
|
||||
|
||||
//scrollto: Keyword (Integer, or "Scroll_to_Element_ID"). How far to scroll document up when control is clicked on (0=top).
|
||||
|
||||
setting: {startline:100, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
|
||||
|
||||
controlHTML: '<button class="mdui-shadow-1 blur mdui-shadow-0 mdui-fab-fixed mdui-fab mdui-fab-mini"><i class="mdui-icon material-icons">keyboard_arrow_up</i></button>',
|
||||
|
||||
controlattrs: {offsetx:30, offsety:30}, //offset of control relative to right/ bottom of window corner
|
||||
|
||||
anchorkeyword: 'javascript:scroll(0,0)', //Enter href value of HTML anchors on the page that should also act as "Scroll Up" links
|
||||
|
||||
state: {isvisible:false, shouldvisible:false},
|
||||
|
||||
|
||||
scrollup:function(){
|
||||
|
||||
if (!this.cssfixedsupport) //if control is positioned using JavaScript
|
||||
|
||||
this.$control.css({opacity:0}) //hide control immediately after clicking it
|
||||
|
||||
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
|
||||
|
||||
if (typeof dest=="string" && jQuery('#'+dest).length==1) //check element set by string exists
|
||||
|
||||
dest=jQuery('#'+dest).offset().top
|
||||
|
||||
else
|
||||
|
||||
dest=0
|
||||
|
||||
this.$body.animate({scrollTop: dest}, this.setting.scrollduration);
|
||||
|
||||
},
|
||||
|
||||
|
||||
keepfixed:function(){
|
||||
|
||||
var $window=jQuery(window)
|
||||
|
||||
var controlx=$window.scrollLeft() + $window.width() - this.$control.width() - this.controlattrs.offsetx
|
||||
|
||||
var controly=$window.scrollTop() + $window.height() - this.$control.height() - this.controlattrs.offsety
|
||||
|
||||
this.$control.css({left:controlx+'px', top:controly+'px'})
|
||||
|
||||
},
|
||||
|
||||
|
||||
togglecontrol:function(){
|
||||
|
||||
|
||||
|
||||
var scrolltop=jQuery(window).scrollTop()
|
||||
|
||||
if (!this.cssfixedsupport)
|
||||
|
||||
this.keepfixed()
|
||||
|
||||
this.state.shouldvisible=(scrolltop>=this.setting.startline)? true : false
|
||||
|
||||
if (this.state.shouldvisible && !this.state.isvisible){
|
||||
|
||||
this.$control.stop().animate({opacity:1}, this.setting.fadeduration[0])
|
||||
|
||||
this.state.isvisible=true
|
||||
|
||||
}
|
||||
|
||||
else if (this.state.shouldvisible==false && this.state.isvisible){
|
||||
|
||||
this.$control.stop().animate({opacity:0}, this.setting.fadeduration[1])
|
||||
|
||||
this.state.isvisible=false
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
init:function(){
|
||||
jQuery(document).ready(function($){
|
||||
var mainobj=scrolltotop
|
||||
var iebrws=document.all
|
||||
mainobj.cssfixedsupport=!iebrws || iebrws && document.compatMode=="CSS1Compat" && window.XMLHttpRequest //not IE or IE7+ browsers in standards mode
|
||||
mainobj.$body=(window.opera)? (document.compatMode=="CSS1Compat"? $('html') : $('body')) : $('html,body')
|
||||
mainobj.$control=$('<div id="topcontrol">'+mainobj.controlHTML+'</div>')
|
||||
.css({position:mainobj.cssfixedsupport? 'fixed' : 'absolute', bottom:mainobj.controlattrs.offsety, right:mainobj.controlattrs.offsetx, opacity:0, cursor:'pointer'})
|
||||
.attr({title:'Scroll to Top'})
|
||||
.click(function(){mainobj.scrollup(); return false})
|
||||
.appendTo('body')
|
||||
if (document.all && !window.XMLHttpRequest && mainobj.$control.text()!='') //loose check for IE6 and below, plus whether control contains any text
|
||||
mainobj.$control.css({width:mainobj.$control.width()}) //IE6- seems to require an explicit width on a DIV containing text
|
||||
mainobj.togglecontrol()
|
||||
|
||||
$('a[href="' + mainobj.anchorkeyword +'"]').click(function(){
|
||||
mainobj.scrollup()
|
||||
return false
|
||||
})
|
||||
$(window).bind('scroll resize', function(e){
|
||||
mainobj.togglecontrol()
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
scrolltotop.init()
|
64
config/js/smoothScoll.js
Normal file
64
config/js/smoothScoll.js
Normal file
@@ -0,0 +1,64 @@
|
||||
(function() {
|
||||
let scrollCurrent = window.scrollY || 0;
|
||||
let velocity = 0;
|
||||
let isAnimating = false;
|
||||
const friction = 0.95;
|
||||
const accelerationFactor = 0.05;
|
||||
|
||||
function animate() {
|
||||
velocity *= friction;
|
||||
|
||||
// 计算新的滚动位置
|
||||
const newScrollPosition = scrollCurrent + velocity;
|
||||
|
||||
// 获取文档最大可滚动高度
|
||||
const maxScroll = document.documentElement.scrollHeight - window.innerHeight;
|
||||
|
||||
// 边界检查
|
||||
if (newScrollPosition <= 0) {
|
||||
scrollCurrent = 0;
|
||||
velocity *= 0.5; // 触顶时快速减速
|
||||
} else if (newScrollPosition >= maxScroll) {
|
||||
scrollCurrent = maxScroll;
|
||||
velocity *= 0.5; // 触底时快速减速
|
||||
} else {
|
||||
scrollCurrent = newScrollPosition;
|
||||
}
|
||||
|
||||
window.scrollTo(0, scrollCurrent);
|
||||
|
||||
// 当速度足够小或触及边界时停止动画
|
||||
if (Math.abs(velocity) > 0.5 && scrollCurrent > 0 && scrollCurrent < maxScroll) {
|
||||
requestAnimationFrame(animate);
|
||||
} else {
|
||||
isAnimating = false;
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('wheel', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
let delta = e.deltaY;
|
||||
if (e.deltaMode === 1) {
|
||||
delta *= 33;
|
||||
} else if (e.deltaMode === 2) {
|
||||
delta *= window.innerHeight;
|
||||
}
|
||||
|
||||
// 获取当前滚动位置和最大滚动位置
|
||||
const currentScroll = window.scrollY;
|
||||
const maxScroll = document.documentElement.scrollHeight - window.innerHeight;
|
||||
|
||||
// 在边界处减小加速度
|
||||
if ((currentScroll <= 0 && delta < 0) || (currentScroll >= maxScroll && delta > 0)) {
|
||||
delta *= 0.3; // 在边界处降低滚动速度
|
||||
}
|
||||
|
||||
velocity += delta * accelerationFactor;
|
||||
|
||||
if (!isAnimating) {
|
||||
isAnimating = true;
|
||||
requestAnimationFrame(animate);
|
||||
}
|
||||
}, { passive: false });
|
||||
})();
|
34
config/js/tagIcon.js
Normal file
34
config/js/tagIcon.js
Normal file
@@ -0,0 +1,34 @@
|
||||
function updateIcon(filterValue) {
|
||||
const iconElement = document.querySelector('.akarom-articletag-index .mdui-icon');
|
||||
switch(filterValue) {
|
||||
case 'article':
|
||||
iconElement.textContent = 'blur_circular';
|
||||
break;
|
||||
case 'sms':
|
||||
iconElement.textContent = 'tonality';
|
||||
break;
|
||||
default:
|
||||
iconElement.textContent = 'panorama_fish_eye';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 默认过滤器
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const savedFilter = localStorage.getItem('articleFilter') || 'all';
|
||||
const filterElement = document.getElementById('filter' + savedFilter);
|
||||
if (filterElement) {
|
||||
filterElement.checked = true;
|
||||
updateIcon(savedFilter);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelectorAll('input[name="filter"]').forEach(radio => {
|
||||
radio.addEventListener('change', (e) => {
|
||||
if (e.target.checked) {
|
||||
const filterValue = e.target.value;
|
||||
localStorage.setItem('articleFilter', filterValue);
|
||||
updateIcon(filterValue);
|
||||
}
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user