504 |
var m; |
var m; |
505 |
if (m = uri.match (/^javascript:\s*(?:'([^']*)'|"([^"]+)")\s*$/i)) { |
if (m = uri.match (/^javascript:\s*(?:'([^']*)'|"([^"]+)")\s*$/i)) { |
506 |
if (m[1]) { |
if (m[1]) { |
507 |
return m[1].replace (/\\u([0-9A-F]{4})/g, function (s, v) { |
return unescapeJSLiteral (m[1]); |
|
return String.fromCharCode (parseInt ('0x' + v)); |
|
|
}); |
|
508 |
} else if (m[2]) { |
} else if (m[2]) { |
509 |
return m[2].replace (/\\u([0-9A-F]{4})/g, function (s, v) { |
return unescapeJSLiteral (m[2]); |
|
return String.fromCharCode (parseInt ('0x' + v)); |
|
|
}); |
|
510 |
} else { |
} else { |
511 |
return null; |
return null; |
512 |
} |
} |
527 |
matched = true; |
matched = true; |
528 |
var args = []; |
var args = []; |
529 |
t.replace (/('[^']*'|"[^"]*")/g, function (s, v) { |
t.replace (/('[^']*'|"[^"]*")/g, function (s, v) { |
530 |
args.push (v.substring (1, v.length - 1)); |
args.push (unescapeJSLiteral (v.substring (1, v.length - 1))); |
531 |
return ''; |
return ''; |
532 |
}); |
}); |
533 |
doc.write.apply (doc, args); |
doc.write.apply (doc, args); |
536 |
s = s.replace (/^\s*var\s+s\s*=\s*document\.createElement\s*\(\s*['"]script['"]\s*\)\s*;\s*s\.src\s*=\s*(?:'(javascript:[^']*)'|"(javascript:[^"]*)")\s*;\s*document\.documentElement\.appendChild\s*\(\s*s\s*\)\s*;\s*/, |
s = s.replace (/^\s*var\s+s\s*=\s*document\.createElement\s*\(\s*['"]script['"]\s*\)\s*;\s*s\.src\s*=\s*(?:'(javascript:[^']*)'|"(javascript:[^"]*)")\s*;\s*document\.documentElement\.appendChild\s*\(\s*s\s*\)\s*;\s*/, |
537 |
function (s, t, u) { |
function (s, t, u) { |
538 |
matched = true; |
matched = true; |
539 |
var args = [t ? t : u]; |
var args = [unescapeJSLiteral (t ? t : u)]; |
540 |
doc._insertExternalScript.apply (doc, args); |
doc._insertExternalScript.apply (doc, args); |
541 |
return ''; |
return ''; |
542 |
}); |
}); |
548 |
} |
} |
549 |
} // parseAndRunScript |
} // parseAndRunScript |
550 |
|
|
551 |
|
function unescapeJSLiteral (s) { |
552 |
|
return s.replace (/\\u([0-9A-Fa-f]{4})/g, function (t, v) { |
553 |
|
return String.fromCharCode (parseInt ('0x' + v)); |
554 |
|
}); |
555 |
|
} // unescapeJSLiteral |
556 |
|
|
557 |
function JSText (data) { |
function JSText (data) { |
558 |
this.data = data; |
this.data = data; |
559 |
} // JSText |
} // JSText |
790 |
<code>src</code> attribute of the <code>script</code> element. In addition, |
<code>src</code> attribute of the <code>script</code> element. In addition, |
791 |
the <abbr title="Uniform Resource Identifiers">URI</abbr> must be conform to |
the <abbr title="Uniform Resource Identifiers">URI</abbr> must be conform to |
792 |
the regular expression <code>^javascript:\s*(?:"[^"]*"|'[^']*')\s*$</code>. |
the regular expression <code>^javascript:\s*(?:"[^"]*"|'[^']*')\s*$</code>. |
793 |
<li>Only supports <code>\u<var>HHHH</var></code> escapes only in |
<li>Only supports <code>\u<var>HHHH</var></code> escapes in JavaScript |
794 |
<code>javascript:</code> URI. |
string literals. |
795 |
</ul> |
</ul> |
796 |
|
|
797 |
<p>For some reason, this parser does not work in browsers that do |
<p>For some reason, this parser does not work in browsers that do |