Add calc by press enter.
This commit is contained in:
1 parent
6b06a49e8e
commit
c9978a20b1
3 files changed
+92
-2
No files matched your search
@@ -35,7 +35,7 @@
|
||||
<div id="control_id" >
|
||||
<h2>Type your code</h2><br/>
|
||||
<form name="pwgen" id="form_id">
|
||||
<input placeholder="Code" type="text" name="serial" id="serial_id" />
|
||||
<input placeholder="Code" type="text" name="serial" id="serial_id" onkeypress="enterPress(event);" />
|
||||
<br/><br/>
|
||||
<input type="button" class="btn primary" name="serial" id="button_id" value="Compute" onclick="calcPass()" />
|
||||
</form>
|
||||
|
||||
@@ -44,6 +44,23 @@ function toDescription(arr){
|
||||
return arr;
|
||||
}
|
||||
|
||||
function enterPress(e){
|
||||
var keynum=0;
|
||||
if(e.which){
|
||||
keynum = e.which;
|
||||
}else if(window.event){
|
||||
keynum = e.keyCode ;
|
||||
}
|
||||
if(keynum == 13){
|
||||
if(e.preventDefault){
|
||||
e.preventDefault();
|
||||
} else {
|
||||
e.returnValue = false;
|
||||
}
|
||||
calcPass();
|
||||
}
|
||||
}
|
||||
|
||||
function calcPass(){
|
||||
var serial = document.getElementById('serial_id').value;
|
||||
var answ = toDescription(toArray(autoGetBiosPwd(serial)));
|
||||
|
||||
@@ -1 +1,74 @@
|
||||
var sDescription=CreateHashTable([[SONY,"Old Sony"],[SAMSUNG,"Samsung"],[PHOENIX,"Generic Phoenix"],[HP_COMPAQ,"HP/Compaq Phoenix BIOS"],[FSI_PHOENIX,"Fujitsu-Siemens Phoenix"],[FSI_L_PHOENIX,"Fujitsu-Siemens (model L) Phoenix "],[FSI_P_PHOENIX,"Fujitsu-Siemens (model P) Phoenix "],[FSI_S_PHOENIX,"Fujitsu-Siemens (model S) Phoenix "],[FSI_X_PHOENIX,"Fujitsu-Siemens (model X) Phoenix "],[INSYDE,"InsydeH2O BIOS (Acer, HP)"],[HP_MINI,"HP/Compaq Mini Netbooks"],[FSI_20_DEC_NEW,"Fujitsu-Siemens new"], [FSI_20_DEC_OLD,"Fujitsu-Siemens old"],[FSI_HEX,"Fujitsu-Siemens"]]);function converToTable(b){for(var a='<table class="answer_table">',c=0;c<b.length;c++){for(var a=a+"<tr>",d=0;d<b[c].length;d++)a+="<td>"+b[c][d]+"<td>";a+="</tr>"}return a+"</table>"}function toArray(b){var a=[],c;for(c in b)a.push([c,b[c]]);return a}function toDescription(b){for(var a=0;a<b.length;a++)b[a][0]=sDescription[b[a][0]];return b} function calcPass(){var b=document.getElementById("serial_id").value,a=toDescription(toArray(autoGetBiosPwd(b))),b=a.length,a=converToTable(a);document.getElementById("try_this").style.display=0<b?"":"none";document.getElementById("answer").innerHTML=a};
|
||||
|
||||
var sDescription = CreateHashTable([[SONY,"Old Sony"],
|
||||
[SAMSUNG,"Samsung"],
|
||||
[PHOENIX,"Generic Phoenix"],
|
||||
[HP_COMPAQ,"HP/Compaq Phoenix BIOS"],
|
||||
[FSI_PHOENIX,"Fujitsu-Siemens Phoenix"],
|
||||
[FSI_L_PHOENIX,"Fujitsu-Siemens (model L) Phoenix "],
|
||||
[FSI_P_PHOENIX,"Fujitsu-Siemens (model P) Phoenix "],
|
||||
[FSI_S_PHOENIX,"Fujitsu-Siemens (model S) Phoenix "],
|
||||
[FSI_X_PHOENIX,"Fujitsu-Siemens (model X) Phoenix "],
|
||||
[INSYDE,"InsydeH2O BIOS (Acer, HP)"],
|
||||
[HP_MINI,"HP/Compaq Mini Netbooks"],
|
||||
[FSI_20_DEC_NEW,"Fujitsu-Siemens new"],
|
||||
[FSI_20_DEC_OLD,"Fujitsu-Siemens old"],
|
||||
[FSI_HEX,"Fujitsu-Siemens"]
|
||||
]);
|
||||
|
||||
|
||||
function converToTable(answ){
|
||||
var str ='<table class="answer_table">';
|
||||
for(var i=0; i<answ.length; i++){
|
||||
str += "<tr>";
|
||||
for(var j=0; j< answ[i].length; j++){
|
||||
str += '<td>' + answ[i][j] + '<td>' ;
|
||||
}
|
||||
str += "</tr>";
|
||||
}
|
||||
str += "</table>";
|
||||
return str;
|
||||
}
|
||||
|
||||
function toArray(obj){
|
||||
var ret = [];
|
||||
for(var i in obj){
|
||||
ret.push([i,obj[i]]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function toDescription(arr){
|
||||
for(var i=0;i<arr.length;i++){
|
||||
arr[i][0] = sDescription[arr[i][0]];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
function enterPress(e){
|
||||
var keynum=0;
|
||||
if(e.which){
|
||||
keynum = e.which;
|
||||
}else if(window.event){
|
||||
keynum = e.keyCode ;
|
||||
}
|
||||
if(keynum == 13){
|
||||
if(e.preventDefault){
|
||||
e.preventDefault();
|
||||
} else {
|
||||
e.returnValue = false;
|
||||
}
|
||||
calcPass();
|
||||
}
|
||||
}
|
||||
|
||||
function calcPass(){
|
||||
var serial = document.getElementById('serial_id').value;
|
||||
var answ = toDescription(toArray(autoGetBiosPwd(serial)));
|
||||
var k = answ.length;
|
||||
var str = converToTable(answ) ;
|
||||
var th = document.getElementById('try_this');
|
||||
th.style.display = (k>0) ? "" :"none";
|
||||
var an = document.getElementById("answer");
|
||||
an.innerHTML = str;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user