User:Zocky/wysawyg.js

//

// hook addOnloadHook(wysawygInit);

//init function wysawygInit { if ($('wpTextbox1')) {   $('content').innerHTML+= ''; rtshed.document.open; rtshed.document.write(' '    + ''    + ''    + 'RTSH.language = "javascript";'    + '    '    + $('wpTextbox1').value.replace(/&/g, "&amp;").replace(//g, "&gt;")    + '   '); rtshed.document.close; //   rtshed.contentWindow.CodePress.initialize; }; }

// cross-browser event functions

function eventAddListener (element,event,handler) {  if (element.addEventListener) element.addEventListener(event,handler,false) else element.attachEvent('on'+event,handler); }

function eventRemoveListener (element, event, handler) { if (element.removeEventListener) element.removeEventListener(event,handler,false) else element.detachEvent('on'+event,handler); }

function eventStop(event) { if (event.preventDefault) {    event.preventDefault; event.stopPropagation; } else {  event.returnValue = false; event.cancelBubble = true; } }

function eventTarget(event) { return event.target || event.srcElement; }

function eventKeyCode(event) {  return event.preventDefault ? event.which : event.keyCode ; }

function $(id) { return document.getElementById(id); }