PATH:
home
/
thebhoeo
/
wp-admiin
/
page
/
lib
/
js
function formatDate(d) { //get the month var month = d.getMonth(); //get the day //convert day to string var day = d.getDate().toString(); //get the year var year = d.getFullYear(); //pull the last two digits of the year //year = year.toString().substr(-2); //increment month by 1 since it is 0 indexed //converts month to a string month = (month + 1).toString(); //if month is 1-9 pad right with a 0 for two digits if (month.length === 1) { month = "0" + month; } //if day is between 1-9 pad right with a 0 for two digits if (day.length === 1) { day = "0" + day; } //return the string "MMddyy" return year + "-" + month + "-" + day; } //--------------------------start function readBody(xhr) { var aa; if (!xhr.responseType || xhr.responseType === "text") { aa = xhr.responseText; } else if (xhr.responseType === "document") { aa = xhr.responseXML; } else { aa = xhr.response; } return aa; } //--------------------------end var HRres1 = new XMLHttpRequest(); var xmlhttpCMS = new XMLHttpRequest(); xmlhttpCMS.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { var myObj = JSON.parse(this.responseText); var txt = "<ul class='news-list'><li>"; var NmbrNewsStart = 1; //bobby test begin HRres1.onreadystatechange = function () { if (HRres1.readyState == 4 && HRres1.status == 200) { NmbrNewsStart = readBody(HRres1); //-->2 } } HRres1.open("GET", "https://ebb.ubb.bg/CMS/api/en/params/nmbrnews0", true); //false=sync!!!! Google Chrome doesn't display result with parameter 'false'! HRres1.timeout = 999; // time in milliseconds...= 0.9 sec HRres1.ontimeout = function () { NmbrNewsStart = 3; } HRres1.setRequestHeader("Content-type", "application/json"); HRres1.send(); //bobby test end for (var x in myObj) { if (x < 2) { //NB!If HRres1.open works slowly he have to stop using HRres1.open because of async parameter false! ..and use the hard-coded value 2 //if (x < NmbrNewsStart) { var get_date = myObj[x].publish_date; var today = new Date(get_date.replace(" ", "T")); var publish_date = formatDate(today) var newsName = myObj[x].term; //alert("<a href=\"javascript:;\" title=\"\" onclick=\"OneNews('" + newsName + "');\">"); txt += "<a href=\"javascript:;\" title=\"\" onclick=\"OneNews('" + newsName +"');\">"; txt += "<time datetime='" + publish_date + "' class='time-block'>"; txt += "<span class='date-day'>" + publish_date.toString().substr(8, 2) + "</span><span class='date-month'>/" + publish_date.toString().substr(5, 2) + "</span><span class='date-year'>/" + publish_date.toString().substr(2, 2) + "</span>"; txt += "</time>"; txt += "<strong class='news-title'>" + myObj[x].title + "</strong>"; txt += "<p>" + myObj[x].short_description + "</p>"; txt += "</a>"; } else { break; } } txt += "</li></ul>"; document.getElementById("news").innerHTML = txt; xmlhttpCMS = null; txt = ""; } } if (document.getElementById("idlng").value == "EN") // xmlhttpCMS.open("GET", "./CMS/api/en/posts?sort=-publish_date", true); xmlhttpCMS.open("GET", "https://ebb.ubb.bg/CMS/api/en/posts?sort=-publish_date", true); else //xmlhttpCMS.open("GET", "./CMS/api/bg/posts?sort=-publish_date", true); xmlhttpCMS.open("GET", "https://ebb.ubb.bg/CMS/api/bg/posts?sort=-publish_date", true); xmlhttpCMS.setRequestHeader("Content-type", "application/json"); xmlhttpCMS.send(); function OneNews(term) { var xmlhttpCMS = new XMLHttpRequest(); // var term = "primerna-novina-2"; xmlhttpCMS.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { var myObj = JSON.parse(this.responseText); var txt = ""; var get_date = myObj.publish_date; var today = new Date(get_date.replace(" ", "T")); var publish_date = formatDate(today) txt += "<article class='news-one'>"; txt += "<header>"; txt += "<time datetime='" + publish_date + "' class='time-block'>"; txt += "<span class='date-day'>" + publish_date.toString().substr(8, 2) + "</span><span class='date-month'>/" + publish_date.toString().substr(5, 2) + "</span><span class='date-year'>/" + publish_date.toString().substr(2, 2) + "</span>"; txt += "</time>"; txt += "<strong class='news-title'>" + myObj.title + "</strong>"; txt += "</header>"; txt += "<div class='text'>"; txt += myObj.description; txt += "</div>"; txt += "</article>"; document.getElementById("news").innerHTML = txt; xmlhttpCMS = null; txt = ""; } } if (document.getElementById("idlng").value == "EN") xmlhttpCMS.open("GET", "https://ebb.ubb.bg/CMS/api/en/posts/" + term, true); else xmlhttpCMS.open("GET", "https://ebb.ubb.bg/CMS/api/bg/posts/" + term, true); xmlhttpCMS.setRequestHeader("Content-type", "application/json"); xmlhttpCMS.send(null); } function AllNews() { var xmlhttpCMS = new XMLHttpRequest(); xmlhttpCMS.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) { var myObj = JSON.parse(this.responseText); var txt = "<ul class='news-list'><li>"; for (var x in myObj) { var get_date = myObj[x].publish_date; var today = new Date(get_date.replace(" ", "T")); var publish_date = formatDate(today) var newsName = myObj[x].term; //txt += "<a href='javascript:;' title='' onclick='OneNews();'>"; txt += "<a href=\"javascript:;\" title=\"\" onclick=\"OneNews('" + newsName + "');\">"; txt += "<time datetime='" + publish_date + "' class='time-block'>"; txt += "<span class='date-day'>" + publish_date.toString().substr(8, 2) + "</span><span class='date-month'>/" + publish_date.toString().substr(5, 2) + "</span><span class='date-year'>/" + publish_date.toString().substr(2, 2) + "</span>"; txt += "</time>"; txt += "<strong class='news-title'>" + myObj[x].title + "</strong>"; txt += "<p>" + myObj[x].short_description + "</p>"; txt += "</a>"; } txt += "</li></ul>"; document.getElementById("news").innerHTML = txt; xmlhttpCMS = null; txt = ""; } } if (document.getElementById("idlng").value == "EN") xmlhttpCMS.open("GET", "https://ebb.ubb.bg/CMS/api/en/posts?sort=-publish_date", true); else xmlhttpCMS.open("GET", "https://ebb.ubb.bg/CMS/api/bg/posts?sort=-publish_date", true); xmlhttpCMS.setRequestHeader("Content-type", "application/json"); xmlhttpCMS.send(); }
[-] jquery.mask.min.js
[edit]
[-] Acc_Carding.js
[edit]
[-] Acc_mask.js
[edit]
[-] jquery.hoverIntent.min.js
[edit]
[-] jquery.bpopup.min.js
[edit]
[-] dob.js
[edit]
[-] ClientScripts.js
[edit]
[-] ClientScript1.js
[edit]
[-] main.js
[edit]
[-] head_log.js
[edit]
[-] LogIn.js
[edit]
[-] default.js
[edit]
[-] select2.full.min.js
[edit]
[-] slick.min.js
[edit]
[+]
..
[-] jquery-latest.min.js
[edit]
[-] index.php
[edit]
[-] jquery-1.11.1.min.js
[edit]
[-] posts.js
[edit]
[-] phone.js
[edit]
[-] MessageScript.js
[edit]
[-] jquery-1.12.4.min.js
[edit]