"use strict"; function set_host() { var host_name = "localhost"; global_hostname = "localhost"; host_name = document.location.hostname; host_name = host_name.toLowerCase(); host_name = host_name.trim(); if (host_name == "localhost") { global_hostname = host_name; return host_name; } else if (host_name == "chromosphere.com") { global_hostname = host_name; return host_name; } else if (host_name == "aircraftarcade.com") { global_hostname = host_name; return host_name; } else if (host_name == "scu8a.com") { global_hostname = host_name; return host_name; } else { global_hostname = "localhost"; return "localhost"; } } function remove_old_head_tags() { var old_base_tag = null; var old_link_canonical = null; var old_link_icon = null; var old_link_author = null; old_base_tag = document.getElementById("base_href"); old_link_canonical = document.getElementById("link_canonical"); old_link_icon = document.getElementById("link_favicon"); old_link_author = document.getElementById("link_author"); old_base_tag.parentNode.removeChild(old_base_tag); old_link_canonical.parentNode.removeChild(old_link_canonical); old_link_icon.parentNode.removeChild(old_link_icon); old_link_author.parentNode.removeChild(old_link_author); } function insert_base_url_tag() { var base_tag = null; var protocol_txt = null; var host_name = null; var base_href = null; var host_port = null; base_tag = document.createElement("base"); protocol_txt = document.location.protocol; host_name = document.location.hostname; host_port = document.location.port; if (host_port.length > 0) { host_port = ":" + host_port; } base_href = protocol_txt + "//" + host_name + host_port + "/"; base_tag.setAttribute("href", base_href); //document.head.appendChild(base_tag); document.head.insertBefore(base_tag, document.head.childNodes[0]); } function config_page_init() { var link_canonical = null; var rel = null; var base_href = null; var favicon = null; var protocol_txt = null; var host_name = null; var host_port = null; link_canonical = document.createElement("link"); rel = "canonical"; protocol_txt = document.location.protocol; host_name = document.location.hostname; host_port = document.location.port; //alert(typeof host_port); if (host_port.length > 0) { host_port = ":" + host_port; } base_href = protocol_txt + "//" + host_name + host_port + "/"; link_canonical.setAttribute("rel", rel); link_canonical.setAttribute("href", base_href); link_author = document.createElement("link"); link_author.setAttribute("rel", "author"); link_author.setAttribute("href", "http://steveraw.com/"); favicon = document.createElement("link"); favicon.setAttribute("rel", "icon"); favicon.setAttribute("type", "image/x-icon"); favicon.setAttribute("href", (base_href + "images/favicon/favicon.ico")); document.head.insertBefore(link_canonical, document.head.childNodes[0]); //appendChild(link_canonical); document.head.insertBefore(link_author, document.head.childNodes[0]); //document.head.appendChild(link_author); document.head.insertBefore(favicon, document.head.childNodes[0]); //document.head.appendChild(favicon); } function create_html_elems() { //global_hostname = set_host(); return; /* //alert(window.document.cookie); var cookie_array = null; var key_name = null; var key_value = null; cookie_array = window.document.cookie.split(";"); items_array = cookie_array[0].split("="); key_name = items_array[0]; key_value = items_array[1]; //alert(key_value); */ //global_hostname = window.location.toLowerCase; //alert(global_hostname); /* global_hostname.protocol = "https:"; global_hostname.hostname = self.location.hostname.toLowerCase; global_hostname.port = self.location.port; global_hostname.pathname = self.location.pathname; global_hostname.search = self.location.search; global_hostname.hash = self.location.hash; */ //create_base_url(document.getElementById("base_href")); //create_link_canonical(document.getElementById("link_canonical")); //create_link_favicon(document.getElementById("link_favicon")); //create_link_author(document.getElementById("link_author")); //alert(global_hostname); //insert_base_url_tag(); //config_page_init(); } /* //remove_old_head_tags(); */ function create_base_url(html_elem) { return; var protocol_txt = null; var host_name = null; var base_href = null; var host_port = null; protocol_txt = self.location.protocol; host_name = self.location.hostname; host_port = self.location.port; if (host_port.length > 0) { host_port = ":" + host_port + "/"; } else { host_port = "/"; } base_href = protocol_txt + "//" + host_name + host_port; base_href = base_href.toLowerCase(); html_elem.setAttribute("href", base_href); } function create_link_canonical(html_elem) { return; var protocol_txt = null; var host_name = null; var base_href = null; var host_port = null; protocol_txt = self.location.protocol; host_name = self.location.hostname; host_port = self.location.port; if (host_port.length > 0) { host_port = ":" + host_port + "/"; } else { host_port = "/"; } base_href = protocol_txt + "//" + host_name + host_port; base_href = base_href.toLowerCase(); html_elem.setAttribute("rel", "canonical"); html_elem.setAttribute("href", base_href); } function create_link_favicon(html_elem) { return; var favicon = null; var protocol_txt = null; var host_name = null; var base_href = null; var host_port = null; favicon = html_elem; protocol_txt = self.location.protocol; host_name = self.location.hostname; host_port = self.location.port; if (host_port.length > 0) { host_port = ":" + host_port + "/"; } else { host_port = "/"; } base_href = protocol_txt + "//" + host_name + host_port; base_href = base_href.toLowerCase(); favicon.setAttribute("rel", "icon"); favicon.setAttribute("type", "image/x-icon"); favicon.setAttribute("href", (base_href + "images/favicon/favicon.ico")); } function create_link_author(html_elem) { return; var author = null; author = html_elem; author.setAttribute("href", "http://steveraw.com/"); author.setAttribute("rel", "author"); }