",style:{26:"0px",29:"middle",32:"normal",39:"0px 0px",43:"726px",110:"1014px",114:"absolute",116:"0px 0px",192:"0px",197:"0px",198:"1014px",199:"726px",200:"0px",201:"0px",206:"0px",284:"0px",286:"none",294:"none",297:"none",300:"none",303:"none",314:"none",319:"none",322:"none",324:"0px",332:"rgba(0, 0, 0, 0)"}},children:[]}, {"tag":"div","attrib":{style:{39:"507px 0px",116:"507px 0px",206:"0px",324:"0px",332:"rgba(0, 0, 0, 0)"}},children:[ {"tag":"iframe","attrib":{style:{26:"auto",29:"middle",32:"normal",39:"50% 50%",116:"50% 50%",201:"auto",206:"auto",250:"none",324:"auto"}},children:[]},]}, {"tag":"div","attrib":{"id":"hbl-live-chat-wrapper","role":"region","aria-label":"Chat widget",style:{39:"507px 0px",116:"507px 0px",206:"0px",324:"0px",332:"rgba(0, 0, 0, 0)"}},children:[ {"tag":"div","attrib":{"id":"olark-wrapper",style:{188:"0px",230:"11px"}},children:[ {"tag":"div","attrib":{"aria-live":"assertive","aria-atomic":"true","role":"alert","id":"chat-box-announcer",style:{26:"1px",27:"nowrap",39:"0.5px 0.5px",43:"2653.03px",110:"1015px",114:"absolute",116:"0.5px 0.5px",134:"hidden",135:"hidden",137:"hidden",138:"hidden",140:"hidden",177:"-1px",178:"-1px",179:"-1px",180:"-1px",181:"-1px",182:"-1px",183:"-1px",184:"-1px",192:"0px",197:"0px",198:"1015px",199:"2653.03px",200:"-1926.03px",201:"1px",206:"1px",273:"polygon(0px 0px, 0px 0px, 0px 0px, 0px 0px)",274:"rect(0px, 0px, 0px, 0px)",284:"-1926.03px",286:"none",294:"none",297:"none",300:"none",303:"none",314:"none",319:"none",322:"none",324:"1px"}},children:[ {"tag":"p","attrib":{style:{39:"0.5px 0px",43:"auto",65:"left",110:"auto",114:"static",116:"0.5px 0px",134:"visible",135:"visible",137:"visible",138:"visible",140:"visible",177:"0px",178:"0px",179:"0px",180:"0px",181:"0px",182:"0px",183:"0px",184:"0px",188:"15.8333px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",206:"0px",217:"200",230:"13.2px",273:"none",274:"auto",284:"auto",324:"0px"}},children:[]},]},]},]},]}}; let zIndexMax = 0 let base_url = "https:\/\/www.olark.com\/no-javascript\/enable-javascript-to-chat"; function url_canonicalize( url ) { url = url.replace(/[?;]jsessionid=[!0-9a-z]+/i,'') let parts = new URL(url) let path = parts.pathname if (( path.length >= 2 )&&( path[0]=='/' )&&( path[1]=='/' )) { path = path.substr( 1 ) } // Transforms // to / if set at the beginning of path let path_parts = [] let path_orig_parts = path.split('/') for ( let i = 0 ; i < path_orig_parts.length ; i++ ) { let path_part = path_orig_parts[i] if (( i==1 )&&( path_part=='' )) continue if ( path_part == '.' ) continue // removes /. if ( path_part == '..' ) { if ( path_parts.length>1 ) { // removes /xxx/.. path_parts.pop() } continue; // and ^/../ which is weird stuff } path_parts.push( path_part ) } path = path_parts.join('/'); let portStr = parts.port ? ':'+parts.port : '' let queryStr = parts.search ? parts.search : '' let hashStr = parts.hash ? parts.hash : '' return parts.protocol + '//' + parts.hostname + portStr + path + queryStr + hashStr } function strip_filename( path ) { last_slash = path.lastIndexOf('/') return ( last_slash >= 0 )? path.substr( 0, last_slash+1 ) : '/' } function getAbsoluteUrl( url ) { if ( url.match(/^data:|^javascript:/i ) ) return url let base_parts = new URL(base_url) if ( base_parts.protocol && base_parts.hostname ) { if ( url.indexOf('//') == 0 ) { url = base_parts.protocol + url } if ( url.indexOf('/') == 0 ) { url = base_parts.protocol + '//' + base_parts.hostname + url; } if ( ! url.match(/^[a-z]{3,5}:\/\//i) ) { let base_path = base_parts.pathname ? base_parts.pathname : '/' url = base_parts.protocol + '//' + base_parts.hostname + strip_filename( base_path ) + url } } return url_canonicalize(url) } function convert_url( tagName, attrib, value ) { let entry = cache_url switch ( attrib ) { case 'src': entry = entry.replace(/index2\.php/,'display2.php') case 'href': if ( value.startsWith('data:') ) return value let postfix = '' if ( tagName.toLowerCase() == 'iframe' ) postfix = '&inframe=1' console.log('convert url : ',entry+encodeURIComponent( getAbsoluteUrl(value) )+postfix) return entry+encodeURIComponent( getAbsoluteUrl(value) )+postfix } return value } let console_timing_count = 0 function console_timing() { if ( !( console_timing_count++ % 1000 ) ) { console.log('1000 ticks') } } let parse_inBody = false function parse_json( json, parentStyles ) { console_timing() if ( json.tag ) { let tag switch ( json.tag ) { case 'head': tag = document.head; break; case 'body': tag = document.body; break; //document.createElement('div'); // document.body.appendChild(tag) break; default: try { tag = document.createElement(json.tag) } catch (error) { return document.createElement('span') /* sometimes, we get an invalid tag name ; drop it */ } } if ( json.tag == 'base' ) { if ( json.attrib.href ) base_url = json.attrib.href } if ( json.tag == 'head' ) { let style = document.createElement('style') style.innerHTML = '.w { '+default_styles_css+' }' tag.appendChild(style) } let ourStyle = {} for ( const attrib in json.attrib ) { if ( attrib == 'style' ) { for ( const style in json.attrib.style ) { let value = json.attrib.style[style] let key = wikiwix_styles[style] if ( default_styles[key] != value ) { tag.style[key] = value } ourStyle[style] = value } for ( const style in parentStyles ) { if ( !ourStyle.hasOwnProperty(style) ) { let value = parentStyles[style] let key = wikiwix_styles[style] if ( default_styles[key] != value ) { tag.style[wikiwix_styles[style]] = parentStyles[style] } ourStyle[style] = parentStyles[style] } } if ( ourStyle[style_to_id['position'] ] != 'static' ) { let zIndex = parseInt(ourStyle[style_to_id['z-index']]) if (( zIndex != NaN )&&( zIndex > zIndexMax )) zIndexMax = zIndex } } else { try { if ( attrib !== 'srcset' ) { tag.setAttribute( attrib, convert_url(json.tag,attrib,json.attrib[attrib]) ) } } catch (err) {} } } if ( json.tag == 'body' ) { tag.style.overflowY='auto' /* tag.style.height='auto' tag.style.inset='0' tag.style.margin='0' tag.style.zIndex='0'*/ } if ( parse_inBody ) tag.setAttribute('class','w') json.children.forEach( (child)=>{ let node = parse_json(child,ourStyle) if (( node instanceof Node )&&( json.tag != 'html' )) tag.appendChild( node ) } ) return tag } else if ( json.text ) { return document.createTextNode( json.text ) } return false } parse_json(wikiwix_dom.head,{}) parse_inBody = true parse_json(wikiwix_dom.body,{}) if ( zIndexMax > 0 ) { $('#wikiwix_container').css('z-index',zIndexMax+1) $('#wikiwix_login_container').css('z-index',zIndexMax+2) $('#wikiwix_minimizer').css('z-index',zIndexMax+3) $('#popup_notice').css('z-index',zIndexMax+1) }