Advertisement
Guest User

Untitled

a guest
Oct 25th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getQueryParams(qs) {
  2. qs = qs.split("+").join(" ");
  3. var params = {}, tokens, re = /[?&]?([^=]+)=([^&]*)/g;
  4. while (tokens = re.exec(qs)) {
  5. params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
  6. }
  7. return params;
  8. }
  9.  
  10. $(document).ready(function () {
  11. var url = window.location.pathname;
  12. var fullpath = window.location.href;
  13. var filename = url.substring(url.lastIndexOf('/') + 1);
  14. var domainName = fullpath.split('/')[2];
  15. var categoryName = url.split('/')[3];
  16.  
  17. var query = getQueryParams(document.location.search);
  18.  
  19. $("#paneldetails").append("<ul></ul>");
  20.  
  21. $.ajax({
  22. type: "GET",
  23. url: "/globalcontent/clientcontent.xml",
  24. dataType: "xml",
  25. success: function (xml) {
  26.  
  27. var panelParent = document.getElementById("panelParent");
  28.  
  29. $(xml).find('row').each(function () {
  30. var BusinessCategory = $(this).find('BusinessCategory').text();
  31. var PanelID = $(this).find('PanelID').text();
  32. var BusinessName = $(this).find('BusinessName').text();
  33. var CouponHeader = $(this).find('CouponHeader').text();
  34. var Keyword = $(this).find('Keyword').text();
  35. var City = $(this).find('City1').text();
  36. var MultipleOffers = $(this).find('AdditionalOffer1').text();
  37. var catName = categoryName.replace(/([a-z])([A-Z])/g, '$1 $2');
  38. $('span#gridCategory').text(catName);
  39.  
  40. if (BusinessCategory == categoryName && City == query.loc) {
  41.  
  42. var panelChild = document.createElement("div");
  43. panelChild.id = "listing"+parseInt(PanelID);
  44.  
  45. var aChild = document.createElement("a");
  46. aChild.href = "./Panel"+PanelID+"/Panel"+PanelID+".html";
  47.  
  48. var imgChild = document.createElement("img");
  49. imgChild.id = "offerImage"+PanelID;
  50. imgChild.className = "ga-background";
  51. imgChild.src = 'http://sandiego-ca.mobikoupon.com/images/' + categoryName + '/Offer-Panel' + PanelID + '.jpg';
  52. imgChild.style.width = "300px";
  53. imgChild.style.height = "200px";
  54. aChild.appendChild(imgChild);
  55.  
  56. var brChild = document.createElement("br");
  57. aChild.appendChild(brChild);
  58. panelChild.appendChild(aChild);
  59.  
  60. var tableChild = document.createElement("table");
  61. tableChild.style.cssText = "font-family:Arial; font-size:14px; text-align:left; width:300px;";
  62.  
  63. var tbodyChild = document.createElement("tbody");
  64. var trChild = document.createElement("tr");
  65. var tdChild = document.createElement("td");
  66. tdChild.className = "firstcol";
  67. tdChild.innerHTML = "<strong>BUSINESS</strong>";
  68. trChild.appendChild(tdChild);
  69.  
  70. tdChild = document.createElement("td");
  71. tdChild.className = "secondcol";
  72. tdChild.innerHTML = "<span id='BizName"+PanelID+"' style='color:yellow'><strong>"+BusinessName+"</strong></span><br>";
  73. trChild.appendChild(tdChild);
  74. tbodyChild.appendChild(trChild);
  75.  
  76. trChild = document.createElement("tr");
  77. tdChild = document.createElement("td");
  78. tdChild.className = "firstcol";
  79. tdChild.innerHTML = "<strong>OFFER</strong>";
  80. trChild.appendChild(tdChild);
  81.  
  82. tdChild = document.createElement("td");
  83. tdChild.className = "secondcol";
  84. tdChild.innerHTML = "<span id='mobiKoupon"+PanelID+"' style='color:yellow'><strong>"+CouponHeader+"</strong></span><br>";
  85. trChild.appendChild(tdChild);
  86. tbodyChild.appendChild(trChild);
  87.  
  88. trChild = document.createElement("tr");
  89. tdChild = document.createElement("td");
  90. tdChild.className = "firstcol";
  91. tdChild.innerHTML = "<strong>KEYWORD</strong>";
  92. trChild.appendChild(tdChild);
  93.  
  94. alert(5);
  95.  
  96. tdChild = document.createElement("td");
  97. tdChild.className = "secondcol";
  98. tdChild.innerHTML = "<span id='Keyword"+PanelID+"' style='color:yellow'><strong>"+Keyword+"</strong></span><br>";
  99. trChild.appendChild(tdChild);
  100. tbodyChild.appendChild(trChild);
  101.  
  102. trChild = document.createElement("tr");
  103. tdChild = document.createElement("td");
  104. tdChild.className = "firstcol";
  105. tdChild.innerHTML = "<strong>LOCATION</strong>";
  106. trChild.appendChild(tdChild);
  107.  
  108. alert(6);
  109.  
  110. tdChild = document.createElement("td");
  111. tdChild.className = "secondcol";
  112. tdChild.innerHTML = "<span id='City"+PanelID+"' style='color:yellow'><strong>"+City+"</strong></span><br>";
  113. trChild.appendChild(tdChild);
  114. tbodyChild.appendChild(trChild);
  115. tableChild.appendChild(tbodyChild);
  116. panelChild.appendChild(tableChild);
  117. panelParent.appendChild(panelChild);
  118.  
  119. alert(7);
  120.  
  121. }
  122.  
  123. });
  124.  
  125.  
  126. $('a#linkedinUrl').attr('href', 'http://www.linkedin.com/shareArticle?mini=true&url=' + fullpath + '&title=Share%20This%20App%20on%20LinkedIn&summary=&source='); // LinkedIn Share
  127. $('a#facebookUrl').attr('href', 'http://www.facebook.com/sharer/sharer.php?s=100&p[url]=' + fullpath + '&p[images][0]=http://www.mobikoupon.com/images/MobiKouponAppIcon.jpg&p[title]=Share%20This%20App%20On%20Facebook&p[summary]='); // Facebook Share
  128. $('a#twitterUrl').attr('href', 'http://twitter.com/home?status=Share%20This%20App%20On%20Twitter%20-' + fullpath); // Twitter Share
  129. $('a#gplusUrl').attr('href', 'https://plus.google.com/share?url=' + fullpath); // Google Plus Share
  130. },
  131. error: function () {
  132. alert("Error found in the data associated with this MobiKoupon. Call us at 760-994-4555 or email us at connect@mobikoupon.com");
  133. }
  134.  
  135. });
  136.  
  137. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement