// 1a. Get location path - replaces getting referrer via PHP var referrer = window.location.href; var l = getLocation(referrer); var path_name = String(l.pathname); // console.log(path_name); drawPortal(path_name, "kingfeatures", "horoscope"); function getLocation(href) { var l = document.createElement("a"); l.href = href; return l; }; // initialize jQuery var jQueryScriptOutputted = false; initJQuery(); // iframe resize document.write(''); document.write(''); function get(name) { var q = unescape(location.search.substring(1)).split(/[=&]/); for (var j=0; j= 2) return stringValue; if (stringValue.length == 1) return ("0" + stringValue); return "00"; } /****************************************************************************************/ /* Draws portal for puzzlesd and horoscopes */ function drawPortal(this_path, clientID, contentType, contentID) { // get url vars not passed outside of handler var content_name = get("content_name"); var content_sign = get("content_sign"); var date = get("date"); if (contentID!=null) { // puzzle can only be alacarte based on this request; ignore content_name var isAlacarte = "yes" } else { var isAlacarte = "no" } // if ((content_name==null) && (contentID!=null)) { if (contentID!=null) { var content_name = contentID; } // if it's a sample, default to first day of last month, if no month is provided if ((date==null) && (clientID=="sample_alacarte")){ var tempDate = new Date(); var curYear = tempDate.getFullYear(); var curMonth = tempDate.getMonth(); var sampleDate=new Date(curYear, curMonth-1, 0); sampleDate.setDate(sampleDate.getDate()+1); // add a day date = dateToString(sampleDate); } // set base iframe url var viewURL = "//horoscopes.kingdigital.com/v4.2/server/display.php"; // build out iframe url viewURL += ("?client="+clientID+"&alacarte="+isAlacarte); viewURL += ("&path_name="+this_path); if (content_name!=null){ // content name is specified if (date!=null){ // date is specified viewURL += ("&date="+date); // +"&content_name="+content_name); } if (content_sign!=null){ // sign is specified viewURL += ("&content_sign="+content_sign); } viewURL += ("&content_name="+content_name); // +"\""); } /******** First write iframe code to page ******/ document.write(''); } /****************************************************************************************/ /* initialize jQuery if it's not present */ function initJQuery() { // if the jQuery object isn't available if (typeof(jQuery) == 'undefined') { if (! jQueryScriptOutputted) { //only output the script once. jQueryScriptOutputted = true; //output the script (load it from google api) document.write(''); } setTimeout("initJQuery()", 50); } }