User:Lirmont/monaco.js

function include(filename) {	var head = document.getElementsByTagName('head')[0]; script = document.createElement('script'); script.src = filename; script.type = 'text/javascript'; head.appendChild(script) }

function addEventHandler(target, eventType, handler) {   if (target.addEventListener) { target.addEventListener(eventType, handler, false); } else if (target.attachEvent) { target.attachEvent("on" + eventType, handler); } else { target["on" + eventType] = handler; } }

function includeFiles {   include('/index.php?title=User:Anthoron/prototype.js&action=raw&ctype=text/javascript'); include('/index.php?title=User:Lirmont/tooltip.js&action=raw&ctype=text/javascript'); }

function showCoordinates(event) { var element = Event.element(event); var el = element.offsetParent; var x = 0, y = 0;

while (el) {		x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; }

var xPos = (100*((event.pageX-x)/element.getWidth)); var yPos = (100*((event.pageY-y)/element.getHeight)); $('xPosField').innerHTML = String(xPos).substr(0,4)+"%"; $('yPosField').innerHTML = String(yPos).substr(0,4)+"%"; }

var codeLines=new Array; var points=new Array; var map; //put in by displayForm var lines = 0;

/* Example

function addPoint {

codeLines[0]="";

for (i=0;i<=lines+1;i++) { if(i==0) { $('showCode').innerHTML = codeLines[i]; } else { $('showCode').innerHTML += codeLines[i]; }

if(i!=(lines+1)) { $('showCode').innerHTML += "\n"; } }

// //http://images.wikia.com/ffxi/images/9/90/User-Anthoron-Blip.png //http://images.wikia.com/ffxi/images/0/04/Check.gif }

function displayForm {	$('pointName').innerHTML=' Show Name Zone Name: '; $('symbolHolder').innerHTML= 'blip '                                   + 'check '                                   + 'text ' + ''; $('buttonHolder').innerHTML='Add Point '; $('textareaHolder').innerHTML=' '; map = $('pictureFrame').getElementsByTagName('a')[0].title; var frameWidth = $('pictureFrame').getElementsByTagName('img')[0].width; var frameHeight = $('pictureFrame').getElementsByTagName('img')[0].height; var frameSrc = $('pictureFrame').getElementsByTagName('img')[0].src; $('pictureFrame').innerHTML=' '; }

addEventHandler(window, "load", includeFiles); addEventHandler(window, "load", displayForm);