canary_fe/dist/js/home-legacy.252af7b4.js
2020-12-28 20:41:41 +08:00

1 line
13 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["home"],{"1c62":function(t,e,s){"use strict";s.r(e);var n=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,n){return s("div",{key:n,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)},i=[],o=(s("e90c"),s("79dd"),s("b128"),s("b3f9"),s("7267"),s("ec4a"),s("d780"),s("3e5e"),s("94ec"),s("b54b")),a=s("08c1"),c=s("c71e"),r=s("36f0"),l=s("e6a3"),h=s("bfd3"),u={name:"Home",data:function(){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["a"])({},Object(a["c"])(["user_infos","row_data","row_pwd","settings","home_state"])),methods:Object(o["a"])({},Object(a["b"])(["setUserInfo","setRowData","setRowPwd","setSettings","setHomeState"]),{changeFixed:function(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:function(){var t=this;if(h["a"].call(this),this.initLanguage(),0!=Object.keys(this.row_pwd).length){var e=(new Date).getTime();if(e-this.row_pwd.create_time<this.settings.expired_time)if(this.unlock=!0,this.row_data){var s,n,i=Object(c["b"])(this.row_pwd.main_code);try{s=Object(c["a"])(i,this.row_data),n=JSON.parse(s)}catch(o){return console.log(o),void this.turnToUnlock("密码错误")}this.row_list=JSON.parse(JSON.stringify(n)),this.show_list=n.sort((function(t,e){return e["open_count"]-t["open_count"]})),this.separateTitle(n),this.home_state&&(this.search_start=this.home_state.search_start,this.search_content=this.home_state.search_content,this.$nextTick((function(){t.$refs.list_placeholder.parentNode.parentNode.scrollTo({top:t.home_state.scrollHeight}),console.log("原状态恢复完成"),t.setHomeState(["",t]),console.log("主页状态缓存删除完成")})))}else this.show_list=[];else this.turnToUnlock("密码超时")}else this.turnToUnlock("无密码");console.log(0!=this.show_list.length?"密码本存在":"空密码本"),console.log(this.unlock?"已解锁":"未解锁")},initLanguage:function(){this.settings.is_chinese?this.lang=Object(r["a"])().home.CHS:this.lang=Object(r["a"])().home.EN,console.log("语言配置完成")},changeSortType:function(t){0!=this.show_list.length?this.show_list="Alphabetically"==t?this.show_list.sort((function(t,e){return t["title"].localeCompare(e["title"])})):"Default"==t?JSON.parse(JSON.stringify(this.row_list)):this.show_list.sort((function(t,e){return e["open_count"]-t["open_count"]})):console.log("修改排序无内容拦截")},turnToUnlock:function(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:function(){0!=this.show_list.length?this.search_start=!this.search_start:console.log("点击搜索无内容拦截")},turnToAdd:function(){if(this.unlock){var t={search_start:this.search_start,search_content:this.search_content,scrollHeight:this.scrollHeight};this.setHomeState([t,this]),this.$router.push("/add")}else this.turnToUnlock("点击新增未解锁拦截")},turnToDetail:function(t){var 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:function(t){var e={search_start:this.search_start,search_content:this.search_content,scrollHeight:this.scrollHeight};this.setHomeState([e,this]),this.$router.push(t)},onCopyUrl:function(t){this.snakebar_msg=this.lang.copy.successful,this.show_snackbar=!0},onErrorUrl:function(t){this.snakebar_msg=this.lang.copy.failed,this.show_snackbar=!0},separateTitle:function(t){var e=[];for(var s in t)e.push(t[s].title);this.titles=e,console.log("数据头部分离完成")},fuzzySearch:function(t){if(this.search_content.trim()){var e=[];for(var s in t)this.generReg(this.search_content.trim()).test(t[s].title)&&e.push(t[s]);this.show_list=e,console.log("模糊搜索完成")}else this.show_list=t},generReg:function(t){var e="(.*)(",s=")(.*)",n=t.split("").join(")(.*)(");return new RegExp(e+n+s,"i")},downloadApk:function(){window.open("https://assets.lacus.site/canary/netdisk_canary.apk")},scrollTop:function(){this.$refs.list_placeholder.parentNode.parentNode.scrollTo({top:0,behavior:"smooth"}),console.log("一键回顶成功")},hasClass:function(t,e){return t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))},addClass:function(t,e){this.hasClass(t,e)||(t.className+=" "+e)},toggleClass:function(t,e){this.hasClass(t,e)?this.removeClass(t,e):this.addClass(t,e)},removeClass:function(t,e){if(this.hasClass(t,e)){var s=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(s," ")}},toggleVc:function(){var t=(new Date).getTime();if(t-this.lastClickTime<3e3?this.count++:this.count=0,this.lastClickTime=t,this.count>=10){var e=document.getElementById("__vconsole");this.toggleClass(e,"vconsole-show"),this.count=0}},scroll:function(t){this.scrollHeight=this.$refs.list_placeholder.parentNode.parentNode.scrollTop},openQQ:function(){window.open("https://jq.qq.com/?_wv=1027&k=KIKWmqys")}}),created:function(){this.lang=Object(r["a"])().home.CHS,console.log("临时语言系统加载完成"),this.init()},mounted:function(){this.clientHeight="".concat(document.documentElement.clientHeight),window.onresize=function(){this.clientHeight="".concat(document.documentElement.clientHeight),Object(l["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:function(){},components:{}},d=u,m=(s("7505"),s("623f")),_=Object(m["a"])(d,n,i,!1,null,"487759be",null);e["default"]=_.exports},"3e1a":function(t,e,s){},7505:function(t,e,s){"use strict";var n=s("3e1a"),i=s.n(n);i.a},"94ec":function(t,e,s){"use strict";var n=s("91fe"),i=s("03fa").trim,o=s("b680");n({target:"String",proto:!0,forced:o("trim")},{trim:function(){return i(this)}})},b128:function(t,e,s){var n=s("7a23"),i=s("d5dc"),o=s("12d9"),a=s("60f2"),c=s("c223").f,r=s("65af").f,l=s("e1dd"),h=s("0618"),u=s("dcb6"),d=s("3d8a"),m=s("f30e"),_=s("d0e2").set,p=s("a867"),g=s("57c4"),f=g("match"),v=i.RegExp,w=v.prototype,b=/a/g,k=/a/g,y=new v(b)!==b,C=u.UNSUPPORTED_Y,x=n&&o("RegExp",!y||C||m((function(){return k[f]=!1,v(b)!=b||v(k)==k||"/a/i"!=v(b,"i")})));if(x){var T=function(t,e){var s,n=this instanceof T,i=l(t),o=void 0===e;if(!n&&i&&t.constructor===T&&o)return t;y?i&&!o&&(t=t.source):t instanceof T&&(o&&(e=h.call(t)),t=t.source),C&&(s=!!e&&e.indexOf("y")>-1,s&&(e=e.replace(/y/g,"")));var c=a(y?new v(t,e):v(t,e),n?this:w,T);return C&&s&&_(c,{sticky:s}),c},S=function(t){t in T||c(T,t,{configurable:!0,get:function(){return v[t]},set:function(e){v[t]=e}})},N=r(v),H=0;while(N.length>H)S(N[H++]);w.constructor=T,T.prototype=w,d(i,"RegExp",T)}p("RegExp")},b680:function(t,e,s){var n=s("f30e"),i=s("2d82"),o="…";t.exports=function(t){return n((function(){return!!i[t]()||o[t]()!=o||i[t].name!==t}))}},e90c:function(t,e,s){"use strict";var n=s("91fe"),i=s("fee7"),o=s("8c47"),a=s("fb11"),c=[].join,r=i!=Object,l=a("join",",");n({target:"Array",proto:!0,forced:r||!l},{join:function(t){return c.call(o(this),void 0===t?",":t)}})},ec4a:function(t,e,s){"use strict";var n=s("deaa"),i=s("ac83"),o=s("684e"),a=s("3193"),c=s("536c"),r=s("81a0");n("match",1,(function(t,e,s){return[function(e){var s=a(this),n=void 0==e?void 0:e[t];return void 0!==n?n.call(e,s):new RegExp(e)[t](String(s))},function(t){var n=s(e,t,this);if(n.done)return n.value;var a=i(t),l=String(this);if(!a.global)return r(a,l);var h=a.unicode;a.lastIndex=0;var u,d=[],m=0;while(null!==(u=r(a,l))){var _=String(u[0]);d[m]=_,""===_&&(a.lastIndex=c(l,o(a.lastIndex),h)),m++}return 0===m?null:d}]}))}}]);