mirror of https://github.com/IoTcat/Ushio-js.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
236 lines
98 KiB
236 lines
98 KiB
5 years ago
|
/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */
|
||
|
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}k.fn=k.prototype={jquery:f,constructor:k,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=k.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return k.each(this,e)},map:function(n){return this.pushStack(k.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},k.extend=k.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(k.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||k.isPlainObject(n)?n:{},i=!1,a[t]=k.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},k.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t){b(e,{nonce:t&&t.nonce})},each:function(e,t){var n,r=0;if(d(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},trim:function(e){return null==e?"":(e+"").replace(p,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(d(Object(e))?k.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(d(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g.apply([],a)},guid:1,support:y}),"function"==typeof Symbol&&(k.fn[Symbol.iterator]=t[Symbol.iterator]),k.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var h=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,k="sizzle"+1*new Date,m=n.document,S=0,r=0,p=ue(),x=ue(),N=ue(),A=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multipl
|
||
|
|
||
3 years ago
|
//Basil.js
|
||
|
!function(){var e=function(t){return e.utils.extend({},e.plugins,(new e.Storage).init(t))};e.version="0.4.11",e.utils={extend:function(){for(var e="object"==typeof arguments[0]?arguments[0]:{},t=1;t<arguments.length;t++)if(arguments[t]&&"object"==typeof arguments[t])for(var n in arguments[t])e[n]=arguments[t][n];return e},each:function(e,t,n){if(this.isArray(e)){for(var i=0;i<e.length;i++)if(!1===t.call(n,e[i],i))return}else if(e)for(var r in e)if(!1===t.call(n,e[r],r))return},tryEach:function(e,t,n,i){this.each(e,function(e,r){try{return t.call(i,e,r)}catch(t){if(this.isFunction(n))try{n.call(i,e,r,t)}catch(e){}}},this)},registerPlugin:function(t){e.plugins=this.extend(t,e.plugins)},getTypeOf:function(e){return void 0===e||null===e?""+e:Object.prototype.toString.call(e).replace(/^\[object\s(.*)\]$/,function(e,t){return t.toLowerCase()})}};for(var t=["Arguments","Boolean","Function","String","Array","Number","Date","RegExp","Undefined","Null"],n=0;n<t.length;n++)e.utils["is"+t[n]]=function(t){return function(n){return e.utils.getTypeOf(n)===t.toLowerCase()}}(t[n]);e.plugins={},e.options=e.utils.extend({namespace:"b45i1",storages:["local","cookie","session","memory"],expireDays:365,keyDelimiter:"."},window.Basil?window.Basil.options:{}),e.Storage=function(){var t="b45i1"+(Math.random()+1).toString(36).substring(7),n={},i=function(t){var n=e.utils.getTypeOf(t);return"string"===n&&t||"number"===n||"boolean"===n},r=function(t){return e.utils.isArray(t)?t:e.utils.isString(t)?[t]:[]},o=function(t,n,r){var o="";return i(n)?o+=n:e.utils.isArray(n)&&(o=(n=e.utils.isFunction(n.filter)?n.filter(i):n).join(r)),o&&i(t)?t+r+o:o},s=function(e,t,n){return i(e)?t.replace(new RegExp("^"+e+n),""):t},u={engine:null,check:function(){try{window[this.engine].setItem(t,!0),window[this.engine].removeItem(t)}catch(e){return!1}return!0},set:function(e,t,n){if(!e)throw Error("invalid key");window[this.engine].setItem(e,t)},get:function(e){return window[this.engine].getItem(e)},remove:function(e){window[this.engine].removeItem(e)},reset:function(e){for(var t,n=0;n<window[this.engine].length;n++)t=window[this.engine].key(n),e&&0!==t.indexOf(e)||(this.remove(t),n--)},keys:function(e,t){for(var n,i=[],r=0;r<window[this.engine].length;r++)n=window[this.engine].key(r),e&&0!==n.indexOf(e)||i.push(s(e,n,t));return i}};return n.local=e.utils.extend({},u,{engine:"localStorage"}),n.session=e.utils.extend({},u,{engine:"sessionStorage"}),n.memory={_hash:{},check:function(){return!0},set:function(e,t,n){if(!e)throw Error("invalid key");this._hash[e]=t},get:function(e){return this._hash[e]||null},remove:function(e){delete this._hash[e]},reset:function(e){for(var t in this._hash)e&&0!==t.indexOf(e)||this.remove(t)},keys:function(e,t){var n=[];for(var i in this._hash)e&&0!==i.indexOf(e)||n.push(s(e,i,t));return n}},n.cookie={check:function(e){if(!navigator.cookieEnabled)return!1;if(window.self!==window.top){var n="thirdparty.check="+Math.round(1e3*Math.random());return document.cookie=n+"; path=/",-1!==document.cookie.indexOf(n)}if(e&&e.secure)try{this.set(t,t,e);var i=this.get(t)===t;return this.remove(t),i}catch(e){return!1}return!0},set:function(e,t,n){if(!this.check())throw Error("cookies are disabled");if(n=n||{},!e)throw Error("invalid key");var i=encodeURIComponent(e)+"="+encodeURIComponent(t);if(n.expireDays){var r=new Date;r.setTime(r.getTime()+24*n.expireDays*60*60*1e3),i+="; expires="+r.toGMTString()}if(n.domain&&n.domain!==document.domain){var o=n.domain.replace(/^\./,"");if(-1===document.domain.indexOf(o)||o.split(".").length<=1)throw Error("invalid domain");i+="; domain="+n.domain}n.sameSite&&["lax","strict","none"].includes(n.sameSite.toLowerCase())&&(i+="; SameSite="+n.sameSite),!0===n.secure&&(i+="; Secure"),document.cookie=i+"; path=/"},get:function(e){if(!this.check())throw Error("cookies are disabled");for(var t,n=encodeURIComponent(e),i=document.cookie?document.cookie.split(";"):[],r=i.length-1;r>=0;r--)if(0===(t=i[r].replace(/^\s*/,"")).indexOf(n+"="))return decodeURIComponent(t.substring(n.length+1,t.length));return null},remove:function(e){
|
||
|
var cookie = new Basil({
|
||
|
namespace: 'ushio/system'
|
||
|
});
|
||
|
cookie.del = cookie.remove;
|
||
4 years ago
|
|
||
4 years ago
|
/* HTML decoder */
|
||
|
function htmlDecode(str){
|
||
|
var s = "";
|
||
|
if(str.length == 0) return "";
|
||
|
s = str.replace(/&/g,"&");
|
||
|
s = s.replace(/</g,"<");
|
||
|
s = s.replace(/>/g,">");
|
||
|
s = s.replace(/ /g," ");
|
||
|
s = s.replace(/'/g,"\'");
|
||
|
s = s.replace(/"/g,"\"");
|
||
|
return s;
|
||
|
}
|
||
|
|
||
4 years ago
|
/* rand string */
|
||
|
function randomStr(length) {
|
||
|
var result = '', chars = '0123456789abcdefghijklmnopqrstuvwxyz';
|
||
|
for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
|
||
|
return result;
|
||
|
}
|
||
|
|
||
5 years ago
|
/* include css */
|
||
4 years ago
|
if(/*typeof block_aplayer == "undefined"*/true){
|
||
4 years ago
|
if(window.screen.width < 600) document.write('<link rel="stylesheet" media="none" onload="this.media=\'all\'" href="https://cdn.yimian.xyz/ushio-js/ushio-js.mobile.min.css">');
|
||
|
else document.write('<link rel="stylesheet" media="none" onload="this.media=\'all\'" href="https://cdn.yimian.xyz/ushio-js/ushio-js.min.css">');
|
||
5 years ago
|
}
|
||
5 years ago
|
if(typeof block_tips == "undefined"){
|
||
4 years ago
|
document.write('<link rel="stylesheet" media="none" onload="this.media=\'all\'" href="https://cdn.yimian.xyz/ushio-js/ushio-js.tips.min.css">');
|
||
5 years ago
|
}
|
||
5 years ago
|
|
||
5 years ago
|
/* global default page config */
|
||
|
var page = {
|
||
3 years ago
|
version: 'v3.5.1',
|
||
5 years ago
|
url: window.location.href,
|
||
|
title: 'Lovely Ushio',
|
||
|
icon: 'https://cdn.yimian.xyz/img/head/head3r.ico',
|
||
5 years ago
|
path: window.location.pathname,
|
||
5 years ago
|
host: window.location.host,
|
||
|
hostname: window.location.hostname,
|
||
5 years ago
|
session: {},
|
||
4 years ago
|
auth: [],
|
||
4 years ago
|
lang: [],
|
||
|
nolang: [],
|
||
|
tran: {},
|
||
|
group: [],
|
||
4 years ago
|
proj: 'iotcat/ushio',
|
||
3 years ago
|
cache: true,
|
||
|
cacheNameSpace: '__session_cache',
|
||
|
cacheExpireTime: 60*60*1000,
|
||
4 years ago
|
ushio: true,
|
||
|
window: true,
|
||
3 years ago
|
debug: false,
|
||
4 years ago
|
LastWindowOpenTime: new Date().valueOf(),
|
||
5 years ago
|
openTime: Date.parse(new Date()) / 1000,
|
||
|
Timer: 0,
|
||
|
TimerObj: null,
|
||
5 years ago
|
params: function() {
|
||
|
var vars = {};
|
||
|
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&#]*)/gi,
|
||
|
function(m,key,value) {
|
||
|
vars[key] = value;
|
||
|
}
|
||
|
);
|
||
|
return vars;
|
||
|
}(),
|
||
5 years ago
|
copyright: {
|
||
3 years ago
|
year: "© 2018-" + (new Date()).getFullYear(),
|
||
5 years ago
|
name: '<a id="ushio-iotcat" href="https://iotcat.me">iotcat</a>',
|
||
3 years ago
|
full: "© 2018-" + (new Date()).getFullYear() + ' ' + '<a id="ushio-iotcat" href="https://iotcat.me">iotcat</a>'
|
||
5 years ago
|
},
|
||
5 years ago
|
|
||
|
};
|
||
|
|
||
4 years ago
|
/* add listener */
|
||
|
setInterval(function(){
|
||
|
if(window.location.href != page.url){
|
||
|
page.url = window.location.href;
|
||
|
page.path = window.location.pathname;
|
||
|
page.host = window.location.host;
|
||
|
page.hostname = window.location.hostname;
|
||
|
}
|
||
|
}, 500);
|
||
|
|
||
|
|
||
4 years ago
|
/* check cookie */
|
||
|
var _t_ran_cookie = randomStr(16);
|
||
|
cookie.set('_t_ran_cookie', _t_ran_cookie);
|
||
|
if(cookie.get('_t_ran_cookie') != _t_ran_cookie && typeof allow_no_cookie == "undefined"){
|
||
3 years ago
|
if((navigator.language||navigator.userLanguage).substr(0, 2) == 'zh') alert('ÄúµÄä¯ÀÀÆ÷²»Ö§³ÖCookie£¬Ushio·þÎñ½«ÖÐÖ¹..');
|
||
4 years ago
|
else alert('Your browser does not support cookie, Ushio service will quit..');
|
||
4 years ago
|
page.ushio = false;
|
||
|
throw new Error('ushio::Not support cookie!');
|
||
|
}
|
||
|
|
||
|
|
||
|
/* get mask */
|
||
|
if(cookie.get('_mask') && cookie.get('_mask').length == 64){
|
||
|
page.mask = cookie.get('_mask');
|
||
|
}else{
|
||
|
page.mask = randomStr(64);
|
||
|
cookie.set('_mask', page.mask);
|
||
|
}
|
||
|
|
||
|
/* set flag */
|
||
|
page.flag = randomStr(64);
|
||
|
|
||
4 years ago
|
/* Get Pre Language */
|
||
|
if(cookie.get('_lang')){
|
||
|
page.lang = JSON.parse(atob(cookie.get('_lang')));
|
||
|
}else{
|
||
|
page.lang.push((navigator.language||navigator.userLanguage).substr(0, 2));
|
||
|
}
|
||
|
|
||
|
|
||
|
/* translater */
|
||
|
;(function(){
|
||
|
if(typeof lang != "undefined" && lang.length > 0){
|
||
|
var l = lang[0];
|
||
|
for(var i = 0; i < lang.length; i++){
|
||
|
if(page.lang.indexOf(lang[i]) != -1){
|
||
|
l = lang[i];
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
page.tran.setLang = function(l){
|
||
4 years ago
|
if(!l && page.tran.hasOwnProperty('getLang')){
|
||
|
l = page.tran.getLang();
|
||
|
}
|
||
4 years ago
|
lang.forEach(function(item){
|
||
4 years ago
|
$('.\\.'+item).hide();
|
||
4 years ago
|
});
|
||
4 years ago
|
$('.\\.'+l).show();
|
||
4 years ago
|
page.tran.getLang = function(){return l;}
|
||
|
}
|
||
4 years ago
|
page.tran.getLang = function(){return (navigator.language||navigator.userLanguage).substr(0, 2);}
|
||
4 years ago
|
$(function(){
|
||
|
page.tran.setLang(l);
|
||
|
});
|
||
4 years ago
|
}else{
|
||
|
page.tran.setLang = function(){}
|
||
|
page.tran.getLang = function(){return 'zh';}
|
||
4 years ago
|
}
|
||
|
})();
|
||
4 years ago
|
|
||
|
|
||
3 years ago
|
/* session cache */
|
||
|
function getCache(){
|
||
|
let cache = null;
|
||
|
try{
|
||
|
cache = cookie.get(page.cacheNameSpace) || null;
|
||
|
cache = JSON.parse(cache);
|
||
|
if(cache.LastSyncTime < new Date().valueOf() - page.cacheExpireTime){
|
||
|
cache = null;
|
||
|
}else{
|
||
|
if(cache.data.hash){
|
||
|
cache = cache.data;
|
||
|
}else{
|
||
|
throw 'no hash';
|
||
|
}
|
||
|
}
|
||
|
}catch(e){
|
||
|
if(page.debug)console.error('Illegal cache!!', e);
|
||
|
cache = null;
|
||
|
}
|
||
|
return cache;
|
||
|
}
|
||
|
|
||
|
|
||
5 years ago
|
/* session ini */
|
||
3 years ago
|
var session = {
|
||
|
get: function(s){
|
||
|
return page.session.hasOwnProperty(s) && page.session[s];
|
||
|
}
|
||
|
};
|
||
|
session.onload = function(f, enCache, isFirst){
|
||
|
if((enCache&&page.cache&&getCache()) || session.status){
|
||
4 years ago
|
if(isFirst == true){
|
||
|
session_wait(f);
|
||
|
}else{
|
||
|
f();
|
||
|
}
|
||
|
}else{
|
||
3 years ago
|
setTimeout(session.onload, 30, f, enCache, true);
|
||
4 years ago
|
}
|
||
|
}
|
||
|
|
||
5 years ago
|
|
||
5 years ago
|
/* page config merge */
|
||
|
if($('title').length){
|
||
4 years ago
|
page.title = htmlDecode($('title').html());
|
||
5 years ago
|
};
|
||
|
if($('[rel="icon"]').length){
|
||
|
page.icon = $('[rel="icon"]').attr("href");
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
/* page reload */
|
||
4 years ago
|
if(window.location.protocol == 'http:' && window.location.hostname != 'localhost' && window.location.hostname != '127.0.0.1' ){
|
||
5 years ago
|
window.location.href = window.location.href.replace(/^http/,"https");
|
||
|
}
|
||
|
|
||
|
|
||
4 years ago
|
/* css addition */
|
||
|
document.write('\
|
||
|
<style>\
|
||
|
@-webkit-keyframes rotation{\
|
||
|
from {-webkit-transform: rotate(0deg);}\
|
||
|
to {-webkit-transform: rotate(360deg);}\
|
||
|
}\
|
||
|
\
|
||
|
.imgRotate{\
|
||
|
-webkit-transform: rotate(360deg);\
|
||
|
animation: rotation 30s linear infinite;\
|
||
|
-moz-animation: rotation 30s linear infinite;\
|
||
|
-webkit-animation: rotation 30s linear infinite;\
|
||
|
-o-animation: rotation 30s linear infinite;\
|
||
|
}\
|
||
|
</style>\
|
||
|
');
|
||
|
|
||
|
|
||
5 years ago
|
/* Start Timer */
|
||
|
page.TimerObj = setInterval("page.Timer++", 1000);
|
||
|
|
||
|
console.log(page);
|