Created
February 5, 2014 00:10
-
-
Save kmaglione/8815056 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compare(a,b) { | |
if (parseInt(a.price) < parseInt(b.price)) | |
return -1; | |
if (parseInt(a.price) > parseInt(b.price)) | |
return 1; | |
return 0; | |
} | |
function escapeHTML(text) { | |
var map = { | |
"&" : "amp", | |
"'": "#39", | |
'"': "quot", | |
"<": "lt", | |
">": "gt" | |
}; | |
return text.replace( /[&'"<>]/g, function(m) { | |
return "&" + map[m] + ";"; | |
}); | |
} | |
function removeEffects(){ | |
if (cancel==false) { | |
elem1.style.background=''; | |
elem1.style.borderColor='';} | |
else if (cancel==true){elem1.style.background="#fbfbfb";elem1.style.borderColor="#ddd";} | |
} | |
function blinker(){ | |
elem1.style.background="linear-gradient(to bottom, #eaefb5 0%,#e1e9a0 100%)"; | |
elem1.style.borderColor="#6b6"; | |
} | |
$s = jQuery.noConflict(); | |
var name = $s('#page-heading').find('h1').text().trim(); | |
name = name.split("(")[0]; | |
origProd = name; | |
var nameS = name.split(" "); | |
if(nameS.length<7){ | |
name = nameS.join("-"); | |
} | |
else { | |
name = nameS[0] + "-" + nameS[1] + "-" + nameS[2] + "-" + nameS[3] + "-" + nameS[4] + "-" + nameS[5] + "-" + nameS[6]; | |
} | |
var url = "http://compare.buyhatke.com/products/" + name; | |
$s('.compare:eq(0)').after('<a target="_blank" href="' + url + '" class="button compare" pname="Sogo SS-083 Trimmer For Men"><i class="i-btn-cmp"></i><span>Compare Prices</span></a>'); | |
if($s('#product-price .price').length!=0){ | |
price = $s('#product-price .price').text().trim().split("Rs.")[1].trim().split(",").join(""); | |
} | |
else { | |
price = 0; | |
} | |
myPrice = price; | |
var final2send = url.split("products/"); | |
var msgToSend = final2send[1] + "~*~*" + price; | |
isApparels = false; | |
var a = $s('body').text(); | |
if(a.split("ISBN-13:").length>1){ | |
isbn = parseInt(a.split("ISBN-13:")[1].trim()); | |
console.log(isbn); | |
} | |
else { | |
isbn = false; | |
console.log("ISBN not found"); | |
} | |
if(isbn){ | |
msgToSend = msgToSend + "moreData=null&isbn=" + isbn; | |
} | |
self.port.emit("search", msgToSend); | |
self.port.on("searchAnswer", function(message) { | |
var results = JSON.parse(message); | |
results.sort(compare); | |
var origPrice = price; | |
console.log(origProd); | |
var countArray = Array(); | |
for (var i = 0; i <= results.length - 1; i++) { | |
var current = results[i].prod; | |
countArray[i] = 0; | |
currentArray = origProd.split(" "); | |
var totalLen = currentArray.length; | |
for(var k=0; k< currentArray.length; k++){ | |
if(current.toUpperCase().indexOf(currentArray[k].toUpperCase())!=-1){ | |
countArray[i] = countArray[i] + 1; | |
} | |
} | |
results[i].score = countArray[i]; | |
console.log(results[i].prod + " " + results[i].price + " " + countArray[i]); | |
} | |
indexSelected = 0; notFound = 1; | |
for(k=0; k< results.length; k++){ | |
if(results[k].score/totalLen > .5){ | |
indexSelected = k; | |
notFound = 0; | |
break; | |
} | |
} | |
console.log(" Final product " + results[indexSelected].prod + " " + results[indexSelected].price); | |
if(results[indexSelected].position==1){ | |
class_assigned = "class_ebay"; | |
image_var = "images/ebay2.png"; | |
siteName2 = "Ebay"; | |
if(results[indexSelected].link.split("rover").length==1){ | |
results[indexSelected]["link"]= "http://rover.ebay.com/rover/1/4686-127726-2357-24/2?&site=Partnership_MSP&mpre=" + encodeURIComponent(results[indexSelected]["link"]); | |
} | |
} | |
else if(results[indexSelected].position==35){ | |
class_assigned = "class_ebay"; | |
image_var = "images/yebhi1.png"; | |
siteName2 = "Yebhi"; | |
} | |
else if(results[indexSelected].position==63){ | |
class_assigned = "class_ebay"; | |
image_var = "images/amazon.png"; | |
siteName2 = "Amazon"; | |
} | |
else if(results[indexSelected].position==30){ | |
class_assigned = "class_ebay"; | |
image_var = "images/indiaplaza1.png"; | |
siteName2 = "Indiaplaza"; | |
} | |
else if(results[indexSelected].position==31){ | |
class_assigned = "class_ebay"; | |
image_var = "images/bookadda1.png"; | |
siteName2 = "Bookadda"; | |
} | |
else if(results[indexSelected].position==129){ | |
class_assigned = "class_ebay"; | |
image_var = "images/snapdeal.png"; | |
siteName2 = "Snapdeal"; | |
} | |
else if(results[indexSelected].position==50){ | |
class_assigned = "class_ebay"; | |
image_var = "images/jabong1.png"; | |
siteName2 = "Ebay"; | |
} | |
else if(results[indexSelected].position==45){ | |
class_assigned = "class_ebay"; | |
image_var = "images/shpstop1.png"; | |
siteName2 = "ShoppersStop"; | |
} | |
else if(results[indexSelected].position==929){ | |
class_assigned = "class_ebay"; | |
image_var = "images/by.png"; | |
siteName2 = "BabyOye"; | |
} | |
else if(results[indexSelected].position==911){ | |
class_assigned = "class_ebay"; | |
image_var = "images/strawberrynet.png"; | |
siteName2 = "StrawBerryNet"; | |
} | |
else if(results[indexSelected].position==939){ | |
class_assigned = "class_ebay"; | |
image_var = "images/hb.png"; | |
siteName2 = "Hushbabies"; | |
} | |
else if(results[indexSelected].position==921){ | |
class_assigned = "class_ebay"; | |
image_var = "images/hk.png"; | |
siteName2 = "Healthkart"; | |
} | |
else if(results[indexSelected].position==62){ | |
class_assigned = "class_ebay"; | |
image_var = "images/indiarush.png"; | |
siteName2 = "IndiaRush"; | |
} | |
else if(results[indexSelected].position==2){ | |
class_assigned = "class_flip"; | |
image_var = "images/flipkart1.png"; | |
siteName2 = "Flipkart"; | |
} | |
else if(results[indexSelected].position==99){ | |
class_assigned = "class_naap"; | |
image_var = "images/infibeam2.png"; | |
results[indexSelected].prod = (results[indexSelected].prod); | |
siteName2 = "Infibeam"; | |
} | |
else if(results[indexSelected].position==4){ | |
class_assigned = "class_naap"; | |
image_var = "images/homeshop181.png"; | |
siteName2 = "HomeShop18"; | |
} | |
else if(results[indexSelected].position==7){ | |
class_assigned = "class_naap"; | |
image_var = "images/landmark1.png"; | |
siteName2 = "Landmark"; | |
} | |
else if(results[indexSelected].position==13){ | |
class_assigned = "class_naap"; | |
image_var = "images/tradus2.png"; | |
siteName2 = "Tradus"; | |
} | |
else if(results[indexSelected].position==22){ | |
class_assigned = "class_naap"; | |
image_var = "images/koovs1.png"; | |
siteName2 = "Koovs"; | |
} | |
else if(results[indexSelected].position==333){ | |
class_assigned = "class_naap"; | |
image_var = "images/pepperfry1.png"; | |
siteName2 = "Pepperfry"; | |
} | |
else if(results[indexSelected].position==11){ | |
class_assigned = "class_naap"; | |
image_var = "images/fnp1.png"; | |
siteName2 = "Flowers n Petals"; | |
} | |
else if(results[indexSelected].position==5){ | |
class_assigned = "class_naap"; | |
image_var = "images/futurebazaar1.png"; | |
siteName2 = "FutureBazaar"; | |
} | |
else if(results[indexSelected].position==98){ | |
class_assigned = "class_naap"; | |
image_var = "images/fashionara.png"; | |
siteName2 = "Fashionara"; | |
} | |
else if(results[indexSelected].position==111){ | |
class_assigned = "class_naap"; | |
image_var = "images/myntra2.png"; | |
siteName2 = "Myntra"; | |
} | |
else if(results[indexSelected].position==411){ | |
class_assigned = "class_naap"; | |
image_var = "images/grabmore.png"; | |
siteName2 = "GrabMore"; | |
} | |
else if(results[indexSelected].position==421){ | |
class_assigned = "class_naap"; | |
image_var = "images/shopclues.png"; | |
siteName2 = "ShopClues"; | |
} | |
else if(results[indexSelected].position==441){ | |
class_assigned = "class_naap"; | |
image_var = "images/naaptol.png"; | |
siteName2 = "Naaptol"; | |
} | |
else if(results[indexSelected].position==471){ | |
class_assigned = "class_naap"; | |
image_var = "images/crossword.png"; | |
siteName2 = "Crossword"; | |
} | |
else if(results[indexSelected].position==461){ | |
class_assigned = "class_naap"; | |
image_var = "images/magmall.png"; | |
siteName2 = "Magazine Mall"; | |
} | |
else if(results[indexSelected].position==91){ | |
class_assigned = "class_naap"; | |
image_var = "images/floralis.png"; | |
siteName2 = "Ebay"; | |
} | |
else if(results[indexSelected].position==401){ | |
class_assigned = "class_naap"; | |
image_var = "images/indtimesshopping.png"; | |
siteName2 = "IndiaTimes Shopping"; | |
} | |
else if(results[indexSelected].position==393){ | |
class_assigned = "class_naap"; | |
image_var = "images/adexmart.png"; | |
siteName2 = "Adexmart"; | |
} | |
else if(results[indexSelected].position==373){ | |
class_assigned = "class_naap"; | |
image_var = "images/phoolwala.png"; | |
siteName2 = "PhoolWala"; | |
} | |
else if(results[indexSelected].position==73){ | |
class_assigned = "class_naap"; | |
image_var = "images/goodlife.png"; | |
siteName2 = "GoodLife"; | |
} | |
else if(results[indexSelected].position==37){ | |
class_assigned = "class_naap"; | |
image_var = "images/jewelkart.jpg"; | |
siteName2 = "JewelsKart"; | |
} | |
else if(results[indexSelected].position==57){ | |
class_assigned = "class_naap"; | |
image_var = "images/lenskart.jpg"; | |
siteName2 = "LensKart"; | |
} | |
else if(results[indexSelected].position==47){ | |
class_assigned = "class_naap"; | |
image_var = "images/bagskart.jpg"; | |
siteName2 = "BagsKart"; | |
} | |
else if(results[indexSelected].position==67){ | |
class_assigned = "class_naap"; | |
image_var = "images/watch.jpeg"; | |
siteName2 = "WatchKart"; | |
} | |
else if(results[indexSelected].position==69){ | |
class_assigned = "class_naap"; | |
image_var = "images/next.png"; | |
siteName2 = "Next.co.in"; | |
} | |
else if(results[indexSelected].position==71){ | |
class_assigned = "class_naap"; | |
image_var = "images/croma.png"; | |
siteName2 = "CromaRetail"; | |
} | |
else if(results[indexSelected].position==412){ | |
class_assigned = "class_naap"; | |
image_var = "images/craftsvilla.png"; | |
siteName2 = "Craftsvilla"; | |
} | |
else if(results[indexSelected].position==469){ | |
class_assigned = "class_naap"; | |
image_var = "images/cilory.png"; | |
siteName2 = "Cilory"; | |
} | |
else if(results[indexSelected].position==429){ | |
class_assigned = "class_naap"; | |
image_var = "images/zivame.png"; | |
siteName2 = "Zivame"; | |
} | |
else if(results[indexSelected].position==422){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/shop19.png"; | |
siteName2 = "ShopNineteen"; | |
} | |
else if(results[indexSelected].position==428){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/donebynone.png"; | |
siteName2 = "DoneByNone"; | |
} | |
else if(results[indexSelected].position==435){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/mirraw.png"; | |
siteName2 = "Mirraw"; | |
} | |
else if(results[indexSelected].position==431){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/trendin.png"; | |
siteName2 = "Trendin"; | |
} | |
else if(results[indexSelected].position==425){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/zovi.png"; | |
siteName2 = "Zovi"; | |
} | |
else if(results[indexSelected].position==426){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/bluestone.png"; | |
siteName2 = "BlueStone"; | |
} | |
else if(results[indexSelected].position==427){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/voylla.png"; | |
siteName2 = "Voylla"; | |
} | |
else if(results[indexSelected].position==439){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/indiaemporium.png"; | |
siteName2 = "IndiaEmporium"; | |
} | |
else if(results[indexSelected].position==430){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/ngal.png"; | |
siteName2 = "N-gal"; | |
} | |
else if(results[indexSelected].position==432){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/strapsnstrings.png"; | |
siteName2 = "StrapsandStrings"; | |
} | |
else if(results[indexSelected].position==433){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/prettysecrets.png"; | |
siteName2 = "PrettySecrets"; | |
} | |
else if(results[indexSelected].position==423){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/cbazaar.png"; | |
siteName2 = "CBazaar"; | |
} | |
else if(results[indexSelected].position==424){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/limeroad.png"; | |
siteName2 = "LimeRoad"; | |
} | |
else if(results[indexSelected].position==331){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/acadzone.png"; | |
siteName2 = "AcadZone"; | |
} | |
else if(results[indexSelected].position==151){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/uread.png"; | |
siteName2 = "Uread"; | |
} | |
else if(results[indexSelected].position==291){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/rediffbooks.png"; | |
siteName2 = "Rediff"; | |
} | |
else if(results[indexSelected].position==422){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/shop19.png"; | |
siteName2 = "ShopNineteen"; | |
} | |
else if(results[indexSelected].position==428){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/donebynone.png"; | |
siteName2 = "DoneByNone"; | |
} | |
else if(results[indexSelected].position==435){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/mirraw.png"; | |
siteName2 = "Mirraw"; | |
} | |
else if(results[indexSelected].position==431){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/trendin.png"; | |
siteName2 = "Trendin"; | |
} | |
else if(results[indexSelected].position==425){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/zovi.png"; | |
siteName2 = "Zovi"; | |
} | |
else if(results[indexSelected].position==426){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/bluestone.png"; | |
siteName2 = "BlueStone"; | |
} | |
else if(results[indexSelected].position==427){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/voylla.png"; | |
siteName2 = "Voylla"; | |
} | |
else if(results[indexSelected].position==439){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/indiaemporium.png"; | |
siteName2 = "IndiaEmporium"; | |
} | |
else if(results[indexSelected].position==430){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/ngal.png"; | |
siteName2 = "N-gal"; | |
} | |
else if(results[indexSelected].position==432){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/strapsnstrings.png"; | |
siteName2 = "StrapsandStrings"; | |
} | |
else if(results[indexSelected].position==433){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/prettysecrets.png"; | |
siteName2 = "PrettySecrets"; | |
} | |
else if(results[indexSelected].position==423){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/cbazaar.png"; | |
siteName2 = "CBazaar"; | |
} | |
else if(results[indexSelected].position==424){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/limeroad.png"; | |
siteName2 = "LimeRoad"; | |
} | |
else if(results[indexSelected].position==151){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/uread.png"; | |
siteName2 = "Uread"; | |
} | |
else if(results[indexSelected].position==291){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/rediffbooks.png"; | |
siteName2 = "Rediff"; | |
} | |
else if(results[indexSelected].position==331){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/acadzone.png"; | |
siteName2 = "AcadZone"; | |
} | |
string = '<div id="dd_menu_list"><ul>'; | |
for(i=0;i<results.length;i++){ | |
if(results[i].position==1){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/ebay2.png"; | |
siteName = "Ebay"; | |
if(results[i].link.split("rover").length==1){ | |
results[i]["link"]= "http://rover.ebay.com/rover/1/4686-127726-2357-24/2?&site=Partnership_MSP&mpre=" + encodeURIComponent(results[i]["link"]); | |
} | |
} | |
else if(results[i].position==35){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/yebhi1.png"; | |
siteName = "Yebhi"; | |
} | |
else if(results[i].position==63){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/amazon.png"; | |
siteName = "Amazon"; | |
} | |
else if(results[i].position==30){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/indiaplaza1.png"; | |
siteName = "Indiaplaza"; | |
} | |
else if(results[i].position==31){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/bookadda1.png"; | |
siteName = "Bookadda"; | |
} | |
else if(results[i].position==129){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/snapdeal.png"; | |
siteName = "Snapdeal"; | |
} | |
else if(results[i].position==50){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/jabong1.png"; | |
siteName = "Ebay"; | |
} | |
else if(results[i].position==45){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/shpstop1.png"; | |
siteName = "ShoppersStop"; | |
} | |
else if(results[i].position==929){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/by.png"; | |
siteName = "BabyOye"; | |
} | |
else if(results[i].position==911){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/strawberrynet.png"; | |
siteName = "StrawBerryNet"; | |
} | |
else if(results[i].position==939){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/hb.png"; | |
siteName = "Hushbabies"; | |
} | |
else if(results[i].position==921){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/hk.png"; | |
siteName = "Healthkart"; | |
} | |
else if(results[i].position==62){ | |
class_assigned = "class_ebay"; | |
image_name = "http://compare.buyhatke.com/images/indiarush.png"; | |
siteName = "IndiaRush"; | |
} | |
else if(results[i].position==2){ | |
class_assigned = "class_flip"; | |
image_name = "http://compare.buyhatke.com/images/flipkart1.png"; | |
siteName = "Flipkart"; | |
} | |
else if(results[i].position==99){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/infibeam2.png"; | |
results[i].prod = (results[i].prod); | |
siteName = "Infibeam"; | |
} | |
else if(results[i].position==4){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/homeshop181.png"; | |
siteName = "HomeShop18"; | |
} | |
else if(results[i].position==7){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/landmark1.png"; | |
siteName = "Landmark"; | |
} | |
else if(results[i].position==13){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/tradus2.png"; | |
siteName = "Tradus"; | |
} | |
else if(results[i].position==22){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/koovs1.png"; | |
siteName = "Koovs"; | |
} | |
else if(results[i].position==333){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/pepperfry1.png"; | |
siteName = "Pepperfry"; | |
} | |
else if(results[i].position==11){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/fnp1.png"; | |
siteName = "Flowers n Petals"; | |
} | |
else if(results[i].position==5){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/futurebazaar1.png"; | |
siteName = "FutureBazaar"; | |
} | |
else if(results[i].position==98){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/fashionara.png"; | |
siteName = "Fashionara"; | |
} | |
else if(results[i].position==111){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/myntra2.png"; | |
siteName = "Myntra"; | |
} | |
else if(results[i].position==411){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/grabmore.png"; | |
siteName = "GrabMore"; | |
} | |
else if(results[i].position==421){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/shopclues.png"; | |
siteName = "ShopClues"; | |
} | |
else if(results[i].position==441){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/naaptol.png"; | |
siteName = "Naaptol"; | |
} | |
else if(results[i].position==471){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/crossword.png"; | |
siteName = "Crossword"; | |
} | |
else if(results[i].position==461){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/magmall.png"; | |
siteName = "Magazine Mall"; | |
} | |
else if(results[i].position==91){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/floralis.png"; | |
siteName = "Ebay"; | |
} | |
else if(results[i].position==401){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/indtimesshopping.png"; | |
siteName = "IndiaTimes Shopping"; | |
} | |
else if(results[i].position==393){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/adexmart.png"; | |
siteName = "Adexmart"; | |
} | |
else if(results[i].position==373){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/phoolwala.png"; | |
siteName = "PhoolWala"; | |
} | |
else if(results[i].position==73){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/goodlife.png"; | |
siteName = "GoodLife"; | |
} | |
else if(results[i].position==37){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/jewelkart.jpg"; | |
siteName = "JewelsKart"; | |
} | |
else if(results[i].position==57){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/lenskart.jpg"; | |
siteName = "LensKart"; | |
} | |
else if(results[i].position==47){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/bagskart.jpg"; | |
siteName = "BagsKart"; | |
} | |
else if(results[i].position==67){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/watch.jpeg"; | |
siteName = "WatchKart"; | |
} | |
else if(results[i].position==69){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/next.png"; | |
siteName = "Next.co.in"; | |
} | |
else if(results[i].position==71){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/croma.png"; | |
siteName = "CromaRetail"; | |
} | |
else if(results[i].position==412){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/craftsvilla.png"; | |
siteName = "Craftsvilla"; | |
} | |
else if(results[i].position==469){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/cilory.png"; | |
siteName = "Cilory"; | |
} | |
else if(results[i].position==429){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/zivame.png"; | |
siteName = "Zivame"; | |
} | |
else if(results[i].position==422){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/shop19.png"; | |
siteName = "ShopNineteen"; | |
} | |
else if(results[i].position==428){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/donebynone.png"; | |
siteName = "DoneByNone"; | |
} | |
else if(results[i].position==435){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/mirraw.png"; | |
siteName = "Mirraw"; | |
} | |
else if(results[i].position==431){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/trendin.png"; | |
siteName = "Trendin"; | |
} | |
else if(results[i].position==425){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/zovi.png"; | |
siteName = "Zovi"; | |
} | |
else if(results[i].position==426){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/bluestone.png"; | |
siteName = "BlueStone"; | |
} | |
else if(results[i].position==427){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/voylla.png"; | |
siteName = "Voylla"; | |
} | |
else if(results[i].position==439){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/indiaemporium.png"; | |
siteName = "IndiaEmporium"; | |
} | |
else if(results[i].position==430){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/ngal.png"; | |
siteName = "N-gal"; | |
} | |
else if(results[i].position==432){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/strapsnstrings.png"; | |
siteName = "StrapsandStrings"; | |
} | |
else if(results[i].position==433){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/prettysecrets.png"; | |
siteName = "PrettySecrets"; | |
} | |
else if(results[i].position==423){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/cbazaar.png"; | |
siteName = "CBazaar"; | |
} | |
else if(results[i].position==424){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/limeroad.png"; | |
siteName = "LimeRoad"; | |
} | |
else if(results[i].position==151){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/uread.png"; | |
siteName = "Uread"; | |
} | |
else if(results[i].position==291){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/rediffbooks.png"; | |
siteName = "Rediff"; | |
} | |
else if(results[i].position==331){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/acadzone.png"; | |
siteName = "AcadZone"; | |
} | |
else if(results[i].position==422){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/shop19.png"; | |
siteName = "ShopNineteen"; | |
} | |
else if(results[i].position==428){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/donebynone.png"; | |
siteName = "DoneByNone"; | |
} | |
else if(results[i].position==435){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/mirraw.png"; | |
siteName = "Mirraw"; | |
} | |
else if(results[i].position==431){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/trendin.png"; | |
siteName = "Trendin"; | |
} | |
else if(results[i].position==425){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/zovi.png"; | |
siteName = "Zovi"; | |
} | |
else if(results[i].position==426){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/bluestone.png"; | |
siteName = "BlueStone"; | |
} | |
else if(results[i].position==427){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/voylla.png"; | |
siteName = "Voylla"; | |
} | |
else if(results[i].position==439){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/indiaemporium.png"; | |
siteName = "IndiaEmporium"; | |
} | |
else if(results[i].position==430){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/ngal.png"; | |
siteName = "N-gal"; | |
} | |
else if(results[i].position==432){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/strapsnstrings.png"; | |
siteName = "StrapsandStrings"; | |
} | |
else if(results[i].position==433){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/prettysecrets.png"; | |
siteName = "PrettySecrets"; | |
} | |
else if(results[i].position==423){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/cbazaar.png"; | |
siteName = "CBazaar"; | |
} | |
else if(results[i].position==424){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/limeroad.png"; | |
siteName = "LimeRoad"; | |
} | |
else if(results[i].position==151){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/uread.png"; | |
siteName = "Uread"; | |
} | |
else if(results[i].position==291){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/rediffbooks.png"; | |
siteName = "Rediff"; | |
} | |
else if(results[i].position==331){ | |
class_assigned = "class_naap"; | |
image_name = "http://compare.buyhatke.com/images/acadzone.png"; | |
siteName = "AcadZone"; | |
} | |
string = string + '<li><a target="_blank" href="' + escapeHTML(results[i].link) + '"><div class="itemWrap"><div class="imageDiv_wrap"><div class="imageDiv"><img src="' + escapeHTML(results[i].image) + '"></div></div><div class="prod_right"><div class="prodName">' + escapeHTML(results[i].prod) + '</div><div class="storeRow"><div class="prodPrice"><img src="http://compare.buyhatke.com/images/rupeeK.png">' + escapeHTML(results[i].price) + '</div><div class="prodStore"><img src="' + image_name + '"></div></div></div></div></a></li>'; | |
} | |
string = string + '</ul></div>'; | |
string2 = '<footer><div id="dd_menu_footer"><iframe src="http://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FBuyHatke&width=450&height=35&colorscheme=light&layout=standard&action=like&show_faces=false&send=false&appId=205177396285577" scrolling="no" frameborder="0" style="border: none;overflow: hidden;width: 230px;height: 30px;float: left;" allowTransparency="true"></iframe> <a href="mailto:wecare@buyhatke.com">Send Feedback</a></div></footer></div></div><div id="share_buttons">Share: <a class="dd_share_buttons" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fextension.buyhatke.com" target="_blank"><img src="http://compare.buyhatke.com/images/fbs.png"></a><a class="dd_share_buttons" href="https://plus.google.com/share?url=http%3A%2F%2Fextension.buyhatke.com" target="_blank"><img src="https://www.gstatic.com/images/icons/gplus-32.png" alt="Share on Google+"/></a><a class="dd_share_buttons" href="http://twitter.com/home?status=Try the amazing CompareHatke Chrome Extension!+http%3A%2F%2Fextension.buyhatke.com" target="_blank"><img src="http://compare.buyhatke.com/images/tweet.png"></a></div></div><a href="#" id="detailClose" onclick="removeAll();return false;">x</a></div></div>'; | |
if(parseInt(results[indexSelected].price)<=parseInt(origPrice)&¬Found==0) { | |
$s('body').before('<div id="detailOutWrap"><div id="detailInWrap"><a target="_blank" href="http://compare.buyhatke.com" title="Visit Buyhatke"><img id="details_logo" src="http://compare.buyhatke.com/images/logo_small.png"></a><div id="details">Hurray ! Massive savings found. This product is available for <span id="detail_cost"><img src="http://compare.buyhatke.com/images/rupeeK.png"> ' + escapeHTML(results[indexSelected].price) + '</span> at <span id="detail_store">' + siteName2 + '</span><a style="display:inline!important;" href="' + escapeHTML(results[indexSelected].link) + '" target="_blank"><input type="button" value=" BUY IT NOW" ></a>or<div class="drop_down" id="compare_now" >COMPARE PRICES<div class="drop_down_symbol"></div><div id="dd_menu"><head><div id="dd_menu_header">Showing <span>' + results.length + '</span> results</div></head>' + string + string2); | |
$s('body').css("margin-top", "86px"); | |
$s('#header').css("margin-top", "45px"); | |
var button = document.getElementById("detailClose"); | |
button.addEventListener("click", function() { | |
document.getElementById('detailOutWrap').style.display = "none"; | |
$s('body').css("margin-top", "0px"); | |
$s('#header').css("margin-top", "0px"); | |
}, false); | |
cancel=false; | |
elem1=document.getElementById("compare_now"); | |
blinker(); | |
} | |
else if(results.length>0) { | |
$s('body').before('<div id="detailOutWrap"><div id="detailInWrap"><a target="_blank" href="http://compare.buyhatke.com" title="Visit Buyhatke"><img id="details_logo" src="http://compare.buyhatke.com/images/logo_small.png"></a><div id="details">Hurray ! Other variants for this product is available for <span id="detail_cost"><img src="http://compare.buyhatke.com/images/rupeeK.png"> ' + escapeHTML(results[indexSelected].price) + '</span> at <span id="detail_store">' + siteName2 + '</span><a style="display:inline!important;" href="' + escapeHTML(results[indexSelected].link) + '" target="_blank"><input type="button" value=" BUY IT NOW" ></a>or<div class="drop_down" id="compare_now" >COMPARE PRICES<div class="drop_down_symbol"></div><div id="dd_menu"><head><div id="dd_menu_header">Showing <span>' + results.length + '</span> results</div></head>' + string + string2); | |
$s('body').css("margin-top", "86px"); | |
$s('#header').css("margin-top", "45px"); | |
var button = document.getElementById("detailClose"); | |
button.addEventListener("click", function() { | |
document.getElementById('detailOutWrap').style.display = "none"; | |
$s('body').css("margin-top", "0px"); | |
$s('#header').css("margin-top", "0px"); | |
}, false); | |
cancel=false; | |
elem1=document.getElementById("compare_now"); | |
blinker(); | |
} | |
else { | |
$s('body').before('<div id="detailOutWrap"><div id="detailInWrap"><div id="details">Hurray ! Massive savings found. Click to know more <a href="' + url + '" target="_blank"><input type="button" value=" COMPARE PRICES"></a><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fextension.buyhatke.com" id="notify_fshare"></a></div><a href="#" id="detailClose" >x</a></div></div>'); | |
$s('body').css("margin-top", "86px"); | |
$s('#header').css("margin-top", "45px"); | |
var button = document.getElementById("detailClose"); | |
button.addEventListener("click", function() { | |
document.getElementById('detailOutWrap').style.display = "none"; | |
$s('body').css("margin-top", "0px"); | |
$s('#header').css("margin-top", "0px"); | |
}, false); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment