jQuery(document).ready(function() { function loadup(){ jQuery.ajax({ type: "POST", url: "/prices/majors/", cache: false, dataType: "html", success: parseMajorsXml }); jQuery.ajax({ type: "POST", url: "/prices/active/", cache: false, dataType: "html", success: parseActiveXml }); jQuery.ajax({ type: "POST", url: "/prices/gainer/", cache: false, dataType: "html", success: parseGainerXml }); jQuery.ajax({ type: "POST", url: "/prices/loser/", cache: false, dataType: "html", success: parseLoserXml }); jQuery.ajax({ type: "POST", url: "/prices/usd/", cache: false, dataType: "html", success: parseUSDXml }); jQuery.ajax({ type: "POST", url: "/prices/btc/", cache: false, dataType: "html", success: parseBTCXml }); setTimeout(function() { stock(); }, 18000); setTimeout(function() { refresh();ticker(); }, 10000); } function parseMajorsXml(xml) { jQuery("#major").html(xml); } function parseActiveXml(xml) { jQuery("#active").html(xml); } function parseGainerXml(xml) { jQuery("#gainer").html(xml); } function parseLoserXml(xml) { jQuery("#loser").html(xml); } function parseUSDXml(xml) { jQuery("#usd").html(xml); } function parseBTCXml(xml) { jQuery("#btc").html(xml); } loadup(); function stock(p){ var t=1; window.addEventListener('blur', (e) => {t = 0;});if(t==0)parseFeed(); jQuery.ajax({ type: "POST", url: "/json/batch?c=1", cache: false, dataType: "text", success: parseFeed }); } function parseFeed(json) { run(json); } function doNothing(){} function parseHtml(html) { jQuery(".sts").html(html); setTimeout(function() {jQuery(".quote").removeClass("up down");}, 11650); } function parseScrpt(html) { jQuery(".scs").html(html); setTimeout(function() {jQuery(".quote").removeClass("up down");}, 11650); } function run(t){ setTimeout(function() { stock(); }, 90500); } function ticker(){ jQuery.ajax({ type: "POST", url: "/prices/majors/ticker", cache: false, dataType: "text", success: parseScrpt }); jQuery.ajax({ type: "POST", url: "/prices/gainer/ticker", cache: false, dataType: "text", success: parseScrpt }); jQuery.ajax({ type: "POST", url: "/prices/loser/ticker", cache: false, dataType: "text", success: parseScrpt }); jQuery.ajax({ type: "POST", url: "/prices/active/ticker", cache: false, dataType: "text", success: parseScrpt }); } function refresh(){ jQuery.ajax({ type: "POST", url: "/prices/usd/ticker", cache: false, dataType: "text", success: parseHtml }); jQuery.ajax({ type: "POST", url: "/prices/btc/ticker", cache: false, dataType: "text", success: parseHtml }); setTimeout(function() { refresh(); }, 44500); } });