"}, {"tag":"br","attrib":{style:{26:"0.0166667px",39:"0.00833333px 12px",116:"0.00833333px 12px",201:"0.0166667px",206:"24px",324:"24px"}},"children":[]}, {"tag":"br","attrib":{style:{26:"0.0166667px",39:"0.00833333px 12px",116:"0.00833333px 12px",201:"0.0166667px",206:"24px",324:"24px"}},"children":[]}, {"text":"5.<% echo \"asp style tag and asp_tags should be enabled but now php 7.0.0 version,this tag is removed\";%>"},]}, {"text":"\n"},]},]}, {"text":"\n "},]}, {"text":"\n "},]}, {"text":"\n "}, {"tag":"div","attrib":{"id":"122644",style:{39:"353.5px 48.25px",43:"0px",110:"0px",114:"relative",116:"353.5px 48.25px",177:"24px",182:"24px",183:"24px",184:"24px",192:"0px",197:"0px",198:"0px",199:"0px",200:"0px",206:"96.5px",284:"0px",324:"96.5px"}},"children":[ {"text":" "}, {"tag":"div","attrib":{style:{26:"67.7333px",39:"33.8667px 12px",43:"auto",94:"0px",100:"0px",110:"auto",114:"static",116:"33.8667px 12px",177:"0px",182:"0px",183:"0px",184:"0px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",201:"67.7333px",206:"24px",238:"left",284:"auto",324:"24px"}},"children":[ {"text":"\n "}, {"tag":"div","attrib":{"id":"Vu122644",style:{26:"16px",39:"8px 9px",94:"52px",100:"52px",116:"8px 9px",201:"16px",206:"18px",324:"18px"}},"children":[ {"text":"\n "}, {"tag":"a","attrib":{"href":"/manual/vote-note.php?id=122644&page=language.basic-syntax.phpmode&vote=up","title":"Vote up!",style:{1:"rgb(51, 102, 153)",2:"rgb(51, 102, 153)",26:"0px",32:"normal",35:"border",36:"0.4s",39:"8px 5px",55:"rgb(51, 102, 153)",60:"rgb(51, 102, 153)",61:"rgb(51, 102, 153)",94:"0px",100:"0px",116:"8px 5px",134:"hidden",135:"hidden",137:"hidden",138:"hidden",140:"hidden",144:"rgb(51, 102, 153)",177:"8px",183:"8px",201:"0px",206:"0px",238:"none",254:"pointer",264:"rgb(51, 102, 153)",271:"rgb(51, 102, 153)",276:"rgb(51, 102, 153)",289:"rgb(51, 102, 153)",293:"8px",294:"solid",295:"rgba(0, 0, 0, 0)",296:"8px",297:"solid",298:"rgba(0, 0, 0, 0)",299:"8px",300:"solid",301:"rgba(0, 0, 0, 0)",302:"8px",303:"solid",304:"rgba(0, 0, 0, 0)",313:"10px",314:"solid",317:"rgb(153, 153, 153)",320:"rgb(51, 102, 153)",321:"10px",322:"solid",323:"rgb(153, 153, 153)",324:"0px"}},"children":[ {"text":"up"},]}, {"text":"\n "},]}, {"text":"\n "}, {"tag":"div","attrib":{"id":"Vd122644",style:{26:"16px",39:"8px 9px",94:"52px",100:"52px",116:"8px 9px",201:"16px",206:"18px",238:"right",324:"18px"}},"children":[ {"text":"\n "}, {"tag":"a","attrib":{"href":"/manual/vote-note.php?id=122644&page=language.basic-syntax.phpmode&vote=down","title":"Vote down!",style:{1:"rgb(51, 102, 153)",2:"rgb(51, 102, 153)",26:"0px",32:"normal",35:"border",36:"0.4s",39:"8px 5px",55:"rgb(51, 102, 153)",60:"rgb(51, 102, 153)",61:"rgb(51, 102, 153)",94:"0px",100:"0px",116:"8px 5px",134:"hidden",135:"hidden",137:"hidden",138:"hidden",140:"hidden",144:"rgb(51, 102, 153)",177:"8px",183:"8px",201:"0px",206:"0px",238:"none",254:"pointer",264:"rgb(51, 102, 153)",271:"rgb(51, 102, 153)",276:"rgb(51, 102, 153)",285:"10px",286:"solid",289:"rgb(153, 153, 153)",293:"8px",294:"solid",295:"rgba(0, 0, 0, 0)",296:"8px",297:"solid",298:"rgba(0, 0, 0, 0)",299:"8px",300:"solid",301:"rgba(0, 0, 0, 0)",302:"8px",303:"solid",304:"rgba(0, 0, 0, 0)",317:"rgb(51, 102, 153)",318:"10px",319:"solid",320:"rgb(153, 153, 153)",323:"rgb(51, 102, 153)",324:"0px"}},"children":[ {"text":"down"},]}, {"text":"\n "},]}, {"text":"\n "}, {"tag":"div","attrib":{"id":"V122644","title":"42% like this...",style:{26:"26.1333px",39:"17.8667px 12px",94:"52px",100:"52px",116:"17.8667px 12px",123:"4.8px",124:"4.8px",125:"4.8px",126:"4.8px",201:"26.1333px",238:"right"}},"children":[ {"text":"\n -28\n "},]}, {"text":"\n "},]}, {"text":"\n "}, {"tag":"a","attrib":{"href":"#122644",style:{26:"auto",32:"normal",39:"76.1667px 11px",43:"auto",94:"0px",100:"0px",110:"auto",114:"static",116:"76.1667px 11px",177:"0px",179:"16px",180:"16px",182:"0px",183:"0px",184:"0px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",201:"auto",206:"auto",230:"18px",250:"inline",254:"pointer",284:"auto",324:"auto"}},"children":[ {"text":"\n "}, {"tag":"strong","attrib":{style:{48:"optimizelegibility",179:"0px",180:"0px",217:"700"}},"children":[ {"tag":"em","attrib":{style:{217:"400"}},"children":[ {"text":"Emil Cataranciuc"},]},]},]}, {"tag":"a","attrib":{"href":"#122644",style:{1:"rgba(0, 0, 0, 0)",2:"rgba(0, 0, 0, 0)",26:"auto",32:"normal",39:"7.63333px 9.5px",43:"auto",55:"rgba(0, 0, 0, 0)",60:"rgba(0, 0, 0, 0)",61:"rgba(0, 0, 0, 0)",94:"0px",100:"0px",110:"auto",114:"static",116:"7.63333px 9.5px",144:"rgba(0, 0, 0, 0)",177:"0px",182:"0px",183:"0px",184:"0px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",201:"auto",206:"auto",250:"inline",254:"pointer",264:"rgba(0, 0, 0, 0)",271:"rgba(0, 0, 0, 0)",276:"rgba(0, 0, 0, 0)",284:"auto",289:"rgba(0, 0, 0, 0)",295:"rgba(0, 0, 0, 0)",298:"rgba(0, 0, 0, 0)",301:"rgba(0, 0, 0, 0)",304:"rgba(0, 0, 0, 0)",317:"rgba(0, 0, 0, 0)",320:"rgba(0, 0, 0, 0)",323:"rgba(0, 0, 0, 0)",324:"auto"}},"children":[ {"text":" ¶"},]}, {"tag":"div","attrib":{"title":"2018-04-19 08:30",style:{1:"rgb(102, 102, 102)",2:"rgb(102, 102, 102)",26:"94.1167px",39:"47.0583px 12px",43:"auto",55:"rgb(102, 102, 102)",60:"rgb(102, 102, 102)",61:"rgb(102, 102, 102)",65:"right",94:"0px",100:"0px",110:"auto",114:"static",116:"47.0583px 12px",144:"rgb(102, 102, 102)",177:"0px",182:"0px",183:"0px",184:"0px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",201:"94.1167px",206:"24px",238:"right",264:"rgb(102, 102, 102)",271:"rgb(102, 102, 102)",276:"rgb(102, 102, 102)",284:"auto",289:"rgb(102, 102, 102)",295:"rgb(102, 102, 102)",298:"rgb(102, 102, 102)",301:"rgb(102, 102, 102)",304:"rgb(102, 102, 102)",317:"rgb(102, 102, 102)",320:"rgb(102, 102, 102)",323:"rgb(102, 102, 102)",324:"24px"}},"children":[ {"tag":"strong","attrib":{style:{26:"auto",32:"normal",39:"47.0583px 9.5px",48:"optimizelegibility",116:"47.0583px 9.5px",201:"auto",206:"auto",238:"none",250:"inline",324:"auto"}},"children":[ {"text":"4 years ago"},]},]}, {"text":"\n "}, {"tag":"div","attrib":{"id":"Hcom122644",style:{26:"683px",35:"opacity",36:"0.4s",39:"353.5px 36px",43:"auto",110:"auto",114:"static",116:"353.5px 36px",122:"12px",123:"12px",124:"12px",125:"12px",126:"12px",127:"12px",128:"12px",129:"12px",146:"0.35",177:"0px",182:"0px",183:"0px",184:"0px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",201:"683px",206:"48px",282:"rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset",284:"auto",310:"2px",311:"2px",315:"2px",316:"2px",324:"48px",332:"rgb(255, 255, 255)"}},"children":[ {"text":"\n"}, {"tag":"div","attrib":{style:{35:"all",36:"0s",39:"341.5px 24px",65:"left",94:"0px",100:"0px",116:"341.5px 24px",122:"0px",123:"0px",124:"0px",125:"0px",126:"0px",127:"0px",128:"0px",129:"0px",146:"1",282:"none",310:"0px",311:"0px",315:"0px",316:"0px",332:"rgba(0, 0, 0, 0)"}},"children":[ {"tag":"code","attrib":{style:{32:"normal",136:"break-word",230:"14px",235:"monospace"}},"children":[ {"tag":"span","attrib":{style:{1:"rgb(0, 0, 0)",2:"rgb(0, 0, 0)",26:"auto",39:"337.333px 8.5px",55:"rgb(0, 0, 0)",60:"rgb(0, 0, 0)",61:"rgb(0, 0, 0)",116:"337.333px 8.5px",144:"rgb(0, 0, 0)",201:"auto",206:"auto",250:"inline",264:"rgb(0, 0, 0)",271:"rgb(0, 0, 0)",276:"rgb(0, 0, 0)",289:"rgb(0, 0, 0)",295:"rgb(0, 0, 0)",298:"rgb(0, 0, 0)",301:"rgb(0, 0, 0)",304:"rgb(0, 0, 0)",317:"rgb(0, 0, 0)",320:"rgb(0, 0, 0)",323:"rgb(0, 0, 0)",324:"auto"}},"children":[ {"text":"\n\", are always available.\" since PHP 7.0.0 is no longer true. These are removed along the ASP \"<%, %>, <%=\" tags."},]}, {"text":"\n"},]},]}, {"text":"\n "},]}, {"text":"\n "},]},]}, {"text":"\n"}, {"tag":"div","attrib":{style:{39:"353.5px 12.5px",43:"auto",65:"right",94:"0px",100:"0px",110:"auto",114:"static",116:"353.5px 12.5px",177:"0px",182:"16px",183:"0px",184:"16px",192:"auto",197:"auto",198:"auto",199:"auto",200:"auto",206:"25px",284:"auto",324:"25px"}},"children":[ {"tag":"a","attrib":{"href":"/manual/add-note.php?sect=language.basic-syntax.phpmode&redirect=https://www.php.net/manual/en/language.basic-syntax.phpmode.php",style:{1:"rgb(51, 102, 153)",2:"rgb(51, 102, 153)",26:"auto",32:"normal",39:"38.8px 10px",55:"rgb(51, 102, 153)",60:"rgb(51, 102, 153)",61:"rgb(51, 102, 153)",116:"38.8px 10px",144:"rgb(51, 102, 153)",182:"0px",184:"0px",201:"auto",206:"auto",250:"inline",254:"pointer",264:"rgb(51, 102, 153)",271:"rgb(51, 102, 153)",276:"rgb(51, 102, 153)",289:"rgb(51, 102, 153)",295:"rgb(51, 102, 153)",298:"rgb(51, 102, 153)",301:"rgb(51, 102, 153)",304:"rgb(51, 102, 153)",313:"1px",314:"solid",317:"rgb(51, 102, 153)",320:"rgb(51, 102, 153)",321:"1px",322:"solid",323:"rgb(51, 102, 153)",324:"auto"}},"children":[ {"text":"+"}, {"tag":"small","attrib":{style:{39:"32.3px 7.5px",116:"32.3px 7.5px",230:"12px",313:"0px",314:"none",321:"0px",322:"none"}},"children":[ {"text":"add a note"},]},]},]}, {"text":"\n"},]}, {"text":" "},]}, {"text":"\n "}, {"tag":"aside","attrib":{style:{26:"253px",39:"126.5px 84px",94:"0px",100:"0px",116:"126.5px 84px",122:"12px",123:"24px",124:"24px",125:"24px",126:"24px",127:"24px",128:"12px",129:"24px",182:"0px",184:"0px",201:"253px",206:"168px",238:"left",275:"none",281:"border-box",324:"168px"}},"children":[ {"text":"\n\n "}, {"tag":"ul","attrib":{style:{26:"205px",39:"102.5px 66.5px",116:"102.5px 66.5px",122:"0px",123:"0px",124:"0px",125:"0px",126:"0px",127:"0px",128:"0px",129:"0px",185:"none",201:"205px",206:"133px",238:"none",256:"list-item 0",281:"content-box",324:"133px"}},"children":[ {"text":"\n "}, {"tag":"li","attrib":{style:{65:"left",250:"list-item",256:"none"}},"children":[ {"text":"\n "}, {"tag":"a","attrib":{"href":"language.basic-syntax.php",style:{32:"normal",39:"102.5px 12px",116:"102.5px 12px",182:"12px",184:"12px",206:"24px",230:"18px",250:"block",254:"pointer",324:"24px"}},"children":[ {"text":"Basic syntax"},]}, {"text":"\n\n "}, {"tag":"ul","attrib":{style:{39:"102.5px 49px",116:"102.5px 49px",185:"disc",206:"98px",250:"block",256:"list-item 0",324:"98px"}},"children":[ {"text":"\n\n "}, {"tag":"li","attrib":{style:{39:"102.5px 13px",116:"102.5px 13px",185:"none",206:"26px",250:"list-item",256:"none",324:"26px"}},"children":[ {"text":"\n "}, {"tag":"a","attrib":{"href":"language.basic-syntax.phptags.php","title":"PHP tags",style:{26:"193px",32:"normal",43:"0px",110:"0px",114:"relative",124:"12px",125:"12px",177:"-1px",182:"-1px",183:"-1px",184:"-1px",192:"0px",197:"0px",198:"0px",199:"0px",200:"0px",201:"193px",206:"24px",230:"14px",250:"block",254:"pointer",284:"0px",285:"1px",286:"dotted",289:"rgb(102, 102, 102)",295:"rgb(102, 102, 102)",298:"rgb(102, 102, 102)",301:"rgb(102, 102, 102)",304:"rgb(102, 102, 102)",313:"1px",314:"dotted",317:"rgb(102, 102, 102)",318:"1px",319:"dotted",320:"rgb(102, 102, 102)",321:"1px",322:"dotted",323:"rgb(102, 102, 102)",324:"24px"}},"children":[ {"text":"PHP tags"},]}, {"text":"\n "},]}, {"text":"\n "}, {"tag":"li","attrib":{style:{39:"102.5px 12.5px",116:"102.5px 12.5px",185:"none",206:"25px",217:"700",250:"list-item",256:"none",324:"25px"}},"children":[ {"text":"\n "}, {"tag":"a","attrib":{"href":"language.basic-syntax.phpmode.php","title":"Escaping from HTML",style:{1:"rgb(174, 80, 141)",2:"rgb(174, 80, 141)",26:"193px",32:"normal",43:"0px",55:"rgb(174, 80, 141)",60:"rgb(174, 80, 141)",61:"rgb(174, 80, 141)",110:"0px",114:"relative",124:"12px",125:"12px",144:"rgb(174, 80, 141)",182:"-1px",184:"-1px",192:"0px",197:"0px",198:"0px",199:"0px",200:"0px",201:"193px",206:"24px",230:"14px",250:"block",254:"pointer",264:"rgb(174, 80, 141)",271:"rgb(174, 80, 141)",276:"rgb(174, 80, 141)",284:"0px",289:"rgb(102, 102, 102)",295:"rgb(102, 102, 102)",298:"rgb(102, 102, 102)",301:"rgb(102, 102, 102)",304:"rgb(102, 102, 102)",313:"1px",314:"dotted",317:"rgb(174, 80, 141)",320:"rgb(102, 102, 102)",321:"1px",322:"dotted",323:"rgb(174, 80, 141)",324:"24px"}},"children":[{"tag":"div","pseudo":"before","attrib":{style:{1:"rgb(174, 80, 141)",2:"rgb(174, 80, 141)",26:"9.05px",32:"normal",39:"4.525px 12px",43:"0px",55:"rgb(174, 80, 141)",60:"rgb(174, 80, 141)",61:"rgb(174, 80, 141)",110:"195.95px",114:"absolute",116:"4.525px 12px",144:"rgb(174, 80, 141)",192:"0px",197:"0px",198:"195.95px",199:"0px",200:"0px",201:"9.05px",206:"24px",230:"14px",250:"block",254:"pointer",258:"'» '",264:"rgb(174, 80, 141)",271:"rgb(174, 80, 141)",276:"rgb(174, 80, 141)",284:"0px",289:"rgb(174, 80, 141)",295:"rgb(174, 80, 141)",298:"rgb(174, 80, 141)",301:"rgb(174, 80, 141)",304:"rgb(174, 80, 141)",317:"rgb(174, 80, 141)",320:"rgb(174, 80, 141)",323:"rgb(174, 80, 141)",324:"24px"}},"children":[{"text":"» "}]}, {"text":"Escaping from HTML"},]}, {"text":"\n "},]}, {"text":"\n "}, {"tag":"li","attrib":{style:{39:"102.5px 12.5px",116:"102.5px 12.5px",185:"none",206:"25px",250:"list-item",256:"none",324:"25px"}},"children":[ {"text":"\n "}, {"tag":"a","attrib":{"href":"language.basic-syntax.instruction-separation.php","title":"Instruction separation",style:{26:"193px",32:"normal",43:"0px",110:"0px",114:"relative",124:"12px",125:"12px",182:"-1px",184:"-1px",192:"0px",197:"0px",198:"0px",199:"0px",200:"0px",201:"193px",206:"24px",230:"14px",250:"block",254:"pointer",284:"0px",289:"rgb(102, 102, 102)",295:"rgb(102, 102, 102)",298:"rgb(102, 102, 102)",301:"rgb(102, 102, 102)",304:"rgb(102, 102, 102)",313:"1px",314:"dotted",317:"rgb(102, 102, 102)",320:"rgb(102, 102, 102)",321:"1px",322:"dotted",323:"rgb(102, 102, 102)",324:"24px"}},"children":[ {"text":"Instruction separation"},]}, {"text":"\n "},]}, {"text":"\n "}, {"tag":"li","attrib":{style:{39:"102.5px 12.5px",116:"102.5px 12.5px",185:"none",206:"25px",250:"list-item",256:"none",324:"25px"}},"children":[ {"text":"\n "}, {"tag":"a","attrib":{"href":"language.basic-syntax.comments.php","title":"Comments",style:{26:"193px",32:"normal",43:"0px",110:"0px",114:"relative",124:"12px",125:"12px",182:"-1px",184:"-1px",192:"0px",197:"0px",198:"0px",199:"0px",200:"0px",201:"193px",206:"24px",230:"14px",250:"block",254:"pointer",284:"0px",289:"rgb(102, 102, 102)",295:"rgb(102, 102, 102)",298:"rgb(102, 102, 102)",301:"rgb(102, 102, 102)",304:"rgb(102, 102, 102)",313:"1px",314:"dotted",317:"rgb(102, 102, 102)",320:"rgb(102, 102, 102)",321:"1px",322:"dotted",323:"rgb(102, 102, 102)",324:"24px"}},"children":[ {"text":"Comments"},]}, {"text":"\n "},]}, {"text":"\n \n "},]}, {"text":"\n \n "},]}, {"text":"\n \n "},]}, {"text":"\n "},]}, {"text":"\n\n\n "},]}, {"text":"\n\n "}, {"tag":"footer","attrib":{style:{39:"506px 36px",116:"506px 36px",134:"auto",135:"auto",137:"auto",138:"auto",140:"auto",177:"0px",183:"0px",188:"48px",206:"72px",275:"both",324:"72px"}},"children":[ {"text":"\n "}, {"tag":"div","attrib":{style:{39:"506px 24px",116:"506px 24px",123:"24px",124:"24px",125:"24px",126:"24px",134:"visible",135:"visible",137:"visible",138:"visible",140:"visible",177:"24px",183:"24px",206:"48px",275:"none",281:"border-box",324:"48px"}},"children":[ {"text":"\n "}, {"tag":"div","attrib":{style:{26:"964px",39:"482px 24px",116:"482px 24px",123:"0px",124:"0px",125:"0px",126:"0px",177:"0px",183:"0px",201:"964px",281:"content-box"}},"children":[ {"text":"\n "}, {"tag":"ul","attrib":{style:{256:"list-item 0"}},"children":[ {"text":"\n "}, {"tag":"li","attrib":{style:{26:"316.583px",39:"158.292px 24px",65:"left",116:"158.292px 24px",178:"12px",179:"12px",180:"12px",181:"12px",201:"316.583px",250:"inline-block",256:"none"}},"children":[ {"tag":"a","attrib":{"href":"/copyright.php",style:{32:"normal",178:"0px",179:"0px",180:"0px",181:"0px",254:"pointer"}},"children":[ {"text":"Copyright © 2001-2022 The PHP Group"},]},]}, {"text":"\n "}, {"tag":"li","attrib":{style:{26:"88.5167px",39:"44.2583px 24px",65:"left",116:"44.2583px 24px",178:"12px",179:"12px",180:"12px",181:"12px",201:"88.5167px",250:"inline-block",256:"none"}},"children":[ {"tag":"a","attrib":{"href":"/my.php",style:{32:"normal",178:"0px",179:"0px",180:"0px",181:"0px",254:"pointer"}},"children":[ {"text":"My PHP.net"},]},]}, {"text":"\n "}, {"tag":"li","attrib":{style:{26:"62.2167px",39:"31.1083px 24px",65:"left",116:"31.1083px 24px",178:"12px",179:"12px",180:"12px",181:"12px",201:"62.2167px",250:"inline-block",256:"none"}},"children":[ {"tag":"a","attrib":{"href":"/contact.php",style:{32:"normal",178:"0px",179:"0px",180:"0px",181:"0px",254:"pointer"}},"children":[ {"text":"Contact"},]},]}, {"text":"\n "}, {"tag":"li","attrib":{style:{26:"153px",39:"76.5px 24px",65:"left",116:"76.5px 24px",178:"12px",179:"12px",180:"12px",181:"12px",201:"153px",250:"inline-block",256:"none"}},"children":[ {"tag":"a","attrib":{"href":"/sites.php",style:{32:"normal",178:"0px",179:"0px",180:"0px",181:"0px",254:"pointer"}},"children":[ {"text":"Other PHP.net sites"},]},]}, {"text":"\n "}, {"tag":"li","attrib":{style:{26:"110.117px",39:"55.0583px 24px",65:"left",116:"55.0583px 24px",178:"12px",179:"12px",180:"12px",181:"12px",201:"110.117px",250:"inline-block",256:"none"}},"children":[ {"tag":"a","attrib":{"href":"/privacy.php",style:{32:"normal",178:"0px",179:"0px",180:"0px",181:"0px",254:"pointer"}},"children":[ {"text":"Privacy policy"},]},]}, {"text":"\n "},]}, {"text":"\n "},]}, {"text":"\n "},]}, {"text":"\n "},]}, {"text":"\n\n \n "}, {"text":"\n "}, {"text":"\n"}, {"text":"\n"}, {"text":"\n"}, {"text":"\n"}, {"text":"\n"}, {"text":"\n"}, {"text":"\n\n"}, {"text":"\n\n\n\n"},]}}; let zIndexMax = 0 let base_url = "http:\/\/www.php.net\/manual\/en\/language.basic-syntax.phpmode.php"; 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) }