Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Insert Headers
- $(document).ready(function() {
- // Grab the Origin Hostname/URL
- var remoteHostName = 'www.xpressdocs.com';
- var scheme_id = '';
- $.getJSON('http://' + remoteHostName + '/next/web_services/restful/json_company_prefs.php?' + 'callback=?', function(data) {
- // Pull Scheme ID
- scheme_id = data['id_scheme_code'];
- scheme_id_css = scheme_id.toLowerCase();
- // Check to see which Company has a different hostname...
- switch (scheme_id) {
- case '243BREADBO':
- hostName = 'www.marketingrevolution.com';
- break;
- case '154CHOICEH':
- hostName = 'choicehotels.xdstorefront.com';
- break;
- case '18KELLERWILLIAMSDF47':
- hostName = 'kellerwilliams.xdstorefront.com';
- break;
- case '293YELLOWB':
- hostName = 'www.yellowbook360dm.com';
- break;
- default:
- hostName = remoteHostName;
- }
- //Grab style sheet with correct scheme code
- $('head').append('<link rel="stylesheet" type="text/css" href="http://' + remoteHostName + '/next/css/social_hq_styles.css?schemecode=' + scheme_id_css + '">');
- // Grab Session ID
- var session_id = data['uuid'];
- // Check to see if a Session ID is set then build navigation...
- if (session_id !== null) {
- // Utility Nav Markup
- if (data['status_bar_default_text'] == "" || data['status_bar_default_text'] == null || data['status_bar_default_text'] == "undefined") {
- var $hdrTop = $('<div id="utility_nav" style="background-color: #000"><ul><li><a href="http://' + hostName + '/next/account/index.php?uuid=' + session_id + '">Account</a></li><li><a href="http://' + hostName + '/next/logout.php?uuid=' + session_id + '">Logout</a></li><li><a href="http://' + hostName + '/next/onlineresources.php?uuid=' + session_id + '">Online Resources</a></li><li><a href="http://' + hostName + '/next/support.php?uuid=' + session_id + '">Support</a></li><li class="chat"><div id="lpButDivID-1283357466"></div></li><li id="companySupportPhone"></li></ul></div>');
- } else {
- var $hdrTop = $('<div id="utility_nav" style="background: ' + data['status_bar_default_text'] + ' url(http://assets.dev54.xpressdocs.com/next_images/css/main/shine.png) left 50% repeat-x"><ul><li><a href="http://' + hostName + '/next/account/index.php?uuid=' + session_id + '">Account</a></li><li><a href="http://' + hostName + '/next/logout.php?uuid=' + session_id + '">Logout</a></li><li><a href="http://' + hostName + '/next/onlineresources.php?uuid=' + session_id + '">Online Resources</a></li><li><a href="http://' + hostName + '/next/support.php?uuid=' + session_id + '">Support</a></li><li class="chat"><div id="lpButDivID-1283357466"></div></li><li id="companySupportPhone"></li></ul></div>');
- }
- // Insert Data into Utility Nav (Won't work with Rezora JQuery version)
- //$hdrTop.find("a").attr("href", function(i, href) {
- //return href + session_id;
- //});
- $hdrTop.find("#companySupportPhone").text(data['company_support_phone']);
- // Create JavaScript Chat Link
- var script = document.createElement("script");
- script.type = "text/javascript";
- script.src = "https://server.iad.liveperson.net/hc/80105492/?cmd=mTagRepstate&site=80105492&buttonID=7&divID=lpButDivID-1283357466&bt=3&c=1";
- $hdrTop.find(".chat").append(script);
- // Main Nav Markup
- var $hdrListStatic = $('<ul><li><a href="http://' + hostName + '/next/index.php?uuid=' + session_id + '">Home</a></li><li><a href="http://' + hostName + '/next/categories.php?uuid=' + session_id + '">Print & Direct Mail</a></li>');
- // Brand Essentials Tab Check
- if (data['fasttrac_enable_tab'] == "true" || data['fasttrac_enable_tab'] == 1) {
- var $hdrListBrand = $('<ul><li><a href="http://' + hostName + '/next/index.php?stationery=true&uuid=' + session_id + '">Brand Essentials</a></li>');
- } else {
- var $hdrListBrand = $('<li style="display: none;"></li>');
- }
- // Stationery Tab Check
- if (data['show_seasonal'] == "true" || data['show_seasonal'] == 1) {
- var $hdrListStationery = $('<ul><li><a href="http://' + hostName + '/next/seasonal.php?uuid=' + session_id + '">Seasonal<!-- & Holiday --></a></li>');
- } else {
- var $hdrListStationery = $('<li style="display: none;"></li>');
- }
- // Promotional Products Tab Check
- if (data['enable_promotional_products'] == "true" || data['enable_promotional_products'] == 1) {
- var $hdrListPromo = $('<ul><li><a href="http://' + hostName + '/next/promotional_products.php?uuid=' + session_id + '">Promo Products</a></li>');
- } else {
- var $hdrListPromo = $('<li style="display: none;"></li>');
- }
- // E-Mail Active Tab Check
- if (data['email_active'] == "true" || data['email_active'] == 1) {
- var $hdrListEmail = $('<ul><li><a href="http://jweb.xpressdocs.com/email/dashboard.do?uuid=' + session_id + '">Email</a></li>');
- } else {
- var $hdrListEmail = $('<li style="display: none;"></li>');
- }
- // New E-Mail Active Tab Check
- if (data['email_new_active'] == "true" || data['email_new_active'] == 1) {
- var $hdrListEmailActive = $('<ul><li><a href="http://' + hostName + '/next/rezora_sso.php?uuid=' + session_id + '">Email Marketing</a></li>');
- } else {
- var $hdrListEmailActive = $('<li style="display: none;"></li>');
- }
- // Social HQ Tab Check
- if (data['enable_socialmadesimple'] == "true" || data['enable_socialmadesimple'] == 1) {
- var $hdrListSocialHQ = $('<ul><li><a href="http://' + hostName + '/next/marketing_socialhq.php?uuid=' + session_id + '">Social HQ</a></li>');
- } else {
- var $hdrListSocialHQ = $('<li style="display: none;"></li>');
- }
- // Calendar Tab Check
- if (data['calendar'] == "true" || data['calendar'] == 1) {
- var $hdrListCalendar = $('<ul><li><a href="http://' + hostName + '/next/calendar.php?uuid=' + session_id + '">Calendar</a></li>');
- } else {
- var $hdrListCalendar = $('<li style="display: none;"></li>');
- }
- // Follow Up Tab Check
- if (data['enable_xpress_connection_program'] == "true" || data['enable_xpress_connection_program'] == 1) {
- var $hdrListFollowUp = $('<ul><li><a href="http://' + hostName + '/next/xpressconnection/index.php?uuid=' + session_id + '">Follow Up</a></li>');
- } else {
- var $hdrListFollowUp = $('<li style="display: none;"></li>');
- }
- // Build HTML for Main Header Navigation
- var $hdrHTML = $hdrListStatic.html() + '' + $hdrListBrand.html() + '' + $hdrListStationery.html() + '' + $hdrListPromo.html() + '' + $hdrListEmail.html() + '' + $hdrListEmailActive.html() + '' + $hdrListSocialHQ.html() + '' + $hdrListCalendar.html() + '' + $hdrListFollowUp.html();
- var $logoStyle = 'url(http://assets.xpressdocs.com/next_images/company/' + scheme_id_css + '/logocell.gif)';
- //var $headerStyle = '' + data['status_bar_default_text'] + ' url(http://assets.xpressdocs.com/next_images/company/' + data['id_scheme_code'] + '/logocell_back.gif) repeat-x 0 34px';
- // Output Main Header Navigation
- $('#header').prepend( '<div class="wrapWS"><div id="logo" style="background-image: '+ $logoStyle +'"></div><div id="topnav"><ul>' + $hdrHTML + '</ul></div></div></div>');
- // Insert before Main Header
- $('body').prepend($hdrTop);
- // Overwrite Utility Holder Styles
- $('#header .wrapper').css({'clear' : 'both' , 'width' : 'auto'});
- $('#utility-holder').css({'margin' : '0 auto' , 'width' : '950px' , 'float' : 'none'});
- $('#utility').css('margin', '7px 0 0');
- $('#welcome-admin, #welcome').css({'margin' : '29px 5px 3px 0' , 'font-size' : '12px' , 'line-height' : '12px'});
- // Output Header if there is no registered user (no session)...
- } else {
- var reBack = 'http://' + hostName + '/next/logout.php?action=logout';
- // Redirect them back to XD login page...
- window.location = reBack;
- }
- });
- });// JavaScript Document
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement