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