From 89ec65bf9d044a06fc63a0bb250c0a675ab6b459 Mon Sep 17 00:00:00 2001 From: ohmyga <40896676+ohmyga233@users.noreply.github.com> Date: Sat, 29 Feb 2020 17:15:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E4=BE=A7=E6=A0=8F=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/libs/Api.php | 6 ++++-- static/js/castle.min.js | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/core/libs/Api.php b/core/libs/Api.php index 91fc137..5bd8459 100644 --- a/core/libs/Api.php +++ b/core/libs/Api.php @@ -1,7 +1,7 @@ [ - 'siteName' => Helper::options()->title + 'siteName' => Helper::options()->title, + 'author' => Castle_Libs::getAdminScreenName(), + 'description' => Helper::options()->description ], //Castle Version diff --git a/static/js/castle.min.js b/static/js/castle.min.js index 51fc41e..5d5d728 100644 --- a/static/js/castle.min.js +++ b/static/js/castle.min.js @@ -7,9 +7,9 @@ \_____| \__,_| |___/ \__| |_| \___| ---------------------------------------- * Castle's JavaScript - * Last Update: 2020/02/29 [0.9.0] + * Last Update: 2020/02/29 [0.9.1] * Author: ohmyga (https://ohmyga.cn) * GitHub: https://github.com/ohmyga233/castle-Typecho-Theme/ * LICENSE: GPL V3 (https://www.gnu.org/licenses/gpl-3.0.html) **/ -var $$=mdui.JQ;var CastleData={"firstChild":document.body.firstChild,"date":new Date(),"scrollTop":"","comments":{"replyID":""}};var CastleCreate={BG:function(){var bg=document.createElement("div");bg.setAttribute("id","moe-bg");if(CastleConfig.setting.background.big){bg.style.backgroundImage="url('"+CastleConfig.setting.background.big+"')"};$$('body')[0].insertBefore(bg,CastleData.firstChild);var style=document.createElement("style");style.innerHTML='';if(CastleConfig.setting.background.color){style.innerHTML+='#moe-bg{background-color: '+CastleConfig.setting.background.color+'!important;}'};if(CastleConfig.setting.background.small){style.innerHTML+='@media (max-width: 600px) {#moe-bg{background-image: url(\''+CastleConfig.setting.background.small+'\')!important;}}'};$$('head').append(style)},Search:function(){var search=document.createElement("div");search.setAttribute("id","search-dialog");search.setAttribute("class","mdui-dialog");$$('body').append(search)},Header:function(){var id=$$('#header')[0];id.classList.add('moe-appbar');id.innerHTML='
menu '+CastleConfig.info.siteName+'
search
'},Sidebar:function(){if(CastleConfig.is.login===true){CastleData.login={tooltip:CastleLang.sidebar.toolbar.logout,onclick:'CastleLogin.Logout()',icon:'power_settings_new'}}else{CastleData.login={tooltip:CastleLang.sidebar.toolbar.login,onclick:'CastleLogin.panel()',icon:'account_circle'}};var sidebarToolsBar='';var sidebarToolsBarBox={"box":"","has":""};if(CastleConfig.switch.sidebarToolsBar.settingBtn){sidebarToolsBar+=''}if(CastleConfig.switch.sidebarToolsBar.login){sidebarToolsBar+=''}if(CastleConfig.switch.sidebarToolsBar.darkBtn){sidebarToolsBar+=''}if(!CastleConfig.switch.sidebarToolsBar.settingBtn&&!CastleConfig.switch.sidebarToolsBar.login&&!CastleConfig.switch.sidebarToolsBar.darkBtn){sidebarToolsBarBox.box='';sidebarToolsBarBox.has=''}else{sidebarToolsBarBox.has=' moe-sidebar-toolbar-has';sidebarToolsBarBox.box='
'+sidebarToolsBar+'
'};var id=$$('#sidebar')[0];id.innerHTML='
ohmyga
一只想咸鱼翻身的萌新
'+sidebarToolsBarBox.box;CastleSidebar.menu();var dom=$$('#sidebar ul a');for(let i=0;i'}else{var miibeian=''}footer.innerHTML='
';$$('body').append(footer)},gotoTopBtn:function(){var topBtn=document.createElement("div");topBtn.setAttribute("id","go-top");topBtn.setAttribute('class','mdui-fab mdui-fab-fixed mdui-ripple mdui-fab-hide mdui-color-theme');topBtn.innerHTML='';topBtn.onclick=function(){CastleTop.gotoTop()};$$('body').append(topBtn)}};var CastleSidebar={menu:function(){if(!$$('#sidebar')[0]){return false};if(!CastleConfig.setting.sidebarMenu){return false};var sidebarMenuBox='';var sidebarMenu=CastleConfig.setting.sidebarMenu;for(let countMenu=0;countMenu '+sidebarMenu[countMenu].icon.text+'
'+sidebarMenu[countMenu].name+'
'};if(sidebarMenu[countMenu].type=='archives'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    keyboard_arrow_down
      ';if(sidebarMenu[countMenu].archives){for(let i=0;i';sidebarMenuBox+=sidebarMenu[countMenu].archives[i].date+'   ';if(sidebarMenu[countMenu].setting.number){sidebarMenuBox+=''+sidebarMenu[countMenu].archives[i].count+''};sidebarMenuBox+=''}};sidebarMenuBox+='
  • '};if(sidebarMenu[countMenu].type=='category'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    keyboard_arrow_down
      ';if(sidebarMenu[countMenu].category){for(let i=0;i';sidebarMenuBox+=sidebarMenu[countMenu].category[i].name+'   ';if(sidebarMenu[countMenu].setting.number){sidebarMenuBox+=''+sidebarMenu[countMenu].category[i].count+''};sidebarMenuBox+=''}};sidebarMenuBox+='
  • '};if(sidebarMenu[countMenu].type=='pages'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    keyboard_arrow_down
      ';if(sidebarMenu[countMenu].pages){for(let i=0;i'+sidebarMenu[countMenu].pages[i].name+''}};sidebarMenuBox+='
  • '};if(sidebarMenu[countMenu].type=='divider'){sidebarMenuBox+='
    '};if(sidebarMenu[countMenu].type=='RssLink'){if(sidebarMenu[countMenu].setting.target){var targetBlank=' target="_blank" '}else{var targetBlank=' target="_blank" '};sidebarMenuBox+=' '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    '};if(sidebarMenu[countMenu].type=='TotalPost'||sidebarMenu[countMenu].type=='TotalComments'||sidebarMenu[countMenu].type=='TotalPage'||sidebarMenu[countMenu].type=='TotalCategory'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].name+'
    '+sidebarMenu[countMenu].count+'
  • '}};$$('#sidebar ul.mdui-list')[0].innerHTML+=sidebarMenuBox}};var CastleSearch={submit:function(input){if(input){var input=input}else{var input=$$('#search-dialog #searchInput')};if(!input.val()){mdui.snackbar({message:CastleLang.search.empty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};new mdui.Dialog('#search-dialog').close();if(CastleConfig.switch.pjax){pjax.loadUrl(CastleConfig.url.index+'/search/'+input.val())}else{window.location.href=CastleConfig.url.index+'/search/'+input.val()}},dialog:function(){var dialog=$$('#search-dialog')[0];if($$('#search-dialog').html()){return};dialog.innerHTML='
    search
    '}};var CastleNight={check:function(){function dark(){$$('body')[0].classList.add('mdui-theme-layout-dark');if(CastleConfig.switch.sidebarToolsBar.darkBtn){window.onload=function(){var btn=$$('#night-btn')[0];btn.classList.add('moe-night-btn-rotate360');$$('#night-btn i')[0].innerHTML='brightness_high';$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.light+"', position: 'top'}")}}};function light(){$$('body')[0].classList.remove('mdui-theme-layout-dark');if(CastleConfig.switch.sidebarToolsBar.darkBtn){window.onload=function(){var btn=$$('#night-btn')[0];btn.classList.remove('moe-night-btn-rotate360');$$('#night-btn i')[0].innerHTML='brightness_4';$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.dark+"', position: 'top'}")}}};if(CastleLibs.getCookie('nightSwitch')){if(CastleLibs.getCookie('nightSwitch')=='true'){dark()};if(CastleLibs.getCookie('nightSwitch')=='false'){light()};return false};if(CastleConfig.switch.dark.scheme){var schemeGeter=window.matchMedia("(prefers-color-scheme: dark)");schemeGeter.addListener(function(scheme){if(scheme.matches){dark()}else if(window.matchMedia("(prefers-color-scheme: light)").matches){light()}});if(schemeGeter.matches){dark();return false}};if(CastleConfig.switch.dark.default=='dark'){dark();return false}else if(CastleConfig.switch.dark.default=='light'){light();return false}},toggle:function(){var status=$$('body').hasClass('mdui-theme-layout-dark');if(status){this.close()}else{this.open()}},open:function(){var id=$$('body')[0];if(CastleConfig.switch.sidebarToolsBar.darkBtn){var btn=$$('#night-btn')[0];$$('#night-btn').attr('disabled',true);btn.classList.add('moe-night-btn-rotate360');$$('#night-btn').attr('mdui-tooltip',"")};CastleLibs.setCookie('nightSwitch',true,30,'/');new mdui.Tooltip('#sidebar .moe-sidebar-toolbar #night-btn').close();setTimeout(function(){id.classList.add('mdui-theme-layout-dark');mdui.snackbar({message:CastleLang.sidebar.dark.dark,position:'right-bottom',onOpen:function(){var snackbar=document.querySelector('.mdui-snackbar');snackbar.classList.add('mdui-color-blue-600')}});if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn').removeAttr("disabled");$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.light+"', position: 'top'}")}},310);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn i')[0].innerHTML='brightness_high'}},330);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){new mdui.Drawer('#sidebar').close()}},400)},close:function(){var id=$$('body')[0];if(CastleConfig.switch.sidebarToolsBar.darkBtn){var btn=$$('#night-btn')[0];$$('#night-btn').attr('disabled',true);btn.classList.remove('moe-night-btn-rotate360');$$('#night-btn').attr('mdui-tooltip',"")};CastleLibs.setCookie('nightSwitch',false,false,'/');new mdui.Tooltip('#sidebar .moe-sidebar-toolbar #night-btn').close();setTimeout(function(){id.classList.remove('mdui-theme-layout-dark');mdui.snackbar({message:CastleLang.sidebar.dark.light,position:'right-bottom'});if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn').removeAttr("disabled");$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.dark+"', position: 'top'}")}},310);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn i')[0].innerHTML='brightness_4'}},330);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){new mdui.Drawer('#sidebar').close()}},400)}};var CastleSetting={panel:function(){if(!CastleConfig.switch.sidebarToolsBar.settingBtn){mdui.alert('别试了,并没有启用设置面板功能 ( ̄_ ̄|||)','提示');return false}new mdui.Drawer('#sidebar').close();mdui.alert(CastleLang.sidebar.setting.content,CastleLang.sidebar.setting.title)}};var CastleLogin={panel:function(){if(!CastleConfig.switch.sidebarToolsBar.login){mdui.alert('别试了,并没有启用前台登录功能 ( ̄_ ̄|||)','提示');return false};new mdui.Drawer('#sidebar').close();if($$('#login-btn').data('loginStatus')=='true'){mdui.alert(CastleLang.sidebar.login.login.logined,CastleLang.tips.tips);return false};var loginStyle='';if(CastleConfig.setting.login.background){loginStyle+='background-image: url(\''+CastleConfig.setting.login.background+'\');'};if(CastleConfig.setting.login.backgroundColor){loginStyle+='background-color: '+CastleConfig.setting.login.background+';'};var content=' ';mdui.dialog({content:content,modal:true,history:false,closeOnEsc:false,cssClass:'moe-login mdui-shadow-10',onOpen:function(init){$$('.moe-login').attr('id','moe-login');CastleData.LoginDialog=init}})},loginSubmit:function(){if(!CastleConfig.switch.sidebarToolsBar.login){mdui.alert('别试了,并没有启用前台登录功能 ( ̄_ ̄|||)','提示');return false};var username=$$('#loginForm #name').val();var password=$$('#loginForm #password').val();if(!username||!password){return false}var loadBtn=$$('#loginForm .moe-login-submit .moe-login-loadBtn');var submitBtn=$$('#loginForm .moe-login-submit .moe-login-submitBtn');submitBtn.attr('disabled','true');loadBtn[0].classList.add('moe-login-loadBtn-display');$$.ajax({method:'POST',url:CastleConfig.url.login,data:$$('#loginForm').serialize(),success:function(data){var data=JSON.parse(data);if(data.status=='error'&&data.status!='ok'){submitBtn.removeAttr("disabled");loadBtn[0].classList.remove('moe-login-loadBtn-display');mdui.snackbar({message:data.error,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}else if(data.status=='ok'){$$('#login-btn').attr('data-loginStatus',"true");$$('#login-btn').attr('onclick',"CastleLogin.Logout()");$$('#login-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.logout+"', position: 'top'}");$$('#login-btn i')[0].innerHTML='power_settings_new';CastleData.LoginDialog.close();loadBtn[0].classList.remove('moe-login-loadBtn-display');if(data.loginStatus===true){data.msg=CastleLang.sidebar.login.login.success;data.color='mdui-color-green-600';if(CastleConfig.switch.pjax){pjax.loadUrl(window.location.href)}else{CastleLibs.reload()}}else{data.msg=CastleLang.sidebar.login.login.logined;data.color='mdui-color-red-400'}mdui.snackbar({message:data.msg,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add(data.color)}})}else{submitBtn.removeAttr("disabled");loadBtn[0].classList.remove('moe-login-loadBtn-display');mdui.snackbar({message:CastleLang.tips.unknown,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}},error:function(xhr,status,error){mdui.snackbar({message:CastleLang.tips.error+'(HTTP '+xhr.status+')',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});submitBtn.removeAttr("disabled");loadBtn[0].classList.remove('moe-login-loadBtn-display')}})},Logout:function(){if(!CastleConfig.switch.sidebarToolsBar.login){mdui.alert('别试了,并没有启用前台登录功能 ( ̄_ ̄|||)','提示');return false};new mdui.Drawer('#sidebar').close();var LoginBtn=$$('#login-btn');LoginBtn.attr('disabled','true');$$.ajax({method:'GET',url:CastleConfig.url.logout,success:function(data){var data=JSON.parse(data);if(data.status=='ok'&&data.logout===true){mdui.alert(CastleLang.sidebar.login.logout.content.logout,CastleLang.sidebar.login.logout.title,function(){if(CastleConfig.switch.pjax){pjax.loadUrl(window.location.href)}else{CastleLibs.reload()}});LoginBtn.attr('data-loginStatus',"false")}else{mdui.alert(data.msg,CastleLang.sidebar.login.logout.title)}LoginBtn.removeAttr('disabled');LoginBtn.attr('onclick',"CastleLogin.panel()");LoginBtn.attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.login+"', position: 'top'}");$$('#login-btn i')[0].innerHTML='account_circle'},error:function(xhr,status,error){mdui.alert(CastleLang.tips.error+'(HTTP '+xhr.status+')',CastleLang.sidebar.login.logout.title);LoginBtn.removeAttr('disabled','true')}})}};var CastlePost={toolbar:function(){if(!$$('.moe-post-card')[0]){this.barColor('remove');return false}var width=document.body.scrollWidth;var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;if(width<=600&&scrollTop>260){if(!$$('#header').hasClass('moe-appbar')){return false}this.barColor('add');this.barTitle('add')}else{if($$('#header').hasClass('moe-appbar')){return false}this.barColor('remove');this.barTitle('remove')}},barColor:function(method){if(method=='add'){$$('#header')[0].classList.remove('moe-appbar');$$('#header .mdui-toolbar')[0].classList.add('mdui-color-theme')}else{$$('#header')[0].classList.add('moe-appbar');$$('#header .mdui-toolbar')[0].classList.remove('mdui-color-theme')}},barTitle:function(method){var bar=$$('#header .mdui-toolbar .mdui-typo-title');var title=$$('.moe-post-card .mdui-card-media .mdui-card-primary .mdui-card-primary-title');if(method=='add'){bar.html(title.html());bar.removeAttr('href');bar[0].onclick=function(){CastleTop.gotoTop()}}else{bar.html(CastleConfig.info.siteName);bar.attr('href',CastleConfig.url.site);bar[0].onclick=''}},Lazyload:function(){var lazyload=new LazyLoad({threshold:0,elements_selector:'.lazyload'})},baguetteBox:function(){baguetteBox.run('[data-baguettebox="photo"]',{noScrollbars:true})},showIndexPostTitle:function(){if(!$$('#moe-post-list')[0]){return false}function regTitle(title){var otitle=CastleLang.index.FloatingTitle;return otitle.replace(/%s/,title)}var title=$$('#moe-post-list .moe-default-card .mdui-card-primary .mdui-card-primary-title');for(let i=0;i '},submitPassword:function(){if(!$$('form.protected')[0]){return false}if(!$$('form.protected #protectPassword').val()){mdui.snackbar({message:CastleLang.post.hidden.empty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false}$$.ajax({method:'POST',data:$$('form.protected').serialize(),url:$$('form.protected').attr('action'),success:function(data){var Obj=$$(document.createElement('body')).append(data);if($$(Obj)[0].querySelector('.container')==null){mdui.snackbar({message:CastleLang.post.hidden.success,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-green-600')}});if(CastleConfig.switch.pjax){pjax.loadUrl(window.location.href)}else{CastleLibs.reload()}}else{mdui.snackbar({message:CastleLang.post.hidden.error+'['+$$(Obj)[0].querySelector('.container').innerHTML+']',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}}})},delPost:function(obj,title,post){var postLang=(post)?CastleLang.post.delete:CastleLang.page.delete;mdui.dialog({title:postLang.tips.title,content:postLang.tips.content.replace(/%s/,title),buttons:[{text:postLang.tips.cancel,onClick:function(){return false}},{text:postLang.tips.confirm,onClick:function(){mdui.dialog({title:postLang.warning.title,content:postLang.warning.content.small.replace(/%s/,title)+'
    '+postLang.warning.content.big+'',buttons:[{text:postLang.warning.cancel,onClick:function(){return false}},{text:postLang.warning.confirm,onClick:function(){window.location.href=$$(obj).data('delUrl')}}],history:false})}}],history:false})}};var CastleOwO={toggle:function(){if(!$$('#comment-card-box')[0]){return false};if(!$$('#owoBox')[0]){this.create()};if($$('#owoBox').hasClass('moe-owo-open')){this.close();return true}else{this.open();return true}},open:function(){if(!$$('#owoBox')[0]){return false};$$('#owoBox')[0].style.display='block';$$('body').addClass('mdui-locked');$$('#moe-owo-overlay')[0].style.display='block';setTimeout(function(){$$('#owoBox')[0].classList.add('moe-owo-open');$$('#moe-owo-overlay')[0].classList.add('moe-owo-overlay-open')},10)},close:function(){if(!$$('#owoBox')[0]){return false};$$('#moe-owo-overlay')[0].classList.remove('moe-owo-overlay-open');$$('#owoBox')[0].classList.remove('moe-owo-open');setTimeout(function(){$$('#owoBox')[0].style.display='none';$$('#moe-owo-overlay')[0].style.display='none';$$('body').removeClass('mdui-locked')},310)},create:function(){if($$('#owoBox')[0]){return false};var owoTmps={owo:'',tab:''};var owoBox=document.createElement("div");owoBox.style.display='none';owoBox.setAttribute('id','owoBox');owoBox.classList.add('mdui-shadow-10');owoBox.innerHTML+='
    tag_faces
    ';var owoList=CastleConfig.setting.owoList;for(let owoNum=0;owoNum';if(owoList[owoNum].content){for(let i=0;i'+owoList[owoNum].content[i].text+''}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='';owoTmps.tab+=''+owoList[owoNum].name+''};if(owoList[owoNum].type=='emoji'){owoTmps.owo+='
    ';if(owoList[owoNum].content){for(let i=0;i'+owoList[owoNum].content[i].text+''}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='
    ';owoTmps.tab+=''+owoList[owoNum].name+''};if(owoList[owoNum].type=='smallPicture'){owoTmps.owo+='
    ';if(owoList[owoNum].content){for(let i=0;i '}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='
    ';owoTmps.tab+=''+owoList[owoNum].name+''};if(owoList[owoNum].type=='picture'){owoTmps.owo+='
    ';if(owoList[owoNum].content){for(let i=0;i '}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='
    ';owoTmps.tab+=''+owoList[owoNum].name+''}};owoBox.innerHTML+='
    '+owoTmps.owo+'
    ';owoBox.innerHTML+='
    '+owoTmps.tab+'
    ';$$('body').append(owoBox);mdui.mutation($$('#owoBox'));this.bindOwO();var owoOverlay=document.createElement("div");owoOverlay.style.display='none';owoOverlay.setAttribute('id','moe-owo-overlay');owoOverlay.onclick=function(){CastleOwO.toggle()};$$('body').append(owoOverlay)},bindOwO:function(){if(!$$('#owoBox main.moe-owo-main a')[0]){return false};for(let owoNum=0;owoNum<$$('#owoBox main.moe-owo-main a').length;++owoNum){if($$('#owoBox main.moe-owo-main a')[owoNum].dataset.owo){$$('#owoBox main.moe-owo-main a')[owoNum].onclick=function(){CastleOwO.grin($$('#owoBox main.moe-owo-main a')[owoNum].dataset.owo);CastleOwO.toggle()}}}},grin:function(tag){tag=' '+tag+' ';myField=$$('#comment-card-box .moe-comment-input-text #text')[0];document.selection?(myField.focus(),sel=document.selection.createRange(),sel.text=tag,myField.focus()):this.insertTag(tag)},insertTag:function(tag){myField=$$('#comment-card-box .moe-comment-input-text #text')[0];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())}};var CastleComments={Core:function(){var commentID=$$('.respondID').attr('id');window.TypechoComment={dom:function(id){return document.getElementById(id)},create:function(tag,attr){var el=document.createElement(tag);for(var key in attr){el.setAttribute(key,attr[key])}return el},reply:function(cid,coid){$$("#comment-card-box").addClass('moe-comment-card-opaque');var comment=$$('#'+cid+' main')[0],parent=comment.parentNode,response=this.dom(commentID),input=this.dom('comment-parent'),form='form'==response.tagName?response:response.getElementsByTagName('form')[0],textarea=response.getElementsByTagName('textarea')[0];if(null==input){input=this.create('input',{'type':'hidden','name':'parent','id':'comment-parent'});form.appendChild(input)}input.setAttribute('value',coid);if(null==this.dom('comment-form-place-holder')){var holder=this.create('div',{'id':'comment-form-place-holder'});response.parentNode.insertBefore(holder,response)}last=CastleComments.getLastComment();if(last==null){comment.appendChild(response)}else if(last.id==cid){$$("#comments")[0].appendChild(response)}else{comment.appendChild(response)}this.dom('cancel-comment-reply-link').style.display='';if(null!=textarea&&'text'==textarea.name){textarea.focus()}return false},cancelReply:function(){$$("#comment-card-box").removeClass('moe-comment-card-opaque');var response=this.dom(commentID),holder=this.dom('comment-form-place-holder'),input=this.dom('comment-parent');if(null!=input){input.parentNode.removeChild(input)}if(null==holder){return true}this.dom('cancel-comment-reply-link').style.display='none';holder.parentNode.insertBefore(response,holder);return false}}},getLastComment:function(){firstNodeList=$$(".moe-comments-list-box > div");if(firstNodeList.length==0){return null}firstNode=firstNodeList[firstNodeList.length-1];return CastleComments.checkLast(firstNode)},checkLast:function(node){next=$$(node).next();if(next[0]==null){return node}if(next.hasClass("moe-comments-list-box")==false){return node}nextNodeList=next.children(".moe-comments-box");nextNode=nextNodeList[nextNodeList.length-1];return CastleComments.checkLast(nextNode)},showLinkInput:function(){if(!$$('.moe-comment-card-content .moe-comment-input-url')[0]){return false}var link=$$('.moe-comment-card-content .moe-comment-input-url');if(link.hasClass('moe-comment-input-url-hidden')){link[0].classList.remove('moe-comment-input-url-hidden')}else{link[0].classList.add('moe-comment-input-url-hidden')}},headimgAJAX:function(){if(!$$(".moe-comment-card-content #email")[0]){return false}$$(".moe-comment-card-content #email")[0].onblur=function(){if(!$$(this).val()){return false}else{$$('#moe-comment-author-avatar')[0].innerHTML='
    ';mdui.mutation($$('#moe-comment-author-avatar'))};$$.ajax({method:'GET',url:CastleConfig.url.index,data:{action:'ajax_get_avatar',form:window.location.host,email:$$(this).val()},success:function(data){if(!data){return false}$$('#moe-comment-author-avatar')[0].innerHTML=''},error:function(xhr,status,error){mdui.snackbar({message:'请求失败,请检查网络是否正常',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}})}},submitComment:function(){if(!$$('.respondID').attr('data-commentUrl')){return false};if(!$$('.moe-comment-card-content #text').val()){mdui.snackbar({message:CastleLang.comment.MsgEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};if($$('.moe-comment-input-username #author').length&&!$$('.moe-comment-input-username #author').val()){mdui.snackbar({message:CastleLang.comment.AuthorEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};if($$('.moe-comment-input-email #email').length&&!$$('.moe-comment-input-email #email').val()&&CastleConfig.switch.comment.email){mdui.snackbar({message:CastleLang.comment.EmailEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};if($$('.moe-comment-input-url #url').length&&!$$('.moe-comment-input-url #url').val()&&CastleConfig.switch.comment.link){mdui.snackbar({message:CastleLang.comment.UrlEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});if($$('.moe-comment-card-content .moe-comment-input-url').hasClass('moe-comment-input-url-hidden')){$$('.moe-comment-card-content .moe-comment-input-url')[0].classList.remove('moe-comment-input-url-hidden')}return false};function beforeComment(){$$('#submitCommentBtn').attr('disabled',true);$$(".mdui-tooltip").removeClass("mdui-tooltip-open");$$('#submitCommentBtn i').html('cached');$$('#submitCommentBtn i').addClass('moe-rotate360deg-infinite')};beforeComment();function afterComment(status){$$('#submitCommentBtn').removeAttr('disabled');$$('#submitCommentBtn i').removeClass('moe-rotate360deg-infinite');if(status){$$('#submitCommentBtn i').html('send');CastleData.comments.replyTo='';$$('.moe-comment-input-text #text').val('');$$('.moe-comment-input-text #text')[0].focus();$$('.moe-comment-input-text #text')[0].blur();CastleLibs.scrollClick()}else{$$('#submitCommentBtn i').html('warning');setTimeout(function(){$$('#submitCommentBtn i').html('send')},1200)}CastleComments.bindReplyBtn()};$$.ajax({method:'POST',url:$$('.respondID').attr('data-commentUrl'),data:$$('.moe-comment-card-content').serialize(),success:function(data){var Obj=$$(document.createElement('body')).append(data);if($$(Obj)[0].querySelector('.container')==null){var $htmlData=$$(document.createElement('body')).append(data);if($htmlData.html()){CastleData.comments.NewID=$htmlData.html().match(/id=\"?comment-\d+/g).join().match(/\d+/g).sort(function(a,b){return a-b}).pop()}else{mdui.snackbar({message:CastleLang.comment.refresh,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});afterComment(false);return false};if(''===CastleData.comments.replyTo){if(!$$('#comments > .moe-comments-list-box > .moe-comments-box').length){CastleData.comments.newComment=$htmlData[0].querySelectorAll('#comment-'+CastleData.comments.NewID);$$('.moe-comments-list-header').after('
    ');$$('.moe-comments-list-box').first().prepend(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein')}else if($$('.prev').length){$$('.moe-comments-page-navigator li a').eq(1)[0].click()}else{CastleData.comments.newComment=$htmlData[0].querySelectorAll('#comment-'+CastleData.comments.NewID);$$('.moe-comments-list-box').first().prepend(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein')}}else{CastleData.comments.newComment=$htmlData[0].querySelectorAll('#comment-'+CastleData.comments.NewID);if($$('#'+CastleData.comments.replyTo).find('.moe-comment-children').length){$$('#'+CastleData.comments.replyTo+' .moe-comment-children .moe-comments-list-box').first().append(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein');TypechoComment.cancelReply();CastleTop.scrollSmoothTo($$('#comment-'+CastleData.comments.NewID).offset().top)}else{$$('#'+CastleData.comments.replyTo).append('
    ');$$('#'+CastleData.comments.replyTo+' .moe-comment-children .moe-comments-list-box').first().prepend(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein');TypechoComment.cancelReply();CastleTop.scrollSmoothTo($$('#comment-'+CastleData.comments.NewID).offset().top)}};if($$('.moe-comments-list-number span').text()==null){$$('.moe-comments-list-number').html(CastleLang.comment.have.replace(/%s/,'1'))}else{var counts=parseInt($$('.moe-comments-list-number span').text());$$('.moe-comments-list-number span').html($$('.moe-comments-list-number span').html().replace(/\d+/,counts+1))};afterComment(true);if($$('#comment-'+CastleData.comments.NewID+' .moe-comments-time span')[0]){CastleData.comments.message=CastleLang.comment.pending;CastleData.comments.messageColor='mdui-color-deep-orange-600'}else{CastleData.comments.message=CastleLang.comment.success;CastleData.comments.messageColor='mdui-color-teal-500'};mdui.snackbar({message:CastleData.comments.message,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add(CastleData.comments.messageColor)}})}else{mdui.snackbar({message:'评论失败!
    原因:['+$$(Obj)[0].querySelector('.container').innerHTML+']',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});afterComment(false)}},error:function(xhr,status,error){mdui.snackbar({message:'评论提交失败!
    原因 [HTTP '+xhr.status+']',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});afterComment(false)}})},bindReplyBtn:function(){if(!$$('#comments')[0]){return false}CastleData.comments.replyTo='';for(let i=0;i<$$(".moe-comments-reply a").length;++i){$$(".moe-comments-reply a")[i].addEventListener('click',function(){CastleData.comments.replyTo=$$(this).parent().parent().parent().parent().attr("id")})};$$(".moe-comment-card-btns a")[0].addEventListener('click',function(){CastleData.comments.replyTo=''})}};var CastleLibs={getCookie:function(name){var name=name+"=";var ca=document.cookie.split(';');for(var i=0;i300&&bottomHeight>100){this.topBtn('display')}else{this.topBtn('hidden')}},topBtn:function(method){if(method=='hidden'){$$('#go-top')[0].classList.add('mdui-fab-hide')}else{$$('#go-top')[0].classList.remove('mdui-fab-hide')}},gotoTop:function(speed,rtime){rtime=rtime||10;speed=speed||0.08;var x2=0,y2=0,x3=0,y3=0;var y1=document.documentElement.scrollTop||document.body.scrollTop||window.pageYOffset||0;var x1=document.documentElement.scrollLeft||document.body.scrollLeft||window.pageXOffset||0;var x3=window.scrollX||0;var y3=window.scrollY||0;var x=Math.max(x1,Math.max(x2,x3));var y=Math.max(y1,Math.max(y2,y3));var speeding=1+speed;window.scrollTo(Math.floor(x/speeding),Math.floor(y/speeding));if(x>0||y>0){var run="CastleTop.gotoTop("+speed+", "+rtime+")";window.setTimeout(run,rtime)}},scrollSmoothTo:function(position){if(!window.requestAnimationFrame){window.requestAnimationFrame=function(callback,element){return setTimeout(callback,17)}}var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;var step=function(){var distance=position-scrollTop;scrollTop=scrollTop+distance/20;if(Math.abs(distance)<1){window.scrollTo(0,position)}else{window.scrollTo(0,scrollTop);requestAnimationFrame(step)}};step()}};CastleCreate.BG();CastleNight.check();CastleCreate.Search();CastleCreate.Sidebar();CastleCreate.Header();CastleCreate.Footer();CastleCreate.gotoTopBtn();if(CastleConfig.switch.pjax){CastleLibs.scrollPos()};needReload=function(){CastleComments.Core();CastleLibs.linkTarget();CastleComments.headimgAJAX();CastleComments.bindReplyBtn();CastleLibs.scrollClick();CastlePost.Lazyload();CastlePost.baguetteBox();CastlePost.toolbar();CastlePost.showIndexPostTitle();CastlePost.modifyPasswordStyle()};needReload();document.onscroll=function(){CastlePost.toolbar();CastleTop.gotoTopBtn()};window.onresize=function(){CastlePost.toolbar()};if(CastleConfig.switch.pjax){var pjax=new Pjax({elements:'a[href^="'+document.location.protocol+'//'+window.location.host+'/"]:not([target="_blank"]):not([no-pjax])',selectors:["title","#moe-pjax-content"],timeout:PjaxConfig.timeout,cacheBust:false,scrollRestoration:true});document.addEventListener('pjax:send',function(){NProgress.start();CastleData.scrollTop=document.documentElement.scrollTop||document.body.scrollTop||window.pageYOffset||0});document.addEventListener('pjax:success',function(){mdui.mutation();needReload();CastleLibs.rmToolTip()});document.addEventListener('pjax:complete',function(){NProgress.done();CastlePost.barTitle('remove');PjaxConfig.after()});document.addEventListener('pjax:error',function(){mdui.snackbar({message:CastleLang.pjax.error,position:'right-bottom',onOpen:function(){var snackbar=document.querySelector('.mdui-snackbar');snackbar.classList.add('mdui-color-red-400')}})})};console.log(" %c \u2728\u0020\u0043\u0061\u0073\u0074\u006c\u0065 "+CastleConfig.CastleVersion+" %c \u0042\u0079\u0020\u006f\u0068\u006d\u0079\u0067\u0061\u0020\u007c\u0020\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u006f\u0068\u006d\u0079\u0067\u0061\u002e\u0063\u006e\u002f ","color: #FFFFFF; background: #1E88E5; padding:6px;","color: #FFFFFF; background: #424242; padding:6px;"); \ No newline at end of file +var $$=mdui.JQ;var CastleData={"firstChild":document.body.firstChild,"date":new Date(),"scrollTop":"","comments":{"replyID":""}};var CastleCreate={BG:function(){var bg=document.createElement("div");bg.setAttribute("id","moe-bg");if(CastleConfig.setting.background.big){bg.style.backgroundImage="url('"+CastleConfig.setting.background.big+"')"};$$('body')[0].insertBefore(bg,CastleData.firstChild);var style=document.createElement("style");style.innerHTML='';if(CastleConfig.setting.background.color){style.innerHTML+='#moe-bg{background-color: '+CastleConfig.setting.background.color+'!important;}'};if(CastleConfig.setting.background.small){style.innerHTML+='@media (max-width: 600px) {#moe-bg{background-image: url(\''+CastleConfig.setting.background.small+'\')!important;}}'};$$('head').append(style)},Search:function(){var search=document.createElement("div");search.setAttribute("id","search-dialog");search.setAttribute("class","mdui-dialog");$$('body').append(search)},Header:function(){var id=$$('#header')[0];id.classList.add('moe-appbar');id.innerHTML=''},Sidebar:function(){if(CastleConfig.is.login===true){CastleData.login={tooltip:CastleLang.sidebar.toolbar.logout,onclick:'CastleLogin.Logout()',icon:'power_settings_new'}}else{CastleData.login={tooltip:CastleLang.sidebar.toolbar.login,onclick:'CastleLogin.panel()',icon:'account_circle'}};var sidebarToolsBar='';var sidebarToolsBarBox={"box":"","has":""};if(CastleConfig.switch.sidebarToolsBar.settingBtn){sidebarToolsBar+=''}if(CastleConfig.switch.sidebarToolsBar.login){sidebarToolsBar+=''}if(CastleConfig.switch.sidebarToolsBar.darkBtn){sidebarToolsBar+=''}if(!CastleConfig.switch.sidebarToolsBar.settingBtn&&!CastleConfig.switch.sidebarToolsBar.login&&!CastleConfig.switch.sidebarToolsBar.darkBtn){sidebarToolsBarBox.box='';sidebarToolsBarBox.has=''}else{sidebarToolsBarBox.has=' moe-sidebar-toolbar-has';sidebarToolsBarBox.box='
    '+sidebarToolsBar+'
    '};var id=$$('#sidebar')[0];id.innerHTML='
    '+CastleConfig.info.author+'
    '+CastleConfig.info.description+'
    '+sidebarToolsBarBox.box;CastleSidebar.menu();var dom=$$('#sidebar ul a');for(let i=0;i'}else{var miibeian=''}footer.innerHTML='
    ';$$('body').append(footer)},gotoTopBtn:function(){var topBtn=document.createElement("div");topBtn.setAttribute("id","go-top");topBtn.setAttribute('class','mdui-fab mdui-fab-fixed mdui-ripple mdui-fab-hide mdui-color-theme');topBtn.innerHTML='';topBtn.onclick=function(){CastleTop.gotoTop()};$$('body').append(topBtn)}};var CastleSidebar={menu:function(){if(!$$('#sidebar')[0]){return false};if(!CastleConfig.setting.sidebarMenu){return false};var sidebarMenuBox='';var sidebarMenu=CastleConfig.setting.sidebarMenu;for(let countMenu=0;countMenu '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    '};if(sidebarMenu[countMenu].type=='archives'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    keyboard_arrow_down
      ';if(sidebarMenu[countMenu].archives){for(let i=0;i';sidebarMenuBox+=sidebarMenu[countMenu].archives[i].date+'   ';if(sidebarMenu[countMenu].setting.number){sidebarMenuBox+=''+sidebarMenu[countMenu].archives[i].count+''};sidebarMenuBox+=''}};sidebarMenuBox+='
  • '};if(sidebarMenu[countMenu].type=='category'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    keyboard_arrow_down
      ';if(sidebarMenu[countMenu].category){for(let i=0;i';sidebarMenuBox+=sidebarMenu[countMenu].category[i].name+'   ';if(sidebarMenu[countMenu].setting.number){sidebarMenuBox+=''+sidebarMenu[countMenu].category[i].count+''};sidebarMenuBox+=''}};sidebarMenuBox+='
  • '};if(sidebarMenu[countMenu].type=='pages'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    keyboard_arrow_down
      ';if(sidebarMenu[countMenu].pages){for(let i=0;i'+sidebarMenu[countMenu].pages[i].name+''}};sidebarMenuBox+='
  • '};if(sidebarMenu[countMenu].type=='divider'){sidebarMenuBox+='
    '};if(sidebarMenu[countMenu].type=='RssLink'){if(sidebarMenu[countMenu].setting.target){var targetBlank=' target="_blank" '}else{var targetBlank=' target="_blank" '};sidebarMenuBox+=' '+sidebarMenu[countMenu].icon.text+'
    '+sidebarMenu[countMenu].name+'
    '};if(sidebarMenu[countMenu].type=='TotalPost'||sidebarMenu[countMenu].type=='TotalComments'||sidebarMenu[countMenu].type=='TotalPage'||sidebarMenu[countMenu].type=='TotalCategory'){sidebarMenuBox+='
  • '+sidebarMenu[countMenu].name+'
    '+sidebarMenu[countMenu].count+'
  • '}};$$('#sidebar ul.mdui-list')[0].innerHTML+=sidebarMenuBox}};var CastleSearch={submit:function(input){if(input){var input=input}else{var input=$$('#search-dialog #searchInput')};if(!input.val()){mdui.snackbar({message:CastleLang.search.empty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};new mdui.Dialog('#search-dialog').close();if(CastleConfig.switch.pjax){pjax.loadUrl(CastleConfig.url.index+'/search/'+input.val())}else{window.location.href=CastleConfig.url.index+'/search/'+input.val()}},dialog:function(){var dialog=$$('#search-dialog')[0];if($$('#search-dialog').html()){return};dialog.innerHTML='
    search
    '}};var CastleNight={check:function(){function dark(){$$('body')[0].classList.add('mdui-theme-layout-dark');if(CastleConfig.switch.sidebarToolsBar.darkBtn){window.onload=function(){var btn=$$('#night-btn')[0];btn.classList.add('moe-night-btn-rotate360');$$('#night-btn i')[0].innerHTML='brightness_high';$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.light+"', position: 'top'}")}}};function light(){$$('body')[0].classList.remove('mdui-theme-layout-dark');if(CastleConfig.switch.sidebarToolsBar.darkBtn){window.onload=function(){var btn=$$('#night-btn')[0];btn.classList.remove('moe-night-btn-rotate360');$$('#night-btn i')[0].innerHTML='brightness_4';$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.dark+"', position: 'top'}")}}};if(CastleLibs.getCookie('nightSwitch')){if(CastleLibs.getCookie('nightSwitch')=='true'){dark()};if(CastleLibs.getCookie('nightSwitch')=='false'){light()};return false};if(CastleConfig.switch.dark.scheme){var schemeGeter=window.matchMedia("(prefers-color-scheme: dark)");schemeGeter.addListener(function(scheme){if(scheme.matches){dark()}else if(window.matchMedia("(prefers-color-scheme: light)").matches){light()}});if(schemeGeter.matches){dark();return false}};if(CastleConfig.switch.dark.default=='dark'){dark();return false}else if(CastleConfig.switch.dark.default=='light'){light();return false}},toggle:function(){var status=$$('body').hasClass('mdui-theme-layout-dark');if(status){this.close()}else{this.open()}},open:function(){var id=$$('body')[0];if(CastleConfig.switch.sidebarToolsBar.darkBtn){var btn=$$('#night-btn')[0];$$('#night-btn').attr('disabled',true);btn.classList.add('moe-night-btn-rotate360');$$('#night-btn').attr('mdui-tooltip',"")};CastleLibs.setCookie('nightSwitch',true,30,'/');new mdui.Tooltip('#sidebar .moe-sidebar-toolbar #night-btn').close();setTimeout(function(){id.classList.add('mdui-theme-layout-dark');mdui.snackbar({message:CastleLang.sidebar.dark.dark,position:'right-bottom',onOpen:function(){var snackbar=document.querySelector('.mdui-snackbar');snackbar.classList.add('mdui-color-blue-600')}});if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn').removeAttr("disabled");$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.light+"', position: 'top'}")}},310);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn i')[0].innerHTML='brightness_high'}},330);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){new mdui.Drawer('#sidebar').close()}},400)},close:function(){var id=$$('body')[0];if(CastleConfig.switch.sidebarToolsBar.darkBtn){var btn=$$('#night-btn')[0];$$('#night-btn').attr('disabled',true);btn.classList.remove('moe-night-btn-rotate360');$$('#night-btn').attr('mdui-tooltip',"")};CastleLibs.setCookie('nightSwitch',false,false,'/');new mdui.Tooltip('#sidebar .moe-sidebar-toolbar #night-btn').close();setTimeout(function(){id.classList.remove('mdui-theme-layout-dark');mdui.snackbar({message:CastleLang.sidebar.dark.light,position:'right-bottom'});if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn').removeAttr("disabled");$$('#night-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.dark+"', position: 'top'}")}},310);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){$$('#night-btn i')[0].innerHTML='brightness_4'}},330);setTimeout(function(){if(CastleConfig.switch.sidebarToolsBar.darkBtn){new mdui.Drawer('#sidebar').close()}},400)}};var CastleSetting={panel:function(){if(!CastleConfig.switch.sidebarToolsBar.settingBtn){mdui.alert('别试了,并没有启用设置面板功能 ( ̄_ ̄|||)','提示');return false}new mdui.Drawer('#sidebar').close();mdui.alert(CastleLang.sidebar.setting.content,CastleLang.sidebar.setting.title)}};var CastleLogin={panel:function(){if(!CastleConfig.switch.sidebarToolsBar.login){mdui.alert('别试了,并没有启用前台登录功能 ( ̄_ ̄|||)','提示');return false};new mdui.Drawer('#sidebar').close();if($$('#login-btn').data('loginStatus')=='true'){mdui.alert(CastleLang.sidebar.login.login.logined,CastleLang.tips.tips);return false};var loginStyle='';if(CastleConfig.setting.login.background){loginStyle+='background-image: url(\''+CastleConfig.setting.login.background+'\');'};if(CastleConfig.setting.login.backgroundColor){loginStyle+='background-color: '+CastleConfig.setting.login.background+';'};var content=' ';mdui.dialog({content:content,modal:true,history:false,closeOnEsc:false,cssClass:'moe-login mdui-shadow-10',onOpen:function(init){$$('.moe-login').attr('id','moe-login');CastleData.LoginDialog=init}})},loginSubmit:function(){if(!CastleConfig.switch.sidebarToolsBar.login){mdui.alert('别试了,并没有启用前台登录功能 ( ̄_ ̄|||)','提示');return false};var username=$$('#loginForm #name').val();var password=$$('#loginForm #password').val();if(!username||!password){return false}var loadBtn=$$('#loginForm .moe-login-submit .moe-login-loadBtn');var submitBtn=$$('#loginForm .moe-login-submit .moe-login-submitBtn');submitBtn.attr('disabled','true');loadBtn[0].classList.add('moe-login-loadBtn-display');$$.ajax({method:'POST',url:CastleConfig.url.login,data:$$('#loginForm').serialize(),success:function(data){var data=JSON.parse(data);if(data.status=='error'&&data.status!='ok'){submitBtn.removeAttr("disabled");loadBtn[0].classList.remove('moe-login-loadBtn-display');mdui.snackbar({message:data.error,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}else if(data.status=='ok'){$$('#login-btn').attr('data-loginStatus',"true");$$('#login-btn').attr('onclick',"CastleLogin.Logout()");$$('#login-btn').attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.logout+"', position: 'top'}");$$('#login-btn i')[0].innerHTML='power_settings_new';CastleData.LoginDialog.close();loadBtn[0].classList.remove('moe-login-loadBtn-display');if(data.loginStatus===true){data.msg=CastleLang.sidebar.login.login.success;data.color='mdui-color-green-600';if(CastleConfig.switch.pjax){pjax.loadUrl(window.location.href)}else{CastleLibs.reload()}}else{data.msg=CastleLang.sidebar.login.login.logined;data.color='mdui-color-red-400'}mdui.snackbar({message:data.msg,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add(data.color)}})}else{submitBtn.removeAttr("disabled");loadBtn[0].classList.remove('moe-login-loadBtn-display');mdui.snackbar({message:CastleLang.tips.unknown,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}},error:function(xhr,status,error){mdui.snackbar({message:CastleLang.tips.error+'(HTTP '+xhr.status+')',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});submitBtn.removeAttr("disabled");loadBtn[0].classList.remove('moe-login-loadBtn-display')}})},Logout:function(){if(!CastleConfig.switch.sidebarToolsBar.login){mdui.alert('别试了,并没有启用前台登录功能 ( ̄_ ̄|||)','提示');return false};new mdui.Drawer('#sidebar').close();var LoginBtn=$$('#login-btn');LoginBtn.attr('disabled','true');$$.ajax({method:'GET',url:CastleConfig.url.logout,success:function(data){var data=JSON.parse(data);if(data.status=='ok'&&data.logout===true){mdui.alert(CastleLang.sidebar.login.logout.content.logout,CastleLang.sidebar.login.logout.title,function(){if(CastleConfig.switch.pjax){pjax.loadUrl(window.location.href)}else{CastleLibs.reload()}});LoginBtn.attr('data-loginStatus',"false")}else{mdui.alert(data.msg,CastleLang.sidebar.login.logout.title)}LoginBtn.removeAttr('disabled');LoginBtn.attr('onclick',"CastleLogin.panel()");LoginBtn.attr('mdui-tooltip',"{content: '"+CastleLang.sidebar.toolbar.login+"', position: 'top'}");$$('#login-btn i')[0].innerHTML='account_circle'},error:function(xhr,status,error){mdui.alert(CastleLang.tips.error+'(HTTP '+xhr.status+')',CastleLang.sidebar.login.logout.title);LoginBtn.removeAttr('disabled','true')}})}};var CastlePost={toolbar:function(){if(!$$('.moe-post-card')[0]){this.barColor('remove');return false}var width=document.body.scrollWidth;var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;if(width<=600&&scrollTop>260){if(!$$('#header').hasClass('moe-appbar')){return false}this.barColor('add');this.barTitle('add')}else{if($$('#header').hasClass('moe-appbar')){return false}this.barColor('remove');this.barTitle('remove')}},barColor:function(method){if(method=='add'){$$('#header')[0].classList.remove('moe-appbar');$$('#header .mdui-toolbar')[0].classList.add('mdui-color-theme')}else{$$('#header')[0].classList.add('moe-appbar');$$('#header .mdui-toolbar')[0].classList.remove('mdui-color-theme')}},barTitle:function(method){var bar=$$('#header .mdui-toolbar .mdui-typo-title');var title=$$('.moe-post-card .mdui-card-media .mdui-card-primary .mdui-card-primary-title');if(method=='add'){bar.html(title.html());bar.removeAttr('href');bar[0].onclick=function(){CastleTop.gotoTop()}}else{bar.html(CastleConfig.info.siteName);bar.attr('href',CastleConfig.url.site);bar[0].onclick=''}},Lazyload:function(){var lazyload=new LazyLoad({threshold:0,elements_selector:'.lazyload'})},baguetteBox:function(){baguetteBox.run('[data-baguettebox="photo"]',{noScrollbars:true})},showIndexPostTitle:function(){if(!$$('#moe-post-list')[0]){return false}function regTitle(title){var otitle=CastleLang.index.FloatingTitle;return otitle.replace(/%s/,title)}var title=$$('#moe-post-list .moe-default-card .mdui-card-primary .mdui-card-primary-title');for(let i=0;i '},submitPassword:function(){if(!$$('form.protected')[0]){return false}if(!$$('form.protected #protectPassword').val()){mdui.snackbar({message:CastleLang.post.hidden.empty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false}$$.ajax({method:'POST',data:$$('form.protected').serialize(),url:$$('form.protected').attr('action'),success:function(data){var Obj=$$(document.createElement('body')).append(data);if($$(Obj)[0].querySelector('.container')==null){mdui.snackbar({message:CastleLang.post.hidden.success,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-green-600')}});if(CastleConfig.switch.pjax){pjax.loadUrl(window.location.href)}else{CastleLibs.reload()}}else{mdui.snackbar({message:CastleLang.post.hidden.error+'['+$$(Obj)[0].querySelector('.container').innerHTML+']',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}}})},delPost:function(obj,title,post){var postLang=(post)?CastleLang.post.delete:CastleLang.page.delete;mdui.dialog({title:postLang.tips.title,content:postLang.tips.content.replace(/%s/,title),buttons:[{text:postLang.tips.cancel,onClick:function(){return false}},{text:postLang.tips.confirm,onClick:function(){mdui.dialog({title:postLang.warning.title,content:postLang.warning.content.small.replace(/%s/,title)+'
    '+postLang.warning.content.big+'',buttons:[{text:postLang.warning.cancel,onClick:function(){return false}},{text:postLang.warning.confirm,onClick:function(){window.location.href=$$(obj).data('delUrl')}}],history:false})}}],history:false})}};var CastleOwO={toggle:function(){if(!$$('#comment-card-box')[0]){return false};if(!$$('#owoBox')[0]){this.create()};if($$('#owoBox').hasClass('moe-owo-open')){this.close();return true}else{this.open();return true}},open:function(){if(!$$('#owoBox')[0]){return false};$$('#owoBox')[0].style.display='block';$$('body').addClass('mdui-locked');$$('#moe-owo-overlay')[0].style.display='block';setTimeout(function(){$$('#owoBox')[0].classList.add('moe-owo-open');$$('#moe-owo-overlay')[0].classList.add('moe-owo-overlay-open')},10)},close:function(){if(!$$('#owoBox')[0]){return false};$$('#moe-owo-overlay')[0].classList.remove('moe-owo-overlay-open');$$('#owoBox')[0].classList.remove('moe-owo-open');setTimeout(function(){$$('#owoBox')[0].style.display='none';$$('#moe-owo-overlay')[0].style.display='none';$$('body').removeClass('mdui-locked')},310)},create:function(){if($$('#owoBox')[0]){return false};var owoTmps={owo:'',tab:''};var owoBox=document.createElement("div");owoBox.style.display='none';owoBox.setAttribute('id','owoBox');owoBox.classList.add('mdui-shadow-10');owoBox.innerHTML+='
    tag_faces
    ';var owoList=CastleConfig.setting.owoList;for(let owoNum=0;owoNum';if(owoList[owoNum].content){for(let i=0;i'+owoList[owoNum].content[i].text+''}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='';owoTmps.tab+=''+owoList[owoNum].name+''};if(owoList[owoNum].type=='emoji'){owoTmps.owo+='
    ';if(owoList[owoNum].content){for(let i=0;i'+owoList[owoNum].content[i].text+''}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='
    ';owoTmps.tab+=''+owoList[owoNum].name+''};if(owoList[owoNum].type=='smallPicture'){owoTmps.owo+='
    ';if(owoList[owoNum].content){for(let i=0;i '}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='
    ';owoTmps.tab+=''+owoList[owoNum].name+''};if(owoList[owoNum].type=='picture'){owoTmps.owo+='
    ';if(owoList[owoNum].content){for(let i=0;i '}}else{owoTmps.owo+='
    此表情包下并没有任何表情..
    '};owoTmps.owo+='
    ';owoTmps.tab+=''+owoList[owoNum].name+''}};owoBox.innerHTML+='
    '+owoTmps.owo+'
    ';owoBox.innerHTML+='
    '+owoTmps.tab+'
    ';$$('body').append(owoBox);mdui.mutation($$('#owoBox'));this.bindOwO();var owoOverlay=document.createElement("div");owoOverlay.style.display='none';owoOverlay.setAttribute('id','moe-owo-overlay');owoOverlay.onclick=function(){CastleOwO.toggle()};$$('body').append(owoOverlay)},bindOwO:function(){if(!$$('#owoBox main.moe-owo-main a')[0]){return false};for(let owoNum=0;owoNum<$$('#owoBox main.moe-owo-main a').length;++owoNum){if($$('#owoBox main.moe-owo-main a')[owoNum].dataset.owo){$$('#owoBox main.moe-owo-main a')[owoNum].onclick=function(){CastleOwO.grin($$('#owoBox main.moe-owo-main a')[owoNum].dataset.owo);CastleOwO.toggle()}}}},grin:function(tag){tag=' '+tag+' ';myField=$$('#comment-card-box .moe-comment-input-text #text')[0];document.selection?(myField.focus(),sel=document.selection.createRange(),sel.text=tag,myField.focus()):this.insertTag(tag)},insertTag:function(tag){myField=$$('#comment-card-box .moe-comment-input-text #text')[0];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())}};var CastleComments={Core:function(){var commentID=$$('.respondID').attr('id');window.TypechoComment={dom:function(id){return document.getElementById(id)},create:function(tag,attr){var el=document.createElement(tag);for(var key in attr){el.setAttribute(key,attr[key])}return el},reply:function(cid,coid){$$("#comment-card-box").addClass('moe-comment-card-opaque');var comment=$$('#'+cid+' main')[0],parent=comment.parentNode,response=this.dom(commentID),input=this.dom('comment-parent'),form='form'==response.tagName?response:response.getElementsByTagName('form')[0],textarea=response.getElementsByTagName('textarea')[0];if(null==input){input=this.create('input',{'type':'hidden','name':'parent','id':'comment-parent'});form.appendChild(input)}input.setAttribute('value',coid);if(null==this.dom('comment-form-place-holder')){var holder=this.create('div',{'id':'comment-form-place-holder'});response.parentNode.insertBefore(holder,response)}last=CastleComments.getLastComment();if(last==null){comment.appendChild(response)}else if(last.id==cid){$$("#comments")[0].appendChild(response)}else{comment.appendChild(response)}this.dom('cancel-comment-reply-link').style.display='';if(null!=textarea&&'text'==textarea.name){textarea.focus()}return false},cancelReply:function(){$$("#comment-card-box").removeClass('moe-comment-card-opaque');var response=this.dom(commentID),holder=this.dom('comment-form-place-holder'),input=this.dom('comment-parent');if(null!=input){input.parentNode.removeChild(input)}if(null==holder){return true}this.dom('cancel-comment-reply-link').style.display='none';holder.parentNode.insertBefore(response,holder);return false}}},getLastComment:function(){firstNodeList=$$(".moe-comments-list-box > div");if(firstNodeList.length==0){return null}firstNode=firstNodeList[firstNodeList.length-1];return CastleComments.checkLast(firstNode)},checkLast:function(node){next=$$(node).next();if(next[0]==null){return node}if(next.hasClass("moe-comments-list-box")==false){return node}nextNodeList=next.children(".moe-comments-box");nextNode=nextNodeList[nextNodeList.length-1];return CastleComments.checkLast(nextNode)},showLinkInput:function(){if(!$$('.moe-comment-card-content .moe-comment-input-url')[0]){return false}var link=$$('.moe-comment-card-content .moe-comment-input-url');if(link.hasClass('moe-comment-input-url-hidden')){link[0].classList.remove('moe-comment-input-url-hidden')}else{link[0].classList.add('moe-comment-input-url-hidden')}},headimgAJAX:function(){if(!$$(".moe-comment-card-content #email")[0]){return false}$$(".moe-comment-card-content #email")[0].onblur=function(){if(!$$(this).val()){return false}else{$$('#moe-comment-author-avatar')[0].innerHTML='
    ';mdui.mutation($$('#moe-comment-author-avatar'))};$$.ajax({method:'GET',url:CastleConfig.url.index,data:{action:'ajax_get_avatar',form:window.location.host,email:$$(this).val()},success:function(data){if(!data){return false}$$('#moe-comment-author-avatar')[0].innerHTML=''},error:function(xhr,status,error){mdui.snackbar({message:'请求失败,请检查网络是否正常',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}})}})}},submitComment:function(){if(!$$('.respondID').attr('data-commentUrl')){return false};if(!$$('.moe-comment-card-content #text').val()){mdui.snackbar({message:CastleLang.comment.MsgEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};if($$('.moe-comment-input-username #author').length&&!$$('.moe-comment-input-username #author').val()){mdui.snackbar({message:CastleLang.comment.AuthorEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};if($$('.moe-comment-input-email #email').length&&!$$('.moe-comment-input-email #email').val()&&CastleConfig.switch.comment.email){mdui.snackbar({message:CastleLang.comment.EmailEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});return false};if($$('.moe-comment-input-url #url').length&&!$$('.moe-comment-input-url #url').val()&&CastleConfig.switch.comment.link){mdui.snackbar({message:CastleLang.comment.UrlEmpty,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});if($$('.moe-comment-card-content .moe-comment-input-url').hasClass('moe-comment-input-url-hidden')){$$('.moe-comment-card-content .moe-comment-input-url')[0].classList.remove('moe-comment-input-url-hidden')}return false};function beforeComment(){$$('#submitCommentBtn').attr('disabled',true);$$(".mdui-tooltip").removeClass("mdui-tooltip-open");$$('#submitCommentBtn i').html('cached');$$('#submitCommentBtn i').addClass('moe-rotate360deg-infinite')};beforeComment();function afterComment(status){$$('#submitCommentBtn').removeAttr('disabled');$$('#submitCommentBtn i').removeClass('moe-rotate360deg-infinite');if(status){$$('#submitCommentBtn i').html('send');CastleData.comments.replyTo='';$$('.moe-comment-input-text #text').val('');$$('.moe-comment-input-text #text')[0].focus();$$('.moe-comment-input-text #text')[0].blur();CastleLibs.scrollClick()}else{$$('#submitCommentBtn i').html('warning');setTimeout(function(){$$('#submitCommentBtn i').html('send')},1200)}CastleComments.bindReplyBtn()};$$.ajax({method:'POST',url:$$('.respondID').attr('data-commentUrl'),data:$$('.moe-comment-card-content').serialize(),success:function(data){var Obj=$$(document.createElement('body')).append(data);if($$(Obj)[0].querySelector('.container')==null){var $htmlData=$$(document.createElement('body')).append(data);if($htmlData.html()){CastleData.comments.NewID=$htmlData.html().match(/id=\"?comment-\d+/g).join().match(/\d+/g).sort(function(a,b){return a-b}).pop()}else{mdui.snackbar({message:CastleLang.comment.refresh,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});afterComment(false);return false};if(''===CastleData.comments.replyTo){if(!$$('#comments > .moe-comments-list-box > .moe-comments-box').length){CastleData.comments.newComment=$htmlData[0].querySelectorAll('#comment-'+CastleData.comments.NewID);$$('.moe-comments-list-header').after('
    ');$$('.moe-comments-list-box').first().prepend(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein')}else if($$('.prev').length){$$('.moe-comments-page-navigator li a').eq(1)[0].click()}else{CastleData.comments.newComment=$htmlData[0].querySelectorAll('#comment-'+CastleData.comments.NewID);$$('.moe-comments-list-box').first().prepend(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein')}}else{CastleData.comments.newComment=$htmlData[0].querySelectorAll('#comment-'+CastleData.comments.NewID);if($$('#'+CastleData.comments.replyTo).find('.moe-comment-children').length){$$('#'+CastleData.comments.replyTo+' .moe-comment-children .moe-comments-list-box').first().append(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein');TypechoComment.cancelReply();CastleTop.scrollSmoothTo($$('#comment-'+CastleData.comments.NewID).offset().top)}else{$$('#'+CastleData.comments.replyTo).append('
    ');$$('#'+CastleData.comments.replyTo+' .moe-comment-children .moe-comments-list-box').first().prepend(CastleData.comments.newComment);$$('#comment-'+CastleData.comments.NewID).addClass('moe-animation-fadein');TypechoComment.cancelReply();CastleTop.scrollSmoothTo($$('#comment-'+CastleData.comments.NewID).offset().top)}};if($$('.moe-comments-list-number span').text()==null){$$('.moe-comments-list-number').html(CastleLang.comment.have.replace(/%s/,'1'))}else{var counts=parseInt($$('.moe-comments-list-number span').text());$$('.moe-comments-list-number span').html($$('.moe-comments-list-number span').html().replace(/\d+/,counts+1))};afterComment(true);if($$('#comment-'+CastleData.comments.NewID+' .moe-comments-time span')[0]){CastleData.comments.message=CastleLang.comment.pending;CastleData.comments.messageColor='mdui-color-deep-orange-600'}else{CastleData.comments.message=CastleLang.comment.success;CastleData.comments.messageColor='mdui-color-teal-500'};mdui.snackbar({message:CastleData.comments.message,position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add(CastleData.comments.messageColor)}})}else{mdui.snackbar({message:'评论失败!
    原因:['+$$(Obj)[0].querySelector('.container').innerHTML+']',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});afterComment(false)}},error:function(xhr,status,error){mdui.snackbar({message:'评论提交失败!
    原因 [HTTP '+xhr.status+']',position:'right-bottom',onOpen:function(){document.querySelector('.mdui-snackbar').classList.add('mdui-color-red-400')}});afterComment(false)}})},bindReplyBtn:function(){if(!$$('#comments')[0]){return false}CastleData.comments.replyTo='';for(let i=0;i<$$(".moe-comments-reply a").length;++i){$$(".moe-comments-reply a")[i].addEventListener('click',function(){CastleData.comments.replyTo=$$(this).parent().parent().parent().parent().attr("id")})};$$(".moe-comment-card-btns a")[0].addEventListener('click',function(){CastleData.comments.replyTo=''})}};var CastleLibs={getCookie:function(name){var name=name+"=";var ca=document.cookie.split(';');for(var i=0;i300&&bottomHeight>100){this.topBtn('display')}else{this.topBtn('hidden')}},topBtn:function(method){if(method=='hidden'){$$('#go-top')[0].classList.add('mdui-fab-hide')}else{$$('#go-top')[0].classList.remove('mdui-fab-hide')}},gotoTop:function(speed,rtime){rtime=rtime||10;speed=speed||0.08;var x2=0,y2=0,x3=0,y3=0;var y1=document.documentElement.scrollTop||document.body.scrollTop||window.pageYOffset||0;var x1=document.documentElement.scrollLeft||document.body.scrollLeft||window.pageXOffset||0;var x3=window.scrollX||0;var y3=window.scrollY||0;var x=Math.max(x1,Math.max(x2,x3));var y=Math.max(y1,Math.max(y2,y3));var speeding=1+speed;window.scrollTo(Math.floor(x/speeding),Math.floor(y/speeding));if(x>0||y>0){var run="CastleTop.gotoTop("+speed+", "+rtime+")";window.setTimeout(run,rtime)}},scrollSmoothTo:function(position){if(!window.requestAnimationFrame){window.requestAnimationFrame=function(callback,element){return setTimeout(callback,17)}}var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;var step=function(){var distance=position-scrollTop;scrollTop=scrollTop+distance/20;if(Math.abs(distance)<1){window.scrollTo(0,position)}else{window.scrollTo(0,scrollTop);requestAnimationFrame(step)}};step()}};CastleCreate.BG();CastleNight.check();CastleCreate.Search();CastleCreate.Sidebar();CastleCreate.Header();CastleCreate.Footer();CastleCreate.gotoTopBtn();if(CastleConfig.switch.pjax){CastleLibs.scrollPos()};needReload=function(){CastleComments.Core();CastleLibs.linkTarget();CastleComments.headimgAJAX();CastleComments.bindReplyBtn();CastleLibs.scrollClick();CastlePost.Lazyload();CastlePost.baguetteBox();CastlePost.toolbar();CastlePost.showIndexPostTitle();CastlePost.modifyPasswordStyle()};needReload();document.onscroll=function(){CastlePost.toolbar();CastleTop.gotoTopBtn()};window.onresize=function(){CastlePost.toolbar()};if(CastleConfig.switch.pjax){var pjax=new Pjax({elements:'a[href^="'+document.location.protocol+'//'+window.location.host+'/"]:not([target="_blank"]):not([no-pjax])',selectors:["title","#moe-pjax-content"],timeout:PjaxConfig.timeout,cacheBust:false,scrollRestoration:true});document.addEventListener('pjax:send',function(){NProgress.start();CastleData.scrollTop=document.documentElement.scrollTop||document.body.scrollTop||window.pageYOffset||0});document.addEventListener('pjax:success',function(){mdui.mutation();needReload();CastleLibs.rmToolTip()});document.addEventListener('pjax:complete',function(){NProgress.done();CastlePost.barTitle('remove');PjaxConfig.after()});document.addEventListener('pjax:error',function(){mdui.snackbar({message:CastleLang.pjax.error,position:'right-bottom',onOpen:function(){var snackbar=document.querySelector('.mdui-snackbar');snackbar.classList.add('mdui-color-red-400')}})})}console.log(" %c \u2728\u0020\u0043\u0061\u0073\u0074\u006c\u0065 "+CastleConfig.CastleVersion+" %c \u0042\u0079\u0020\u006f\u0068\u006d\u0079\u0067\u0061\u0020\u007c\u0020\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u006f\u0068\u006d\u0079\u0067\u0061\u002e\u0063\u006e\u002f ","color: #FFFFFF; background: #1E88E5; padding:6px;","color: #FFFFFF; background: #424242; padding:6px;"); \ No newline at end of file