Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

CountZero's scratchpad

by CountZero (Chancellor)
on Jun 02, 2004 at 15:55 UTC ( #359524=scratchpad: print w/ replies, xml ) Need Help??

<script> var headID = document.getElementsByTagName("head")`[0`]; var cssNode = document.createElement('link'); cssNode.type = 'text/css'; cssNode.rel = 'stylesheet'; cssNode.href = 'http://datenzoo.de/pub/prettify-jaap.css'; cssNode.media = 'screen'; headID.appendChild(cssNode); </script> <script type="text/javascript" src="http://datenzoo.de/pub/prettify-ja +ap.js"></script> <p> <form> <input type="text" size="15" id="viewer_replaceTextSpec" value="s/\n\n ++/\n&lt;p&gt;/g; s/\&#x5b/&amp;#x5b;/g; s/\&#x5d;/&amp;#x5d;/"> <input type="button" value="Subst" id="viewer_replaceTextButton"> </form> <script type="text/javascript"><!-- function viewer_replaceText() { var spec = document.getElementById("viewer_replaceTextSpec").value +; var parser = /\s*s\s*(\S)((?:[^\\]|\\.)*?)\1((?:[^\\]|\\.)*?)\1(\w +*)\s*;?\s*|(.+)/g ; var parseE = {}; var pairs = []; while (fret = parser.exec(spec)) { if (undefined != fret[5]) { window.alert("Error parsing substitution list, remaining: +" + fret[5]); return; } else { pairs.push([new RegExp(fret[2], fret[4]), fret[3]]); } }; if (!pairs) { window.alert("Warning: no substitution patterns given."); } var textarea = document.getElementsByTagName("textarea")[0]; var text = new String(textarea.value); var nmatches = 0; pairs.forEach(function(pair) { var lh = pair[0]; var rh = pair[1]; text = text.replace(lh, function(whole) { nmatches++; var captures = arguments; var rp = rh.replace( /(\\(?:u\w{1,4}|x\w{1,2}|\d{1,3}|.))| +(\$\&)|\$(\d+)|\$\{(\d+)\}/g, function(rNone, rBs, rWhole, rCapture, +rCapture2) { var t; if (rBs.length) { t = eval('"'+rBs+'"'); } else if (rWhole.length) { t = whole; } else if (rCapture.length) { t = captures[rCapture-0]; +} else if (rCapture2.length) { t = captures[rCapture2-0] +; } if (undefined == t) return ""; return t; }); return rp; }); }) //window.alert(text); textarea.value = text; window.alert("Replaced " + nmatches + " matches."); } var btn = document.getElementById("viewer_replaceTextButton"); var stdEventQueue = window.addEventListener; if (stdEventQueue) { btn.addEventListener("click", function(e) { viewer_replaceText(); +}, false); } else { btn.attachEvent("onclick", function(e) { viewer_replaceText(); }); + } //--> </script> <script type="text/javascript"> // A lot of code was taken from // Dunn By Paul's http://dunnbypaul.net/js_mouse/ var mousex = 0; var mousey = 0; var grabx = 0; var graby = 0; var orix = 600; var oriy = 0; var elex = 0; var eley = 0; var cb_mz = false; var cb_dt = /cbdt=1/.test(document.cookie) ? true : false; if(/cbxy=(\d+)-(\d+)/.test(document.cookie)) { orix = RegExp.$1; oriy = RegExp.$2; } if (cb_dt) { document.write('<style type="text/css">'); document.write('#Chatterbox{position:fixed;left:'+orix+'px;top:'+ori +y+'px;width:300px;border:solid 1px red;z-index:10;}'); document.write('</style>'); } var dragobj = null; var cb = null; var cb_btn_tgl; var cb_btn_det; function falsefunc(){return false;} function cb_toggle() { cb_mz = !cb_mz; cb.childNodes`[3`].childNodes`[0`].style.display = cb_mz ? 'none' : +''; cb_btn_tgl.innerHTML = cb_mz ? '`[+`]' : '`[&ndash;`]'; } function cb_detach() { cb_dt = !cb_dt; cb_btn_det.innerHTML = cb_dt ? '`[v`]' : '`[^`]'; document.cookie='cbdt='+(cb_dt ? '1' : '0'); if (cb_dt) { cb.style.position = 'fixed'; cb.style.borderStyle = 'solid'; cb.style.borderWidth = '1px'; cb.style.borderColor = 'red'; cb.style.width = '300px'; cb.childNodes`[1`].childNodes`[0`].style.width = '300px'; cb.style.left = (orix).toString(10) + 'px'; cb.style.top = (oriy).toString(10) + 'px'; } else { cb.style.position = "static"; cb.style.left = '0px'; cb.style.top = '0px'; } } function cb_init() { cb = document.getElementById('Chatterbox'); cb.childNodes`[1`].onmousedown = grab; cb.childNodes`[1`].style.cursor = 'pointer'; if(cb_dt) cb.childNodes`[1`].childNodes`[0`].style.width = '300px'; var elem =document.createElement('SPAN'); elem.innerHTML='&nbsp;'; cb.childNodes`[1`].childNodes`[0`].appendChild(elem); cb_btn_tgl=document.createElement('SPAN'); cb_btn_tgl.innerHTML='`[&ndash;`]'; cb.childNodes`[1`].childNodes`[0`].appendChild(cb_btn_tgl); cb_btn_tgl.onclick=cb_toggle; cb_btn_det=document.createElement('SPAN'); cb_btn_det.innerHTML='`['+(cb_dt?'v':'^')+'`]'; cb.childNodes`[1`].childNodes`[0`].appendChild(cb_btn_det); cb_btn_det.onclick=cb_detach; document.onmousemove = update; update(); } function getMouseXY(e) { if (!e) e = window.event; if (e) { if (e.pageX || e.pageY) { mousex = e.pageX; mousey = e.pageY; } else if (e.clientX || e.clientY) { mousex = e.clientX + document.body.scrollLeft; mousey = e.clientY + document.body.scrollTop; } } } function update(e) { getMouseXY(e); } function grab(context) { if (!cb_dt) return; context = document.getElementById('Chatterbox'); document.onmousedown = falsefunc; dragobj = context; document.onmousemove = drag; document.onmouseup = drop; grabx = mousex; graby = mousey; elex = orix = dragobj.offsetLeft; eley = oriy = dragobj.offsetTop; update(); } function drag(e) { if (dragobj) { elex = orix + (mousex-grabx); eley = oriy + (mousey-graby); dragobj.style.left = (elex).toString(10) + 'px'; dragobj.style.top = (eley).toString(10) + 'px'; document.cookie='cbxy='+(elex).toString(10)+'-'+(eley).toString(10 +); } update(e); return false; } function drop() { dragobj = null; update(); document.onmousemove = update; document.onmouseup = null; document.onmousedown = null; } setTimeout('cb_init()',500); </script>
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-04-19 23:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls