forked from geokrety/geokrety-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
funkcje-2.min.js
9 lines (9 loc) · 3.05 KB
/
funkcje-2.min.js
1
2
3
4
5
6
7
8
9
function zliczaj(a){var b=document.getElementById("licznik"),c=document.getElementById("poledoliczenia"),f=c.value,g=c.value.length,d=0,h=0;for(i=0;i<g;i++){if(f.charAt(i)=="\n"){d++;h++;navigator.appName!="Netscape"&&i++}d++}b.value=a-d;if(d>a){c.value=navigator.appName!="Netscape"?c.substring(0,a):c.value.substring(0,a-h);b.value=0;alert("max length "+a+"!")}}
function count_remaining(a,b,c){a=document.getElementById(a);b=document.getElementById(b);if(a.value.length>c)a.value=a.value.substring(0,c);b.innerHTML=""+(c-a.value.length)}function copy_value_to_innerHTML(a,b){var c=document.getElementById(a);document.getElementById(b).innerHTML=c.value}
function RuchyPola(a){var b=document;if(a==0||a==3||a==5){b.getElementById("latlon").disabled=false;b.getElementById("wpt").disabled=false;b.getElementById("btn_sprawdzskrzynke").disabled=false;b.getElementById("NazwaSkrzynki").disabled=false}else if(a==1||a==2||a==4||a==6){b.getElementById("latlon").disabled=true;b.getElementById("wpt").disabled=true;b.getElementById("btn_sprawdzskrzynke").disabled=true;b.getElementById("NazwaSkrzynki").disabled=true}}
function sprawdzWpt(a){if(a){var b=window.event?event.keyCode:a.keyCode;if(b==9||b>=16&&b<=20||b>=33&&b<=40)return}b=document;var c=b.getElementById("latlon"),f=b.getElementById("NazwaSkrzynki"),g=b.getElementById("ajax_status"),d=b.getElementById("wpt").value.replace(/^\s\s*/,"").replace(/\s\s*$/,""),h=b.getElementById("wynikWpt");if(d.length>=6){if(a||g.title!=d){g.innerHTML="Retrieving...";g.title=d;$.get("szukaj-ajax.php",{skad:"ajax",wpt:d},function(e){g.innerHTML="";e=JSON.parse(e);if(e.lat!=
""){c.value=e.lat+" "+e.lon;c.disabled=true}else{c.disabled=false;c.value=""}f.disabled=true;h.innerHTML=e.tresc})}}else{c.disabled=false;c.value="";f.disabled=false;f.value="";h.innerHTML="";g.title=""}}
function sprawdzNazwe(){var a=document,b=a.getElementById("NazwaSkrzynki").value.replace(/^\s\s*/,"").replace(/\s\s*$/,""),c=a.getElementById("wpt"),f=a.getElementById("latlon"),g=a.getElementById("NazwaSkrzynki"),d=a.getElementById("ajax_status"),h=a.getElementById("wynikWpt");if(b.length>=5){h.innerHTML="";d.innerHTML="Retrieving...";d.title=b;$.get("szukaj-ajax.php",{skad:"ajax",NazwaSkrzynki:b},function(e){d.innerHTML="";e=JSON.parse(e);if(e.IleSkrzynek==1){f.disabled=true;f.value=e.lat+" "+e.lon;
c.value=e.wpt}else{f.disabled=false;f.value="";c.disabled=false;c.value=""}h.innerHTML=e.tresc})}else{c.disabled=false;c.value="";f.disabled=false;f.value="";g.disabled=false;h.innerHTML="";d.title="";d.innerHTML="<br /><br /><br />Enter at least 5 characters of the name"}}
function sprawdzGK(a){if(a){a=window.event?event.keyCode:a.keyCode;if(a==9||a>=16&&a<=20||a>=33&&a<=40)return}a=document.getElementById("nr").value.replace(/^\s\s*/,"").replace(/\s\s*$/,"");var b=document.getElementById("wynikNr");if(/^[a-zA-Z0-9]{6}(\.[a-zA-Z0-9]{6})*$/.test(a)){b.innerHTML="Retrieving...";$.get("szukaj-ajax.php",{skad:"ajax",nr:a},function(c){b.innerHTML=c})}else b.innerHTML=""}
function CzySkasowac(a,b){var c=confirm("Are you sure you want to delete "+b);if(c)a.href+="&confirmed=1";return c};