1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["home"],{"166f":function(t,e,s){"use strict";s("2fc3")},"1c62":function(t,e,s){"use strict";s.r(e);var i=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{ref:"home",staticClass:"home"},[s("md-app",{attrs:{"md-waterfall":"","md-mode":"fixed"}},[s("md-app-toolbar",{staticClass:"md-primary"},[s("div",{staticClass:"md-toolbar-section-start"},[s("md-button",{staticClass:"md-icon-button",on:{click:function(e){t.menuVisible=!t.menuVisible}}},[s("md-icon",[t._v("menu")])],1),s("span",{staticClass:"md-title page-title",on:{click:function(e){return t.scrollTop()}}},[t._v(t._s(t.lang.title))])],1),s("div",{staticClass:"md-toolbar-section-end"},[s("div",{staticClass:"sroll-top-area",on:{click:function(e){return t.scrollTop()}}}),s("md-button",{staticClass:"md-icon-button",on:{click:function(e){return t.turnToSearch()}}},[s("md-icon",[t._v("search")])],1),s("md-menu",{attrs:{"md-align-trigger":""}},[s("md-button",{staticClass:"md-icon-button",attrs:{"md-menu-trigger":""}},[s("md-icon",[t._v("more_vert")])],1),s("md-menu-content",[s("md-menu-item",{on:{click:function(e){return t.changeSortType("Alphabetically")}}},[t._v(t._s(t.lang.menu[0]))]),s("md-menu-item",{on:{click:function(e){return t.changeSortType("Default")}}},[t._v(t._s(t.lang.menu[1]))]),s("md-menu-item",{on:{click:function(e){return t.changeSortType("Recently Used")}}},[t._v(t._s(t.lang.menu[2]))])],1)],1)],1),t.search_start?s("div",{staticClass:"md-toolbar-row"},[s("md-autocomplete",{staticClass:"search",attrs:{"md-options":t.titles,"md-layout":"box"},model:{value:t.search_content,callback:function(e){t.search_content=e},expression:"search_content"}},[s("label",[t._v(t._s(t.lang.search))])])],1):t._e()]),s("md-app-drawer",{attrs:{"md-active":t.menuVisible},on:{"update:mdActive":function(e){t.menuVisible=e},"update:md-active":function(e){t.menuVisible=e}}},[s("div",{staticClass:"drawer-banner",on:{click:function(e){return t.toggleVc()}}},[s("md-icon",{staticClass:"default-avatar md-size-2x face"},[t._v("face")]),s("p",{staticClass:"md-title"},[t._v("Canary Codebook")]),s("p",{staticClass:"md-caption"},[t._v(t._s(t.user_infos.user_name))])],1),s("md-list",[s("md-list-item",{on:{click:function(e){return t.turnToPage("/account")}}},[s("md-icon",[t._v("person")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[0]))])],1),s("md-list-item",{on:{click:function(e){return t.turnToPage("/settings")}}},[s("md-icon",[t._v("settings")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[1]))])],1),s("md-list-item",{on:{click:function(e){return t.turnToPage("/generator")}}},[s("md-icon",[t._v("extension")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[2]))])],1),s("md-list-item",{on:{click:function(e){return t.turnToPage("/updatelog")}}},[s("md-icon",[t._v("event_note")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[3]))])],1),s("md-list-item",{on:{click:function(e){return t.openQQ()}}},[s("md-icon",[t._v("question_answer")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[7]))])],1),s("md-list-item",{directives:[{name:"clipboard",rawName:"v-clipboard:copy",value:t.web_addr,expression:"web_addr",arg:"copy"},{name:"clipboard",rawName:"v-clipboard:success",value:t.onCopyUrl,expression:"onCopyUrl",arg:"success"},{name:"clipboard",rawName:"v-clipboard:error",value:t.onErrorUrl,expression:"onErrorUrl",arg:"error"}]},[s("md-icon",[t._v("reply")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[4]))])],1),s("md-list-item",{on:{click:function(e){return t.downloadApk()}}},[s("md-icon",[t._v("file_download")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[5]))])],1),s("md-list-item",{on:{click:function(e){return t.turnToUnlock("用户点击锁定")}}},[s("md-icon",[t._v("beenhere")]),s("span",{staticClass:"md-list-item-text"},[t._v(t._s(t.lang.drawer[6]))])],1)],1)],1),s("md-app-content",[s("v-touch",{attrs:{"swipe-options":{direction:"horizontal"}},on:{swiperight:function(e){t.menuVisible=!0}}},[s("div",{ref:"list_placeholder",style:"height:"+(t.search_start?"86":"40")+"px"}),0!=t.show_list.length||t.search_start?t._e():s("md-empty-state",{attrs:{"md-icon":"devices_other","md-label":t.lang.empty_state.label,"md-description":t.lang.empty_state.description}},[s("md-button",{staticClass:"md-primary md-raised",on:{click:function(e){return t.turnToAdd()}}},[t._v(t._s(t.lang.empty_state.button))])],1),t._l(t.show_list,(function(e,i){return s("div",{key:i,staticClass:"code-card",on:{click:function(s){return t.turnToDetail(e)}}},[s("p",{staticClass:"md-title"},[t._v(t._s(e.title))]),s("p",{staticClass:"md-caption"},[t._v(t._s(e.user_name))]),s("md-divider"),s("div",{staticStyle:{"margin-bottom":".3rem"}})],1)})),0!=t.show_list.length||t.search_start?s("md-speed-dial",{staticClass:"md-bottom-right"},[s("md-speed-dial-target",{staticClass:"md-primary",on:{click:function(e){return t.turnToAdd()}}},[s("md-icon",[t._v("add")])],1)],1):t._e(),s("md-snackbar",{attrs:{"md-position":"center","md-active":t.show_snackbar,"md-persistent":""},on:{"update:mdActive":function(e){t.show_snackbar=e},"update:md-active":function(e){t.show_snackbar=e}}},[s("span",[t._v(t._s(t.snakebar_msg))])])],2)],1)],1)],1)},n=[],o=(s("9b42"),s("cf6b")),a=s("c71e"),c=s("36f0"),r=s("e6a3"),l=s("bfd3"),h={name:"Home",data(){return{menuVisible:!1,clientHeight:"",show_list:[],row_list:[],cache_list:[],unlock:!1,show_snackbar:!1,snakebar_msg:"",web_addr:"https://canary.lacus.icu",titles:[],search_content:"",search_start:!1,lang:"",lastClickTime:0,count:0,scrollHeight:0}},computed:{...Object(o["c"])(["user_infos","row_data","row_pwd","settings","home_state"])},methods:{...Object(o["b"])(["setUserInfo","setRowData","setRowPwd","setSettings","setHomeState"]),changeFixed(t){this.$refs.home.children[0].style.minHeight=t+"px",this.$refs.list_placeholder.parentNode.parentNode.style.maxHeight=t+"px",this.$refs.list_placeholder.parentNode.style.minHeight=t-32+"px",window.document.documentElement.setAttribute("data-theme",this.settings.is_dark_mode?"dark":"light")},init(){if(l["a"].call(this),this.initLanguage(),0!=Object.keys(this.row_pwd).length){let e=(new Date).getTime();if(e-this.row_pwd.create_time<this.settings.expired_time)if(this.unlock=!0,this.row_data){let e,s,i=Object(a["b"])(this.row_pwd.main_code);try{e=Object(a["a"])(i,this.row_data),s=JSON.parse(e)}catch(t){return console.log(t),void this.turnToUnlock("密码错误")}this.row_list=JSON.parse(JSON.stringify(s)),this.show_list=s.sort((t,e)=>e["open_count"]-t["open_count"]),this.separateTitle(s),this.home_state&&(this.search_start=this.home_state.search_start,this.search_content=this.home_state.search_content,this.$nextTick(()=>{this.$refs.list_placeholder.parentNode.parentNode.scrollTo({top:this.home_state.scrollHeight}),console.log("原状态恢复完成"),this.setHomeState(["",this]),console.log("主页状态缓存删除完成")}))}else this.show_list=[];else this.turnToUnlock("密码超时")}else this.turnToUnlock("无密码");console.log(0!=this.show_list.length?"密码本存在":"空密码本"),console.log(this.unlock?"已解锁":"未解锁")},initLanguage(){this.settings.is_chinese?this.lang=Object(c["a"])().home.CHS:this.lang=Object(c["a"])().home.EN,console.log("语言配置完成")},changeSortType(t){0!=this.show_list.length?this.show_list="Alphabetically"==t?this.show_list.sort((t,e)=>t["title"].localeCompare(e["title"])):"Default"==t?JSON.parse(JSON.stringify(this.row_list)):this.show_list.sort((t,e)=>e["open_count"]-t["open_count"]):console.log("修改排序无内容拦截")},turnToUnlock(t){this.setHomeState(["",this]),console.log("主页状态缓存删除完成"),console.log(t),this.setRowPwd(["",this]),"密码超时"==t&&this.$router.push({name:"Unlock",params:{msg:this.lang.unlock_msg.expired}}),"密码错误"==t?this.$router.push({name:"Unlock",params:{msg:this.lang.unlock_msg.wrong}}):this.$router.push("/unlock")},turnToSearch(){0!=this.show_list.length?this.search_start=!this.search_start:console.log("点击搜索无内容拦截")},turnToAdd(){if(!this.unlock)return void this.turnToUnlock("点击新增未解锁拦截");let t={search_start:this.search_start,search_content:this.search_content,scrollHeight:this.scrollHeight};this.setHomeState([t,this]),this.$router.push("/add")},turnToDetail(t){let e={search_start:this.search_start,search_content:this.search_content,scrollHeight:this.scrollHeight};this.setHomeState([e,this]),this.$router.push({name:"Detail",params:{code_content:t}})},turnToPage(t){let e={search_start:this.search_start,search_content:this.search_content,scrollHeight:this.scrollHeight};this.setHomeState([e,this]),this.$router.push(t)},onCopyUrl(t){this.snakebar_msg=this.lang.copy.successful,this.show_snackbar=!0},onErrorUrl(t){this.snakebar_msg=this.lang.copy.failed,this.show_snackbar=!0},separateTitle(t){let e=[];for(let s in t)e.push(t[s].title);this.titles=e,console.log("数据头部分离完成")},fuzzySearch(t){if(!this.search_content.trim())return void(this.show_list=t);let e=[];for(let s in t)this.generReg(this.search_content.trim()).test(t[s].title)&&e.push(t[s]);this.show_list=e,console.log("模糊搜索完成")},generReg(t){let e="(.*)(",s=")(.*)",i=t.split("").join(")(.*)(");return new RegExp(e+i+s,"i")},downloadApk(){window.open("https://assets.lacus.site/canary/netdisk_canary.apk")},scrollTop(){this.$refs.list_placeholder.parentNode.parentNode.scrollTo({top:0,behavior:"smooth"}),console.log("一键回顶成功")},hasClass(t,e){return t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass(t,e){this.hasClass(t,e)||(t.className+=" "+e)},toggleClass(t,e){this.hasClass(t,e)?this.removeClass(t,e):this.addClass(t,e)},removeClass(t,e){if(this.hasClass(t,e)){var s=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(s," ")}},toggleVc(){const t=(new Date).getTime();if(t-this.lastClickTime<3e3?this.count++:this.count=0,this.lastClickTime=t,this.count>=10){let t=document.getElementById("__vconsole");this.toggleClass(t,"vconsole-show"),this.count=0}},scroll(t){this.scrollHeight=this.$refs.list_placeholder.parentNode.parentNode.scrollTop},openQQ(){window.open("https://jq.qq.com/?_wv=1027&k=KIKWmqys")}},created(){this.lang=Object(c["a"])().home.CHS,console.log("临时语言系统加载完成"),this.init()},mounted(){this.clientHeight=""+document.documentElement.clientHeight,window.onresize=function(){this.clientHeight=""+document.documentElement.clientHeight,Object(r["a"])()}.bind(this),this.$refs.list_placeholder.parentNode.parentNode.addEventListener("scroll",this.scroll)},watch:{clientHeight:function(){this.changeFixed(this.clientHeight)},search_start:function(){this.search_start?(this.cache_list=JSON.parse(JSON.stringify(this.show_list)),console.log("搜索阵列展开,缓存设置完成")):(this.search_content="",this.show_list=JSON.parse(JSON.stringify(this.cache_list)),this.cache_list=[],console.log("搜索阵列关闭,缓存清空完成"))},search_content:function(){this.search_start&&this.fuzzySearch(this.cache_list)}},beforeDestroy(){},components:{}},d=h,m=(s("166f"),s("5d22")),u=Object(m["a"])(d,i,n,!1,null,"cc7e6ae2",null);e["default"]=u.exports},"2fc3":function(t,e,s){}}]); |