代码拉取完成,页面将自动刷新
/*! Huawei ThemeStudio Extensions v1.0.1 | https://gitee.com/arnie/hwt-ext */
function hwt_ext(){this.base_url="https://arnie.gitee.io/hwt-ext/";this.locale=localStorage.getItem("com.huawei.hwtdesigner.locale");this.plugins={hwt_ext:{path:"SELF",loaded:false},jscolor:{path:"jscolor/jscolor.min.js",loaded:false}};this.vocab={bg_color:{en:"Background Color",cn:"背景颜色"},dial_outline:{en:"Dial Outline",cn:"表盘轮廓"},option:{en:"Option",cn:"自定义选项"}};this.get_vocab=e=>{return this.vocab[e][this.locale]};this.set_view_names=function(t,e){const l=e.getAttributeNames();for(let e=0;e<l.length;e+=1){if(l[e].indexOf("data-v")>-1){t.setAttribute(l[e],"")}}};this.event_agent=function(t,l,i){let o=0;let s=setInterval(()=>{let e=document.querySelector(t);if(e||o>99){clearInterval(s);if(e){if(l==="load")i();else e.addEventListener(l,i)}}o+=1},100)};const e=new MutationObserver(()=>{if(location.hash.indexOf("/watchindex")>-1){let i=document.querySelectorAll(".right-main");for(let l=0;l<i.length;l+=1){let e=i[l].querySelector("button:last-child");e.onclick=()=>{let t=i[l].querySelector(".name").innerText;t=t.replace(/^\s+|\s+$/g).replaceAll(" ","_");setTimeout(()=>{let e=".delete-dialog .btn:not(.cancle-btn)";document.querySelector(e).onclick=()=>{localStorage.removeItem("layer."+t)}},100)}}}});e.observe(document,{childList:true,subtree:true})}hwt_ext.prototype.init=function(){const e=()=>{let e=window.location.hash;let t=e.indexOf("/watch?")===1;let l=e.indexOf("/menu/")===1;if(t)new watch_face;if(l)new phone_theme};e();const t=function(e){const t=history[e];const l=new Event(e);return function(){const e=t.apply(this,arguments);l.arguments=arguments;window.dispatchEvent(l);return e}};history.pushState=t("pushState");window.addEventListener("pushState",e);if(!this.plugins.hwt_ext.loaded){let e="The plugin is loaded and initialized successfully. ";let t="color:white;background:#006400;font-size:12px;padding:3px";console.log("%c"+e,t);this.plugins.jscolor.loaded=false}};function watch_face(){this._pub=new hwt_ext;this.get_project_name=()=>{let e=location.hash.match(/\?watchFaceName=(.*)/);return e[1].replaceAll("%20","_")};this._pub.event_agent(".watch-layer-select-wrapper","load",()=>{this.init_layers()});this._pub.event_agent(".watch-record-icon","click",()=>{if(!document.fullscreenElement)document.documentElement.requestFullscreen();setTimeout(()=>{this.init_recorder();document.getElementsByClassName("record-tool")[0].lastChild.addEventListener("click",()=>{document.exitFullscreen()})},100)})}watch_face.prototype.init_recorder=function(){this.show_outline=false;const e=this._pub.base_url+"images/watch.png";const t=960;const l=466;const i=this._pub.base_url+this._pub.plugins.jscolor.path;this.record_tools=document.getElementsByClassName("record-tool")[0];this.record_area=document.getElementById("watch-record-arae");this.preview_wrap=document.getElementsByClassName("preview-record-warp")[0];this.dial_wrap=this.preview_wrap.children[1].firstChild;document.getElementsByClassName("record-tool-null")[0].style.display="none";const o=this.dial_wrap.lastChild;let s=o.clientWidth;let n=o.clientHeight;if(s!==n)return;let a=document.createElement("button");a.className="btn";a.innerText=this._pub.get_vocab("dial_outline");this._pub.set_view_names(a,this.record_tools);a.addEventListener("click",()=>{this.set_outline_visib()});this.record_tools.prepend(a);let r=document.createElement("button");r.className="btn";r.innerText=this._pub.get_vocab("bg_color");this._pub.set_view_names(r,this.record_tools);r.setAttribute("id","btn-color-picker");const c=()=>{this.record_tools.prepend(r);let e=localStorage.getItem("video.bg_color")||"#000000";let t={backgroundColor:"#585858",value:e,previewElement:"#watch-record-arae",onChange:function(){localStorage.setItem("video.bg_color",this.toString())}};new jscolor(r,t);this._pub.plugins.jscolor.loaded=true};if(this._pub.plugins.jscolor.loaded){c()}else{let e=document.createElement("script");e.src=i;document.getElementsByTagName("body")[0].appendChild(e);e.onload=c}let h=document.createElement("div"),u=`position:absolute; left: 50%; top: 50%; opacity:0; width:${t}px; height:${t}px; background-image: url(${e}); background-size:cover; -webkit-transform:translate(-50%,-50%);`;h.setAttribute("style",u);h.style.zoom=s/l;let d=this.record_area.clientWidth;let p=d/s;this.dial_wrap.style.WebkitTransform=`scale( ${p} )`;this.dial_wrap.style.zoom="1";this.max_scale=p;this.min_scale=d/(t*h.style.zoom);this.dial_wrap.prepend(h);this.watch_outline=h};watch_face.prototype.set_outline_visib=function(e){this.watch_outline.style.WebkitTransition="opacity 300ms linear";this.dial_wrap.style.WebkitTransition="transform 300ms linear";if(!this.show_outline){this.watch_outline.style.opacity=1;this.dial_wrap.style.WebkitTransform=`scale( ${this.min_scale} )`;this.show_outline=true}else{this.watch_outline.style.opacity=0;this.dial_wrap.style.WebkitTransform=`scale( ${this.max_scale} )`;this.show_outline=false}};watch_face.prototype.init_layers=function(){this.layers_initialized=false;const l="layer."+this.get_project_name();let e=localStorage.getItem(l);let t=e?JSON.parse(e):null;setTimeout(()=>{this.traverse_layers(true,t)},100);const i=document.querySelector(".layer-layer-area");const o={attributes:true,childList:true,subtree:true};const s=new MutationObserver(()=>{if(this.layers_initialized){let e=this.traverse_layers();let t=JSON.stringify(e);localStorage.setItem(l,t)}});s.observe(i,o)};watch_face.prototype.traverse_layers=function(w=false,e=null){const b="NvbWJpbmVkLVNoYXBlIiBmaWxsPSIjMD";const v="AgICAgICAgPHVzZSBpZD0iQ29tYmluZW";let x=[];const k=(_,m)=>{let f=[];let g=0;let y=0;for(let p=0;p<_.childElementCount;p+=1){let e=_.children[p];let t=e.querySelector("[class^=layer]");if(!t)continue;let l=".layer-name,.label-name,.widget-label-name";let i=t.querySelector(l).innerText;i=i.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/," ");let o=t.querySelector(".operate-start").firstChild;let s=t.querySelector(".operate-item:last-child");let n=t.querySelector("[class^=layer]");let a=o.firstChild.style.WebkitMask.indexOf(v)>-1?0:1;let r=s.firstChild.style.WebkitMask.indexOf(b)>-1?0:1;let c=n.className.indexOf("down")>-1?0:1;let h=null;let u=this._pub.get_vocab("option");let d=i.indexOf(u)>-1&&x.indexOf(i)>-1;if(!d){let l=e.querySelector("[class^=layer][class$=area]");if(l){let e=m?m[p].group:null;let t=k(l,e);h=t.list_data;a=t.hide_all?1:0;r=t.lock_all?1:0}if(w&&m){if(m[p].hide){o.click();a=1}if(m[p].lock){s.click();r=1}if(m[p].fold&&l){n.click();c=1}}x.push(i)}if(a)g+=1;if(r)y+=1;f.push({hide:a,lock:r,fold:c,group:h})}let e=y===f.length;let t=g===f.length;return{list_data:f,lock_all:e,hide_all:t}};const t=document.querySelector(".layer-layer-area");let l=k(t,e);if(w)this.layers_initialized=true;return l.list_data};function phone_theme(){let e="The extension for phone theme is not yet developed.";let t="color:white;background:#fb7e31;font-size:12px;padding:3px";console.log("%c"+e,t)}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。