var _CONNET_cert_type = 167; var _CONNET_sb_logo = ''; //execute the inline code of the script tag which loaded this file //NOTE: cert_type is defined elsewhere var _CONNET_scripts = document.getElementsByTagName("script"); var _CONNET_count = _CONNET_scripts.length; if (typeof _CONNET_refresh_page !== 'function' ) { function _CONNET_refresh_page() { setTimeout("location.reload(true);", 3600000); } _CONNET_refresh_page(); } while (_CONNET_count > 0) { _CONNET_count--; var _CONNET_curr_script = _CONNET_scripts[_CONNET_count]; var _CONNET_script_sc = "https://verify.safesigned.com/seal_js?cert=" + _CONNET_cert_type; var _CONNET_script_sb = _CONNET_script_sc + "&sb=1&sb_logo=" + _CONNET_sb_logo; var _CONNET_script_sbt = _CONNET_script_sc + "&sbt=1&sb_logo=" + _CONNET_sb_logo; // SecuButton var _CONNET_script_ss = _CONNET_script_sc + "&ss=1&sb_logo=" + _CONNET_sb_logo; // SecuSeal var _CONNET_script_scr = _CONNET_script_sc + "&scr=1&sb_logo=" + _CONNET_sb_logo; // SecuSeal if (_CONNET_curr_script.src == _CONNET_script_sc || _CONNET_curr_script.src == _CONNET_script_sb || _CONNET_curr_script.src == _CONNET_script_sbt || _CONNET_curr_script.src == _CONNET_script_ss || _CONNET_curr_script.src == _CONNET_script_scr) { //add seal CSS (Note: we can override the _CONNET_ variable with no harm, because the script object it //used to reference has already been inserted into the
section of the page) _CONNET_css = document.createElement('link'); _CONNET_css.rel = "stylesheet"; _CONNET_css.type = "text/css"; _CONNET_css.href = "https://verify.safesigned.com/static/api/legacy_seal_css.css"; //TODO: append only if it does not exist yet //TODO: simply add snippet to loadSeal method? document.getElementsByTagName('head')[0].appendChild(_CONNET_css); //execute code for triggering seal loading eval(_CONNET_curr_script.innerHTML); break; } } /* this version of the script is meant for displaying ALL types of seals (external seals currently excluded) and should be coupled with a code which loads seals ASYNCHRONOUSLY */ function CON(domain_id, cert_type_id, seal_shape, text_id) { text_id = typeof text_id !== 'undefined' ? text_id : 'none'; this.text_id = text_id; this.domain_id = domain_id; this.cert_type_id = cert_type_id; this.seal_shape = seal_shape; //1 - notary, 2 - tab, 4 - rectangle, 5 - classic this.base_url = "https://verify.safesigned.com/"; this.var_name = 'CON_' + this.cert_type_id; //CON instance variable name this.t_AR = 1200; //seal automatic reload time in seconds (after the seal has been loaded) this.t_SL = 2000; //spinner "loading" time in miliseconds //determine current page url (TODO: move this to function A() because you trigger security exception there //again anyway (to check loading in iframe etc) try { this.p_url = window.top.location.href; //we need to get topmost location (just in case if page uses frames) this.r_url = window.top.document.referrer; //referring url ... needed only for statistics } catch (ex) { //security exception... seal is loaded on a page which is open in a frame on another domain this.p_url = window.location.href; //save current page url, although it won't be used, because //it is open in a frame on another domain this.r_url = ''; } this.loadSeal = function() { this.c_name = 'con_s_container_' + this.cert_type_id //seal container name this.c_div = document.getElementById(this.c_name); //container div this.A(); //create script request link and insert it into section (and load it this way) //TODO: load CSS here if not yet included? }; //generates a link to the seal displaying script and inserts this link into the head //section of the page so that the script is retrieved and executed this.A = function() { var CON_objHead = document.getElementsByTagName("head")[0]; var CON_objScript = document.createElement("script"); CON_objScript.type = 'text/javascript'; var CON_mode = location.protocol; var CON_isSecure = (CON_mode == 'https:') ? 1 : 0; var parts = this.r_url.split('/', 3); var ref_domain = (parts.length < 3) ? '' : parts[2]; var cookies = document.cookie.split(';'), name = 'safesigned_ct=', //cookie name token = 'F0F0'; for (var i = 0; i < cookies.length; i++) { var c = cookies[i]; while (c.charAt(0) == ' ') { c = c.substring(1, c.length); } if (c.indexOf(name) === 0) { token = c.substring(name.length, c.length); } } //generate a link to request the seal var seal_req_link = this.base_url + "legacy_loader/" + this.domain_id + '/?id=' + this.cert_type_id + '&secure=' + CON_isSecure + '&p_url=' + escape(this.p_url) + '&token=' + token + '&s_shape=' + this.seal_shape + '&ref_d=' + escape(ref_domain) + '&text_id=' + this.text_id + '&' + Math.floor(Math.random()*999999999999); try { var dummy = window.top.document; //trigger security exception if page is loaded in an iframe on another domain } catch (ex) { //create invalid script link that will result in a NOT VERIFIED seal //-6 for p_url is our special error code which indicates that a security exception was triggered seal_req_link = this.base_url + "legacy_loader/" + this.domain_id + '?id=' + this.cert_type_id + '&secure=' + CON_isSecure + '&p_url=-6' + '&s_shape=' + this.seal_shape + '&ref_d=' + '&' + Math.floor(Math.random()*999999999999); } CON_objScript.src = seal_req_link; CON_objHead.appendChild(CON_objScript); window.setTimeout(this.var_name + '.A();', (this.t_AR * 1000)); //set automatic seal reload time }; //create notary seal this.gen_seal_notary = function(cert_link, seal_img_url, signature) { //if signature is not provided (undefined), this means we have tech. issues or "not verified" case //if signature IS provided (even if it is an empty string) var use_bubble = (signature === ""); //empty string (NOTE: undefined does not count!) var show_sig = signature ? true : false; var toggle_code = ""; if (use_bubble) { //TODO: duplicate code ... have a function for creating this? //create mouseover and mouseout code for toggling the signature bubble logo var bubble_id = "sig_bubble_" + this.cert_type_id; var code_mover = [this.var_name, ".sig_bubble_pre_toggle('", bubble_id, "', true);"].join(""); var code_mout = [this.var_name + ".sig_bubble_pre_toggle('", bubble_id, "', false);"].join(""); toggle_code = ["onmouseover=\"", code_mover, "\" onmouseout=\"", code_mout, "\""].join(""); } var seal_html = ['']; if (show_sig) { var sig = ['']; seal_html.push.apply(seal_html, sig); } this.c_div.innerHTML = seal_html.join(""); //add seal to container //now that the seal image exists, create its signature bubble if necessary if (use_bubble) { //TODO: duplicate code ... have a function to create bubble? var sig_bubble = document.getElementById(bubble_id); if (!sig_bubble) { //if signature bubble does not yet exist ... sig_bubble = document.createElement("div"); sig_bubble.id = bubble_id; sig_bubble.onmouseover = function() { eval(code_mover); }; sig_bubble.onmouseout = function() { eval(code_mout); }; sig_bubble.innerHTML = ['