",style:{26:"0px",32:"normal",39:"0px 0px",43:"716px",110:"1024px",114:"absolute",116:"0px 0px",192:"0px",197:"0px",198:"1024px",199:"716px",200:"0px",201:"0px",206:"0px",284:"0px",324:"0px",332:"rgba(0, 0, 0, 0)"}},children:[]}, {"tag":"div","attrib":{"id":"hbl-live-chat-wrapper","role":"region","aria-label":"Chat widget",style:{39:"512px 0px",116:"512px 0px",206:"0px",230:"14.75px",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:"535.883px",110:"1025px",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:"1025px",199:"535.883px",200:"181.117px",201:"1px",206:"1px",230:"10.5667px",273:"polygon(0px 0px, 0px 0px, 0px 0px, 0px 0px)",274:"rect(0px, 0px, 0px, 0px)",284:"181.117px",324:"1px"}},children:[ {"tag":"p","attrib":{style:{39:"0.5px 0px",43:"auto",110:"auto",114:"static",116:"0.5px 0px",134:"visible",135:"visible",137:"visible",138:"visible",140:"visible",177:"12px",178:"0px",179:"0px",180:"0px",181:"0px",182:"12px",183:"12px",184:"12px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",206:"0px",230:"12px",273:"none",274:"auto",284:"auto",324:"0px"}},children:[]},]},]},]},]}}; let zIndexMax = 0 let base_url = "http:\/\/ringding.law.yale.edu\/screens\/course.html"; 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( 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 return entry+encodeURIComponent( getAbsoluteUrl(value) ) } 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: tag = document.createElement(json.tag) } 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 { tag.setAttribute( attrib, convert_url(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) }