//////////////////////wspolne: function visi_notatka(co) { document.getElementById(co).style.visibility = 'visible'; } function analityk_form_visi(co) { document.getElementById('komentarz_' + co).style.visibility = 'visible'; document.getElementById('container_analityk_' + co).style.height = '90px'; } function visi_pm(co) { document.getElementById(co).style.visibility = 'visible'; } function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds) { break; } } } function stooq_zmieniaj() { stooq_zmien('next'); } function stooq_zmien(co) { if (co == 'next') { if (stooq_co == 'gpw') { co = "zag"; } if (stooq_co == 'zag') { co = "wal"; } if (stooq_co == 'wal') { co = "gpw"; } } if (document.getElementById("stooq_gpw") == null) { return false; } if (co == "gpw") { document.getElementById("stooq_gpw").style.display = ''; document.getElementById("stooq_gpw_nag").style.fontWeight = 'bold'; stooq_co = co; } else { document.getElementById("stooq_gpw").style.display = 'none'; document.getElementById("stooq_gpw_nag").style.fontWeight = 'normal'; } if (co == "wal") { document.getElementById("stooq_wal").style.display = ''; document.getElementById("stooq_wal_nag").style.fontWeight = 'bold'; stooq_co = co; } else { document.getElementById("stooq_wal").style.display = 'none'; document.getElementById("stooq_wal_nag").style.fontWeight = 'normal'; } if (co == "zag") { document.getElementById("stooq_zag").style.display = ''; document.getElementById("stooq_zag_nag").style.fontWeight = 'bold'; stooq_co = co; } else { document.getElementById("stooq_zag").style.display = 'none'; document.getElementById("stooq_zag_nag").style.fontWeight = 'normal'; } } function prawa_staty_zmien(co) { if (co == "wzrosty") { document.getElementById("tab_prawa_wzrosty").style.display = ''; document.getElementById("tab_prawa_wzrosty_nag").style.fontWeight = 'bold'; } else { document.getElementById("tab_prawa_wzrosty").style.display = 'none'; document.getElementById("tab_prawa_wzrosty_nag").style.fontWeight = 'normal'; } if (co == "spadki") { document.getElementById("tab_prawa_spadki").style.display = ''; document.getElementById("tab_prawa_spadki_nag").style.fontWeight = 'bold'; } else { document.getElementById("tab_prawa_spadki").style.display = 'none'; document.getElementById("tab_prawa_spadki_nag").style.fontWeight = 'normal'; } if (co == "staty") { document.getElementById("tab_prawa_staty").style.display = ''; document.getElementById("tab_prawa_staty_nag").style.fontWeight = 'bold'; } else { document.getElementById("tab_prawa_staty").style.display = 'none'; document.getElementById("tab_prawa_staty_nag").style.fontWeight = 'normal'; } } function prawa_polecane_zmien(co) { for (i = 0; i < 3; i++) { if (Number(co) == i) { document.getElementById("tab_prawa_polecane_" + i).style.display = ''; document.getElementById("tab_prawa_polecane_" + i + "_nag").style.fontWeight = 'bold'; } else { document.getElementById("tab_prawa_polecane_" + i).style.display = 'none'; document.getElementById("tab_prawa_polecane_" + i + "_nag").style.fontWeight = 'normal'; } } } function ClearInput(value, id) { var input = document.getElementById(id); if (value == input.value) { input.value = ''; // Empty It. } } function visi_post(co) { document.getElementById(co).style.display = 'block'; if (document.getElementById('post_dodaj_top')) { document.getElementById('post_dodaj_top').style.visibility = 'hidden'; } if (document.getElementById('post_dodaj_bottom')) { document.getElementById('post_dodaj_top').style.visibility = 'hidden'; } } function visi_temat(co) { document.getElementById(co).style.display = 'block'; if (document.getElementById('temat_dodaj_top')) { document.getElementById('temat_dodaj_top').style.visibility = 'hidden'; } if (document.getElementById('temat_dodaj_bottom')) { document.getElementById('temat_dodaj_bottom').style.visibility = 'hidden'; } } function liczwpzn(textarea, gdzie, limit) { gdzie.value = limit - textarea.value.length; } function rozciag_menu(co) { for (i = 0; i < 20; i++) { if (document.getElementById('menu' + co + i)) { if (document.getElementById('menu' + co + i).style.display == 'none') { document.getElementById('menu' + co + i).style.display = ''; } else { document.getElementById('menu' + co + i).style.display = 'none'; } } } } function formatCurrency(num) { num = num.toString().replace(/\$|\,/g, ''); if (isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num * 100 + 0.50000000001); cents = num % 100; num = Math.floor(num / 100).toString(); if (cents < 10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++) num = num.substring(0, num.length - (4 * i + 3)) + ',' + num.substring(num.length - (4 * i + 3)); return (((sign) ? '' : '-') + num + '.' + cents); } function czyscchecked() { //alert (document.forms['koszyk'].length); for (i = 0; i < document.forms['koszyk'].length; i++) { if (document.forms[0].elements[i].type == 'checkbox') { document.forms[0].elements[i].defaultChecked = ''; document.forms[0].elements[i].checked = ''; } } } function skrotchange() { document.form.submit(); } function skrotchange_new(form_name) { document.forms[form_name].submit(); } function visi_rss(co) { if (document.getElementById('tresc' + co)) { if (document.getElementById('tresc' + co).style.display == 'none') { document.getElementById('tresc' + co).style.display = ''; document.getElementById('link' + co).style.display = ''; } else { document.getElementById('tresc' + co).style.display = 'none'; document.getElementById('link' + co).style.display = 'none'; } } } function bbcode_podmien(otw, zam, gdzie) { pole = document.getElementById(gdzie); // explorer if (document.selection && document.selection.createRange) { pole.focus(); sel = document.selection.createRange(); sel.text = otw + sel.text + zam; pole.focus(); } // firefox else if (pole.selectionStart || pole.selectionStart == '0') { var poczatek = pole.selectionStart; var koniec = pole.selectionEnd; pole.value = pole.value.substring(0, poczatek) + otw + pole.value.substring(poczatek, koniec) + zam + pole.value.substring(koniec, pole.value.length); pole.selectionStart = pole.selectionEnd = koniec + otw.length + zam.length; pole.focus(); } return; } function shBlock(id) { var item; item = document.getElementById(id); if (item.style.display == 'none' || item.style.display == '') { item.style.display = 'block'; } else { item.style.display = 'none'; } } function parseRecordsZlecVirt(xml) { record = xml.getElementsByTagName("record"); if (record.length == 0) { return; } // alert("asdf2"); if (typeof (tabelkan) != 'undefined') { zmieniac = 1; } else { tabelkan = new Array(5); tabelkan[0] = new Array(9); tabelkan[1] = new Array(9); tabelkan[2] = new Array(9); tabelkan[3] = new Array(9); tabelkan[4] = new Array(9); tabelkazm = new Array(5); tabelkazm[0] = new Array(9); tabelkazm[1] = new Array(9); tabelkazm[2] = new Array(9); tabelkazm[3] = new Array(9); tabelkazm[4] = new Array(9); zmieniac = 0; } for (i = 0; i < 5; i++) { /* if (record[i].childNodes[8].childNodes[0].nodeValue!='-') { temp=record[i].childNodes[8].childNodes[0].nodeValue; temp_czas=temp.charAt(0)+temp.charAt(1)+":"+temp.charAt(2)+temp.charAt(3)+":"+temp.charAt(4)+temp.charAt(5); record[i].childNodes[8].childNodes[0].nodeValue=temp_czas; } */ for (ii = 0; ii < 6; ii++) { if (tabelkan[i][ii] != record[i].childNodes[ii].childNodes[0].nodeValue && zmieniac == 1) { if (tabelkan[i][ii] < record[i].childNodes[ii].childNodes[0].nodeValue) { tabelkazm[i][ii] = 1; } else { tabelkazm[i][ii] = -1; } } else { tabelkazm[i][ii] = 0; } tabelkan[i][ii] = record[i].childNodes[ii].childNodes[0].nodeValue; if (ii == 2 || ii == 3) { if (record[i].childNodes[ii].childNodes[0].nodeValue == -100) { record[i].childNodes[ii].childNodes[0].nodeValue = 'PKC'; } if (record[i].childNodes[ii].childNodes[0].nodeValue == -20) { record[i].childNodes[ii].childNodes[0].nodeValue = 'PCRO'; } } } zmiana_trans = 0; for (ii = 6; ii < 9; ii++) { if (tabelkan[i][ii] != record[i].childNodes[ii].childNodes[0].nodeValue && zmieniac == 1) { zmiana_trans = 1; } tabelkan[i][ii] = record[i].childNodes[ii].childNodes[0].nodeValue; } } for (i = 0; i < 5; i++) { for (ii = 0; ii < 6; ii++) { if (tabelkazm[i][ii] == 0) { document.getElementById('t' + i + ii).innerHTML = record[i].childNodes[ii].childNodes[0].nodeValue; } else { if (tabelkazm[i][ii] > 0) { document.getElementById('t' + i + ii).innerHTML = "" + record[i].childNodes[ii].childNodes[0].nodeValue + ""; } else { document.getElementById('t' + i + ii).innerHTML = "" + record[i].childNodes[ii].childNodes[0].nodeValue + ""; } } } for (ii = 6; ii < 9; ii++) { if (zmiana_trans == 0) { document.getElementById('t' + i + ii).innerHTML = record[i].childNodes[ii].childNodes[0].nodeValue; } else { document.getElementById('t' + i + ii).innerHTML = "" + record[i].childNodes[ii].childNodes[0].nodeValue + ""; } } } // alert("asdf3"); info = xml.getElementsByTagName("info"); if (info.length == 0) { return; } document.getElementById('info').innerHTML = "Otw: " + info[0].childNodes[0].childNodes[0].nodeValue + " Min: " + info[0].childNodes[1].childNodes[0].nodeValue + " Max: " + info[0].childNodes[2].childNodes[0].nodeValue + " Vol: " + info[0].childNodes[3].childNodes[0].nodeValue + " Obr: " + info[0].childNodes[4].childNodes[0].nodeValue + "
Widełki max: " + info[0].childNodes[5].childNodes[0].nodeValue + " Widełki min: " + info[0].childNodes[6].childNodes[0].nodeValue; return; } function parseRecordsNotowania(xml) { ile_rekordow_xml = xml.getElementsByTagName("info"); if (ile_rekordow_xml.length == 0) { return; } ile_rekordow = ile_rekordow_xml[0].childNodes[0].childNodes[0].nodeValue; // document.getElementById('notowania_czas_odswiezenia').innerHTML=ile_rekordow_xml[0].childNodes[1].childNodes[0].nodeValue; //alert (ile_rekordow); notowania_tab = naglowek_tab + ''; record = xml.getElementsByTagName("record"); if (record.length == 0) { return; } if (typeof (tabelkakoszyk) != 'undefined') { zmieniac = 1; } else { tabelkanot = new Array(ile_rekordow); tabelkazm = new Array(ile_rekordow); tabelkanot_st = new Array(ile_rekordow); notowania_tabelka = new Array(ile_rekordow); for (i = 0; i < ile_rekordow; i++) { notowania_tabelka[i] = 0; tabelkanot[i] = new Array(56); tabelkazm [i] = new Array(56); tabelkanot_st[i] = new Array(56); } zmieniac = 0; tabelkakoszyk = 1; } record = xml.getElementsByTagName("record"); if (record.length == 0) { return; } for (xx = 0; xx < ile_rekordow; xx++) { //alert(record[i].childNodes[1].childNodes[0].nodeValue); a = record[xx].childNodes[0].childNodes[0].nodeValue.split(';'); b = record[xx].childNodes[1].childNodes[0].nodeValue.split(';'); c = record[xx].childNodes[2].childNodes[0].nodeValue.split(';'); ii = 0; for (i = 0; i < a.length; i++) //dane podstawowe { tabelkanot[xx][ii] = a[i]; ii++; } for (i = 0; i < b.length; i++) //dane tabelka ofert { tabelkanot[xx][ii] = b[i]; ii++; } for (i = 0; i < c.length; i++) //dane tabelka transakcji { tabelkanot[xx][ii] = c[i]; ii++; } //sprawdzenie czy wartosci sie zmieniły: if (zmieniac == 0)//pierwsze uruchomienie { for (i = 0; i < 56; i++) { tabelkazm[xx][i] = 0; } } else //porownac z poprzednią wartościa { for (i = 0; i < 56; i++) { if (tabelkanot[xx][i] != tabelkanot_st[xx][i]) { if (tabelkanot[xx][i] < tabelkanot_st[xx][i]) { tabelkazm[xx][i] = -1; } else { tabelkazm[xx][i] = 1; } } else { tabelkazm[xx][i] = 0; } } } //alert (tabelkanot_st[xx]); for (j = 0; j < 56; j++) { tabelkanot_st[xx][j] = tabelkanot[xx][j]; } //alert (tabelkanot_st[xx]); //kolorowanie liczb tabelkanot[xx][6] = pokoloruj(formatCurrency(tabelkanot[xx][6]), 1); //zmiana % tabelkanot[xx][42] = formatCurrency(tabelkanot[xx][42]); //tabelka transakcji - kurs tabelkanot[xx][45] = formatCurrency(tabelkanot[xx][45]); tabelkanot[xx][48] = formatCurrency(tabelkanot[xx][48]); tabelkanot[xx][51] = formatCurrency(tabelkanot[xx][51]); tabelkanot[xx][54] = formatCurrency(tabelkanot[xx][54]); tabelkanot[xx][4] = formatCurrency(tabelkanot[xx][4]); //min/max widełki tabelkanot[xx][5] = formatCurrency(tabelkanot[xx][5]); tabelkanot[xx][7] = formatCurrency(tabelkanot[xx][7]); tabelkanot[xx][8] = formatCurrency(tabelkanot[xx][8]); if (tabelkanot[xx][21] < 0 || tabelkanot[xx][36] < 0) { if (tabelkanot[xx][21] == -100) { tabelkanot[xx][21] = 'PKC'; } if (tabelkanot[xx][21] == -20) { tabelkanot[xx][21] = 'PCRO'; } if (tabelkanot[xx][22] == -100) { tabelkanot[xx][22] = 'PKC'; } if (tabelkanot[xx][22] == -20) { tabelkanot[xx][22] = 'PCRO'; } if (tabelkanot[xx][36] == -100) { tabelkanot[xx][36] = 'PKC'; } if (tabelkanot[xx][36] == -20) { tabelkanot[xx][36] = 'PCRO'; } if (tabelkanot[xx][37] == -100) { tabelkanot[xx][37] = 'PKC'; } if (tabelkanot[xx][37] == -20) { tabelkanot[xx][37] = 'PCRO'; } } for (i = 11; i < 41; i++) //tabela ofert kolorowanie { if (tabelkazm[xx][i] > 0) { tabelkanot[xx][i] = '' + tabelkanot[xx][i] + ''; } if (tabelkazm[xx][i] < 0) { tabelkanot[xx][i] = '' + tabelkanot[xx][i] + ''; } } pogrubtrans = 0; for (i = 41; i < 56; i = i + 3) // pogrubienie jeśli coś sie zmieniło { if (tabelkazm[xx][i] != 0) { tabelkanot[xx][i] = '' + tabelkanot[xx][i] + ''; tabelkanot[xx][i + 1] = '' + tabelkanot[xx][i + 1] + ''; tabelkanot[xx][i + 2] = '' + tabelkanot[xx][i + 2] + ''; } if (tabelkazm[xx][i + 1] > 0) { tabelkanot[xx][i] = '' + tabelkanot[xx][i] + ''; tabelkanot[xx][i + 1] = '' + tabelkanot[xx][i + 1] + ''; tabelkanot[xx][i + 2] = '' + tabelkanot[xx][i + 2] + ''; } if (tabelkazm[xx][i + 1] < 0) { tabelkanot[xx][i] = '' + tabelkanot[xx][i] + ''; tabelkanot[xx][i + 1] = '' + tabelkanot[xx][i + 1] + ''; tabelkanot[xx][i + 2] = '' + tabelkanot[xx][i + 2] + ''; } } if (pogrubtrans == 1) { for (i = 41; i < 56; i++) // pogrubienie jeśli coś sie zmieniło { tabelkanot[xx][i] = '' + tabelkanot[xx][i] + ''; } } //wyswietlanie nowych danych: // alert(a); // alert(a[0]); // alert(tabelkanot[0]);'+tabelkanot[xx][]+' if (notowania_tabelka[xx] == 0) { pokaz_dol = 'display: none;'; } else { pokaz_dol = ''; } notowania_tab = notowania_tab + '' + tabelkanot[xx][1] + ''; notowania_tab = notowania_tab + '' + tabelkanot[xx][3] + '' + tabelkanot[xx][6] + '' + tabelkanot[xx][41] + '' + tabelkanot[xx][43] + '' + tabelkanot[xx][42] + '' + tabelkanot[xx][11] + '' + tabelkanot[xx][16] + '' + tabelkanot[xx][21] + '' + tabelkanot[xx][36] + '' + tabelkanot[xx][31] + '' + tabelkanot[xx][26] + '' + tabelkanot[xx][9] + '' + tabelkanot[xx][10] + '[+]'; notowania_tab = notowania_tab + '' + tabelkanot[xx][2] + '
' + tabelkanot[xx][4] + '
' + tabelkanot[xx][5] + '
' + tabelkanot[xx][7] + '
' + tabelkanot[xx][8] + '' + tabelkanot[xx][44] + '
' + tabelkanot[xx][47] + '
' + tabelkanot[xx][50] + '
' + tabelkanot[xx][53] + '
' + tabelkanot[xx][46] + '
' + tabelkanot[xx][49] + '
' + tabelkanot[xx][52] + '
' + tabelkanot[xx][55] + '
' + tabelkanot[xx][45] + '
' + tabelkanot[xx][48] + '
' + tabelkanot[xx][51] + '
' + tabelkanot[xx][54] + '
' + tabelkanot[xx][12] + '
' + tabelkanot[xx][13] + '
' + tabelkanot[xx][14] + '
' + tabelkanot[xx][15] + '' + tabelkanot[xx][17] + '
' + tabelkanot[xx][18] + '
' + tabelkanot[xx][19] + '
' + tabelkanot[xx][20] + '' + tabelkanot[xx][22] + '
' + tabelkanot[xx][23] + '
' + tabelkanot[xx][24] + '
' + tabelkanot[xx][25] + '' + tabelkanot[xx][37] + '
' + tabelkanot[xx][38] + '
' + tabelkanot[xx][39] + '
' + tabelkanot[xx][40] + '' + tabelkanot[xx][32] + '
' + tabelkanot[xx][33] + '
' + tabelkanot[xx][34] + '
' + tabelkanot[xx][35] + '' + tabelkanot[xx][27] + '
' + tabelkanot[xx][28] + '
' + tabelkanot[xx][29] + '
' + tabelkanot[xx][30] + ''; //alert (tabelkanot_st[xx]); //alert (a); //return result; } document.getElementById('notowania_dane').innerHTML = notowania_tab + ""; } function pokoloruj(wartosc, procent) { if (wartosc < 0) { if (procent == 0) { return '' + wartosc + ''; } else { return '' + wartosc + ' %'; } } if (wartosc == 0) { if (procent == 0) { return '' + wartosc + ''; } else { return '' + wartosc + ' %'; } } if (wartosc > 0) { if (procent == 0) { return '' + wartosc + ''; } else { return '' + wartosc + ' %'; } } } function getRecords(parametr) { $.ajax({url: parametr + '&test=' + test + '&sesja=' + shout_sesja + '&ids=' + shout_id}).done(function (data) { if (parametr == '/osobne/not_virtual.php?module=a') { parseRecordsZlecVirt(data); } if (parametr == '/osobne/notowania_lista.php?module=a') { parseRecordsNotowania(data); } }); } function getShoutsAfterPost() { setTimeout('document.getElementById("shoutboxResult").innerHTML ="";', 5000); $('#wiadomosc').val(''); $('#sh_image').val(''); $('#imagePreviewName').html(''); $('#imagePreview').attr('src', ''); getShouts(); } let currentTitle = document.title; function getShouts() { if (typeof (shout_sesja) == 'undefined') { shout_sesja = 'a'; } if (typeof (shout_id) == 'undefined') { shout_id = '1'; } if (typeof (shout_id) == 'undefined') { shout_id = '1'; } let updateColorbox = false; $.ajax({ type: 'GET', url: '/api.php?method=ShoutBox&action=_apiGetShouts' + '&test=' + test + '&sesja=' + shout_sesja + '&ids=' + shout_id, dataType: 'json', cache: false, success: function (data) { console.log(data); // lista = document.getElementById("sh_m_c").innerHTML; wyniktest = setScrollBottomTest(); ilelinii = data.length; console.log('ilelinii: ' + ilelinii); lista = ''; for (i = 0; i < data.length; i++) { console.log('data' + i + ': ' + data[i]); lista = lista + '
' + data[i].c + '
'; lista = lista + '
' + data[i].l + '
'; // zablokuj = 0; for (var j = 0; j < blokowani.length; j++) { if (blokowani[j] == data[i].i) { zablokuj = 1; } } //alert (blokowani); if (zablokuj == 0) { lista = lista + '
' + data[i].m + '
'; } else { lista = lista + '
Ta wiadomość została usunięta ze względu na blokadę gracza.
'; } updateColorbox = true; } $('#sh_m_c').append(lista); if (updateColorbox) { document.title = 'Shoutbox - Nowa wiadomość'; setTimeout('document.title = currentTitle;', 5000); $('.colorbox').colorbox({ rel: function () { return $(this).data('rel'); }, scalePhotos: true, maxWidth: '95%', maxHeight: '95%' }); } //alert ("aa");//alert (pierwszyraz); if (wyniktest == 1 || pierwszyraz == 1) { sleep(500); setScrollBottom(); pierwszyraz = 0; } //updateStockList(); //alert (wyniktest); } }) } function getRecordsZlNot(parametr) { $.ajax({url: parametr + '&id_not=' + id_not}).done(function (data) { parseRecordsZlecVirt(data); }) } function repeatloop(parametr) { getRecords(parametr); } function repeatloop_zl_not(parametr) { getRecordsZlNot(parametr); } function setScrollBottomTest() { // var container = document.getElementById("sh_m_c"); //alert (container.clientHeight); 570 //alert (container.scrollHeight); 715 //alert (container.scrollTop); 142 if (container == null) { return 0; } if ((container.clientHeight + container.scrollTop + 25) > container.scrollHeight) { return 1; } else { return 0; } } function setScrollBottom() { var scrolledDiv = document.getElementById('sh_m_c'); if (scrolledDiv == null) { return false; } scrolledDiv.scrollTop = scrolledDiv.scrollHeight; } function roz(co) { if (document.getElementById('sp' + co)) { if (document.getElementById('sp' + co).style.display == 'none') { document.getElementById('sp' + co).style.display = ''; notowania_tabelka[co] = 1; } else { document.getElementById('sp' + co).style.display = 'none'; notowania_tabelka[co] = 0; } } } function rozall(ile) { if (typeof (notowania_tabelka) != 'undefined') { } else { notowania_tabelka = new Array(ile); } if (typeof (notowania_zwijac_rozwijac) != 'undefined') { } else { notowania_zwijac_rozwijac = 0; } for (var i = 0; i < ile; i++) { if (document.getElementById('sp' + i)) { if (notowania_zwijac_rozwijac == 0) { document.getElementById('sp' + i).style.display = ''; notowania_tabelka[i] = 1; } else { document.getElementById('sp' + i).style.display = 'none'; notowania_tabelka[i] = 0; } /* if(document.getElementById('sp'+i).style.display == 'none' ) { document.getElementById('sp'+i).style.display = ''; } else { document.getElementById('sp'+i).style.display = 'none'; } */ } } if (notowania_zwijac_rozwijac == 0) { notowania_zwijac_rozwijac = 1; } else { notowania_zwijac_rozwijac = 0; } } function pm_rozall() { if (typeof (pm_tabelka) != 'undefined') { } else { pm_tabelka = new Array(1000); } if (typeof (pm_zwijac_rozwijac) != 'undefined') { } else { pm_zwijac_rozwijac = 0; } for (var i = 0; i < 1000; i++) { if (document.getElementById('sp' + i)) { if (pm_zwijac_rozwijac == 0) { document.getElementById('sp' + i).style.display = ''; pm_tabelka[i] = 1; } else { document.getElementById('sp' + i).style.display = 'none'; pm_tabelka[i] = 0; } } } if (pm_zwijac_rozwijac == 0) { pm_zwijac_rozwijac = 1; } else { pm_zwijac_rozwijac = 0; } } function pm_roz(co) { if (document.getElementById('sp' + co)) { if (document.getElementById('sp' + co).style.display == 'none') { document.getElementById('sp' + co).style.display = ''; pm_tabelka[co] = 1; } else { document.getElementById('sp' + co).style.display = 'none'; pm_tabelka[co] = 0; } } } function sprawdzpola(co, gdzie) //-----------------> sprawdza pola i pokazuje / ukrywa divy lub wysyła zapytanie do ajaxa { wartosc = document.getElementById(gdzie).value; if (co == "blednehaslo2" || co == "blednyemail2") { if (co == "blednehaslo2") { if (wartosc != document.getElementById("NKhaslo1").value) { document.getElementById("blednehaslo2").style.visibility = "visible"; return false; } else { document.getElementById("blednehaslo2").style.visibility = "hidden"; return true; } } if (co == "blednyemail2") { if (wartosc != document.getElementById("NKemail2").value) { document.getElementById("blednyemail2").style.visibility = "visible"; return false; } else { document.getElementById("blednyemail2").style.visibility = "hidden"; return true; } } } else { if (co == 'blednylogin') { if (wartosc.length > 15) { document.getElementById("blednylogin").style.visibility = "visible"; return false; } } if (wartosc != "") { return sprawdzwbazie(co, wartosc); } else { return false; } } } function sprawdzwbazie(co, wartosc) //----------------->wysyła zapytanie do bazy z szukanym polem oraz wartoscia wpisaną { $.ajax({url: "/osobne/sprawdzxml.php?co=" + co + "&szukane=" + wartosc}).done(function (data) { document.getElementById("wynik").value = parseRecordsProfil(data); }) if (document.getElementById("wynik").value == false) { return false; } else { return true; } } function parseRecordsProfil(xml) //----------------->parsuje rekordy xmla i odkrywa pole div jesli napotka błąd { record = xml.getElementsByTagName("record"); if (record[0].childNodes[1].childNodes[0].nodeValue == 0) { document.getElementById(record[0].childNodes[0].childNodes[0].nodeValue).style.visibility = "visible"; return false; } else { document.getElementById(record[0].childNodes[0].childNodes[0].nodeValue).style.visibility = "hidden"; return true; } } function simple_tooltip(target_items, name) { $(target_items).each(function (i) { $("body").append("
" + $(this).attr('title') + "
"); var my_tooltip = $("#" + name + i); if ($(this).attr("title") != "" && $(this).attr("title") != "undefined") { $(this).removeAttr("title").mouseover(function () { my_tooltip.css({opacity: 0.8, display: "none"}).fadeIn(400); }).mousemove(function (kmouse) { var border_top = $(window).scrollTop(); var border_right = $(window).width(); var left_pos; var top_pos; var offset = 20; if (border_right - (offset * 2) >= my_tooltip.width() + kmouse.pageX) { left_pos = kmouse.pageX + offset; } else { left_pos = border_right - my_tooltip.width() - offset; } if (border_top + (offset * 2) >= kmouse.pageY - my_tooltip.height()) { top_pos = border_top + offset; } else { top_pos = kmouse.pageY - my_tooltip.height() - offset; } my_tooltip.css({left: left_pos, top: top_pos}); }).mouseout(function () { my_tooltip.css({left: "-9999px"}); }); } }); } function skrotchange_filtruj(form_name) { document.forms[form_name].submit(); } function select_change(form_name) { document.forms[form_name].submit(); } function form_submit_get_zlecenia(form_name) { document.getElementById(form_name).action = document.getElementById(form_name).action + "/spolka/" + document.getElementById("zlecenie_wybierzespolke").value; document.forms[form_name].submit(); } var allHTMLTags = document.getElementsByTagName('*'); function getElementByClass(theClass) { //Create Array of All HTML Tags //Loop through all tags using a for loop for (i = 0; i < allHTMLTags.length; i++) { //Get all tags with the specified class name. if (allHTMLTags[i].className == theClass) { //Place any code you want to apply to all //pages with the class specified. //In this example is to “display:none;” them //Making them all dissapear on the page. allHTMLTags[i].style.display = 'none'; } } } function skrotchange() { document.form.submit(); } function czyscchecked() { //alert (document.forms['koszyk'].length); for (i = 0; i < document.forms['koszyk'].length; i++) { if (document.forms[0].elements[i].type == 'checkbox') { document.forms[0].elements[i].defaultChecked = ''; document.forms[0].elements[i].checked = ''; } } } function commadot(x) //or string back if not a number { if (typeof (x) != 'undefined') { x = x.replace(',', '.'); y = x.replace(' ', ''); //y = parseFloat(x); if (!isNaN(y)) { return y; //wraca numerek } else { return x; //wraca oryginał } } } function podmienzero() { if (document.getElementById('wpisana_ilosc').value == 0) { document.getElementById('wpisana_ilosc').value = ''; } } function cyfry(a) { for (i = 0; i < a.length; i++) { if (a.charCodeAt(i) <= 47 || a.charCodeAt(i) >= 58) { return false; } } return true; } function cyfry2(b) { for (i = 0; i < b.length; i++) { if (b.charCodeAt(i) < 44 || b.charCodeAt(i) == 45 || b.charCodeAt(i) == 47 || b.charCodeAt(i) > 57) { return false; } } return true; } function pole_disable(co) { if (co == 'zlimitem') { document.getElementById('wpisana_limit_trans').disabled = false; } if (co == 'pkc') { document.getElementById('wpisana_limit_trans').disabled = true; } przeliczopisini();//wywolac przeliczenie przy przelaczeniu rodzaju zdarzenia } var maxmozliwe = 0; function przeliczopisini() { zlecenie_typ = 'zlimitem'; maxmozliwe = 0; maxmozliwe_pkc = 0; //podstawiam 0 pod tabelkę na dole document.getElementById('JSkwotatrans').innerHTML = 0; document.getElementById('JSmaxmozliwe_limit').innerHTML = 0; document.getElementById('JSmaxmozliwe_pkc').innerHTML = 0; if ($('#zlecenie_stan_zlimitem').prop('checked')) { zlecenie_typ = 'zlimitem'; wpisana_cena = $('#wpisana_limit_trans').val(); document.getElementById('wpisana_limit_trans').value = commadot(wpisana_cena); } if ($('#zlecenie_stan_pkc').prop('checked')) { zlecenie_typ = 'pkc'; wpisana_cena = $('#JSkurs').val(); } //pobieram i sprawdzam wpisaną cene document.getElementById('limit_aktywacji').value = commadot(document.getElementById('limit_aktywacji').value); //pobieram i sprawdzam wpisaną ilosc wpisana_ilosc = document.getElementById('wpisana_ilosc').value; document.getElementById('wpisana_ilosc').value = commadot(wpisana_ilosc); //rodzaj wybranej transakcji rodzaj_trans = document.getElementById('JSrodztransakcji').value; //odpowiedzialne za wpisanie nazwy transakcji if (rodzaj_trans == 1) { $('#info_zyskstrata').hide(); $('#info_razemkoszt').show(); $('#info_makszlimitem').show(); $('#info_makspkc').show(); nazwatransakcji = "kupić"; nazwatrans2 = "kupno"; } if (rodzaj_trans == 2) { $('#info_zyskstrata').show(); $('#info_razemkoszt').hide(); $('#info_makszlimitem').hide(); $('#info_makspkc').hide(); nazwatransakcji = "sprzedać"; nazwatrans2 = "sprzedaż"; } document.getElementById('JSrodztrans').innerHTML = nazwatrans2; wid_max = parseFloat(document.getElementById('wid_max').value); pro_pro = parseFloat(document.getElementById('pro_pro').value); pro_min = parseFloat(document.getElementById('pro_min').value); //uzupelniam wybrany kurs jesli znam, jesli nie - obecny kurs if (isNaN(wpisana_cena) === false) { document.getElementById('JSkurswybrany').innerHTML = wpisana_cena; } else { wpisana_cena = document.getElementById('JSkurs').value; document.getElementById('JSkurswybrany').innerHTML = wpisana_cena; } //uzupelniam wybrany ilosc jesli znam, jesli nie - 0 if (isNaN(wpisana_ilosc) === false) { document.getElementById('JSiloscakcji').innerHTML = wpisana_ilosc; } else { wpisana_ilosc = 0; document.getElementById('JSiloscakcji').innerHTML = 0; } gotowka = Number(document.getElementById('JSgotowka').value); if (rodzaj_trans == 1) { if (gotowka > 1281) { if (wpisana_cena * pro_pro > 0.5) { max_gotowka = gotowka / ((pro_pro / 100) + 1); maxmozliwe = max_gotowka / wpisana_cena; } else { wpisana_cena_temp = (wpisana_cena * 1) + (0.005 * 1); //alert (gotowka); //alert (wpisana_cena_temp); maxmozliwe = gotowka / wpisana_cena_temp; //alert (max_mozliwe); } } else { max_prowizja = pro_min; maxmozliwe = (gotowka - pro_min) / wpisana_cena; } if (gotowka > 1281) { if (wid_max * pro_pro > 0.5) { max_gotowka = gotowka / ((pro_pro / 100) + 1); maxmozliwe_pkc = max_gotowka / wid_max; } else { wpisana_cena_temp = (wid_max * 1) + (0.005 * 1); //alert (gotowka); //alert (wpisana_cena_temp); maxmozliwe_pkc = gotowka / wpisana_cena_temp; //alert (max_mozliwe); } } else { max_prowizja = pro_min; maxmozliwe_pkc = (gotowka - pro_min) / wid_max; } } maxmozliwe = Math.floor(maxmozliwe); maxmozliwe_pkc = Math.floor(maxmozliwe_pkc); prowizja_temp = wpisana_ilosc * 0.005; prowizja = (Math.round(wpisana_cena * wpisana_ilosc * pro_pro)) / 100; if (prowizja_temp > prowizja) { prowizja = prowizja_temp; } if (prowizja < pro_min && wpisana_ilosc > 0) { prowizja = pro_min; } document.getElementById('JSkwotatrans').innerHTML = formatCurrency(Math.round(wpisana_cena * wpisana_ilosc)); if (maxmozliwe != 0) { document.getElementById('JSmaxmozliwe_limit').innerHTML = maxmozliwe + " akcji"; } if (maxmozliwe_pkc != 0) { document.getElementById('JSmaxmozliwe_pkc').innerHTML = maxmozliwe_pkc + " akcji"; } document.getElementById('JSprowizja').innerHTML = formatCurrency(prowizja); if (document.getElementById('JScena_z_portfela').value != 0 && wpisana_ilosc > 0) { POcena = document.getElementById('JScena_z_portfela').value; ilosc = document.getElementById('wpisana_ilosc').value; zyskstrata = Math.round((wpisana_cena - POcena) * ilosc) - prowizja * 2; if (document.getElementById('JSrodztransakcji').value == 3) { zyskstrata = Math.round((wpisana_cena - POcena) * ilosc) + prowizja * 2; zyskstrata = zyskstrata * (-1); } document.getElementById('JSzyskstrata').innerHTML = zyskstrata.toFixed(2); } if (zlecenie_typ == 'pkc') { document.getElementById('JSkwotarazem').innerHTML = formatCurrency(Math.round(wid_max * wpisana_ilosc + prowizja)); } else { document.getElementById('JSkwotarazem').innerHTML = formatCurrency(Math.round(wpisana_cena * wpisana_ilosc + prowizja)); } } function sprawdz_formularz() { ////rodzaj_Trans- 1 - kupno / 2 - sprzedaz //typ zlecenia var typ = 0; if (document.getElementById('zlecenie_stan_zlimitem').checked) { typ = 2; } if (document.getElementById('zlecenie_stan_pkc').checked) { typ = 3; } if (typ == 0) { alert("Błędny typ zlecenia"); return false; } if (typ == 0) { alert("Błędny typ zlecenia"); return false; } wpisana_ilosc = parseFloat(document.getElementById('wpisana_ilosc').value); if (wpisana_ilosc <= 0 || isNaN(wpisana_ilosc) === true) { alert("Ilość musi być wieksza niż 0"); return false; } rodzaj_trans = parseFloat(document.getElementById('JSrodztransakcji').value); kurs_aktualny = parseFloat(document.getElementById('JSkurs').value); limit_aktywacji = parseFloat(document.getElementById('limit_aktywacji').value); limit_transakcji = parseFloat(document.getElementById('wpisana_limit_trans').value); //Kupno: Kurs ost. trans. < Limit aktywacji <= Limit realizacji zlecenia //Sprzedaż: Kurs ost. trans. > Limit aktywacji >= Limit realizacji zlecenia if (typ == 2) // z limitem { if (isNaN(limit_transakcji)) { alert("Nie wpisałeś limitu ceny."); return false; } if (isNaN(limit_aktywacji) === true) { return true; } if (rodzaj_trans == 1) // kupno { if (kurs_aktualny < limit_aktywacji && limit_aktywacji <= limit_transakcji) { return true; } else { alert("Nie został spełniony warunek: \nkurs aktualny < limit aktywacji <= limit ceny"); return false; } } if (rodzaj_trans == 2) //sprzedaz { if (kurs_aktualny > limit_aktywacji && limit_aktywacji >= limit_transakcji) { return true; } else { alert("Nie został spełniony warunek: \nkurs aktualny > limit aktywacji >= limit ceny"); return false; } } } if (typ == 3) //pkc { if (isNaN(limit_aktywacji) === true) { return true; } if (rodzaj_trans == 1) //kupno { if (kurs_aktualny < limit_aktywacji) { return true; } else { alert("Nie został spełniony warunek: \nkurs aktualny < limit aktywacji"); return false; } } if (rodzaj_trans == 2) //sprzedaz { if (kurs_aktualny > limit_aktywacji) { return true; } else { alert("Nie został spełniony warunek: \nkurs aktualny > limit aktywacji"); return false; } } } } function spolkaSearch(go, searchId, resultId) { var spol_szuk = new Array(); szuk = document.getElementById(searchId).value; szuk = szuk.toUpperCase(); if (szuk.length < 1) { document.getElementById(resultId).innerHTML = ""; document.getElementById(resultId).className = ""; ost_szuk = ""; return; } if (typeof (ost_szuk) != "undefined") { if (szuk == ost_szuk) { return; } } ost_szuk = szuk; $.getJSON('/api.php?method=Spolka&action=_apiUnloggedSearchSpolka&search=' + szuk, function (result) { console.log(result); var str; str = '
'; $(result).each(function () { str = str + ' ' + this.krotka + ' - ' + this.nazwa_akcji + ''; }); str = str + '
'; document.getElementById(resultId).className = "zl_arkusz_lista_border"; if (result.length == 0) { document.getElementById(resultId).innerHTML = "Brak spółek!"; } else { document.getElementById(resultId).innerHTML = str; } }) } var updateInProgress = false; function updateContent(url, targetId) { if (url === null) { window.location = "/"; return; } //gdzie ma być przypisana zawartość if (targetId === undefined || targetId === '') { targetId = '#main'; } $(targetId).load(url, function () { //console.log('updateInProgress: ' + updateInProgress); updateInProgress = false; }); // load the html response into a DOM element } $(document).ready(function () { var scrollRelPx = 0; $('body').on('click', 'apopup, a.jsPopup', function (e) { //a:not(.noajaxlink,.colorbox),a[href*=\#]:not(.noajaxlink,.colorbox) e.preventDefault(); console.log('->html->click->a:not/ahref:not'); let targetid = ''; // do jakiego id console.log('updateInProgress?'); if (updateInProgress === false) { console.log('updateInProgress=false'); updateInProgress = true; } else { console.log('updateInProgress=true'); return; } //podstawowy href var url = $(this).attr('href'); if (url.indexOf('.') !== -1) {/// || url.indexOf('#') !== -1 ?? // updateInProgress = false; // return; } let urlExtra = ''; let urlExtraApi = ''; //data-action if (typeof $(this).data('action') !== 'undefined') { urlExtra += 'action/' + $(this).data('action') + '/'; urlExtraApi += '&action=' + $(this).data('action'); } //data-id if (typeof $(this).data('id') !== 'undefined') { urlExtra += 'id/' + $(this).data('id') + '/'; urlExtraApi += '&id=' + $(this).data('id'); } //data-url if (typeof $(this).data('url') !== 'undefined') { urlExtra += $(this).data('url'); urlExtraApi += $(this).data('url'); } if (typeof $(this).data('targetid') !== 'undefined') { targetid = $(this).data('targetid'); } if (typeof $(this).data('requireconfirm') !== 'undefined') { console.log('swal.fire'); Swal.fire({ title: $(this).data('swaltitle'), //text: "Nie będzie dało ", icon: 'warning', showCancelButton: true, confirmButtonColor: '#11c080', cancelButtonColor: '#d33', confirmButtonText: 'Potwierdź', cancelButtonText: 'Anuluj', }).then((result) => { if (result.value) { if (targetid != '#popup_canvas') { window.history.pushState(url, "Title", url); console.log('history: ' + window.history.location); console.log('load: ' + url); updateContent(url + urlExtra, targetid); updateInProgress = false; } else { $('#popup').css('display', 'block'); $('#popup_bg').css('display', 'block'); $('#popup_canvas').html(''); updateContent(url + urlExtraApi, targetid); updateInProgress = false; } } else { updateInProgress = false; } }); } else { if (targetid != '#popup_canvas') { window.history.pushState(url, "Title", url); console.log('history: ' + window.history.location); console.log('load: ' + url); updateContent(url + urlExtra, targetid); } else { $('#popup').css('display', 'block'); $('#popup_bg').css('display', 'block'); $('#popup_canvas').html(''); updateContent(url + urlExtraApi, targetid); } } return false; }); $('#popup_canvas').on('submit', 'form', function (e) { console.log('->main->submit->form'); e.preventDefault(); // avoid to execute the actual submit of the form. let targetid = ''; // do jakiego id var form = $(this).get(0); var url = $(this).attr('action'); var urlExtra = ''; //data-action if (typeof $(this).data('action') !== 'undefined') { urlExtra += 'action/' + $(this).data('action') + '/'; } //data-id if (typeof $(this).data('id') !== 'undefined') { urlExtra += 'id/' + $(this).data('id') + '/'; } //data-url if (typeof $(this).data('url') !== 'undefined') { urlExtra += $(this).data('url'); } var formData = new FormData(form); if (typeof $(this).data('targetid') !== 'undefined') { targetid = $(this).data('targetid'); } if (targetid == '#popup_canvas') { $('#popup').css('display', 'block'); $('#popup_bg').css('display', 'block'); $('#popup_canvas').html(''); } $.ajax({ type: "POST", url: url + urlExtra, data: formData, processData: false, contentType: false, success: function (data) { if (targetid != '#popup_canvas') { console.log('history: ' + window.history.location); console.log('load: ' + url); window.history.pushState(url, "Title", url); $('#main').html(data); $('html,body').animate({scrollTop: 0}, "fast"); } else { $('#popup_canvas').html(data); } } }); }); //jqpopup cms_popupCloseWarning = false; //edycja inline //pokazywanie inputa i ukrywanie przycisku edycji $('body').on('click', 'span.inlineEditable', function () { var $this = $(this); $this.toggle(); $this.parent().append('
' + '' + '
'); $this.parent().find('textarea').focus().val($this.html()); }); //potiwerdzenie i zapisanie wartości $('body').on('click', 'span.inlineConfirm', function (e) { console.log('->main->click->span.inlineConfirm'); var $this = $(this); var editable = $this.parent().siblings('span.inlineEditable').data('editable'); var context = $this.parent().siblings('span.inlineEditable').data('context'); var id = $this.parent().siblings('span.inlineEditable').data('id'); console.log(id); // Get some values from elements on the page: url = '/api.php?method=Editable&action=_apiSave&context=' + context + '&editable=' + editable + '&id=' + id; // Send the data using post $.ajax({ type: "POST", url: url, data: $this.siblings('textarea').serialize(), success: function (data) { alertify.success(data, 5000); $this.parent().siblings('span.inlineEditable').html($this.siblings('textarea').val()); $this.parent().siblings("span.inlineEditable").toggle(); $this.parent().remove(); }, error: function (xhr, textStatus, data) { alertify.error(xhr.responseText, 0); } }); }); //anulowanie edycji $('body').on('click', 'span.inlineCancel', function () { var $this = $(this); $this.parent().siblings("span.inlineEditable").toggle(); $this.parent().remove(); }); $("#main").on('click', 'span.switch', function (e) { reloadview = 0; var $this = $(this); if (typeof $this.data('module') !== 'undefined') { `` } column = 'active'; if (typeof $this.data('column') !== 'undefined') { column = $this.data('column'); } if (typeof $this.data('reloadview') !== 'undefined') { reloadview = 1; } var $this = $(this); var id = $this.data('id'); var action = $this.data('action'); var tableName = $this.data('table'); console.log(id); // Get some values from elements on the page: if (action == undefined) { url = '/api.php?method=Editable&class=' + className + '&modId=' + modId + '&table=' + tableName + '&action=_apiActive&id=' + id + '&reloadview=' + reloadview + '&column=' + column; } else { url = '/api.php?method=Editable&class=' + className + '&modId=' + modId + '&table=' + tableName + '&action=_apiActive&id=' + id + '&reloadview=' + reloadview + '&column=' + column; } // Send the data using post $.ajax({ type: "GET", url: url, dataType: 'json', success: function (data) { alertify.success(data.resultMessage, 20000); if (data.result == 0) { $this.removeClass('switchoff'); $this.addClass('switchon'); } else { $this.removeClass('switchon'); $this.addClass('switchoff'); } if (typeof data.reloadview !== 'undefined' && data.reloadview == 1) { window.location = window.location.href; } }, error: function (xhr, textStatus, data) { alertify.error(xhr.responseText, 0); } }); }); //blokada klików zamykających popupa - ostatni w priorytecie /* $('#popup_wrapper').on('click', function (e) { console.log('->body->click->#popup_wrapper'); e.stopPropagation(); e.preventDefault(); }); */ //zamknięcie popupa po kliknięciu w czarne $('body').on('click', '#popup_bg, .popupClose', function (e) { if (e.target !== e.currentTarget) { console.log('diff target! false'); return; } e.stopPropagation(); e.preventDefault(); console.log('->body->click->#popup_bg'); if (cms_popupCloseWarning) { if (!confirm('Posiadasz niezapisane zmiany!')) { return false; } cms_popupCloseWarning = false; } $('#popup').css('display', 'none'); $('#popup_bg').css('display', 'none'); $('#popup_canvas').html(''); }); }); function popup_open() { $('#popup_bg').css('display', 'block'); $('#popup').css('display', 'block'); } function popup_content(content) { $('#popup_canvas').html(content); } //blokada klików zamykających popupa $("#popup_wrapper").click(function (e) { e.stopPropagation(); }); $("#popup_canvas").on('click', '#show_daily', function () { console.log('show_daily click'); $('#chart_history').toggle(); $('#chart_daily').toggle(); }); $("#popup_canvas").on('click', '#show_history', function () { console.log('show_history click'); $('#chart_daily').toggle(); $('#chart_history').toggle(); }); function js_cookie_warning_hide(domain) { var myDate = new Date(); myDate.setMonth(myDate.getMonth() + 24); document.cookie = "show_cookie_warning=0; Secure; SameSite=Strict; expires=" + myDate + "; path=/;domain=.gragieldowa.pl"; $('#top_cookie_warning').hide(); } $(document).ready(function () { $('body').on('click', '.portfel_wykres_link', function () { let krotka = $(this).data('krotka'); popup_open(); console.log(krotka); let content = ''; content = ''; content += '
'; content += 'Dzienny'; content += 'Roczny'; content += 'Interaktywny'; popup_content(content); }); $("#popup").on('click', '#show_daily', function () { console.log('show_daily click'); $('#chart_history').toggle(); $('#chart_daily').toggle(); }); $("#popup").on('click', '#show_history', function () { console.log('show_history click'); $('#chart_daily').toggle(); $('#chart_history').toggle(); }); //pokazywanie / ukrywanie contentu $('body').on('click', 'button.showhide', function () { $('#' + $(this).data('show')).toggle(); }); //przeładowywanie ajaxem zawartości panelu var updateInProgress = false; // $('body').on('click', 'a.apiCall', function (e) { console.log('->body->click->a.apiCall'); e.preventDefault(); console.log('updateInProgress?'); if (updateInProgress === false) { console.log('updateInProgress=false'); updateInProgress = true; } else { console.log('updateInProgress=true'); return; } let urlExtraApi = $(this).attr('href'); //data-action if (typeof $(this).data('action') !== 'undefined') { urlExtraApi += '&action=' + $(this).data('action'); } //data-id if (typeof $(this).data('id') !== 'undefined') { urlExtraApi += '&id=' + $(this).data('id'); } //data-url if (typeof $(this).data('url') !== 'undefined') { urlExtraApi += $(this).data('url'); } $.get(urlExtraApi) .done(function (result) { updateInProgress = false; alertify.success(result, 10000); }) .fail(function (result) { updateInProgress = false; alertify.error(result, 10000); }); return false; }); });