2023-03-03 19:19:19 +08:00
< %+cbi/valueheader%>
< script type = "text/javascript" > / / < ! [ C D A T A [
function chpass(btn)
{
btn.disabled = true;
btn.value = '< %:loading...%>';
if (typeof bcryptloaded == 'undefined' ){
var theHead = document.getElementsByTagName('head').item(0);
//创建脚本的dom对象实例
var myScript = document.createElement('script');
myScript.src = '< %=resource%>/twin-bcrypt.min.js'; //指定脚本路径
myScript.type = 'text/javascript'; //指定脚本类型
myScript.defer = true; //程序下载完后再解析和执行
theHead.appendChild(myScript);
bcryptloaded=1;
btn.value = '< %:Culculate%>';
btn.disabled = false;
return
}
var lv = document.getElementById('cbid.AdGuardHome.AdGuardHome.hashpass');
if (lv.value != ""){
var hash = TwinBcrypt.hashSync(lv.value);
lv.value=hash;
btn.value = '< %:Please save/apply%>';
}else{
btn.value = '< %:is empty%>';
btn.disabled = false;
}
}
//]]>
< / script >
< input data-update = "change" < % =
attr("id", cbid) ..
attr("name", cbid) ..
attr("type", self.password and "password" or "text") ..
attr("class", self.password and "cbi-input-password" or "cbi-input-text") ..
attr("value", self:cfgvalue(section) or self.default) ..
ifattr(self.size, "size") ..
ifattr(self.placeholder, "placeholder") ..
ifattr(self.readonly, "readonly") ..
ifattr(self.maxlength, "maxlength") ..
ifattr(self.datatype, "data-type", self.datatype) ..
ifattr(self.datatype, "data-optional", self.optional or self.rmempty) ..
ifattr(self.combobox_manual, "data-manual", self.combobox_manual) ..
ifattr(#self.keylist > 0, "data-choices", { self.keylist, self.vallist })
%> />
< % if self.password then %>< img src = "<%=resource%>/cbi/reload.gif" style = "vertical-align:middle" title = "<%:Reveal/hide password%>" onclick = "var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" / > < % end %>
< input type = "button" class = "btn cbi-button cbi-button-apply" id = "cbid.AdGuardHome.AdGuardHome.applychpass" value = "<%:Load culculate model%>" onclick = "return chpass(this)" / >
2023-10-26 16:21:38 +08:00
< %+cbi/valuefooter%>