$ = function(selector) {
var selectorType = 'querySelectorAll';
if (selector.indexOf('#') === 0) {
selectorType = 'getElementById';
selector = selector.substr(1, selector.length);
}
return document[selectorType](selector);
};
function slideup(find){
element = document.querySelector(find);
element.className = "animate slideup";
}
function moveDown(element) {
if(element.nextElementSibling)
element.parentNode.insertBefore(element.nextElementSibling, element);
}
var jek ="";
var isnew = 2;
var mozx = "";
var con = document.getElementById('content');
var hidenewz = document.getElementById('hidenewz');
var gz = document.getElementById('gz');
function load_home(e){
// e.preventDefault();
document.getElementById("navrbar").innerHTML = "";
document.querySelector('#selectone').style.display='none';
document.querySelector('.left').classList.add('showed');
document.querySelector('#loader').style.display='block';
document.querySelector('.right').classList.add('showed');
document.querySelector('#hero').classList.add('fixed');
document.querySelector('#tobet').classList.add('fillup');
closeAllLists();
con.innerHTML = "";
hidenewz.innerHTML = "";
document.querySelector('#spcl').classList.add('box-closed');
document.querySelector('.trends').classList.add('box-closed');
con.innerHTML = "<div class=\"loadingna\" id=\"gz\"><span class=\"loadingnaimg
abg\"></span><span class=\"loadingnat1 abg\"></span><span class=\"loadingnat2
abg\"></span><span class=\"loadingna3 abg\"></span></div>";
jek = document.getElementById('se').value;
isnew = 1;
window.location.hash='searchvalue='+encodeURIComponent(jek);
document.querySelector('#se').className ='hide';
}
}
xhr.open("GET","all/sig.php?req=1&q="+encodeURIComponent(jek), true);
xhr.setRequestHeader('Content-type', 'text/html');
xhr.send();
document.getElementById('se').blur();
return false;
}
window.onhashchange = function () {
var hash = location.hash;
if(hash.indexOf("searchvalue") !== -1) {
document.getElementById('se').value = decodeURIComponent(hash);
load_home(event);
}
else {
if(isnew !== 1) {
closedt("byhash");
}
}
} else {}
};
window.onload = function () {
var hash = location.hash;
if(hash.indexOf("searchvalue") !== -1) {
else {
console.log("elsefired");
if(isnew !== 1) {
closedt("byhash");
}
}
} else {}
};
function load_more(){
// document.querySelector('#gz').classList.add('box-closed');
document.querySelector('#loader').style.display='none';
document.querySelector('#selectone').style.display='block';
hidenewz.innerHTML += xhr.responseText;
document.querySelector('#gz').classList.add('box-closed');
sortOut();
displaylabels();
// mozx += xhr.responseText;
}
}
xhr.open("GET","all/sig.php?req=2&q="+encodeURIComponent(jek), true);
xhr.setRequestHeader('Content-type', 'text/html');
xhr.send();
// document.getElementById('se').blur();
return false;
}
function zort(a, b) {
vaxz = +a.getAttribute("data-val") - +b.getAttribute("data-val");
if (vaxz >= 0){
return true;
} else {
return false;
}
}
function sortOut() {
var clzxp= document.getElementsByClassName('newz');
for (var i = 0; i < clzxp.length; ++i) {
}
}
}
}
function isInArray(value, array) {
return array.indexOf(value) > -1;
}
function displaylabels() {
var arrayof = [];
var dataElems = document.querySelectorAll("[data-store]")
for (var i=0;i<dataElems.length;i++) {
var storev = dataElems[i].getAttribute("data-store");
if(isInArray(storev,arrayof)) {} else {
arrayof.push(storev);
}
}
}, 100);
setTimeout(function(){
target.style.display = 'none';
document.getElementById("banner2").innerHTML = "";
}, 190);
};
function addlistnr2() {
var inputsx = document.querySelectorAll("[data-store]");
for (i = 0; i < inputsx.length; i++) {
inputsx[i].addEventListener('click', function(e) {
if(e.target.classList.contains("buyit")) {
console.log(e.target.classList);
e.stopPropagation();
return true;
}
isnew = 2;
window.location.hash='back='+encodeURIComponent("justcheck");
var namenz = this.getAttribute("data-name");
var pricenz = this.getAttribute("data-price");
var storenz = this.getAttribute("data-store");
var imagenz = this.getAttribute("data-image");
var linknz = this.getAttribute("data-link");
var extranz = this.getAttribute("data-extra");
document.getElementById("closeit").addEventListener("click", closedt);
document.getElementById("banner2").innerHTML = newup;
var target = document.getElementById("banner");
target.style.display = 'block';
target.style.marginRight = '-80px';
setTimeout(function(){ target.style.marginRight= '-40px'; }, 40);
setTimeout(function(){ target.style.marginRight = '0px'; }, 80);
e.stopPropagation();
});
}}
function sortthis(AttrToSort,orderof,thetxt) {
Array.prototype.slice.call(document.querySelectorAll('.product-
list')).sort(function(a, b) {
if (orderof === 'H') {
return +b.getAttribute(AttrToSort) -
+a.getAttribute(AttrToSort);
}
if (orderof === 'L') {
return +a.getAttribute(AttrToSort) -
+b.getAttribute(AttrToSort);
}
}).forEach(function(a) {
a.parentNode.appendChild(a);
});
document.getElementById("wut").innerHTML = thetxt;
document.getElementById("buttonsid").style.display="none";
}
document.getElementById("sortbyy").onclick = function() {
(function(style) {
style.display = style.display === 'none' ? 'block' : 'none';
})(document.getElementById("buttonsid").style);
};
function addlike(name,price,store,url,image,el) {
if(el.target.classList.contains("activeit")) {
return true;
}
el.target.classList.add('activeit');
var objarry = [];
var fvrtslcl = localStorage.getItem("fvrtslcl");
if(fvrtslcl){
objarry= JSON.parse(fvrtslcl);
}
objarry.push({"ts": Date.now(),
"name":name,"price":price,"store":store,"url":url,"image":image});
localStorage.setItem("fvrtslcl",JSON.stringify(objarry));
fvrtslcl = JSON.parse(localStorage.getItem("fvrtslcl"));
}
function showrt(event) {
document.getElementById("rtmenu").style.display = 'block';
document.getElementById("overlayit").style.display = 'block';
}
function hidert() {
document.getElementById("rtmenu").style.display = 'none';
document.getElementById("overlayit").style.display = 'none';
closeAllLists();
}
function autocomplete(inp) {
var currentFocus;
inp.addEventListener("input", function(e) {
closeAllLists();
val = this.value;
if (!val || val.length < 3) { return false;}
b.addEventListener("click", function(e) {
inp.value = this.getElementsByTagName("input")[0].value;
hidert();
load_home(e);
});
a.appendChild(b);
console.log(matchesz[i].split("-text-").join(""));
}
}
}
xhr.open("GET","suggest.php?q="+encodeURIComponent(val), true);
xhr.setRequestHeader('Content-type', 'text/html');
xhr.send();
});}
window.onload = function () {
var trendsx = document.querySelectorAll(".trnd");
for (i = 0; i < trendsx.length; i++) {
trendsx[i].addEventListener('click', function() {
var trendvalue = this.innerHTML;
document.getElementById('se').value = trendvalue;
load_home(event);
});
}
};
function closeAllLists(elmnt) {
/*close all autocomplete lists in the document,
except the one passed as an argument:*/
var aitems = document.getElementsByClassName("aitems");
var inp = document.getElementById("se");
for (var i = 0; i < aitems.length; i++) {
if (elmnt != aitems[i] && elmnt != inp) {
aitems[i].parentNode.removeChild(aitems[i]);
}
}
}
autocomplete(document.getElementById("se"));