mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 18:40:53 +08:00
first commit
This commit is contained in:
1
source/js/activate-power-mode.js
Normal file
1
source/js/activate-power-mode.js
Normal file
@@ -0,0 +1 @@
|
||||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.POWERMODE=e():t.POWERMODE=e()}(this,function(){return function(o){var n={};function r(t){if(n[t])return n[t].exports;var e=n[t]={exports:{},id:t,loaded:!1};return o[t].call(e.exports,e,e.exports,r),e.loaded=!0,e.exports}return r.m=o,r.c=n,r.p="",r(0)}([function(t,e,l){"use strict";var r=document.createElement("canvas");r.width=window.innerWidth,r.height=window.innerHeight,r.style.cssText="position:fixed;top:0;left:0;pointer-events:none;z-index:999999",window.addEventListener("resize",function(){r.width=window.innerWidth,r.height=window.innerHeight}),document.body.appendChild(r);var i=r.getContext("2d"),c=[],u=0,p=!1;function o(t,e){return Math.random()*(e-t)+t}function f(t){if(h.colorful){var e=o(0,360);return"hsla("+o(e-10,e+10)+", 100%, "+o(50,80)+"%, 1)"}return window.getComputedStyle(t).color}function h(){for(var t=function(){var t,e=document.activeElement;if("TEXTAREA"===e.tagName||"INPUT"===e.tagName&&"text"===e.getAttribute("type")){var o=l(1)(e,e.selectionEnd);return t=e.getBoundingClientRect(),{x:o.left+t.left,y:o.top+t.top,color:f(e)}}var n=window.getSelection();if(n.rangeCount){var r=n.getRangeAt(0),i=r.startContainer;return i.nodeType===document.TEXT_NODE&&(i=i.parentNode),{x:(t=r.getBoundingClientRect()).left,y:t.top,color:f(i)}}return{x:0,y:0,color:"transparent"}}(),e=5+Math.round(10*Math.random());e--;)c[u]=(o=t.x,n=t.y,r=t.color,{x:o,y:n,alpha:1,color:r,velocity:{x:2*Math.random()-1,y:2*Math.random()-3.5}}),u=(u+1)%500;var o,n,r;if(h.shake){var i=1+2*Math.random(),a=i*(.5<Math.random()?-1:1),d=i*(.5<Math.random()?-1:1);document.body.style.marginLeft=a+"px",document.body.style.marginTop=d+"px",setTimeout(function(){document.body.style.marginLeft="",document.body.style.marginTop=""},75)}p||requestAnimationFrame(s)}function s(){p=!0,i.clearRect(0,0,r.width,r.height);for(var t=!1,e=r.getBoundingClientRect(),o=0;o<c.length;++o){var n=c[o];n.alpha<=.1||(n.velocity.y+=.075,n.x+=n.velocity.x,n.y+=n.velocity.y,n.alpha*=.96,i.globalAlpha=n.alpha,i.fillStyle=n.color,i.fillRect(Math.round(n.x-1.5)-e.left,Math.round(n.y-1.5)-e.top,3,3),t=!0)}t?requestAnimationFrame(s):p=!1}h.shake=!0,h.colorful=!1,t.exports=h},function(e,t){!function(){var u=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderStyle","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing","tabSize","MozTabSize"],p=null!=window.mozInnerScreenX;function t(t,e,o){var n=o&&o.debug||!1;if(n){var r=document.querySelector("#input-textarea-caret-position-mirror-div");r&&r.parentNode.removeChild(r)}var i=document.createElement("div");i.id="input-textarea-caret-position-mirror-div",document.body.appendChild(i);var a=i.style,d=window.getComputedStyle?getComputedStyle(t):t.currentStyle;a.whiteSpace="pre-wrap","INPUT"!==t.nodeName&&(a.wordWrap="break-word"),a.position="absolute",n||(a.visibility="hidden"),u.forEach(function(t){a[t]=d[t]}),p?t.scrollHeight>parseInt(d.height)&&(a.overflowY="scroll"):a.overflow="hidden",i.textContent=t.value.substring(0,e),"INPUT"===t.nodeName&&(i.textContent=i.textContent.replace(/\s/g," "));var l=document.createElement("span");l.textContent=t.value.substring(e)||".",i.appendChild(l);var c={top:l.offsetTop+parseInt(d.borderTopWidth),left:l.offsetLeft+parseInt(d.borderLeftWidth)};return n?l.style.backgroundColor="#aaa":document.body.removeChild(i),c}void 0!==e&&void 0!==e.exports?e.exports=t:window.getCaretCoordinates=t}()}])});
|
||||
12
source/js/baidupush.js
Normal file
12
source/js/baidupush.js
Normal file
@@ -0,0 +1,12 @@
|
||||
(function(){
|
||||
var bp = document.createElement('script');
|
||||
var curProtocol = window.location.protocol.split(':')[0];
|
||||
if (curProtocol === 'https') {
|
||||
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
|
||||
}
|
||||
else {
|
||||
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
|
||||
}
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(bp, s);
|
||||
})();
|
||||
513
source/js/main.js
Normal file
513
source/js/main.js
Normal file
@@ -0,0 +1,513 @@
|
||||
$(function () {
|
||||
if ($(".sidebar-toc__content").children().length > 0 ) {
|
||||
$(".layout_post").animate({}, function () {
|
||||
{
|
||||
setTimeout(function () {
|
||||
$('#page-header').addClass('open-sidebar')
|
||||
$("#toggle-sidebar").addClass('on')
|
||||
$('body').animate({
|
||||
paddingLeft: 300
|
||||
}, 200)
|
||||
$('#sidebar').animate({}, function () {
|
||||
$('#sidebar').css({
|
||||
'transform': 'translateX(300px)'
|
||||
},200)
|
||||
})
|
||||
$('#toggle-sidebar').animate({}, function () {
|
||||
$('#toggle-sidebar').css({
|
||||
'transform': 'rotateZ(180deg)',
|
||||
'color': '#99a9bf',
|
||||
'opacity': "1"
|
||||
})
|
||||
})
|
||||
|
||||
}, 200);
|
||||
}
|
||||
})
|
||||
}
|
||||
else
|
||||
$("#toggle-sidebar").css("display", "none")
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
//sidebar
|
||||
$('#toggle-sidebar').on('click', function () {
|
||||
|
||||
if (!isMobile() && $('#sidebar').is(':visible')) {
|
||||
var isOpen = $(this).hasClass('on')
|
||||
isOpen ? $(this).removeClass('on') : $(this).addClass('on')
|
||||
if (isOpen) {
|
||||
$('#page-header').removeClass('open-sidebar')
|
||||
$('body').animate({
|
||||
paddingLeft: 0
|
||||
}, 200)
|
||||
|
||||
$('#sidebar').animate({}, function () {
|
||||
$('#sidebar').css({
|
||||
'transform': 'translateX(0px)'
|
||||
})
|
||||
})
|
||||
|
||||
$('#toggle-sidebar').animate({}, function () {
|
||||
$('#toggle-sidebar').css({
|
||||
'transform': 'rotateZ(0deg)',
|
||||
'color': '#1F2D3D'
|
||||
})
|
||||
})
|
||||
|
||||
} else {
|
||||
$('#page-header').addClass('open-sidebar')
|
||||
$('body').animate({
|
||||
paddingLeft: 300
|
||||
}, 200)
|
||||
$('#sidebar').animate({}, function () {
|
||||
$('#sidebar').css({
|
||||
'transform': 'translateX(300px)'
|
||||
})
|
||||
})
|
||||
$('#toggle-sidebar').animate({}, function () {
|
||||
$('#toggle-sidebar').css({
|
||||
'transform': 'rotateZ(180deg)',
|
||||
'color': '#99a9bf'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
// 首页fullpage添加
|
||||
// 添加class
|
||||
if (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)) {
|
||||
} else {
|
||||
$('.full_page').css('background-attachment', 'fixed')
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
//側邊欄comment
|
||||
$("#to_comment").on("click", function () {
|
||||
|
||||
scrollTo('#post-comment')
|
||||
|
||||
});
|
||||
|
||||
$(".scroll-down").on("click", function () {
|
||||
|
||||
scrollTo('#content-outer')
|
||||
|
||||
});
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// tags 隨機大小 顔色
|
||||
var list = document.querySelectorAll(".tag-cloud .tag-cloud-tags a");
|
||||
|
||||
if ($(window).width() > 768) {
|
||||
Array.prototype.forEach.call(list, (item, index) => {
|
||||
item.style.fontSize = Math.floor(Math.random() * 20 + 15) + "px"; //15 ~ 35
|
||||
item.style.color =
|
||||
"rgb(" +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
")"; // 0,0,0 -> 200,200,200
|
||||
});
|
||||
} else {
|
||||
Array.prototype.forEach.call(list, (item, index) => {
|
||||
item.style.fontSize = Math.floor(Math.random() * 13 + 15) + "px"; //15 ~ 28
|
||||
item.style.color =
|
||||
"rgb(" +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
", " +
|
||||
Math.floor(Math.random() * 201) +
|
||||
")"; // 0,0,0 -> 200,200,200
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// bookmark
|
||||
$.fancyConfirm = function (opts) {
|
||||
opts = $.extend(true, {
|
||||
title: 'Are you sure?',
|
||||
message: '',
|
||||
okButton: 'OK',
|
||||
noButton: 'Cancel',
|
||||
callback: $.noop
|
||||
}, opts || {});
|
||||
|
||||
$.fancybox.open({
|
||||
type: 'html',
|
||||
src:
|
||||
'<div class="fc-content">' +
|
||||
'<h3>' + opts.title + '</h3>' +
|
||||
'<p>' + opts.message + '</p>' +
|
||||
'<p class="tright">' +
|
||||
'<button data-value="1" data-fancybox-close class="bookmark-ok">' + opts.okButton + '</button>' +
|
||||
'</p>' +
|
||||
'</div>',
|
||||
opts: {
|
||||
animationDuration: 350,
|
||||
animationEffect: 'material',
|
||||
modal: true,
|
||||
baseTpl:
|
||||
'<div class="fancybox-container fc-container" role="dialog" tabindex="-1">' +
|
||||
'<div class="fancybox-bg"></div>' +
|
||||
'<div class="fancybox-inner">' +
|
||||
'<div class="fancybox-stage"></div>' +
|
||||
'</div>' +
|
||||
'</div>',
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#bookmark-it').click(
|
||||
function () {
|
||||
if (window.sidebar && window.sidebar.addPanel) { // Mozilla Firefox Bookmark
|
||||
window.sidebar.addPanel(document.title, window.location.href, '');
|
||||
} else if (window.external && ('AddFavorite' in window.external)) { // IE Favorite
|
||||
window.external.AddFavorite(location.href, document.title);
|
||||
} else if (window.opera && window.print) { // Opera Hotlist
|
||||
this.title = document.title;
|
||||
return true;
|
||||
} else { // webkit - safari/chrome
|
||||
// alert('按 ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D 鍵將本頁加入書籤.');
|
||||
$.fancyConfirm({
|
||||
title: "添加書籤?",
|
||||
message:
|
||||
'按 ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D 鍵將本頁加入書籤.',
|
||||
okButton: "OK",
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
//代码copy
|
||||
// Add copy icon
|
||||
// $('figure.highlight').wrap('<div class="code-area-wrap"></div>')
|
||||
// var $copyIcon = $('<i class="fa fa-clipboard" aria-hidden="true"></i>')
|
||||
// var $notice = $('<div class="copy-notice"></div>')
|
||||
// $('.code-area-wrap').prepend($copyIcon)
|
||||
// $('.code-area-wrap').prepend($notice)
|
||||
// // copy function
|
||||
// function copy(text, ctx) {
|
||||
// if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
|
||||
// try {
|
||||
// document.execCommand('copy') // Security exception may be thrown by some browsers.
|
||||
// $(ctx).prev('.copy-notice')
|
||||
// .text(GLOBAL_CONFIG.copy.success)
|
||||
// .velocity({
|
||||
// translateX: -30,
|
||||
// opacity: 1
|
||||
// }, {
|
||||
// loop: 1,
|
||||
// duration: 750,
|
||||
// easing: 'easeOutQuint'
|
||||
// })
|
||||
// } catch (ex) {
|
||||
// $(ctx).prev('.copy-notice')
|
||||
// .text(GLOBAL_CONFIG.copy.error)
|
||||
// .velocity({
|
||||
// translateX: -30,
|
||||
// opacity: 1
|
||||
// }, {
|
||||
// loop: 1,
|
||||
// duration: 750,
|
||||
// easing: 'easeOutQuint'
|
||||
// })
|
||||
// return false
|
||||
// }
|
||||
// } else {
|
||||
// $(ctx).prev('.copy-notice').text(GLOBAL_CONFIG.copy.noSupport)
|
||||
// }
|
||||
// }
|
||||
// // click events
|
||||
// $('.code-area-wrap .fa-clipboard').on('click', function () {
|
||||
// var selection = window.getSelection()
|
||||
// var range = document.createRange()
|
||||
// range.selectNodeContents($(this).siblings('figure').find('.code pre')[0])
|
||||
// selection.removeAllRanges()
|
||||
// selection.addRange(range)
|
||||
// var text = selection.toString()
|
||||
// copy(text, this)
|
||||
// selection.removeAllRanges()
|
||||
// })
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
//fancybox
|
||||
var imgList = $(".recent-post-info img");
|
||||
if (imgList.length === 0) {
|
||||
imgList = $("#post-content img");
|
||||
}
|
||||
for (var i = 0; i < imgList.length; i++) {
|
||||
var $a = $(
|
||||
'<a href="' +
|
||||
imgList[i].src +
|
||||
'" data-fancybox="group" data-caption="' +
|
||||
imgList[i].alt +
|
||||
'" class="fancybox"></a>'
|
||||
);
|
||||
var alt = imgList[i].alt;
|
||||
var $wrap = $(imgList[i]).wrap($a);
|
||||
if (alt) {
|
||||
$wrap.after('<div class="img-alt">' + alt + "</div>");
|
||||
}
|
||||
}
|
||||
|
||||
$().fancybox({
|
||||
selector: "[data-fancybox]",
|
||||
loop: true,
|
||||
transitionEffect: "slide",
|
||||
protect: true,
|
||||
// wheel: false,
|
||||
buttons: ["slideShow", "fullScreen", "thumbs", "close"]
|
||||
});
|
||||
|
||||
var galleryItem = $(".gallery-item");
|
||||
var galleryList = [];
|
||||
galleryItem.each(function (idx, elem) {
|
||||
galleryList.push({
|
||||
src: $(elem).data("url"),
|
||||
opts: {
|
||||
caption: $(elem).data("title")
|
||||
}
|
||||
});
|
||||
});
|
||||
galleryItem.on("click", function () {
|
||||
$.fancybox.open(
|
||||
galleryList, {
|
||||
loop: true,
|
||||
transitionEffect: "slide"
|
||||
},
|
||||
galleryItem.index(this)
|
||||
);
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//lazy懶加載
|
||||
//把img的src删除,添加data-src,用于lozad.js
|
||||
var $img = $("#post img");
|
||||
$img.addClass("lozad");
|
||||
$img.each(function () {
|
||||
var src_link = $(this).attr("src");
|
||||
$(this).attr("data-src", src_link);
|
||||
$(this).removeAttr("src");
|
||||
})
|
||||
|
||||
const observer = lozad(); // lazy loads elements with default selector as '.lozad'
|
||||
observer.observe();
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
/** head点击*/
|
||||
$('.toggle-menu').on('click', function () {
|
||||
if (!$('.menus').is(':visible')) {
|
||||
$(".toggle-menu").removeClass("open").addClass("close");
|
||||
$('.menus').slideDown(300)
|
||||
} else {
|
||||
$(".toggle-menu").removeClass("close").addClass("open");
|
||||
$('.menus').slideUp(200)
|
||||
}
|
||||
})
|
||||
|
||||
$(document).on('click touchstart', function (e) {
|
||||
var flag = $('.menus')[0].contains(e.target) || $('.toggle-menu')[0].contains(e.target)
|
||||
if (!flag && $('.toggle-menu').is(':visible')) {
|
||||
$(".toggle-menu").removeClass("close").addClass("open");
|
||||
$('.menus').slideUp(200)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
$(window).on('resize', function (e) {
|
||||
if (!$('.toggle-menu').is(':visible')) {
|
||||
if (!$('.menus').is(':visible')) {
|
||||
$(".toggle-menu").removeClass("open").addClass("close");
|
||||
$('.menus').slideDown(300)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
/** scroll 滚动 toc*/
|
||||
var initTop = 0
|
||||
$('.toc-child').hide()
|
||||
|
||||
// main of scroll
|
||||
$(window).scroll(throttle(function (event) {
|
||||
var currentTop = $(this).scrollTop()
|
||||
if (!isMobile()) {
|
||||
// percentage inspired by hexo-theme-next
|
||||
scrollPercent(currentTop)
|
||||
// head position
|
||||
findHeadPosition(currentTop)
|
||||
}
|
||||
var isUp = scrollDirection(currentTop)
|
||||
if (currentTop > 56) {
|
||||
if (isUp) {
|
||||
$('#page-header').hasClass('visible') ? $('#page-header').removeClass('visible') : console.log()
|
||||
} else {
|
||||
$('#page-header').hasClass('visible') ? console.log() : $('#page-header').addClass('visible')
|
||||
}
|
||||
$('#page-header').addClass('fixed')
|
||||
if ($('#go-up').css('opacity') === '0') {
|
||||
|
||||
$('#go-up').animate({}, function () {
|
||||
$('#go-up').css({
|
||||
'opacity': '1',
|
||||
'transform': 'translateX(-30px) rotateZ(360deg)'
|
||||
})
|
||||
})
|
||||
}
|
||||
if ($('#rightside').css('opacity') === '0') {
|
||||
|
||||
$('#rightside').animate({}, function () {
|
||||
$('#rightside').css({
|
||||
'opacity': '1',
|
||||
'transform': 'translateX(-38px)'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
if (currentTop === 0) {
|
||||
$('#page-header').removeClass('fixed').removeClass('visible')
|
||||
}
|
||||
|
||||
$('#go-up').animate({}, function () {
|
||||
$('#go-up').css({
|
||||
'opacity': '0',
|
||||
'transform': 'translateX(0) rotateZ(180deg) '
|
||||
})
|
||||
})
|
||||
|
||||
$('#rightside').animate({}, function () {
|
||||
$('#rightside').css({
|
||||
'opacity': '0',
|
||||
'transform': 'translateX(0)'
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
}, 50, 100))
|
||||
|
||||
// go up smooth scroll
|
||||
$('#go-up').on('click', function () {
|
||||
scrollTo('body')
|
||||
})
|
||||
|
||||
// head scroll
|
||||
$('#post-content').find('h1,h2,h3,h4,h5,h6').on('click', function (e) {
|
||||
scrollToHead('#' + $(this).attr('id'))
|
||||
})
|
||||
|
||||
// head scroll
|
||||
$('.toc-link').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
scrollToHead($(this).attr('href'))
|
||||
})
|
||||
|
||||
// find the scroll direction
|
||||
function scrollDirection(currentTop) {
|
||||
var result = currentTop > initTop // true is down & false is up
|
||||
initTop = currentTop
|
||||
return result
|
||||
}
|
||||
|
||||
// scroll to a head(anchor)
|
||||
function scrollToHead(anchor) {
|
||||
scrollTo(anchor);
|
||||
}
|
||||
|
||||
// expand toc-item
|
||||
function expandToc($item) {
|
||||
if ($item.is(':visible')) {
|
||||
return
|
||||
}
|
||||
$item.fadeIn(400)
|
||||
}
|
||||
|
||||
function scrollPercent(currentTop) {
|
||||
var docHeight = $('#content-outer').height()
|
||||
var winHeight = $(window).height()
|
||||
var contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : ($(document).height() - winHeight)
|
||||
var scrollPercent = (currentTop) / (contentMath)
|
||||
var scrollPercentRounded = Math.round(scrollPercent * 100)
|
||||
var percentage = (scrollPercentRounded > 100) ? 100 : scrollPercentRounded
|
||||
$('.progress-num').text(percentage)
|
||||
$('.sidebar-toc__progress-bar').animate({
|
||||
width: percentage + '%'
|
||||
}, 100)
|
||||
}
|
||||
|
||||
function updateAnchor(anchor) {
|
||||
if (window.history.replaceState && anchor !== window.location.hash) {
|
||||
window.history.replaceState(undefined, undefined, anchor)
|
||||
}
|
||||
}
|
||||
|
||||
// find head position & add active class
|
||||
// DOM Hierarchy:
|
||||
// ol.toc > (li.toc-item, ...)
|
||||
// li.toc-item > (a.toc-link, ol.toc-child > (li.toc-item, ...))
|
||||
function findHeadPosition(top) {
|
||||
// assume that we are not in the post page if no TOC link be found,
|
||||
// thus no need to update the status
|
||||
if ($('.toc-link').length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
var list = $('#post-content').find('h1,h2,h3,h4,h5,h6')
|
||||
var currentId = ''
|
||||
list.each(function () {
|
||||
var head = $(this)
|
||||
if (top > head.offset().top - 25) {
|
||||
currentId = '#' + $(this).attr('id')
|
||||
}
|
||||
})
|
||||
|
||||
if (currentId === '') {
|
||||
$('.toc-link').removeClass('active')
|
||||
$('.toc-child').hide()
|
||||
}
|
||||
|
||||
var currentActive = $('.toc-link.active')
|
||||
if (currentId && currentActive.attr('href') !== currentId) {
|
||||
updateAnchor(currentId)
|
||||
|
||||
$('.toc-link').removeClass('active')
|
||||
var _this = $('.toc-link[href="' + currentId + '"]')
|
||||
_this.addClass('active')
|
||||
|
||||
var parents = _this.parents('.toc-child')
|
||||
// Returned list is in reverse order of the DOM elements
|
||||
// Thus `parents.last()` is the outermost .toc-child container
|
||||
// i.e. list of subsections
|
||||
var topLink = (parents.length > 0) ? parents.last() : _this
|
||||
expandToc(topLink.closest('.toc-item').find('.toc-child'))
|
||||
topLink
|
||||
// Find all top-level .toc-item containers, i.e. sections
|
||||
// excluding the currently active one
|
||||
.closest('.toc-item').siblings('.toc-item')
|
||||
// Hide their respective list of subsections
|
||||
.find('.toc-child').hide()
|
||||
}
|
||||
}
|
||||
|
||||
//代碼框雙擊全屏
|
||||
$('figure').on('dblclick', function(e) {
|
||||
if (e.target !== this)
|
||||
return;
|
||||
$(this).toggleClass('code_full_page');
|
||||
$('body').toggleClass('code_body');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
28
source/js/nightshift.js
Normal file
28
source/js/nightshift.js
Normal file
@@ -0,0 +1,28 @@
|
||||
$(function() {
|
||||
changeReadModel();
|
||||
|
||||
function switchReadMode() {
|
||||
var next_mode = $("body").hasClass("night-mode") ? "day" : "night";
|
||||
Cookies.set("read-mode", next_mode, {expires: 7, path: '/'});
|
||||
changeReadModel();
|
||||
}
|
||||
|
||||
function changeReadModel() {
|
||||
if (Cookies.get("read-mode") == "night") {
|
||||
$("body").addClass("night-mode");
|
||||
$("#nightshift").removeClass("fa-moon-o").addClass("fa-sun-o");
|
||||
}
|
||||
|
||||
// 非夜間模式
|
||||
if (Cookies.get("read-mode") == "day") {
|
||||
$("body").removeClass("night-mode");
|
||||
$("#nightshift").removeClass("fa-sun-o").addClass("fa-moon-o");
|
||||
}
|
||||
}
|
||||
|
||||
$("#nightshift").click(function() {
|
||||
switchReadMode();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
21
source/js/runtimeshow.js
Normal file
21
source/js/runtimeshow.js
Normal file
@@ -0,0 +1,21 @@
|
||||
function show_date_time(){
|
||||
window.setTimeout("show_date_time()", 1000);
|
||||
BirthDay=new Date("6/7/2018 00:00:00");//這個日期是可以修改的
|
||||
today=new Date();
|
||||
timeold=(today.getTime()-BirthDay.getTime());//其實僅僅改了這裏
|
||||
// sectimeold=timeold/1000
|
||||
// secondsold=Math.floor(sectimeold);
|
||||
msPerDay=24*60*60*1000
|
||||
e_daysold=timeold/msPerDay
|
||||
daysold=Math.floor(e_daysold);
|
||||
// e_hrsold=(e_daysold-daysold)*24;
|
||||
// hrsold=Math.floor(e_hrsold);
|
||||
// e_minsold=(e_hrsold-hrsold)*60;
|
||||
// minsold=Math.floor((e_hrsold-hrsold)*60);
|
||||
// seconds=Math.floor((e_minsold-minsold)*60);
|
||||
// span_dt_dt.innerHTML = "已運行 " + daysold + " 天 " + hrsold + " 時 " + minsold + " 分 " + seconds + " 秒";
|
||||
webinfo_runtime_count.innerHTML= daysold + " 天"
|
||||
}
|
||||
|
||||
show_date_time()
|
||||
|
||||
136
source/js/search/algolia.js
Normal file
136
source/js/search/algolia.js
Normal file
@@ -0,0 +1,136 @@
|
||||
$(function () {
|
||||
$('a.social-icon.search').on('click', function () {
|
||||
$('body').css('width', '100%')
|
||||
$('body').css('overflow', 'hidden')
|
||||
|
||||
$('.search-dialog').animate({}, function () {
|
||||
$('.search-dialog').css({
|
||||
'display': 'block',
|
||||
'animation': 'titlescale 0.5s'
|
||||
})
|
||||
})
|
||||
|
||||
$('.ais-search-box--input').focus()
|
||||
$('.search-mask').fadeIn();
|
||||
// shortcut: ESC
|
||||
document.addEventListener('keydown', function f(event) {
|
||||
if (event.code == "Escape") {
|
||||
closeSearch();
|
||||
document.removeEventListener('keydown', f);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
var closeSearch = function () {
|
||||
$('body').css('overflow', 'auto')
|
||||
|
||||
$('.search-dialog').animate({}, function () {
|
||||
$('.search-dialog').css({
|
||||
'display': 'none'
|
||||
})
|
||||
})
|
||||
|
||||
$('.search-mask').fadeOut();
|
||||
}
|
||||
$('.search-mask, .search-close-button').on('click', closeSearch)
|
||||
|
||||
|
||||
var algolia = GLOBAL_CONFIG.algolia
|
||||
var isAlgoliaValid = algolia.appId && algolia.apiKey && algolia.indexName
|
||||
if (!isAlgoliaValid) {
|
||||
return console.error('Algolia setting is invalid!')
|
||||
}
|
||||
|
||||
var search = instantsearch({
|
||||
appId: algolia.appId,
|
||||
apiKey: algolia.apiKey,
|
||||
indexName: algolia.indexName,
|
||||
searchParameters: {
|
||||
hitsPerPage: algolia.hits.per_page || 10
|
||||
},
|
||||
searchFunction: function (helper) {
|
||||
var searchInput = $('#algolia-search-input').find('input')
|
||||
|
||||
if (searchInput.val()) {
|
||||
helper.search()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
search.addWidget(
|
||||
instantsearch.widgets.searchBox({
|
||||
container: '#algolia-search-input',
|
||||
reset: false,
|
||||
magnifier: false,
|
||||
placeholder: GLOBAL_CONFIG.algolia.languages.input_placeholder
|
||||
})
|
||||
)
|
||||
search.addWidget(
|
||||
instantsearch.widgets.hits({
|
||||
container: '#algolia-hits',
|
||||
templates: {
|
||||
item: function (data) {
|
||||
var link = data.permalink ? data.permalink : (GLOBAL_CONFIG.root + data.path)
|
||||
return (
|
||||
'<a href="' + link + '" class="algolia-hit-item-link">' +
|
||||
data._highlightResult.title.value +
|
||||
'</a>'
|
||||
)
|
||||
},
|
||||
empty: function (data) {
|
||||
return (
|
||||
'<div id="algolia-hits-empty">' +
|
||||
GLOBAL_CONFIG.algolia.languages.hits_empty.replace(/\$\{query}/, data.query) +
|
||||
'</div>'
|
||||
)
|
||||
}
|
||||
},
|
||||
cssClasses: {
|
||||
item: 'algolia-hit-item'
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
search.addWidget(
|
||||
instantsearch.widgets.stats({
|
||||
container: '#algolia-stats',
|
||||
templates: {
|
||||
body: function (data) {
|
||||
var stats = GLOBAL_CONFIG.algolia.languages.hits_stats
|
||||
.replace(/\$\{hits}/, data.nbHits)
|
||||
.replace(/\$\{time}/, data.processingTimeMS)
|
||||
return (
|
||||
'<hr>' +
|
||||
stats +
|
||||
'<span class="algolia-logo pull-right">' +
|
||||
' <img src="' + GLOBAL_CONFIG.root + 'img/algolia.svg" alt="Algolia" />' +
|
||||
'</span>'
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
search.addWidget(
|
||||
instantsearch.widgets.pagination({
|
||||
container: '#algolia-pagination',
|
||||
scrollTo: false,
|
||||
showFirstLast: false,
|
||||
labels: {
|
||||
first: '<i class="fa fa-angle-double-left"></i>',
|
||||
last: '<i class="fa fa-angle-double-right"></i>',
|
||||
previous: '<i class="fa fa-angle-left"></i>',
|
||||
next: '<i class="fa fa-angle-right"></i>'
|
||||
},
|
||||
cssClasses: {
|
||||
root: 'pagination',
|
||||
item: 'pagination-item',
|
||||
link: 'page-number',
|
||||
active: 'current',
|
||||
disabled: 'disabled-item'
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
search.start()
|
||||
})
|
||||
102
source/js/search/local-search.js
Normal file
102
source/js/search/local-search.js
Normal file
@@ -0,0 +1,102 @@
|
||||
$(function () {
|
||||
var loadFlag = false
|
||||
$('a.social-icon.search').on('click', function () {
|
||||
$('body').css('width', '100%')
|
||||
$('body').css('overflow', 'hidden')
|
||||
$('.search-dialog').animate({}, function () {
|
||||
$('.search-dialog').css({
|
||||
'display': 'block',
|
||||
'animation': 'titlescale 0.5s'
|
||||
})
|
||||
})
|
||||
$('#local-search-input input').focus()
|
||||
|
||||
$('.search-mask').fadeIn();
|
||||
if (!loadFlag) {
|
||||
search(GLOBAL_CONFIG.localSearch.path)
|
||||
loadFlag = true
|
||||
}
|
||||
|
||||
// shortcut: ESC
|
||||
document.addEventListener('keydown', function f(event) {
|
||||
if (event.code === 'Escape') {
|
||||
closeSearch()
|
||||
document.removeEventListener('keydown', f)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
var closeSearch = function () {
|
||||
$('body').css('overflow', 'auto')
|
||||
$('.search-dialog').animate({}, function () {
|
||||
$('.search-dialog').css({
|
||||
'display': 'none'
|
||||
})
|
||||
})
|
||||
$('.search-mask').fadeOut();
|
||||
}
|
||||
$('.search-mask, .search-close-button').on('click', closeSearch)
|
||||
|
||||
function search(path) {
|
||||
$.ajax({
|
||||
url: GLOBAL_CONFIG.root + path,
|
||||
dataType: 'xml',
|
||||
success: function (xmlResponse) {
|
||||
// get the contents from search data
|
||||
var datas = $('entry', xmlResponse).map(function () {
|
||||
return {
|
||||
title: $('title', this).text(),
|
||||
content: $('content', this).text(),
|
||||
url: $('url', this).text()
|
||||
}
|
||||
}).get()
|
||||
var $input = $('#local-search-input input')[0]
|
||||
var $resultContent = $('#local-hits')[0]
|
||||
$input.addEventListener('input', function () {
|
||||
var str = '<div class="search-result-list">'
|
||||
var keywords = this.value.trim().toLowerCase().split(/[\s]+/)
|
||||
$resultContent.innerHTML = ''
|
||||
if (this.value.trim().length <= 0) {
|
||||
$('.local-search-stats__hr').hide()
|
||||
return
|
||||
}
|
||||
var count = 0
|
||||
// perform local searching
|
||||
datas.forEach(function (data) {
|
||||
var isMatch = true
|
||||
var dataTitle = data.title.trim().toLowerCase()
|
||||
var dataContent = data.content.trim().replace(/<[^>]+>/g, '').toLowerCase()
|
||||
var dataUrl = data.url
|
||||
var indexTitle = -1
|
||||
var indexContent = -1
|
||||
// only match artiles with not empty titles and contents
|
||||
if (dataTitle !== '' && dataContent !== '') {
|
||||
keywords.forEach(function (keyword, i) {
|
||||
indexTitle = dataTitle.indexOf(keyword)
|
||||
indexContent = dataContent.indexOf(keyword)
|
||||
if (indexTitle < 0 && indexContent < 0) {
|
||||
isMatch = false
|
||||
} else {
|
||||
if (indexContent < 0) {
|
||||
indexContent = 0
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// show search results
|
||||
if (isMatch) {
|
||||
str += '<div class="local-search__hit-item"><a href="' + dataUrl + '" class="search-result-title">' + dataTitle + '</a>' + '</div>'
|
||||
count += 1
|
||||
$('.local-search-stats__hr').show()
|
||||
}
|
||||
})
|
||||
if (count === 0) {
|
||||
str += '<div id="local-search__hits-empty">' + GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/, this.value.trim()) +
|
||||
'</div>'
|
||||
}
|
||||
$resultContent.innerHTML = str
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
27
source/js/third-party/anime.min.js
vendored
Normal file
27
source/js/third-party/anime.min.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
2017 Julian Garnier
|
||||
Released under the MIT license
|
||||
*/
|
||||
var $jscomp$this=this;
|
||||
(function(v,p){"function"===typeof define&&define.amd?define([],p):"object"===typeof module&&module.exports?module.exports=p():v.anime=p()})(this,function(){function v(a){if(!g.col(a))try{return document.querySelectorAll(a)}catch(b){}}function p(a){return a.reduce(function(a,d){return a.concat(g.arr(d)?p(d):d)},[])}function w(a){if(g.arr(a))return a;g.str(a)&&(a=v(a)||a);return a instanceof NodeList||a instanceof HTMLCollection?[].slice.call(a):[a]}function F(a,b){return a.some(function(a){return a===b})}
|
||||
function A(a){var b={},d;for(d in a)b[d]=a[d];return b}function G(a,b){var d=A(a),c;for(c in a)d[c]=b.hasOwnProperty(c)?b[c]:a[c];return d}function B(a,b){var d=A(a),c;for(c in b)d[c]=g.und(a[c])?b[c]:a[c];return d}function S(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,d,h){return b+b+d+d+h+h});var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);a=parseInt(b[1],16);var d=parseInt(b[2],16),b=parseInt(b[3],16);return"rgb("+a+","+d+","+b+")"}function T(a){function b(a,b,c){0>
|
||||
c&&(c+=1);1<c&&--c;return c<1/6?a+6*(b-a)*c:.5>c?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var d=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a);a=parseInt(d[1])/360;var c=parseInt(d[2])/100,d=parseInt(d[3])/100;if(0==c)c=d=a=d;else{var e=.5>d?d*(1+c):d+c-d*c,l=2*d-e,c=b(l,e,a+1/3),d=b(l,e,a);a=b(l,e,a-1/3)}return"rgb("+255*c+","+255*d+","+255*a+")"}function x(a){if(a=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|pc|vw|vh|deg|rad|turn)?/.exec(a))return a[2]}function U(a){if(-1<a.indexOf("translate"))return"px";
|
||||
if(-1<a.indexOf("rotate")||-1<a.indexOf("skew"))return"deg"}function H(a,b){return g.fnc(a)?a(b.target,b.id,b.total):a}function C(a,b){if(b in a.style)return getComputedStyle(a).getPropertyValue(b.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())||"0"}function I(a,b){if(g.dom(a)&&F(V,b))return"transform";if(g.dom(a)&&(a.getAttribute(b)||g.svg(a)&&a[b]))return"attribute";if(g.dom(a)&&"transform"!==b&&C(a,b))return"css";if(null!=a[b])return"object"}function W(a,b){var d=U(b),d=-1<b.indexOf("scale")?
|
||||
1:0+d;a=a.style.transform;if(!a)return d;for(var c=[],e=[],l=[],h=/(\w+)\((.+?)\)/g;c=h.exec(a);)e.push(c[1]),l.push(c[2]);a=l.filter(function(a,c){return e[c]===b});return a.length?a[0]:d}function J(a,b){switch(I(a,b)){case "transform":return W(a,b);case "css":return C(a,b);case "attribute":return a.getAttribute(b)}return a[b]||0}function K(a,b){var d=/^(\*=|\+=|-=)/.exec(a);if(!d)return a;b=parseFloat(b);a=parseFloat(a.replace(d[0],""));switch(d[0][0]){case "+":return b+a;case "-":return b-a;case "*":return b*
|
||||
a}}function D(a){return g.obj(a)&&a.hasOwnProperty("totalLength")}function X(a,b){function d(c){c=void 0===c?0:c;return a.el.getPointAtLength(1<=b+c?b+c:0)}var c=d(),e=d(-1),l=d(1);switch(a.property){case "x":return c.x;case "y":return c.y;case "angle":return 180*Math.atan2(l.y-e.y,l.x-e.x)/Math.PI}}function L(a,b){var d=/-?\d*\.?\d+/g;a=D(a)?a.totalLength:a;if(g.col(a))b=g.rgb(a)?a:g.hex(a)?S(a):g.hsl(a)?T(a):void 0;else{var c=x(a);a=c?a.substr(0,a.length-c.length):a;b=b?a+b:a}b+="";return{original:b,
|
||||
numbers:b.match(d)?b.match(d).map(Number):[0],strings:b.split(d)}}function Y(a,b){return b.reduce(function(b,c,e){return b+a[e-1]+c})}function M(a){return(a?p(g.arr(a)?a.map(w):w(a)):[]).filter(function(a,d,c){return c.indexOf(a)===d})}function Z(a){var b=M(a);return b.map(function(a,c){return{target:a,id:c,total:b.length}})}function aa(a,b){var d=A(b);if(g.arr(a)){var c=a.length;2!==c||g.obj(a[0])?g.fnc(b.duration)||(d.duration=b.duration/c):a={value:a}}return w(a).map(function(a,c){c=c?0:b.delay;
|
||||
a=g.obj(a)&&!D(a)?a:{value:a};g.und(a.delay)&&(a.delay=c);return a}).map(function(a){return B(a,d)})}function ba(a,b){var d={},c;for(c in a){var e=H(a[c],b);g.arr(e)&&(e=e.map(function(a){return H(a,b)}),1===e.length&&(e=e[0]));d[c]=e}d.duration=parseFloat(d.duration);d.delay=parseFloat(d.delay);return d}function ca(a){return g.arr(a)?y.apply(this,a):N[a]}function da(a,b){var d;return a.tweens.map(function(c){c=ba(c,b);var e=c.value,l=J(b.target,a.name),h=d?d.to.original:l,h=g.arr(e)?e[0]:h,m=K(g.arr(e)?
|
||||
e[1]:e,h),l=x(m)||x(h)||x(l);c.isPath=D(e);c.from=L(h,l);c.to=L(m,l);c.start=d?d.end:a.offset;c.end=c.start+c.delay+c.duration;c.easing=ca(c.easing);c.elasticity=(1E3-Math.min(Math.max(c.elasticity,1),999))/1E3;g.col(c.from.original)&&(c.round=1);return d=c})}function ea(a,b){return p(a.map(function(a){return b.map(function(b){var c=I(a.target,b.name);if(c){var d=da(b,a);b={type:c,property:b.name,animatable:a,tweens:d,duration:d[d.length-1].end,delay:d[0].delay}}else b=void 0;return b})})).filter(function(a){return!g.und(a)})}
|
||||
function O(a,b,d){var c="delay"===a?Math.min:Math.max;return b.length?c.apply(Math,b.map(function(b){return b[a]})):d[a]}function fa(a){var b=G(ga,a),d=G(ha,a),c=Z(a.targets),e=[],g=B(b,d),h;for(h in a)g.hasOwnProperty(h)||"targets"===h||e.push({name:h,offset:g.offset,tweens:aa(a[h],d)});a=ea(c,e);return B(b,{children:[],animatables:c,animations:a,duration:O("duration",a,d),delay:O("delay",a,d)})}function n(a){function b(){return window.Promise&&new Promise(function(a){return Q=a})}function d(a){return f.reversed?
|
||||
f.duration-a:a}function c(a){for(var b=0,c={},d=f.animations,e={};b<d.length;){var g=d[b],h=g.animatable,m=g.tweens;e.tween=m.filter(function(b){return a<b.end})[0]||m[m.length-1];e.isPath$1=e.tween.isPath;e.round=e.tween.round;e.eased=e.tween.easing(Math.min(Math.max(a-e.tween.start-e.tween.delay,0),e.tween.duration)/e.tween.duration,e.tween.elasticity);m=Y(e.tween.to.numbers.map(function(a){return function(b,c){c=a.isPath$1?0:a.tween.from.numbers[c];b=c+a.eased*(b-c);a.isPath$1&&(b=X(a.tween.value,
|
||||
b));a.round&&(b=Math.round(b*a.round)/a.round);return b}}(e)),e.tween.to.strings);ia[g.type](h.target,g.property,m,c,h.id);g.currentValue=m;b++;e={isPath$1:e.isPath$1,tween:e.tween,eased:e.eased,round:e.round}}if(c)for(var k in c)E||(E=C(document.body,"transform")?"transform":"-webkit-transform"),f.animatables[k].target.style[E]=c[k].join(" ");f.currentTime=a;f.progress=a/f.duration*100}function e(a){if(f[a])f[a](f)}function g(){f.remaining&&!0!==f.remaining&&f.remaining--}function h(a){var h=f.duration,
|
||||
l=f.offset,n=f.delay,P=f.currentTime,q=f.reversed,r=d(a),r=Math.min(Math.max(r,0),h);if(f.children){var p=f.children;if(r>=f.currentTime)for(var u=0;u<p.length;u++)p[u].seek(r);else for(u=p.length;u--;)p[u].seek(r)}r>l&&r<h?(c(r),!f.began&&r>=n&&(f.began=!0,e("begin")),e("run")):(r<=l&&0!==P&&(c(0),q&&g()),r>=h&&P!==h&&(c(h),q||g()));a>=h&&(f.remaining?(t=m,"alternate"===f.direction&&(f.reversed=!f.reversed)):(f.pause(),"Promise"in window&&(Q(),R=b()),f.completed||(f.completed=!0,e("complete"))),
|
||||
k=0);e("update")}a=void 0===a?{}:a;var m,t,k=0,Q=null,R=b(),f=fa(a);f.reset=function(){var a=f.direction,b=f.loop;f.currentTime=0;f.progress=0;f.paused=!0;f.began=!1;f.completed=!1;f.reversed="reverse"===a;f.remaining="alternate"===a&&1===b?2:b;for(a=f.children.length;a--;)b=f.children[a],b.seek(b.offset),b.reset()};f.tick=function(a){m=a;t||(t=m);h((k+m-t)*n.speed)};f.seek=function(a){h(d(a))};f.pause=function(){var a=q.indexOf(f);-1<a&&q.splice(a,1);f.paused=!0};f.play=function(){f.paused&&(f.paused=
|
||||
!1,t=0,k=d(f.currentTime),q.push(f),z||ja())};f.reverse=function(){f.reversed=!f.reversed;t=0;k=d(f.currentTime)};f.restart=function(){f.pause();f.reset();f.play()};f.finished=R;f.reset();f.autoplay&&f.play();return f}var ga={update:void 0,begin:void 0,run:void 0,complete:void 0,loop:1,direction:"normal",autoplay:!0,offset:0},ha={duration:1E3,delay:0,easing:"easeOutElastic",elasticity:500,round:0},V="translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY".split(" "),
|
||||
E,g={arr:function(a){return Array.isArray(a)},obj:function(a){return-1<Object.prototype.toString.call(a).indexOf("Object")},svg:function(a){return a instanceof SVGElement},dom:function(a){return a.nodeType||g.svg(a)},str:function(a){return"string"===typeof a},fnc:function(a){return"function"===typeof a},und:function(a){return"undefined"===typeof a},hex:function(a){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)},rgb:function(a){return/^rgb/.test(a)},hsl:function(a){return/^hsl/.test(a)},col:function(a){return g.hex(a)||
|
||||
g.rgb(a)||g.hsl(a)}},y=function(){function a(a,d,c){return(((1-3*c+3*d)*a+(3*c-6*d))*a+3*d)*a}return function(b,d,c,e){if(0<=b&&1>=b&&0<=c&&1>=c){var g=new Float32Array(11);if(b!==d||c!==e)for(var h=0;11>h;++h)g[h]=a(.1*h,b,c);return function(h){if(b===d&&c===e)return h;if(0===h)return 0;if(1===h)return 1;for(var m=0,k=1;10!==k&&g[k]<=h;++k)m+=.1;--k;var k=m+(h-g[k])/(g[k+1]-g[k])*.1,l=3*(1-3*c+3*b)*k*k+2*(3*c-6*b)*k+3*b;if(.001<=l){for(m=0;4>m;++m){l=3*(1-3*c+3*b)*k*k+2*(3*c-6*b)*k+3*b;if(0===l)break;
|
||||
var n=a(k,b,c)-h,k=k-n/l}h=k}else if(0===l)h=k;else{var k=m,m=m+.1,f=0;do n=k+(m-k)/2,l=a(n,b,c)-h,0<l?m=n:k=n;while(1e-7<Math.abs(l)&&10>++f);h=n}return a(h,d,e)}}}}(),N=function(){function a(a,b){return 0===a||1===a?a:-Math.pow(2,10*(a-1))*Math.sin(2*(a-1-b/(2*Math.PI)*Math.asin(1))*Math.PI/b)}var b="Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),d={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,
|
||||
.335],[.6,-.28,.735,.045],a],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(b,c){return 1-a(1-b,c)}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(b,c){return.5>b?a(2*b,c)/2:1-a(-2*b+2,c)/2}]},c={linear:y(.25,.25,.75,.75)},e={},l;for(l in d)e.type=l,d[e.type].forEach(function(a){return function(d,
|
||||
e){c["ease"+a.type+b[e]]=g.fnc(d)?d:y.apply($jscomp$this,d)}}(e)),e={type:e.type};return c}(),ia={css:function(a,b,d){return a.style[b]=d},attribute:function(a,b,d){return a.setAttribute(b,d)},object:function(a,b,d){return a[b]=d},transform:function(a,b,d,c,e){c[e]||(c[e]=[]);c[e].push(b+"("+d+")")}},q=[],z=0,ja=function(){function a(){z=requestAnimationFrame(b)}function b(b){var c=q.length;if(c){for(var d=0;d<c;)q[d]&&q[d].tick(b),d++;a()}else cancelAnimationFrame(z),z=0}return a}();n.version="2.0.2";
|
||||
n.speed=1;n.running=q;n.remove=function(a){a=M(a);for(var b=q.length;b--;)for(var d=q[b],c=d.animations,e=c.length;e--;)F(a,c[e].animatable.target)&&(c.splice(e,1),c.length||d.pause())};n.getValue=J;n.path=function(a,b){var d=g.str(a)?v(a)[0]:a,c=b||100;return function(a){return{el:d,property:a,totalLength:d.getTotalLength()*(c/100)}}};n.setDashoffset=function(a){var b=a.getTotalLength();a.setAttribute("stroke-dasharray",b);return b};n.bezier=y;n.easings=N;n.timeline=function(a){var b=n(a);b.pause();
|
||||
b.duration=0;b.add=function(a){b.children.forEach(function(a){a.began=!0;a.completed=!0});w(a).forEach(function(a){var c=b.duration,d=a.offset;a.autoplay=!1;a.offset=g.und(d)?c:K(d,c);b.seek(a.offset);a=n(a);a.duration>c&&(b.duration=a.duration);a.began=!0;b.children.push(a)});b.reset();b.seek(0);b.autoplay&&b.restart();return b};return b};n.random=function(a,b){return Math.floor(Math.random()*(b-a+1))+a};return n});
|
||||
85
source/js/third-party/canvas-ribbon.js
vendored
Normal file
85
source/js/third-party/canvas-ribbon.js
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Copyright (c) 2016 hustcc
|
||||
* License: MIT
|
||||
* Version: v1.0.1
|
||||
* GitHub: https://github.com/hustcc/ribbon.js
|
||||
**/
|
||||
// changed by Molunerfinn
|
||||
!(function () {
|
||||
function attr (node, attr, default_value) {
|
||||
if (default_value === true) {
|
||||
return node.getAttribute(attr) || default_value
|
||||
}
|
||||
return Number(node.getAttribute(attr)) || default_value
|
||||
}
|
||||
|
||||
// get user config
|
||||
var script = document.getElementById('ribbon'),
|
||||
config = {
|
||||
z: attr(script, 'zIndex', -1), // z-index
|
||||
a: attr(script, 'alpha', 0.6), // alpha
|
||||
s: attr(script, 'size', 90), // size
|
||||
c: attr(script, 'data-click', true) // click-to-change
|
||||
}
|
||||
|
||||
var canvas = document.createElement('canvas'),
|
||||
g2d = canvas.getContext('2d'),
|
||||
pr = window.devicePixelRatio || 1,
|
||||
width = window.innerWidth,
|
||||
height = window.innerHeight,
|
||||
f = config.s,
|
||||
q,
|
||||
t,
|
||||
m = Math,
|
||||
r = 0,
|
||||
pi = m.PI * 2,
|
||||
cos = m.cos,
|
||||
random = m.random
|
||||
canvas.width = width * pr
|
||||
canvas.height = height * pr
|
||||
g2d.scale(pr, pr)
|
||||
g2d.globalAlpha = config.a
|
||||
canvas.style.cssText =
|
||||
'opacity: ' +
|
||||
config.a +
|
||||
';position:fixed;top:0;left:0;z-index: ' +
|
||||
config.z +
|
||||
';width:100%;height:100%;pointer-events:none;'
|
||||
// create canvas
|
||||
document.getElementsByTagName('body')[0].appendChild(canvas)
|
||||
|
||||
function redraw () {
|
||||
g2d.clearRect(0, 0, width, height)
|
||||
q = [{ x: 0, y: height * 0.7 + f }, { x: 0, y: height * 0.7 - f }]
|
||||
while (q[1].x < width + f) draw(q[0], q[1])
|
||||
}
|
||||
function draw (i, j) {
|
||||
g2d.beginPath()
|
||||
g2d.moveTo(i.x, i.y)
|
||||
g2d.lineTo(j.x, j.y)
|
||||
var k = j.x + (random() * 2 - 0.25) * f,
|
||||
n = line(j.y)
|
||||
g2d.lineTo(k, n)
|
||||
g2d.closePath()
|
||||
r -= pi / -50
|
||||
g2d.fillStyle =
|
||||
'#' +
|
||||
(
|
||||
((cos(r) * 127 + 128) << 16) |
|
||||
((cos(r + pi / 3) * 127 + 128) << 8) |
|
||||
(cos(r + (pi / 3) * 2) * 127 + 128)
|
||||
).toString(16)
|
||||
g2d.fill()
|
||||
q[0] = q[1]
|
||||
q[1] = { x: k, y: n }
|
||||
}
|
||||
function line (p) {
|
||||
t = p + (random() * 2 - 1.1) * f
|
||||
return t > height || t < 0 ? line(p) : t
|
||||
}
|
||||
if (config.c !== 'false') {
|
||||
document.onclick = redraw
|
||||
document.ontouchstart = redraw
|
||||
}
|
||||
redraw()
|
||||
})()
|
||||
12
source/js/third-party/jquery.fancybox.min.js
vendored
Normal file
12
source/js/third-party/jquery.fancybox.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
source/js/third-party/jquery.min.js
vendored
Normal file
4
source/js/third-party/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
324
source/js/third-party/piao.js
vendored
Normal file
324
source/js/third-party/piao.js
vendored
Normal file
@@ -0,0 +1,324 @@
|
||||
(function(name, factory) {
|
||||
if (typeof window === "object") {
|
||||
window[name] = factory()
|
||||
}
|
||||
})("Ribbons", function() {
|
||||
var _w = window,
|
||||
_b = document.body,
|
||||
_d = document.documentElement;
|
||||
var random = function() {
|
||||
if (arguments.length === 1) {
|
||||
if (Array.isArray(arguments[0])) {
|
||||
var index = Math.round(random(0, arguments[0].length - 1));
|
||||
return arguments[0][index]
|
||||
}
|
||||
return random(0, arguments[0])
|
||||
} else if (arguments.length === 2) {
|
||||
return Math.random() * (arguments[1] - arguments[0]) + arguments[0]
|
||||
}
|
||||
return 0
|
||||
};
|
||||
var screenInfo = function(e) {
|
||||
var width = Math.max(0, _w.innerWidth || _d.clientWidth || _b.clientWidth || 0),
|
||||
height = Math.max(0, _w.innerHeight || _d.clientHeight || _b.clientHeight || 0),
|
||||
scrollx = Math.max(0, _w.pageXOffset || _d.scrollLeft || _b.scrollLeft || 0) - (_d.clientLeft || 0),
|
||||
scrolly = Math.max(0, _w.pageYOffset || _d.scrollTop || _b.scrollTop || 0) - (_d.clientTop || 0);
|
||||
return {
|
||||
width: width,
|
||||
height: height,
|
||||
ratio: width / height,
|
||||
centerx: width / 2,
|
||||
centery: height / 2,
|
||||
scrollx: scrollx,
|
||||
scrolly: scrolly
|
||||
}
|
||||
};
|
||||
var mouseInfo = function(e) {
|
||||
var screen = screenInfo(e),
|
||||
mousex = e ? Math.max(0, e.pageX || e.clientX || 0) : 0,
|
||||
mousey = e ? Math.max(0, e.pageY || e.clientY || 0) : 0;
|
||||
return {
|
||||
mousex: mousex,
|
||||
mousey: mousey,
|
||||
centerx: mousex - screen.width / 2,
|
||||
centery: mousey - screen.height / 2
|
||||
}
|
||||
};
|
||||
var Point = function(x, y) {
|
||||
this.x = 0;
|
||||
this.y = 0;
|
||||
this.set(x, y)
|
||||
};
|
||||
Point.prototype = {
|
||||
constructor: Point,
|
||||
set: function(x, y) {
|
||||
this.x = x || 0;
|
||||
this.y = y || 0
|
||||
},
|
||||
copy: function(point) {
|
||||
this.x = point.x || 0;
|
||||
this.y = point.y || 0;
|
||||
return this
|
||||
},
|
||||
multiply: function(x, y) {
|
||||
this.x *= x || 1;
|
||||
this.y *= y || 1;
|
||||
return this
|
||||
},
|
||||
divide: function(x, y) {
|
||||
this.x /= x || 1;
|
||||
this.y /= y || 1;
|
||||
return this
|
||||
},
|
||||
add: function(x, y) {
|
||||
this.x += x || 0;
|
||||
this.y += y || 0;
|
||||
return this
|
||||
},
|
||||
subtract: function(x, y) {
|
||||
this.x -= x || 0;
|
||||
this.y -= y || 0;
|
||||
return this
|
||||
},
|
||||
clampX: function(min, max) {
|
||||
this.x = Math.max(min, Math.min(this.x, max));
|
||||
return this
|
||||
},
|
||||
clampY: function(min, max) {
|
||||
this.y = Math.max(min, Math.min(this.y, max));
|
||||
return this
|
||||
},
|
||||
flipX: function() {
|
||||
this.x *= -1;
|
||||
return this
|
||||
},
|
||||
flipY: function() {
|
||||
this.y *= -1;
|
||||
return this
|
||||
}
|
||||
};
|
||||
var Factory = function(options) {
|
||||
this._canvas = null;
|
||||
this._context = null;
|
||||
this._sto = null;
|
||||
this._width = 0;
|
||||
this._height = 0;
|
||||
this._scroll = 0;
|
||||
this._ribbons = [];
|
||||
this._options = {
|
||||
colorSaturation: "80%",
|
||||
colorBrightness: "60%",
|
||||
colorAlpha: 0.65,
|
||||
colorCycleSpeed: 6,
|
||||
verticalPosition: "center",
|
||||
horizontalSpeed: 150,
|
||||
ribbonCount: 5,
|
||||
strokeSize: 5,
|
||||
parallaxAmount: -0.5,
|
||||
animateSections: true
|
||||
};
|
||||
this._onDraw = this._onDraw.bind(this);
|
||||
this._onResize = this._onResize.bind(this);
|
||||
this._onScroll = this._onScroll.bind(this);
|
||||
this.setOptions(options);
|
||||
this.init()
|
||||
};
|
||||
Factory.prototype = {
|
||||
constructor: Factory,
|
||||
setOptions: function(options) {
|
||||
if (typeof options === "object") {
|
||||
for (var key in options) {
|
||||
if (options.hasOwnProperty(key)) {
|
||||
this._options[key] = options[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
init: function() {
|
||||
try {
|
||||
this._canvas = document.createElement("canvas");
|
||||
this._canvas.style["display"] = "block";
|
||||
this._canvas.style["position"] = "fixed";
|
||||
this._canvas.style["margin"] = "0";
|
||||
this._canvas.style["padding"] = "0";
|
||||
this._canvas.style["border"] = "0";
|
||||
this._canvas.style["outline"] = "0";
|
||||
this._canvas.style["left"] = "0";
|
||||
this._canvas.style["top"] = "0";
|
||||
this._canvas.style["width"] = "100%";
|
||||
this._canvas.style["height"] = "100%";
|
||||
this._canvas.style["z-index"] = "-1";
|
||||
this._onResize();
|
||||
this._context = this._canvas.getContext("2d");
|
||||
this._context.clearRect(0, 0, this._width, this._height);
|
||||
this._context.globalAlpha = this._options.colorAlpha;
|
||||
window.addEventListener("resize", this._onResize);
|
||||
window.addEventListener("scroll", this._onScroll);
|
||||
document.body.appendChild(this._canvas)
|
||||
} catch (e) {
|
||||
console.warn("Canvas Context Error: " + e.toString());
|
||||
return
|
||||
}
|
||||
this._onDraw()
|
||||
},
|
||||
addRibbon: function() {
|
||||
var dir = Math.round(random(1, 9)) > 5 ? "right" : "left",
|
||||
stop = 1000,
|
||||
hide = 200,
|
||||
min = 0 - hide,
|
||||
max = this._width + hide,
|
||||
movex = 0,
|
||||
movey = 0,
|
||||
startx = dir === "right" ? min : max,
|
||||
starty = Math.round(random(0, this._height));
|
||||
if (/^(top|min)$/i.test(this._options.verticalPosition)) {
|
||||
starty = 0 + hide
|
||||
} else if (/^(middle|center)$/i.test(this._options.verticalPosition)) {
|
||||
starty = this._height / 2
|
||||
} else if (/^(bottom|max)$/i.test(this._options.verticalPosition)) {
|
||||
starty = this._height - hide
|
||||
}
|
||||
var ribbon = [],
|
||||
point1 = new Point(startx, starty),
|
||||
point2 = new Point(startx, starty),
|
||||
point3 = null,
|
||||
color = Math.round(random(0, 360)),
|
||||
delay = 0;
|
||||
while (true) {
|
||||
if (stop <= 0) break;
|
||||
stop--;
|
||||
movex = Math.round((Math.random() * 1 - 0.2) * this._options.horizontalSpeed);
|
||||
movey = Math.round((Math.random() * 1 - 0.5) * (this._height * 0.25));
|
||||
point3 = new Point();
|
||||
point3.copy(point2);
|
||||
if (dir === "right") {
|
||||
point3.add(movex, movey);
|
||||
if (point2.x >= max) break
|
||||
} else if (dir === "left") {
|
||||
point3.subtract(movex, movey);
|
||||
if (point2.x <= min) break
|
||||
}
|
||||
ribbon.push({
|
||||
point1: new Point(point1.x, point1.y),
|
||||
point2: new Point(point2.x, point2.y),
|
||||
point3: point3,
|
||||
color: color,
|
||||
delay: delay,
|
||||
dir: dir,
|
||||
alpha: 0,
|
||||
phase: 0
|
||||
});
|
||||
point1.copy(point2);
|
||||
point2.copy(point3);
|
||||
delay += 4;
|
||||
color += this._options.colorCycleSpeed
|
||||
}
|
||||
this._ribbons.push(ribbon)
|
||||
},
|
||||
_drawRibbonSection: function(section) {
|
||||
if (section) {
|
||||
if (section.phase >= 1 && section.alpha <= 0) {
|
||||
return true
|
||||
}
|
||||
if (section.delay <= 0) {
|
||||
section.phase += 0.02;
|
||||
section.alpha = Math.sin(section.phase) * 1;
|
||||
section.alpha = section.alpha <= 0 ? 0 : section.alpha;
|
||||
section.alpha = section.alpha >= 1 ? 1 : section.alpha;
|
||||
if (this._options.animateSections) {
|
||||
var mod = Math.sin(1 + section.phase * Math.PI / 2) * 0.1;
|
||||
if (section.dir === "right") {
|
||||
section.point1.add(mod, 0);
|
||||
section.point2.add(mod, 0);
|
||||
section.point3.add(mod, 0)
|
||||
} else {
|
||||
section.point1.subtract(mod, 0);
|
||||
section.point2.subtract(mod, 0);
|
||||
section.point3.subtract(mod, 0)
|
||||
}
|
||||
section.point1.add(0, mod);
|
||||
section.point2.add(0, mod);
|
||||
section.point3.add(0, mod)
|
||||
}
|
||||
} else {
|
||||
section.delay -= 0.5
|
||||
}
|
||||
var s = this._options.colorSaturation,
|
||||
l = this._options.colorBrightness,
|
||||
c = "hsla(" + section.color + ", " + s + ", " + l + ", " + section.alpha + " )";
|
||||
this._context.save();
|
||||
if (this._options.parallaxAmount !== 0) {
|
||||
this._context.translate(0, this._scroll * this._options.parallaxAmount)
|
||||
}
|
||||
this._context.beginPath();
|
||||
this._context.moveTo(section.point1.x, section.point1.y);
|
||||
this._context.lineTo(section.point2.x, section.point2.y);
|
||||
this._context.lineTo(section.point3.x, section.point3.y);
|
||||
this._context.fillStyle = c;
|
||||
this._context.fill();
|
||||
if (this._options.strokeSize > 0) {
|
||||
this._context.lineWidth = this._options.strokeSize;
|
||||
this._context.strokeStyle = c;
|
||||
this._context.lineCap = "round";
|
||||
this._context.stroke()
|
||||
}
|
||||
this._context.restore()
|
||||
}
|
||||
return false
|
||||
},
|
||||
_onDraw: function() {
|
||||
for (var i = 0, t = this._ribbons.length; i < t; ++i) {
|
||||
if (!this._ribbons[i]) {
|
||||
this._ribbons.splice(i, 1)
|
||||
}
|
||||
}
|
||||
this._context.clearRect(0, 0, this._width, this._height);
|
||||
for (var a = 0; a < this._ribbons.length; ++a) {
|
||||
var ribbon = this._ribbons[a],
|
||||
numSections = ribbon.length,
|
||||
numDone = 0;
|
||||
for (var b = 0; b < numSections; ++b) {
|
||||
if (this._drawRibbonSection(ribbon[b])) {
|
||||
numDone++
|
||||
}
|
||||
}
|
||||
if (numDone >= numSections) {
|
||||
this._ribbons[a] = null
|
||||
}
|
||||
}
|
||||
if (this._ribbons.length < this._options.ribbonCount) {
|
||||
this.addRibbon()
|
||||
}
|
||||
requestAnimationFrame(this._onDraw)
|
||||
},
|
||||
_onResize: function(e) {
|
||||
var screen = screenInfo(e);
|
||||
this._width = screen.width;
|
||||
this._height = screen.height;
|
||||
if (this._canvas) {
|
||||
this._canvas.width = this._width;
|
||||
this._canvas.height = this._height;
|
||||
if (this._context) {
|
||||
this._context.globalAlpha = this._options.colorAlpha
|
||||
}
|
||||
}
|
||||
},
|
||||
_onScroll: function(e) {
|
||||
var screen = screenInfo(e);
|
||||
this._scroll = screen.scrolly
|
||||
}
|
||||
};
|
||||
return Factory
|
||||
});
|
||||
new Ribbons({
|
||||
colorSaturation: "60%",
|
||||
colorBrightness: "50%",
|
||||
colorAlpha: 0.5,
|
||||
colorCycleSpeed: 5,
|
||||
verticalPosition: "random",
|
||||
horizontalSpeed: 200,
|
||||
ribbonCount: 3,
|
||||
strokeSize: 0,
|
||||
parallaxAmount: -0.2,
|
||||
animateSections: true
|
||||
});
|
||||
203
source/js/tw_cn.js
Normal file
203
source/js/tw_cn.js
Normal file
File diff suppressed because one or more lines are too long
54
source/js/utils.js
Normal file
54
source/js/utils.js
Normal file
@@ -0,0 +1,54 @@
|
||||
function debounce(func, wait, immediate) {
|
||||
var timeout
|
||||
return function () {
|
||||
var context = this
|
||||
var args = arguments
|
||||
var later = function () {
|
||||
timeout = null
|
||||
if (!immediate) func.apply(context, args)
|
||||
}
|
||||
var callNow = immediate && !timeout
|
||||
clearTimeout(timeout)
|
||||
timeout = setTimeout(later, wait)
|
||||
if (callNow) func.apply(context, args)
|
||||
}
|
||||
};
|
||||
|
||||
function throttle(func, wait, mustRun) {
|
||||
var timeout
|
||||
var startTime = new Date()
|
||||
|
||||
return function () {
|
||||
var context = this
|
||||
var args = arguments
|
||||
var curTime = new Date()
|
||||
|
||||
clearTimeout(timeout)
|
||||
if (curTime - startTime >= mustRun) {
|
||||
func.apply(context, args)
|
||||
startTime = curTime
|
||||
} else {
|
||||
timeout = setTimeout(func, wait)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function isMobile() {
|
||||
var check = false;
|
||||
(function (a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true })(navigator.userAgent || navigator.vendor || window.opera)
|
||||
return check
|
||||
};
|
||||
|
||||
function scrollTo(name) {
|
||||
var scroll_offset = $(name).offset();
|
||||
$("body,html").animate({
|
||||
scrollTop: scroll_offset.top
|
||||
})
|
||||
};
|
||||
|
||||
window.debounce = debounce
|
||||
|
||||
window.throttle = throttle
|
||||
|
||||
window.isMobile = isMobile
|
||||
|
||||
Reference in New Issue
Block a user