Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getQueryParams(qs) {
- qs = qs.split("+").join(" ");
- var params = {}, tokens, re = /[?&]?([^=]+)=([^&]*)/g;
- while (tokens = re.exec(qs)) {
- params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
- }
- return params;
- }
- $(document).ready(function () {
- var url = window.location.pathname;
- var fullpath = window.location.href;
- var filename = url.substring(url.lastIndexOf('/') + 1);
- var domainName = fullpath.split('/')[2];
- var categoryName = url.split('/')[3];
- var query = getQueryParams(document.location.search);
- $("#paneldetails").append("<ul></ul>");
- $.ajax({
- type: "GET",
- url: "/globalcontent/clientcontent.xml",
- dataType: "xml",
- success: function (xml) {
- var panelParent = document.getElementById("panelParent");
- $(xml).find('row').each(function () {
- var BusinessCategory = $(this).find('BusinessCategory').text();
- var PanelID = $(this).find('PanelID').text();
- var BusinessName = $(this).find('BusinessName').text();
- var CouponHeader = $(this).find('CouponHeader').text();
- var Keyword = $(this).find('Keyword').text();
- var City = $(this).find('City1').text();
- var MultipleOffers = $(this).find('AdditionalOffer1').text();
- var catName = categoryName.replace(/([a-z])([A-Z])/g, '$1 $2');
- $('span#gridCategory').text(catName);
- if (BusinessCategory == categoryName && City == query.loc) {
- var panelChild = document.createElement("div");
- panelChild.id = "listing"+parseInt(PanelID);
- var aChild = document.createElement("a");
- aChild.href = "./Panel"+PanelID+"/Panel"+PanelID+".html";
- var imgChild = document.createElement("img");
- imgChild.id = "offerImage"+PanelID;
- imgChild.className = "ga-background";
- imgChild.src = 'http://sandiego-ca.mobikoupon.com/images/' + categoryName + '/Offer-Panel' + PanelID + '.jpg';
- imgChild.style.width = "300px";
- imgChild.style.height = "200px";
- aChild.appendChild(imgChild);
- var brChild = document.createElement("br");
- aChild.appendChild(brChild);
- panelChild.appendChild(aChild);
- var tableChild = document.createElement("table");
- tableChild.style.cssText = "font-family:Arial; font-size:14px; text-align:left; width:300px;";
- var tbodyChild = document.createElement("tbody");
- var trChild = document.createElement("tr");
- var tdChild = document.createElement("td");
- tdChild.className = "firstcol";
- tdChild.innerHTML = "<strong>BUSINESS</strong>";
- trChild.appendChild(tdChild);
- tdChild = document.createElement("td");
- tdChild.className = "secondcol";
- tdChild.innerHTML = "<span id='BizName"+PanelID+"' style='color:yellow'><strong>"+BusinessName+"</strong></span><br>";
- trChild.appendChild(tdChild);
- tbodyChild.appendChild(trChild);
- trChild = document.createElement("tr");
- tdChild = document.createElement("td");
- tdChild.className = "firstcol";
- tdChild.innerHTML = "<strong>OFFER</strong>";
- trChild.appendChild(tdChild);
- tdChild = document.createElement("td");
- tdChild.className = "secondcol";
- tdChild.innerHTML = "<span id='mobiKoupon"+PanelID+"' style='color:yellow'><strong>"+CouponHeader+"</strong></span><br>";
- trChild.appendChild(tdChild);
- tbodyChild.appendChild(trChild);
- trChild = document.createElement("tr");
- tdChild = document.createElement("td");
- tdChild.className = "firstcol";
- tdChild.innerHTML = "<strong>KEYWORD</strong>";
- trChild.appendChild(tdChild);
- alert(5);
- tdChild = document.createElement("td");
- tdChild.className = "secondcol";
- tdChild.innerHTML = "<span id='Keyword"+PanelID+"' style='color:yellow'><strong>"+Keyword+"</strong></span><br>";
- trChild.appendChild(tdChild);
- tbodyChild.appendChild(trChild);
- trChild = document.createElement("tr");
- tdChild = document.createElement("td");
- tdChild.className = "firstcol";
- tdChild.innerHTML = "<strong>LOCATION</strong>";
- trChild.appendChild(tdChild);
- alert(6);
- tdChild = document.createElement("td");
- tdChild.className = "secondcol";
- tdChild.innerHTML = "<span id='City"+PanelID+"' style='color:yellow'><strong>"+City+"</strong></span><br>";
- trChild.appendChild(tdChild);
- tbodyChild.appendChild(trChild);
- tableChild.appendChild(tbodyChild);
- panelChild.appendChild(tableChild);
- panelParent.appendChild(panelChild);
- alert(7);
- }
- });
- $('a#linkedinUrl').attr('href', 'http://www.linkedin.com/shareArticle?mini=true&url=' + fullpath + '&title=Share%20This%20App%20on%20LinkedIn&summary=&source='); // LinkedIn Share
- $('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
- $('a#twitterUrl').attr('href', 'http://twitter.com/home?status=Share%20This%20App%20On%20Twitter%20-' + fullpath); // Twitter Share
- $('a#gplusUrl').attr('href', 'https://plus.google.com/share?url=' + fullpath); // Google Plus Share
- },
- error: function () {
- alert("Error found in the data associated with this MobiKoupon. Call us at 760-994-4555 or email us at connect@mobikoupon.com");
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement