Filename is " + escape(document.getElementById("file").files[0].mozFullPath + document.getElementById("file").value) + " ... Type is (" + (document.getElementById("file").files[0].type || "n/a") + ") ... Date is " + (document.getElementById("file").files[0].lastModifiedDate ? document.getElementById("file").files[0].lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + infilecontents.length + " bytes ... Line Count is " + ourlines.length + " ... Word Count is " + ourwords.length + "
"; //document.body.innerHTML = document.body.innerHTML + myfis; //var huh = document.URL.split("?"); //if (huh.length > 1) { // location.href = huh[0] + "?myf=" + decodeURIComponent(myfis); //} else { // location.href = document.URL + "?myf=" + decodeURIComponent(myfis); //} //alert(infilecontents); fcont = infilecontents; //document.getElementById("byte_content").style.display='block'; document.getElementById("byte_range").style.display='block'; if (bmode != ' an image ') { //alert(bmode); var areader = new FileReader(); areader.onload = function(e) { //xaudio = new Audio(); //alert(e.target.result); }; areader.readAsDataURL(infilecontents); // Thanks to //stackoverflow.com/questions/22255580/javascript-upload-image-file-and-draw-it-into-a-canvas //alert(infilecontents.substring(0,30)); //alert("document.getElementById('mapcoords" + eval(-1 + dmfcnt) + "').value='" + document.getElementById('mapcoords' + eval(-1 + dmfcnt)).value + "'"); //alert("document.getElementById('mapaudio" + eval(-1 + dmfcnt) + "').value='" + infilecontents.substring(0,30) + "'"); document.getElementById('mapaudio' + eval(-1 + dmfcnt)).value=infilecontents; document.getElementById('mapxaudio' + eval(-1 + dmfcnt)).value=infilecontents; bmode = ' an image '; } } function intwo() { x=0; y=0; lastx=0; lasty=0; isScribble=2; } function touchWindowHandler(event) // thanks to //stackoverflow.com/questions/1517924/javascript-mapping-touch-events-to-mouse-events { var touches = event.changedTouches, first = touches[0], type = ""; switch(event.type) { case "touchstart": type = "onclick"; //alert(88 + moid + event.targetTouches.length); break; default: return; } //initMouseEvent(type, canBubble, cancelable, view, clickCount, // screenX, screenY, clientX, clientY, ctrlKey, // altKey, shiftKey, metaKey, button, relatedTarget); var simulatedEvent = document.createEvent("MouseEvent"); simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null); first.target.dispatchEvent(simulatedEvent); event.preventDefault(); } function touchHandler(event) // thanks to //stackoverflow.com/questions/1517924/javascript-mapping-touch-events-to-mouse-events { var touches = event.changedTouches, first = touches[0], type = ""; //if (event.targetTouches.length == 1) { switch(event.type) { //case "touchstart": type="mousedown"; break; case "touchmove": type="mousemove"; break; case "touchend": type="mouseup"; break; default: return; } //initMouseEvent(type, canBubble, cancelable, view, clickCount, // screenX, screenY, clientX, clientY, ctrlKey, // altKey, shiftKey, metaKey, button, relatedTarget); var simulatedEvent = document.createEvent("MouseEvent"); simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null); first.target.dispatchEvent(simulatedEvent); event.preventDefault(); event.stopPropagation(); switch(type) { //case "mousedown": if (isScribble == 1) { isScribble=2; storecanvascommands("context=context;", false); } break; case "mousemove": if (isScribble == 2 || isScribble == 1) { if (x == 0 && y == 0 && lastx == 0 && lasty == 0) { if (event.pageX || event.pageY) { x = event.pageX - elemLeft; y = event.pageY - elemTop; } else { x = event.clientX - elemLeft; y = event.clientY - elemTop; } lastx=x; lasty=y; } else { lastx=x; lasty=y; if (event.pageX || event.pageY) { x = event.pageX - elemLeft; y = event.pageY - elemTop; } else { x = event.clientX - elemLeft; y = event.clientY - elemTop; } } if (isScribble == 2) { if (x != lastx || y != lasty) { document.getElementById('divannotation').style.display='block'; document.getElementById('myisubject').style.display = 'inline'; document.getElementById('myiemail').style.display = 'inline'; context.strokeStyle=document.getElementById('mycolour').value; storecanvascommands("context.fillStyle='" + document.getElementById('mycolour').value + "';", false); context.beginPath(); storecanvascommands("context.beginPath();", false); context.moveTo(x,y); storecanvascommands("context.moveTo(" + x + "," + y + ");", false); context.lineTo(lastx,lasty); storecanvascommands("context.lineTo(" + lastx + "," + lasty + ");", false); context.stroke(); storecanvascommands("context.stroke();", false); } } isScribble=2; } break; case "mouseup": if (isScribble == 2) { x=0; y=0; lastx=0; lasty=0; isScribble=1; storecanvascommands("context=context;", true); } break; default: return; } //} } function drawRotated(degrees) { // thanks to //stackoverflow.com/questions/17411991/html5-canvas-rotate-image var needflip=0; var wasf=document.getElementById('rotation').value; var spareewtwo = eval(zeroone * eval( Math.min(x,lastx) + Math.abs(x - lastx) / 2 )); var spareehtwo = eval(zeroone * eval( Math.min(y,lasty) + Math.abs(y - lasty) / 2 )); ewtwo = eval(elem.width/2); ehtwo = eval(elem.height/2); if (document.getElementById('rof').value.indexOf('of ') != -1) { storecanvascommands("context.clearRect(" + 0 + "," + 0 + "," + elem.width + "," + elem.height + ");", false); context.clearRect(0,0,elem.width,elem.height); } //if (document.getElementById('rof').value == '' && oimg != null) { //storecanvascommands("context.clearRect(" + 0 + "," + 0 + "," + elem.width + "," + elem.height + ");", false); //context.clearRect(0,0,elem.width,elem.height); // save the unrotated context of the canvas so we can restore it later // the alternative is to untranslate & unrotate after drawing storecanvascommands("context.save();", false); context.save(); //} // move to the center of the canvas if (eval(txtoffx) != 0.0 || eval(txtoffy) != 0.0) { //alert("Ewtwo,Ehtwo=" + ewtwo + "," + ehtwo); storecanvascommands("context.translate(" + txtoffx + "," + txtoffy + ");", false); context.translate(txtoffx,txtoffy); if (rotcmd != '') { rotoffx=eval(-txtoffx); rotoffy=eval(-txtoffy); } } else if (eval(document.getElementById("xoff").value) != 0 || eval(document.getElementById("yoff").value) != 0) { ewtwo = eval(eval(spareeewtwo) * 0 + eval(document.getElementById("xoff").value)); ehtwo = eval(eval(spareeehtwo) * 0 + eval(document.getElementById("yoff").value)); //alert("Ewtwo,ehtwo=" + ewtwo + "," + ehtwo); storecanvascommands("context.translate(" + ewtwo + "," + ehtwo + ");", false); context.translate(ewtwo,ehtwo); ewtwo = eval(-ewtwo); ehtwo = eval(-ehtwo); } else if (0 == 0) { curih=oimg.height; curiw=oimg.width; //if (eval(degrees) >= 180) { // needflip=true; // degrees = eval(360 - wasf); // document.getElementById('rotation').value=degrees; //} var dx=0, dy=0; newiw=postnewiw(eval(eval(curiw - cropx) * scalex), eval(curih - cropy), eval(curiw - cropx), curih, cropy); newih=postnewih(eval(eval(curih - cropy) * scaley), eval(curiw - cropx), eval(curih - cropy), curiw, cropx); //alert(newiw + ' ' + newih); //ewtwo = eval(eval( Math.min(x,lastx) + 1 * offxmaybe(eval(document.getElementById("xoff").value),newih,newiw) + Math.abs(x - lastx) / 2 - postscalew(scalex,oimg.height,oimg.width) * oimg.width / 2 )); //ehtwo = eval(eval( Math.min(y,lasty) + 1 * offymaybe(eval(document.getElementById("yoff").value),newiw,newih) + Math.abs(y - lasty) / 2 - postscaleh(scaley,oimg.width,oimg.height) * oimg.height / 2 )); ewtwo = eval(eval( Math.min(x,lastx) + 1 * offxmaybe(eval(document.getElementById("xoff").value),newih,newiw) + Math.abs(x - lastx) / 2 - postscalew(scalex,oimg.height,oimg.width) * oimg.width / 2 )); ehtwo = eval(eval( Math.min(y,lasty) + 1 * offymaybe(eval(document.getElementById("yoff").value),newiw,newih) + Math.abs(y - lasty) / 2 - postscaleh(scaley,oimg.width,oimg.height) * oimg.height / 2 )); //alert("ewtwo,ehtwo=" + ewtwo + "," + ehtwo); if (eval(degrees) >= 270) { needflip=1; } else if (eval(degrees) >= 180) { needflip=-1; } storecanvascommands("context.translate(" + ewtwo + "," + ehtwo + ");", false); context.translate(ewtwo,ehtwo); if (needflip != 0) { context.scale(needflip, -needflip); storecanvascommands("context.scale(" + eval(needflip) + "," + eval(-needflip) + ");", false); } //ewtwo = eval(-ewtwo + Math.min(x,lastx) + 1 * offxmaybe(eval(document.getElementById("xoff").value),newih,newiw) + Math.abs(x - lastx) / 2 - postscalew(scalex,oimg.height,oimg.width) * oimg.width / 2 ); //ehtwo = eval(-ehtwo + Math.min(y,lasty) + 1 * offymaybe(eval(document.getElementById("yoff").value),newiw,newih) + Math.abs(y - lasty) / 2 - postscaleh(scaley,oimg.width,oimg.height) * oimg.height / 2 ); ewtwo = eval(-ewtwo + Math.min(x,lastx) + dx + 1 * offxmaybe(eval(document.getElementById("xoff").value),newih,newiw) + Math.abs(x - lastx) / 2 - postscalew(scalex,oimg.height,oimg.width) * oimg.width / 2 ); ehtwo = eval(-ehtwo + Math.min(y,lasty) + dy + 1 * offymaybe(eval(document.getElementById("yoff").value),newiw,newih) + Math.abs(y - lasty) / 2 - postscaleh(scaley,oimg.width,oimg.height) * oimg.height / 2 ); // New idea below ewtwo = eval(dx - (offxmaybe(eval(document.getElementById("xoff").value),newih,newiw))); //eval(-ewtwo + Math.min(x,lastx) + 1 * offxmaybe(eval(document.getElementById("xoff").value),newih,newiw) + Math.abs(x - lastx) / 2 - postscalew(scalex,oimg.height,oimg.width) * oimg.width / 2 ); ehtwo = eval(dy - (offymaybe(eval(document.getElementById("yoff").value),newiw,newih))); //eval(-ehtwo + Math.min(y,lasty) + 1 * offymaybe(eval(document.getElementById("yoff").value),newiw,newih) + Math.abs(y - lasty) / 2 - postscaleh(scaley,oimg.width,oimg.height) * oimg.height / 2 ); //alert("ewTwo,ehTwo=" + ewtwo + "," + ehtwo); } else { //alert("ewTwo,ehtwo=" + ewtwo + "," + ehtwo); storecanvascommands("context.translate(" + ewtwo + "," + ehtwo + ");", false); context.translate(ewtwo,ehtwo); ewtwo = eval(-ewtwo); ehtwo = eval(-ehtwo); } // rotate the canvas to the specified degrees storecanvascommands("context.rotate(" + degrees*Math.PI/180 + ");", false); context.rotate(degrees*Math.PI/180); if (rotcmd != '') { var sparerotcmd=rotcmd; //rotcmd=''; //alert("sparerotcmd=" + sparerotcmd); eval(sparerotcmd); } else { if (document.getElementById('rof').value != '') { oimg = origimg; curih=oimg.height; curiw=oimg.width; } if (document.getElementById('rof').value == '' || oimg != null) { // draw the image // since the context is rotated, the image will be rotated also if (imageclickmode != 0 || eval(scalex) != 1.0 || eval(scaley) != 1.0 || eval(cropwidth) != 100.00 || eval(cropheight) != 100.000 || eval(cropx) != 0.00 || eval(cropy) != 0.00) { curih=oimg.height; curiw=oimg.width; newiw=postpostnewiw(eval(eval(curiw - cropx) * scalex), eval(curih - cropy), eval(curiw - cropx), curih, cropy); newih=postpostnewih(eval(eval(curih - cropy) * scaley), eval(curiw - cropx), eval(curih - cropy), curiw, cropx); if (imageclickmode != 0) { ourDrawImage(oimg,eval(ewtwo + eval(document.getElementById("xoff").value)),eval(ehtwo + eval(document.getElementById("yoff").value)),newiw,newih); storecanvascommands("ourDrawImage(oimg," + eval(ewtwo + eval(document.getElementById("xoff").value)) + "," + eval(ehtwo + eval(document.getElementById("yoff").value)) + "," + newiw + "," + newih + ");", true); //alert(13); } else if (eval(cropwidth) != 100.00 || eval(cropheight) != 100.000 || eval(cropx) != 0.00 || eval(cropy) != 0.00) { //alert("newiw=" + newiw + " and newiH=" + newih); ourDrawImage(oimg,eval(cropx),eval(cropy),eval(eval(curiw - cropx) * cropwidth / ((document.getElementById('cselwidth').value == '%') ? 100.0 : 1.00)),eval(eval(curih - cropy) * cropheight / ((document.getElementById('cselheight').value == '%') ? 100.0 : 1.00)),eval(ewtwo + eval(document.getElementById("xoff").value)),eval(ehtwo + eval(document.getElementById("yoff").value)),newiw,newih); //storecanvascommands("ourDrawImage(oimg," + cropx + "," + cropy + "," + eval(eval(curiw - cropx) * cropwidth / ((document.getElementById('cselwidth').value == '%') ? 100.0 : 1.00)) + "," + eval(eval(curih - cropy) * cropheight / ((document.getElementById('cselheight').value == '%') ? 100.0 : 1.00)) + "," + -oimg.width/2 + eval(document.getElementById("xoff").value) + "," + -oimg.height/2 + eval(document.getElementById("yoff").value) + "," + newiw + "," + newih + ");", true); storecanvascommands("ourDrawImage(oimg," + cropx + "," + cropy + "," + eval(eval(curiw - cropx) * cropwidth / ((document.getElementById('cselwidth').value == '%') ? 100.0 : 1.00)) + "," + eval(eval(curih - cropy) * cropheight / ((document.getElementById('cselheight').value == '%') ? 100.0 : 1.00)) + "," + eval(ewtwo + eval(document.getElementById("xoff").value)) + "," + eval(ehtwo + eval(document.getElementById("yoff").value)) + "," + newiw + "," + newih + ");", true); //alert(113); } else { ourDrawImage(oimg,eval(ewtwo + eval(document.getElementById("xoff").value)),eval(ehtwo + eval(document.getElementById("yoff").value)),newiw,newih); storecanvascommands("ourDrawImage(oimg," + eval(ewtwo + eval(document.getElementById("xoff").value)) + "," + eval(ehtwo + eval(document.getElementById("yoff").value)) + "," + newiw + "," + newih + ");", true); //alert(1113); } } else { storecanvascommands("ourDrawImage(oimg," + eval(ewtwo + eval(document.getElementById("xoff").value)) + "," + eval(ehtwo + eval(document.getElementById("yoff").value)) + ");", false); //ourDrawImage(oimg, //eval(elem.width/2 + eval(document.getElementById("xoff").value) - Math.sin(degrees*Math.PI/180)*(oimg.height/1)*1), //eval(elem.height/2 + eval(document.getElementById("yoff").value) - Math.sin(degrees*Math.PI/180)*(oimg.width/1)*1)); //alert(98); ourDrawImage(oimg,eval(ewtwo + eval(document.getElementById("xoff").value)),eval(ehtwo + eval(document.getElementById("yoff").value))); //alert(11113); } //alert(980); document.getElementById('rof').value = ''; oimg = null; } } // we’re done with the rotating so restore the unrotated context storecanvascommands("context.restore();", false); context.restore(); document.getElementById('rotation').value=wasf; } function maybe(tv) { if (tv != "" && eval(document.getElementById("rotation").value) != 0) { drawRotated(eval(document.getElementById("rotation").value)); } } function audiomaybe() { if (bmode == ' an audio ') { document.getElementById('oic').click(); } else if (bmode == ' an image ') { var xfiles = document.getElementById("file").files; var xfile = xfiles[0]; if (xfile.type.match('image.gif')) { mapext='.gif'; } else { mapext=''; } } } function noforeach() { if (foreachon) { foreachon=false; try { blobc='transparent'; } catch(ewq) { } } } function closewinois() { if (winois != null) { winois.close(); winois=null; } } function switchzn() { if (longhover.trim() != "") { switchit(0, longhover); } } function switchit(aclick, blurb) { if (aclick == 0 && firsthover == 1) { if (longhover == "") { longhover=blurb; setTimeout(switchzn, 2000); return; } else { var bfp=confirm(blurb + ' ... OK proceeds on this basis, else Cancel will only listen for a click/touch of the Copy button here'); if (bfp == true) { firsthover=0; } else { firsthover=-1; } } } if (aclick == 1 || firsthover != -1) { var canvuri = elem.toDataURL("image/png",0); winois=window.open('','_blank','top=30,left=30,width=1000,height=800'); winois.document.write(''); setTimeout(closewinois, 5000); } longhover=" "; } function aemail(ame) { // thanks to //www.telerik.com/forums/proper-way-to-do-mailto-and-tel-links( //alert(ame.href); //navigator.app.loadUrl(ame.href, { openExternal:true } ); window.top.location = ame.href; } function dowhite() { if (whiteize) { if (('' + whiteize.getAttribute('data-nocb')).replace('null','').indexOf('gradient_creations.htm') == -1) { whiteize.style.backgroundColor='white'; } } //else { alert(0); } whiteize=null; } function wlsact(invalis) { var altvalgoes='', initval='', winitval='', initvals=[], updatebg=false; if (('' + invalis) != '') { //alert(wlsdval); var thisnameis=('' + wlsnval).split('`')[eval('' + invalis)]; //.split(',')[0]; winitval=('' + wlsdval).split('`')[eval('' + invalis)]; //.split(',')[0]; initvals=('' + winitval).split('#'); for (var iiu=0; iiu