// signature_signature.js
// RJM Programming
// May, 2017
// Help out signature_signature.html and others like it
var insidedanimation="";
var csvv='', alldus=[], allgo=0, alltot=0, alllen=0;
var etreplace="youllneverfindthis", pagebit="", nopagebit="", twas=0, telem=null,tcontext=null,numc=1, templateurl='', omyask=null, pdfnickname="", pdfname="", pdfthispage=-1, pdfprevpage=-1, pdfnextpage=-1, pdflastpage=-1, pdfurlsuffix="", pdfbookdata="";
var pdfideas="";
var pdfpn='0', esent=false, reduction=0.7, eighty="21";
var wasisgood='', listofbrowseimages='|';
var domymd5=false, mymd5prefix="//www.rjmprogramming.com.au/nonexistantplace/", mymd5="", mymd5suffix=".jpg";
var sil=10, presobutton="", phpit=true, globalendtrue="", cqarr='', sobutton='', wastarget='', sodelim='', socoords='', imurl="", kurl="", otherthings='', showits=null, wascolcf="", allowed=true, exceptwhen=false, transcontent=false, elemis=null, contextis=null, tlx=-1, tly=-1;
var undoprefix='undoi', undonum=0, thisundonum=0;
var tenimages='';
var trotis=0, rotis=0, always_horizontally_flip=false, always_vertically_flop=false;
var lastrotis=0, lastalways_horizontally_flip=false, lastalways_vertically_flop=false;
var jsanimg=null, lastim='';
var topprocessb=null,topin=null,toplastta='',topfirst=true,toplthere=false, topelem=null, topielem=null, topcontext=null, topwidth=0, topheight=0, topvswidth=0, topvsheight=0, topvswidthoff=0, topvsheightoff=0;
var firstcall=true;savenow=0, lastsavenow=0, ppx=-1,ppy=-1,threebackpmore='',twobackpmore='',lastpmore='',pmore='', wasScribble=-1, isScribble=1; //0;
var prevlines=[], lines=[];
var eighteen=18;
var ourx, oury, iqarr, qarr=[];
var njk=0;
var tx=-1, ty=-1;
var prevtx=-1, prevty=-1;
var imgmode="y";
var omyh1;
var lastimis="";
var fcont="";
var qqcnt=0;
var bigi=0;
var bigj=0;
var mytaone="\n\n
\n\n\n\n\n";
var wl="", pddcm="";
var doneonce="";
var presm="sm";
var bigbuffer="";
var prevmy_res="";
var bigf=new Array();
var urlsuf="";
var zipcnt=0;var jsrectbits=[0,0,0,0,0,0];
var jsclickno = 0;
var jsimgh=0, jsimgw=0;
var jsemail = "";
var jscf = "18px Verdana", lastjscf=jscf;
var precolcf = "black";
var colcf = "blue rgba(0,0,255,1.0)";
var xua = navigator.userAgent;
var isiPad = /iPad/i.test(xua) || /iPhone/i.test(xua) || /iPhone OS 3_1_2/i.test(xua) || /Andrxoid/i.test(xua) || /iPhone OS 3_2_2/i.test(xua);
var isTouch = /touch/i.test(xua) || /Touch/i.test(xua);
var sscoords = (location.search.split('sscoords=')[1] ? decodeURIComponent(location.search.split('sscoords=')[1].split('&')[0]) : '');
var ninehundred = (location.search.split('ninehundred=')[1] ? eval(decodeURIComponent(location.search.split('ninehundred=')[1].split('&')[0])) : 900);
if (ninehundred > 900) sscoords='';
//var cbrowse='
Read bytes:';
var cbrowse=' ';
cbrowse+='';
cbrowse+=' ';
cbrowse+=' ';
cbrowse+=' ';
cbrowse+=' ';
var cbrowse_nocapture=cbrowse.replace(' capture','');
var methis='GET';
var thishis=200, thiswis=850;
var ssx='';
if (sscoords != '') {
if (sscoords.length > ninehundred) {
methis='POST';
setTimeout(prenwpixellate,1000);
} else {
methis='POST';
setTimeout(prenwpixellate,1000);
}
} else {
methis='';
setTimeout(prenwpixellate,3000);
}
var createCookie = function(name, value, days) { // thanks to https://stackoverflow.com/questions/4825683/how-do-i-create-and-read-a-value-from-cookie
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString();
}
else {
expires = "";
}
if (localStorage && name != 'gameon') {
if (localStorage.getItem(name)) {
//document.title+=' remove ';
localStorage.removeItem(name);
}
//document.title+=' set ';
//alert(value);
localStorage.setItem(name, value);
} else {
//if (name == 'gameon') alert('why');
//if (name == 'gameon' && topelem) alert('Why');
document.cookie = name + "=" + value + expires + "; path=/";
}
}
function getCookie(c_name) { // https://stackoverflow.com/questions/4825683/how-do-i-create-and-read-a-value-from-cookie
if (localStorage && localStorage.getItem(c_name) && c_name != 'gameon') { // thanks to https://www.w3schools.com/html/html5_webstorage.asp
//alert(2);
//document.title+=' get ';
//alert(localStorage.getItem(c_name));
return unescape(localStorage.getItem(c_name));
} else if (document.cookie.length > 0) {
var c_start = document.cookie.indexOf(c_name + "=");
if (c_start != -1) {
c_start = c_start + c_name.length + 1;
var c_end = document.cookie.indexOf(";", c_start);
if (c_end == -1) {
c_end = document.cookie.length;
}
//alert(22);
return unescape(document.cookie.substring(c_start, c_end));
}
}
return null; //"";
}
function prenwpixellate() {
if (methis == '') {
if (document.getElementById('longsignature').innerHTML.indexOf(',') != -1) {
ssx=document.getElementById('longsignature').innerHTML;
//alert(ssx);
nwpixellate(ssx, 'POST');
} else if (ssx.indexOf(',') != -1) {
//alert('ssx=' + ssx);
nwpixellate(ssx, 'POST');
} else if (sscoords.indexOf(',') != -1) {
ssx=sscoords;
nwpixellate(ssx, 'POST');
}
} else {
if (document.getElementById('longsignature').innerHTML.indexOf(',') != -1 && ssx == '') {
ssx=document.getElementById('longsignature').innerHTML;
//alert('SSX=' + ssx);
}
if (ssx != '') nwpixellate(ssx, methis);
}
}
function preprenwpixellate(argsare, amethod) {
ssx=argsare;
methis=amethod;
setTimeout(prenwpixellate,2000);
return argsare;
}
function nwpixellate(argsare, amethod) {
//return argsare;
if (document.getElementById('canvaselement')) {
var styleinfo='';
if (argsare == '') styleinfo=' style=display:none; ';
if (amethod.toUpperCase() == 'POST') { // && argsare != '') {
//alert('POST ' + argsare);
if (document.getElementById('myipsub')) {
if (argsare != '') {
if (1 == 2) {
if (document.getElementById('canvaselement')) thishis=eval(window.getComputedStyle(document.getElementById('canvaselement'), null).getPropertyValue("height").replace('px',''));
if (document.getElementById('canvaselement')) thiswis=eval(window.getComputedStyle(document.getElementById('canvaselement'), null).getPropertyValue("width").replace('px',''));
}
document.getElementById('myip').style.height='' + thishis + 'px';
document.getElementById('myip').style.width='' + thiswis + 'px';
document.getElementById('myip').height='' + thishis + 'px';
document.getElementById('myip').width='' + thiswis + 'px';
document.getElementById('divwidth').value='' + thiswis;
document.getElementById('divheight').value='' + thishis;
document.getElementById('myip').style.display='block';
}
document.getElementById('tarea').value=(argsare.replace('?sscoords=-','').replace('?sscoords=','').replace(/-/g,';'));
document.getElementById('myipsub').click();
}
//alert('pOST ' + argsare);
} else if (amethod.toUpperCase() != 'POST') { // && argsare != '') {
//alert('GET ' + argsare);
if (argsare != '') {
if (1 == 2) {
if (document.getElementById('canvaselement')) thishis=eval(window.getComputedStyle(document.getElementById('canvaselement'), null).getPropertyValue("height").replace('px',''));
if (document.getElementById('canvaselement')) thiswis=eval(window.getComputedStyle(document.getElementById('canvaselement'), null).getPropertyValue("width").replace('px',''));
}
document.getElementById('myip').style.height='' + thishis + 'px';
document.getElementById('myip').style.width='' + thiswis + 'px';
document.getElementById('myip').height='' + thishis + 'px';
document.getElementById('myip').width='' + thiswis + 'px';
document.getElementById('divwidth').value='' + thiswis;
document.getElementById('divheight').value='' + thishis;
document.getElementById('myip').style.display='block';
}
document.getElementById('tarea').value=(argsare.replace('?sscoords=-','').replace('?sscoords=','').replace(/-/g,';'));
document.getElementById('myip').src="//www.rjmprogramming.com.au/PHP/pixellate.php?width=" + thiswis + "&height=" + thishis + "&tarea=" + encodeURIComponent((argsare.replace('?sscoords=-','').replace('?sscoords=','').replace(/-/g,';')));
//alert('gET ' + argsare);
}
}
return argsare;
}
function dripfeed() {
var pdelim='y';
if (eval(allgo) == alltot) {
createCookie('gameon',pdelim + '!' ,365);
//alert(alldus[1].substring(eval(eval(-1 + allgo) * alllen)).length + ' ' + pdelim + '!' + alldus[1].substring(eval(eval(-1 + allgo) * alllen)));
allgo++;
alltot=0;
} else if (eval(allgo + 1) == alltot) {
createCookie('gameon',pdelim + '!' + alldus[1].substring(eval(allgo * alllen)),365);
allgo++;
setTimeout(dripfeed,100);
} else if (allgo < alltot) {
createCookie('gameon',pdelim + '!' + alldus[1].substring(eval(allgo * alllen), eval(eval(1 + allgo) * alllen)),365);
allgo++;
setTimeout(dripfeed,100);
}
}
function sendchallenge(bid) {
var pdelim=(getCookie('gameon') + '!').substring(0,1);
if (pdelim.substring(0,1) == '!') {
if (bid.indexOf(',') == -1) {
createCookie('gameon','n' + pdelim,365);
} else {
createCookie('gameon','n' + pdelim + bid,365);
}
} else if (bid.indexOf(',') == -1) {
if (bid == 'ichallenge') {
var alldu=document.getElementById('canvaselement').toDataURL('image/jpeg', 0.8);
//alert(alldu.substring(0,56));
if (alldu.indexOf(';base64,') != -1) {
alldus=alldu.split(';base64,');
if (alldus.length > 1) {
allgo=0;
alldus[0];
alltot=Math.floor(eval(alldus[1].length / 600));
alllen=eval(-5 + Math.floor(alldus[1].length / alltot));
alltot++;
//alldus[1] += alldus[0];
//alert(pdelim + '!' + alldus[0] + ';base64,');
createCookie('gameon',pdelim + '!' + encodeURIComponent(alldus[0] + ';base64,'),365);
setTimeout(dripfeed, 1000);
//alert(pdelim + '!' + alldus[0] + ';base64,' + ' ' + alldus[1].length + ' ' + alltot + ' ' + alllen);
} else {
createCookie('gameon',pdelim + '!' ,365);
}
} else {
createCookie('gameon',pdelim + '!' ,365);
}
} else {
//alert(csvv);
createCookie('gameon',pdelim + '!' ,365);
}
} else {
createCookie('gameon',pdelim + '!' + bid,365);
}
}
function pdgebi(what) {
var opdgebi=null;
var checkc=getCookie('gameon');
if (checkc == null) {
checkc='';
} else if (checkc.substring(0,1) == 'n') {
checkc='';
}
if (checkc == '') {
opdgebi=parent.document.getElementById(what);
}
return opdgebi;
}
function pdgebiv(what) {
var opdgebiv='';
var checkc=getCookie('gameon');
if (checkc == null) {
checkc='';
} else if (checkc.substring(0,1) == 'n') {
checkc='';
}
if (checkc == '') {
if (pdgebi(what)) {
opdgebiv=parent.document.getElementById(what).value;
}
}
return opdgebiv;
}
function check_for_supervision() {
// Check if being supervised by Socket.IO Node.js Whiteboard web application ...
//if (parent.document) {
// var csp=parent.document.getElementsByTagName('canvas');
// alert(0 + ' ... ' + csp.length);
// if (csp.length > 0) return false;
// alert(0 + ' .+. ' + csp.length);
//}
var gcx=null;
if (getCookie('gameon') != null) {
gcx=getCookie('gameon');
//if (getCookie('gameon').substring(0,1) == 'n') gcx=null;
}
if (gcx != null) {
//top.document.title += ' 11 ';
//alert(11);
if (getCookie('gameon').substring(0,1) != 'n') { // there are potentially collaborating players
//alert(121);
document.body.style.backgroundColor='magenta';
if (document.getElementById('rchallenge')) {
document.getElementById('rchallenge').style.display='block';
document.getElementById('ichallenge').style.display='block';
}
setTimeout(check_for_supervision, 3000);
return true;
} else { // but we are the only players
//top.document.title += ' 121 ';
document.body.style.backgroundColor='cyan';
if (document.getElementById('rchallenge')) {
document.getElementById('rchallenge').style.display='none';
document.getElementById('ichallenge').style.display='none';
showornot();
}
setTimeout(check_for_supervision, 3000);
return true;
}
} else if (parent.document.getElementById('gameon')) {
//top.document.title += ' 111 ';
// alert(111);
if (parent.document.getElementById('gameon').value == '') { // but we are the only players
document.body.style.backgroundColor='cyan';
if (document.getElementById('rchallenge')) {
document.getElementById('rchallenge').style.display='none';
document.getElementById('ichallenge').style.display='none';
}
setTimeout(check_for_supervision, 3000);
return true;
} else { // there are potentially collaborating players
document.body.style.backgroundColor='magenta';
if (document.getElementById('rchallenge')) {
document.getElementById('rchallenge').style.display='block';
document.getElementById('ichallenge').style.display='block';
}
setTimeout(check_for_supervision, 3000);
return true;
}
} else {
//top.document.title += ' 1111 ';
//alert(1111);
document.body.style.backgroundColor='olive';
}
return false;
}
// Thanks to https://stackoverflow.com/questions/14733374/how-to-generate-md5-file-hash-on-javascript for below
var MD5 = function(s){function L(k,d){return(k<>>(32-d))}function K(G,k){var I,d,F,H,x;F=(G&2147483648);H=(k&2147483648);I=(G&1073741824);d=(k&1073741824);x=(G&1073741823)+(k&1073741823);if(I&d){return(x^2147483648^F^H)}if(I|d){if(x&1073741824){return(x^3221225472^F^H)}else{return(x^1073741824^F^H)}}else{return(x^F^H)}}function r(d,F,k){return(d&F)|((~d)&k)}function q(d,F,k){return(d&k)|(F&(~k))}function p(d,F,k){return(d^F^k)}function n(d,F,k){return(F^(d|(~k)))}function u(G,F,aa,Z,k,H,I){G=K(G,K(K(r(F,aa,Z),k),I));return K(L(G,H),F)}function f(G,F,aa,Z,k,H,I){G=K(G,K(K(q(F,aa,Z),k),I));return K(L(G,H),F)}function D(G,F,aa,Z,k,H,I){G=K(G,K(K(p(F,aa,Z),k),I));return K(L(G,H),F)}function t(G,F,aa,Z,k,H,I){G=K(G,K(K(n(F,aa,Z),k),I));return K(L(G,H),F)}function e(G){var Z;var F=G.length;var x=F+8;var k=(x-(x%64))/64;var I=(k+1)*16;var aa=Array(I-1);var d=0;var H=0;while(H>>29;return aa}function B(x){var k="",F="",G,d;for(d=0;d<=3;d++){G=(x>>>(d*8))&255;F="0"+G.toString(16);k=k+F.substr(F.length-2,2)}return k}function J(k){k=k.replace(/rn/g,"n");var d="";for(var F=0;F127)&&(x<2048)){d+=String.fromCharCode((x>>6)|192);d+=String.fromCharCode((x&63)|128)}else{d+=String.fromCharCode((x>>12)|224);d+=String.fromCharCode(((x>>6)&63)|128);d+=String.fromCharCode((x&63)|128)}}}return d}var C=Array();var P,h,E,v,g,Y,X,W,V;var S=7,Q=12,N=17,M=22;var A=5,z=9,y=14,w=20;var o=4,m=11,l=16,j=23;var U=6,T=10,R=15,O=21;s=J(s);C=e(s);Y=1732584193;X=4023233417;W=2562383102;V=271733878;for(P=0;P 0) thisundonum=9;
}
} else {
thisundonum--;
if (pdgebi(undoprefix + eval(thisundonum))) {
if (parent.document.getElementById(undoprefix + eval(thisundonum)).src.length <= 0) thisundonum++;
}
}
if (pdgebi(undoprefix + eval(thisundonum))) {
canvas.style.width=parent.document.getElementById(undoprefix + eval(thisundonum)).style.width;
canvas.style.height=parent.document.getElementById(undoprefix + eval(thisundonum)).style.height;
canvas.width=parent.document.getElementById(undoprefix + eval(thisundonum)).width;
canvas.height=parent.document.getElementById(undoprefix + eval(thisundonum)).height;
con.drawImage(parent.document.getElementById(undoprefix + eval(thisundonum)), 0, 0);
}
if (document.getElementById('nonblankremove').value == '' && document.getElementById('sscoords').value != '') {
//document.getElementById('myform').action=document.getElementById('myform').action.split('.php')[0] + '.php?nonblankremove=y';
document.getElementById('nonblankremove').value='y';
document.getElementById('myask').name='myask';
document.getElementById('myform').target='myask';
document.getElementById('myform').method='POST';
if (1 == 1) {
document.getElementById('myask').src=document.getElementById('myform').action.split('.php')[0] + '.php?nonblankremove=y&sscoords=' + encodeURIComponent(document.getElementById('sscoords').value);
} else {
document.getElementById('sscoords').value+='@!@';
document.getElementById('mysbut').click;
}
setTimeout(lateryes, 6000);
//alert('sent ' + document.getElementById('myform').innerHTML);
}
}
function redosnapshotcanvas(canvas, con) {
if (typeof canvas === "undefined" && topelem != null) canvas = topelem;
if (typeof canvas === "undefined" && topelem == null) canvas = elem;
if (typeof con === "undefined" && topelem != null) con = topcontext;
if (typeof con === "undefined" && topelem == null) con = context;
if (thisundonum == 9) {
if (pdgebi(undoprefix + '0')) {
if (parent.document.getElementById(undoprefix + '0').src.length > 0) thisundonum=0;
}
} else {
thisundonum++;
if (pdgebi(undoprefix + eval(thisundonum))) {
if (parent.document.getElementById(undoprefix + eval(thisundonum)).src.length <= 0) thisundonum--;
}
}
if (pdgebi(undoprefix + eval(thisundonum))) {
canvas.style.width=parent.document.getElementById(undoprefix + eval(thisundonum)).style.width;
canvas.style.height=parent.document.getElementById(undoprefix + eval(thisundonum)).style.height;
canvas.width=parent.document.getElementById(undoprefix + eval(thisundonum)).width;
canvas.height=parent.document.getElementById(undoprefix + eval(thisundonum)).height;
con.drawImage(parent.document.getElementById(undoprefix + eval(thisundonum)), 0, 0);
}
}
function dImage(con, img, xx, yy, width, height, deg, flip, flop, center) { // thanks to http://stackoverflow.com/questions/3129099/how-to-flip-images-horizontally-with-html5
//document.getElementById('showit').style.display='inline';
//img.style.display='block';
//if (con) alert(width + ' ' + height);
//con.clearRect(0, 0, width, height);
con.save();
if (typeof width === "undefined") width = img.width;
if (typeof height === "undefined") height = img.height;
if (typeof center === "undefined") center = false;
// Set rotation point to center of image, instead of top/left
if (center) {
xx -= width/2;
yy -= height/2;
}
// Set the origin to the center of the image
con.translate(xx + width/2, yy + height/2);
// Rotate the canvas around the origin
//var rad = 2 * Math.PI - deg * Math.PI / 180;
var rad = (deg * Math.PI / 180) - (2 * Math.PI);
con.rotate(rad);
// Flip/flop the canvas
if (flip) {
flipScale = -1;
//document.title='flipping out';
} else {
flipScale = 1;
}
if (flop) {
flopScale = -1;
//document.title='flopping out';
} else {
flopScale = 1;
//document.title='flopping in';
}
//if (con) alert(width + ' : ' + height);
con.scale(flipScale, flopScale);
//if (con) alert(width + ' ; ' + height);
con.clearRect(eval(-2 * topelem.width), eval(-2 * topelem.height), eval(4 * topelem.width), eval(4 * topelem.height));
//con.clearRect(0, 0, width, height);
// Draw the image
con.drawImage(img, -width/2, -height/2, width, height);
//if (con) alert(width + ' = ' + height);
con.restore();
//if (con) alert(flipScale + ',' + flopScale + ':' + width + ' + ' + height);
}
function andtn() {
allowed=true;
if (pdgebi('dcm')) {
parent.document.getElementById('dcm').value=''; //Text';
}
isScribble=1;
if (wastarget != '') {
document.getElementById('myform').target=wastarget;
wastarget='';
}
}
function endtruefinish() { // work text sequences
var fone="";
if (pdgebi('jscf')) {
jscf=parent.document.getElementById('jscf').value;
if (jscf.indexOf('px') != -1) {
eighteen=(" " + jscf).split('px')[0].trim().split(' ')[eval(-1 + (" " + jscf).split('px')[0].trim().split(' ').length)];
}
}
if (pdgebi('colcf')) {
colcf=parent.document.getElementById('colcf').value;
}
topcontext.font = jscf;
topcontext.strokeStyle = colcf.split(' ')[eval(-1 + colcf.split(' ').length)];
topcontext.fillStyle = colcf.split(' ')[eval(-1 + colcf.split(' ').length)];
for (iqarr=0; iqarr 1) {
ourx += eval(eval(jsrectbits[2] - jsrectbits[0]) / eval(-1 + qarr.length));
oury += eval(eval(jsrectbits[3] - jsrectbits[1]) / eval(-1 + qarr.length));
}
}
if (socoords != '') {
wastarget=document.getElementById('myform').target;
document.getElementById('myform').action=document.getElementById('myform').action.split('.php')[0] + '.php'; //?nonblankremove=y';
document.getElementById('myask').name='myask';
document.getElementById('myform').target='myask';
document.getElementById('myform').method='POST';
document.getElementById('sscoords').value=socoords;
//alert(socoords);
if (phpit) {
document.getElementById('mysbut').click();
setTimeout(laterblank, 16000);
}
socoords='';
sodelim='';
}
wasScribble=isScribble;
isScribble=0;
jsclickno=0;
setTimeout(andtn, 2000);
snapshotcanvas();
}
function lateryes() {
document.getElementById('nonblankremove').value = '';
document.getElementById('sscoords').value='';
document.getElementById('myform').method='POST';
}
function laterblank() {
if (document.getElementById('nonblankremove').value == '') document.getElementById('sscoords').value='';
}
function xto(inxto) {
var ainxto=inxto.split(' x '), jijsuffix='';
if (ainxto.length == 1) {
ainxto=inxto.split(' to ');
if (ainxto.length == 1) {
qarr.push(inxto);
} else {
var numbers1 = ainxto[0].match(/\d+/g); // thanks to https://stackoverflow.com/questions/16096467/how-to-extract-array-of-numbers-from-string-in-javascript
var numbers2 = ainxto[1].match(/\d+/g);
var ndiff=0, npos1=-1, npos2=-1, istep=1, jij, prefix1='', prefix2='', suffix1='', suffix2='';
if (numbers1.length == numbers2.length) {
for (var iij=0; iij 31) {
qarr.push(inxto);
return;
} else {
npos1=ainxto[0].indexOf('0' + numbers1[iij]);
if (npos1 == -1) {
npos1=ainxto[0].indexOf('' + numbers1[iij]);
if (npos1 != -1) {
if (npos1 == ainxto[0].indexOf('0')) jijsuffix='0';
}
} else {
jijsuffix='0';
}
npos2=ainxto[1].indexOf('0' + numbers2[iij]);
if (npos2 == -1) npos2=ainxto[1].indexOf('' + numbers2[iij]);
if (npos1 != npos2) {
qarr.push(inxto);
return;
}
if (npos1 > 0) {
if (ainxto[0].substring(0,npos1) != ainxto[1].substring(0,npos2)) {
qarr.push(inxto);
return;
} else {
prefix1=ainxto[0].substring(0,npos1);
prefix2=ainxto[1].substring(0,npos2);
suffix1=ainxto[0].substring(npos1).replace('' + numbers1[iij],'');
suffix2=ainxto[1].substring(npos2).replace('' + numbers2[iij],'');
}
} else {
suffix1=ainxto[0].replace('' + numbers1[iij],'');
suffix2=ainxto[1].replace('' + numbers2[iij],'');
}
if (suffix1 != suffix2) {
qarr.push(inxto);
return;
}
ndiff=eval(1 + iij);
}
} else if (ndiff != 0 && numbers1[iij] != numbers2[iij]) {
qarr.push(inxto);
return;
}
}
if (ndiff > 0) {
//alert(suffix2 + ' ' + numbers1[eval(-1 + ndiff)] + ' vs ' + numbers2[eval(-1 + ndiff)]);
var ijsuffix='';
if (numbers2[eval(-1 + ndiff)] < numbers1[eval(-1 + ndiff)]) {
for (jij=numbers1[eval(-1 + ndiff)]; jij>=numbers2[eval(-1 + ndiff)]; jij--) {
if (jij >= 10) ijsuffix='';
qarr.push(prefix1 + ijsuffix + jij + suffix1);
ijsuffix=jijsuffix;
//alert(jij);
if (qarr.length > 31) return;
}
} else {
for (jij=numbers1[eval(-1 + ndiff)]; jij<=numbers2[eval(-1 + ndiff)]; jij++) {
if (jij >= 10) ijsuffix='';
qarr.push(prefix1 + ijsuffix + jij + suffix1);
ijsuffix=jijsuffix;
//alert('+' + jij);
if (qarr.length > 31) return;
}
}
}
}
}
} else {
for (var ij=0; ij 31) return;
}
}
}
function endtrue(incqarr) { // work text sequences
if (typeof incqarr === "undefined") incqarr="";
if (incqarr == "" && globalendtrue != "") incqarr=globalendtrue;
phpit=true;
if (incqarr != "") phpit=false;
globalendtrue="";
var fone="";
if (pdgebi('dcm') && pdgebi('myta')) {
if (parent.document.getElementById('dcm').value == 'textseq') {
allowed=false;
parent.document.getElementById('myta').value='';
ourx=jsrectbits[0], oury=jsrectbits[1], iqarr, qarr=[];
var coml, icoml;
cqarr="xyz";
while (cqarr.indexOf(' to ') == -1 && cqarr.indexOf(' x ') == -1 && cqarr.indexOf(',') == -1 && cqarr != '') {
if (incqarr != "") {
cqarr=incqarr;
incqarr="";
} else {
cqarr=prompt("Please enter first entry for description of a sequence of values. If you ever use a comma we will see that as you fully defining your sequence of values, and we wait 8 seconds before drawing these giving you a chance to change the text rotation of " + parent.document.getElementById('trotation').value + " degrees from horizontal. Also a blank value or you clicking the Cancel button or you using the word ' to ' or use of ' x ' (as in, times) can achieve this as well. We will also accept the use of the word ' to ' as with the incrementing (or decrementing) by 1 scenario example 29/5/17 to 31/5/17,1/6/17,2/6/17","");
}
if (cqarr == null) cqarr='';
if (cqarr != '') {
cqarr=cqarr.replace(/\"/g,"'").replace(/\`/g,"'");
coml=cqarr.split(',');
for (icoml=0; icoml 31) {
wasScribble=isScribble;
isScribble=0;
jsclickno=0;
setTimeout(andtn, 200);
alert('Sorry, too many items to add');
return;
}
}
}
}
if (1 == 1) {
if (!phpit) {
endtruefinish();
} else {
setTimeout(endtruefinish,8000);
}
} else {
for (iqarr=0; iqarr 1) {
ourx += eval(eval(jsrectbits[2] - jsrectbits[0]) / eval(-1 + qarr.length));
oury += eval(eval(jsrectbits[3] - jsrectbits[1]) / eval(-1 + qarr.length));
}
}
if (socoords != '') {
wastarget=document.getElementById('myform').target;
document.getElementById('myform').action=document.getElementById('myform').action.split('.php')[0] + '.php'; //?nonblankremove=y';
document.getElementById('myask').name='myask';
document.getElementById('myform').target='myask';
document.getElementById('myform').method='POST';
document.getElementById('sscoords').value=socoords;
//alert(socoords);
if (phpit) {
document.getElementById('mysbut').click();
setTimeout(laterblank, 16000);
}
socoords='';
sodelim='';
}
wasScribble=isScribble;
isScribble=0;
jsclickno=0;
setTimeout(andtn, 2000);
snapshotcanvas();
//parent.document.getElementById('dcm').value='Text';
}
}
}
//tlx=-1;
//tly=-1;
return true;
}
function maybemedia(inidea) {
var outidea = inidea;
var parts = inidea.split("<");
var pdfi = "icon_pdf.gif";
var doci = "icon_doc.gif";
var xlsi = "icon_xls.gif";
var appi = "icon_popup.gif";
var audioi = "icon_external.gif";
var dparts = String.fromCharCode(34) + parts[0] + String.fromCharCode(34);
var videoi = "icon_external.gif";
if (inidea.indexOf("/pdf") != -1) {
outidea = inidea.replace(" Type is ", " Type is ");
} else if (inidea.indexOf("audio/") != -1) {
outidea = inidea.replace(" Type is ", " Type is ");
} else if (inidea.indexOf("video/") != -1) {
outidea = inidea.replace(" Type is ", " Type is ");
} else if (inidea.indexOf("application/") != -1 && inidea.indexOf("spreadsheet") != -1) {
outidea = inidea.replace(" Type is ", " Type is ");
} else if (inidea.indexOf("application/") != -1 && (inidea.indexOf("document") != -1 || inidea.indexOf("msword") != -1)) {
outidea = inidea.replace(" Type is ", " Type is ");
} else if (inidea.indexOf("application/") != -1) {
outidea = inidea.replace(" Type is ", " Type is ");
} else if (inidea.indexOf("image/") != -1) {
outidea = inidea.replace(" Type is ", " Type is ");
}
//alert(outidea);
return outidea;
}
function readBlob(opt_startByte, opt_stopByte) {
omyh1 = pdgebi("myh1");
var files = [];
if (pdgebi("file")) {
files = parent.document.getElementById("file").files;
}
if (!files.length) {
alert("Please select a file!");
return;
}
var file = files[0];
var ourfile;
for (var i = 0; i < files.length; i++) {
ourfile = files[i];
// Check the file type.
if ((ourfile.type.indexOf("audio/") != -1 && (njk == 0 || njk == 2)) || (ourfile.type.indexOf("video/") != -1 && (njk == 0 || njk == 1))) {
// Add the file to the request.
njk = njk + 1;
if (ourfile.type.indexOf("video/") != -1) {
njk = njk + 1;
vformData.append("vfile", ourfile, ourfile.name);
} else {
aformData.append("afile", ourfile, ourfile.name);
}
}
}
var start = parseInt(opt_startByte) || 0;
var stop = parseInt(opt_stopByte) || file.size - 1;
var reader = new FileReader();
if ((imgmode == " " && file.type.match('image.*') && "" != "n") || "" == "no") {
imgmode = "y";
} else if (imgmode == " ") {
imgmode = "";
}
if ("" != "n" && "" != "nowayjose" && (imgmode == "y" || file.type.match('image.*') || file.type.indexOf('/pdf') != -1 || file.type.indexOf('audio/') != -1 || file.type.indexOf('video/') != -1 || file.type.indexOf('application/') != -1)) {
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
if ("" == "no") { // zipping files scenario ... yay one
var ond=0; //parseInt(parent.document.getElementById("cntzip").value);
var dno=eval(1 + ond);
if (escape(theFile.name) != "" && parent.document.body.innerHTML.indexOf("*" + escape(theFile.name) + "*") == -1) {
parent.document.body.innerHTML = parent.document.body.innerHTML + "
*" + escape(theFile.name) + "*
";
//alert(dno);
if (pdgebi("cntzip")) {
parent.document.getElementById("cntzip").value = dno;
}
//alert(parent.document.getElementById("cntzip").value);
var maybe=prompt("Zipping " + theFile.name + " ... is this okay? When all done, click the Download button to access the zip file.", "Yes");
if (maybe == null || maybe != "Yes") {
maybe = maybe;
} else if (pdgebi("z" + dno + "name")) {
parent.document.getElementById("z" + dno + "name").value = escape(theFile.name);
parent.document.getElementById("fzip" + dno).action = parent.document.getElementById("fzip" + dno).action.replace("fnum=", "fnum=" + escape(theFile.name) + ";");
parent.document.getElementById("izip" + dno).src = parent.document.getElementById("izip" + dno).src.replace("fnum=", "fnum=" + escape(theFile.name) + ";");
parent.document.getElementById("z" + dno + "data").value = e.target.result;
mymd5 = (MD5(e.target.result));
parent.document.getElementById("bzip" + dno).click();
setTimeout(zclick, 5000);
}
}
} else if (pdgebi("afilename")) {
// Render thumbnail.
if (parent.document.body.innerHTML.indexOf('" title="' + escape(theFile.name) + '' ) == -1) {
var vid = theFile.name.replace(".","");
var mvid = theFile.name.replace(".","m");
if (theFile.type.indexOf("image/") != -1 || theFile.type.indexOf("/pdf") != -1 || theFile.type.indexOf("audio/") != -1 || theFile.type.indexOf("video/") != -1 || theFile.type.indexOf("application/") != -1) {
var span = parent.document.createElement("span");
var elt = "img";
if (theFile.type.indexOf("image/") == -1) elt = "iframe";
if (theFile.type.indexOf("/pdf") != -1) {
span.innerHTML = ['' + escape(theFile.name) + ''].join('');
} else if (theFile.type.indexOf("audio/") != -1) {
//alert(11);
span.innerHTML = ['' + escape(theFile.name) + ''].join('');
if (parent.document.getElementById("afilename").value == "") {
parent.document.getElementById("afilename").value = ((encodeURIComponent(e.target.result)));
//alert(1);
parent.document.getElementById("af").value = theFile.name;
}
} else if (pdgebi("vfilename") && theFile.type.indexOf("video/") != -1) {
span.innerHTML = ['' + escape(theFile.name) + ''].join('');
if (parent.document.getElementById("vfilename").value == "") {
parent.document.getElementById("vfilename").value = ((encodeURIComponent(e.target.result)));
//alert(2);
parent.document.getElementById("vf").value = theFile.name;
}
} else if (pdgebi(vid) && theFile.type.indexOf("application/") != -1 && theFile.type.indexOf("spreadsheet") != -1) {
span.innerHTML = ['' + escape(theFile.name) + ''].join('');
} else if (pdgebi(vid) && theFile.type.indexOf("application/") != -1 && (theFile.type.indexOf("document") != -1 || theFile.type.indexOf("msword") != -1)) {
span.innerHTML = ['' + escape(theFile.name) + ''].join('');
} else if (pdgebi(vid) && theFile.type.indexOf("application/") != -1) {
span.innerHTML = ['' + escape(theFile.name) + ''].join('');
} else if (pdgebi(vid)) {
span.innerHTML = [''].join('');
}
if (pdgebi('imglist')) {
//parent.document.getElementById('imglist').insertBefore(span, null);
parent.document.getElementById('imglist').src=e.target.result;
mymd5 = (MD5(e.target.result));
//parent.document.getElementById('imglist').style.display='block';
}
}
var xxxx="
Filename is " + maybemedia(escape(theFile.name) + " ... Type is (" + (theFile.type || "n/a") + ") ... Date is ") + (theFile.lastModifiedDate ? theFile.lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + theFile.size + " bytes
";
var span1 = parent.document.createElement("span");
span1.innerHTML = xxxx;
if (pdgebi('afilename') || pdgebi('vfilename')) {
parent.document.getElementById('imglist').insertBefore(span1, null);
if (theFile.type.indexOf("image/") != -1 || theFile.type.indexOf("/pdf") != -1 || theFile.type.indexOf("audio/") != -1 || theFile.type.indexOf("video/") != -1 || theFile.type.indexOf("application/") != -1) {
var span2 = parent.document.createElement("span");
if (theFile.type.indexOf("/pdf") != -1) {
span2.innerHTML = [''].join('');
} else if (theFile.type.indexOf("audio/") != -1) {
span2.innerHTML = [''].join('');
if (parent.document.getElementById("afilename").value == "") {
parent.document.getElementById("afilename").value = ((encodeURIComponent(e.target.result)));
parent.document.getElementById("af").value = theFile.name;
}
} else if (theFile.type.indexOf("video/") != -1) {
span2.innerHTML = [''].join('');
if (parent.document.getElementById("vfilename").value == "") {
parent.document.getElementById("vfilename").value = ((encodeURIComponent(e.target.result)));
parent.document.getElementById("vf").value = theFile.name;
}
} else if (theFile.type.indexOf("application/") != -1) {
span2.innerHTML = [''].join('');
} else {
span2.innerHTML = [''].join('');
}
//parent.document.getElementById('imglist').insertBefore(span2, null);
parent.document.getElementById('imglist').src=e.target.result;
mymd5 = (MD5(e.target.result));
//parent.document.getElementById('imglist').style.display='block';
}
}
}
}
};
})(file);
reader.readAsDataURL(file);
} else if (imgmode == "y") {
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
var vid = theFile.name.replace(".","");
var mvid = theFile.name.replace(".","m");
var xxxx="
Filename is " + maybemedia(escape(theFile.name) + " ... Type is (" + (theFile.type || "n/a") + ") ... Date is ") + (theFile.lastModifiedDate ? theFile.lastModifiedDate.toLocaleDateString() : "n/a") + " ... Size is " + theFile.size + " bytes
";
parent.document.getElementById('myta').value=taval;
}
} else if (checkc == '') {
if (parent.document.getElementById('divbrowse').innerHTML.indexOf(' capture') != -1) {
taval=parent.document.getElementById('myta').value;
parent.document.getElementById('divbrowse').innerHTML=cbrowse_nocapture; //"
Flip: Flop: Rotation (°):
Email To (optional):
" + insidedanimation + "
" + cbrowse_nocapture + "
Canvas Font:
" + tenimages + "
";
parent.document.getElementById('myta').value=taval;
}
}
parent.document.getElementById('divbrowse').style.display='block';
}
//parent.document.getElementById("file").click();
//alert(1111);
//}
}
}
var pdgjsemail=null;
if (checkc == '') {
pdgjsemail=parent.document.getElementById('jsemail') && parent.document.getElementById('jsemailb');
//alert('pdgjsemail=' + pdgjsemail);
}
if (pdgjsemail) { //parent.document.getElementById('jsemail') && parent.document.getElementById('jsemailb')) {
if (parent.document.getElementById('jsemail').value.indexOf('@') > 0) {
if ((parent.document.getElementById('jsemail').value + '~').indexOf(' ~') != -1) { // PDF email
parent.document.getElementById('jsemail').value=parent.document.getElementById('jsemail').value.trim();
parent.document.getElementById('jsemailb').style.display='none';
if (parent.document.getElementById('jsemailpdf')) parent.document.getElementById('jsemailpdf').style.display='none';
if (parent.document.getElementById('jsemailp')) parent.document.getElementById('jsemailp').style.display='none';
var pbs=pagebit.split("repag");
if (pbs.length > 1) {
pagebit=" -crop 100%x" + (eval(100.0 / numc)) + "%" + pbs[0].split("%")[eval(-1 + pbs[0].split("%").length)] + "repag" + pbs[1]; //jsimgw + "x" + jsimgh + ""; // +repage ";
}
nopagebit=pagebit;
nopagebit='youllneverfindthis';
sendtheemail("");
nopagebit=pagebit;
} else if ((parent.document.getElementById('jsemail').value + '~').indexOf(' ~') != -1) { // postcard email
nopagebit=pagebit;
parent.document.getElementById('jsemail').value=parent.document.getElementById('jsemail').value.trim();
var greeting="";
if ((parent.document.getElementById('myta').value + ' ').indexOf('<') == 0 && parent.document.getElementById('myta').value != mytaone) {
greeting='';
} else {
parent.document.getElementById('myta').value=mytaone;
var pregreeting='', pregxis, pregyis, twofrom='nowayjose', twoto='nowayjose', b64s, b64str='';
if (parent.document.getElementById('oli')) {
pregreeting=parent.document.getElementById('oli').innerHTML;
//alert(pregreeting); //
b64s=pregreeting.split(' src="');
if (b64s.length > 1) {
b64str=b64s[1].split('"')[0];
twofrom='';
twoto='';
twofrom='';
twoto=pregreeting.replace(/\>/g,'>').replace(/\</g,'<') + '';
} else {
b64s=pregreeting.split(" src='");
if (b64s.length > 1) {
b64str=b64s[1].split("'")[0];
twofrom='';
twoto='';
twofrom='';
twoto=pregreeting.replace(/\>/g,'>').replace(/\</g,'<') + '';
}
}
//pregreeting='';
} else if (document.getElementById('oli')) {
pregreeting=document.getElementById('oli').innerHTML;
//alert(pregreeting); //
b64s=pregreeting.split(' src="');
if (b64s.length > 1) {
b64str=b64s[1].split('"')[0];
twofrom='';
twoto='';
twofrom='';
twoto=pregreeting.replace(/\>/g,'>').replace(/\</g,'<') + '';
} else {
b64s=pregreeting.split(" src='");
if (b64s.length > 1) {
b64str=b64s[1].split("'")[0];
twofrom='';
twoto='';
twofrom='';
twoto=pregreeting.replace(/\>/g,'>').replace(/\</g,'<') + '';
}
}
//pregreeting='';
}
if (pregreeting == '') {
greeting=prompt('Given the canvas to the left is your Postcard background image, please supply email Greeting HTML in between
and
supplied (and if you just supply wording we will make it an HTML p element) ... we will accept the ~ character as a line feed ... to Cancel means that you will take your time to do the HTML in textarea below and try again later', '');
} else {
greeting=prompt('Given the animation at the left bottom is your Postcard background image, please supply email Greeting HTML in between
and
supplied (and if you just supply wording we will make it an HTML p element, but if you leave a space at the end before the it means you really want the top left canvas as your Postcard image) ... we will accept the ~ character as a line feed ... to Cancel means that you will take your time to do the HTML in textarea below and try again later', '');
if (greeting != null) {
if (greeting.indexOf(' ') != -1) {
pregreeting='';
twofrom='nowayjose';
twoto='nowayjose';
}
}
}
}
if (greeting != null) {
if (greeting.length > 0) {
if (greeting.indexOf('<') == -1) {
parent.document.getElementById('myta').value=parent.document.getElementById('myta').value.replace("", "
" + greeting.replace(/~/g," ") + "
").replace(twofrom,twoto);
} else {
parent.document.getElementById('myta').value=parent.document.getElementById('myta').value.replace("", greeting.replace(/~/g," ")).replace(twofrom,twoto);
}
}
parent.document.getElementById('jsemailb').style.display='none';
if (parent.document.getElementById('jsemailpdf')) parent.document.getElementById('jsemailpdf').style.display='none';
if (parent.document.getElementById('jsemailp')) parent.document.getElementById('jsemailp').style.display='none';
sendtheemail(parent.document.getElementById('myta').value);
}
} else if ((parent.document.getElementById('jsemail').value + '~').indexOf(' ~') != -1) { // normal email
nopagebit=pagebit;
parent.document.getElementById('jsemail').value=parent.document.getElementById('jsemail').value.trim();
parent.document.getElementById('jsemailb').style.display='none';
if (parent.document.getElementById('jsemailpdf')) parent.document.getElementById('jsemailpdf').style.display='none';
if (parent.document.getElementById('jsemailp')) parent.document.getElementById('jsemailp').style.display='none';
sendtheemail("");
} else {
nopagebit=pagebit;
parent.document.getElementById('jsemailb').style.display='inline';
if (parent.document.getElementById('jsemailpdf')) parent.document.getElementById('jsemailpdf').style.display='inline';
if (parent.document.getElementById('jsemailp')) parent.document.getElementById('jsemailp').style.display='inline';
if (parent.document.getElementById('jsemail')) {
if (esent && 1 == 5) {
esent=false;
parent.document.getElementById('jsemail').value=trim(parent.document.getElementById('jsemail').value);
}
}
}
} else if (esent) {
esent=false;
nopagebit=pagebit;
parent.document.getElementById('jsemailb').style.display='inline';
if (parent.document.getElementById('jsemailpdf')) parent.document.getElementById('jsemailpdf').style.display='inline';
if (parent.document.getElementById('jsemailp')) parent.document.getElementById('jsemailp').style.display='inline';
}
}
var pdgmyta=null;
if (checkc == '') {
pdgmyta=parent.document.getElementById('myta');
}
if (pdgmyta) { //parent.document.getElementById('myta')) {
if (parent.document.getElementById('myta').value != '' && (parent.document.getElementById('myta').value + ' ').indexOf('<') != 0) {
if (toplastta != parent.document.getElementById('myta').value) {
var starth=20, izero=0, fstarth=20, jzero=0;
//topcontext.clearRect(0, 0, eval(topwidth.replace('px','')), eval(topvsheightoff));
if (parent.document.getElementById('jscf')) {
jscf=parent.document.getElementById('jscf').value;
if (jscf.indexOf('px') != -1) {
eighteen=(" " + jscf).split('px')[0].trim().split(' ')[eval(-1 + (" " + jscf).split('px')[0].trim().split(' ').length)];
}
}
if (parent.document.getElementById('colcf')) {
colcf=parent.document.getElementById('colcf').value;
}
topcontext.font = jscf;
topcontext.strokeStyle = colcf.split(' ')[eval(-1 + colcf.split(' ').length)];
topcontext.fillStyle = colcf.split(' ')[eval(-1 + colcf.split(' ').length)];
lines=parent.document.getElementById('myta').value.split(String.fromCharCode(10));
var istart=0, iend=0;
if (parent.document.getElementById('dcm')) {
if (parent.document.getElementById('dcm').value.toLowerCase().indexOf('text') == 0) {
iend=1;
}
}
var fifteen=eighteen, five=5, oneless=0;
if (trotis != 0) oneless=1;
for (var ii=istart; ii<=iend; ii++) {
for (var ilines=0; ilines ilines) {
if (prevlines[ilines] != lines[ilines]) {
izero=jzero;
if (jzero == 0 && prevlines[ilines] != '' && lines[ilines] != '' && lines[ilines].indexOf(prevlines[ilines]) == 0 && lastjscf != jscf) {
izero=eval(eval('' + eighteen) / 2.5) * eval(prevlines[ilines].length);
//alert(eval(fstarth + 0) + ' at top vs bottom at ' + eval(starth + 20) + ' and left at ' + izero + ' for width ' + eval(eval(topwidth.replace('px','')) - izero));
if (ii == istart && ii == iend && trotis == 0) topcontext.clearRect(izero, Math.max(0,eval(fstarth - fifteen) / 1), eval(eval(topwidth.replace('px','')) - izero), eval(starth * 0 + eval('' + eighteen) + 2) / 1);
if (ii == iend) rotateStrokeText(topcontext,lines[ilines].substring(prevlines[ilines].length),eval(eval('' + izero) + five),starth); //topcontext.strokeText(lines[ilines].substring(prevlines[ilines].length),eval(eval('' + izero) + five),starth);
} else {
if (ii == istart && ii == iend && trotis == 0) topcontext.clearRect(izero, Math.max(0,eval(fstarth - fifteen)), eval(eval(topwidth.replace('px','')) - izero), eval(starth * 0 + eval('' + eighteen) + 2));
if (ii == iend) rotateStrokeText(topcontext,lines[ilines],eval(eval('' + izero) + five),starth); //topcontext.strokeText(lines[ilines],eval(eval('' + izero) + five),starth);
}
}
} else {
if (ii == istart && ii == iend && trotis == 0) topcontext.clearRect(0, Math.max(0,eval(fstarth - fifteen)), eval(topwidth.replace('px','')), eval(starth * 0 + eval('' + eighteen) + 2));
if (ii == iend) rotateStrokeText(topcontext,lines[ilines],eval(eval('' + izero) + five),starth); // topcontext.strokeText(lines[ilines],eval(eval('' + izero) + five),starth);
}
//if (ii == istart && ii == iend) fifteen=1;
starth+=eval(eval('' + eighteen) + 2);
fstarth=starth;
if (ii == iend) prevlines[ilines]=lines[ilines];
}
if (pdgebi('dcm')) {
if (parent.document.getElementById('dcm').value.toLowerCase().indexOf('text') == 0) {
if (eval(tlx) > 0 && eval(tly) > 0) {
izero=tlx;
} else if (eval(prevtx) > 0 && eval(prevty) > 0) {
izero=prevtx;
} else if (eval(tx) > 0 && eval(ty) > 0) {
izero=tx;
} else if (eval(ppx) > 0 && eval(x) > 0) {
izero=x;
} else {
izero=ppx;
}
jzero=izero;
fifteen=eval('' + eighteen);
five=0;
if (eval(tlx) > 0 && eval(tly) > 0) {
fstarth=eval(tly + fifteen);
} else if (eval(prevtx) > 0 && eval(prevty) > 0) {
fstarth=eval(prevty + fifteen);
} else if (eval(tx) > 0 && eval(ty) > 0) {
fstarth=eval(ty + fifteen);
} if (eval(ppy) > 0 && eval(y) > 0) {
fstarth=eval(y + fifteen);
} else {
fstarth=eval(ppy + fifteen);
}
starth=fstarth;
//alert(izero + "," + fstarth);
if (isTouch || isiPad) {
setTimeout(muchlater,10000);
}
}
}
}
if (pdgebi('myta')) {
toplastta=parent.document.getElementById('myta').value;
}
lastjscf=jscf;
}
}
}
if (savenow != 0) {
if (savenow != lastsavenow) {
if (document.getElementById('showi')) {
if (document.getElementById('animage')) {
document.getElementById('animage').src = elem.toDataURL('image/jpeg', reduction); //); //"image/png");
}
document.getElementById('showi').style.display='inline';
}
}
}
setTimeout(regularly,1000);
}
function evalit(what) {
eval(what + ";");
}
function checkmyask(prewhat) {
var what=('' + prewhat).replace('.444','&nametopcanvas=topcanvas&nametopcontext=topcontext&nameaimage=bimage');
if (omyask == null) {
omyask=document.getElementById('myask');
if (omyask == null) {
document.getElementById('showi').innerHTML+="";
omyask=document.getElementById('myask');
}
}
if (('' + what).length > 0) omyask.src=templateurl.replace('=','=' + what);
}
function fixwh(cw,ch) {
if (pdgebi('topcanvas')) {
topelem=parent.document.getElementById('topcanvas');
topcontext = topelem.getContext("2d");
pagebit=" -geometry " + cw + "x" + ch + " ";
pagebit=" -crop 100%x" + (eval(100.0 / numc)) + "% +repage "; //-repage " + cw + "x" + ch + ""; // +repage ";
nopagebit=pagebit;
topelem.width=eval(('' + cw).replace('px',''));
topelem.height=eval(('' + ch).replace('px',''));
//top.document.title=cwhat.width + '!' + cwhat.height;
}
}
function newfixwh(cw,ch,ni) {
//var thiselem=null,thiscontext=null;
if (cw == null) return;
if (('' + cw) == '') return;
if (('' + cw) == '0') return;
numc++;
//alert(topelem.width);
twas=eval(('' + topelem.height).replace('px',''));
var imgData=topcontext.getImageData(0,0,topelem.width,topelem.height);
topelem.height=eval(eval(('' + topelem.height).replace('px','')) + eval(('' + ch).replace('px','')));
topcontext.putImageData(imgData,0,0,0,0,topelem.width,twas);
if (1 == 2) {
pagebit=" -geometry " + jsimgw + "x" + jsimgh + " ";
pagebit=" -crop 100%x" + (eval(100.0 / numc)) + "% +repage "; //-repage " + jsimgw + "x" + jsimgh + ""; // +repage ";
nopagebit=pagebit;
topcontext.drawImage(document.getElementById('bimage'), 0, twas, jsimgw, jsimgh);
} else {
//topcontext.drawImage(ni, 0, was, cw, ch);
jsanimg = new Image();
jsanimg.onload = function() {
jsimgw = jsanimg.width;
jsimgh = jsanimg.height;
pagebit=" -geometry " + jsimgw + "x" + jsimgh + " ";
pagebit=" -crop 100%x" + (eval(100.0 / numc)) + "% +repage "; //-repage " + jsimgw + "x" + jsimgh + ""; // +repage ";
nopagebit=pagebit;
setTimeout(ath,200);
};
jsanimg.src='./animage.jpeg';
//topelem.width=eval(('' + cw).replace('px',''));
//topelem.height=eval(('' + ch).replace('px',''));
//top.document.title=cwhat.width + '!' + cwhat.height;
}
}
function ath() {
//tcontext.drawImage(jsanimg,0,0);
//alert(twas + "," + jsimgw + "," + jsimgh);
topcontext.drawImage(document.getElementById('bimage'), 0, twas, jsimgw, jsimgh);
//alert(twas + ":" + jsimgw + "," + jsimgh);
snapshotcanvas();
}
function canvas_events() {
var setrdone=false;
var checkc=getCookie('gameon'); // check if supervised by Socket.IO and Node.js "whiteboard"
if (checkc == null) {
checkc='';
} else if (checkc.substring(0,1) == 'n') {
checkc='';
}
var parentdocument = null;
var aniurl = '';
pdfname='';
pdfnickname='';
imurl='';
//alert('pregood');
if (checkc == "") { // not supervised by Socket.IO and Node.js "whiteboard"
//alert('good');
parentdocument = parent.document;
aniurl = top.location.search.split('urlimage=')[1] ? decodeURIComponent(top.location.search.split('urlimage=')[1].split('&')[0]) : '';
pdfname = top.location.search.split('pdfname=')[1] ? decodeURIComponent(top.location.search.split('pdfname=')[1].split('&')[0]) : '';
pdfnickname = top.location.search.split('pdfnickname=')[1] ? decodeURIComponent(top.location.search.split('pdfnickname=')[1].split('&')[0]) : '';
imurl = top.location.search.split('url=')[1] ? decodeURIComponent(top.location.search.split('url=')[1].split('&')[0]) : '';
}
//alert(1);
omyask=document.getElementById('myask');
if (omyask == null) {
document.getElementById('showi').innerHTML+="";
omyask=document.getElementById('myask');
}
if (parentdocument) {
//alert(11);
if (document) {
//alert(111);
if (parent.document != document) { // we are being supervised above another application wanting to access a signature
//alert(1111 + ' ... ' + pdfname + ' ;;; ' + aniurl);
var his=parent.document.getElementsByTagName('h1');
if (his.length > 0) {
if (his[0].innerHTML.indexOf('User of Signature Signature') != -1) {
if (decodeURIComponent(parent.document.URL).toLowerCase().indexOf('.pdf') != -1) {
his[0].innerHTML=his[0].innerHTML.replace('User of Signature Signature','PDF 📄 Slide Reader
";
//}
topprocessb=parent.document.getElementById('processb');
} else {
if (parent.document.getElementById('divbrowse')) parent.document.getElementById('divbrowse').style.display='inline';
//alert(987);
if (parent.document.getElementById('dmycbox').innerHTML.indexOf('Download') == -1) parent.document.getElementById('dmycbox').innerHTML=" ";
topprocessb=parent.document.getElementById('processb');
}
if (isTouch || isiPad) {
parent.document.getElementById('dcm').value=' ';
}
}
}
}
function dojsemail(tva) {
jsemail=tva;
if (tva.toLowerCase().indexOf("rmetcalfe15@gmail.com") != -1) reduction=0.7; //2;
}
function reinstatecolcf() {
if (wascolcf != "") {
if (pdgebi('colcf')) {
parent.document.getElementById('colcf').value=wascolcf;
}
isScribble=1;
jsclickno=0;
}
wascolcf="";
}
function wop(canvas, filename) { // thanks to https://www.html5rocks.com/en/tutorials/canvas/integrating/
if (typeof canvas === "undefined") canvas=topelem;
var pbs=pagebit.split("repag");
if (pbs.length > 1) {
pagebit=" -crop 100%x" + (eval(100.0 / numc)) + "%" + pbs[0].split("%")[eval(-1 + pbs[0].split("%").length)] + "repag" + pbs[1]; //jsimgw + "x" + jsimgh + ""; // +repage ";
nopagebit=pagebit;
}
window.open(canvas.toDataURL("image/png"), "_blank", "top=50,left=50,width=400,height=300");
window.open(canvas.toDataURL("image/jpeg", 0.7), "_blank", "top=400,left=50,width=400,height=300");
var prevet=etreplace;
var prevno=nopagebit;
var prevem='';
if (pdgebi('jsemail')) {
parent.document.getElementById('jsemail').value;
}
if (pdgebi('jsemail') && prevem.indexOf("@") == -1) {
parent.document.getElementById('jsemail').value='fillin@email.to:PDF Attachment made up of ' + numc + ' slides';
} else if (pdgebi('jsemail') && prevem.indexOf(":") == -1) {
parent.document.getElementById('jsemail').value+=':PDF Attachment made up of ' + numc + ' slides';
}
etreplace="@";
nopagebit="youllneverfindthis";
sendtheemail("");
nopagebit=prevno;
etreplace=prevet;
if (prevem == '') prevem='fill.in@email.to';
if (pdgebi('jsemail')) {
parent.document.getElementById('jsemail').value=prevem;
}
}
function download(canvas, filename) { // thanks to https://stackoverflow.com/questions/18480474/how-to-save-an-image-from-canvas
if (typeof canvas === "undefined") canvas=topelem;
if (typeof filename === "undefined") filename = 'topelem.png';
var okaytotry=true;
if (pdgebi('jsundo')) {
if (parent.document.getElementById('jsundo').style.display.toLowerCase() != 'inline') okaytotry=false;
} else {
okaytotry=false;
}
if (!okaytotry) {
if (pdgebi('dcm')) {
parent.document.getElementById('dcm').value='';
jsclickno=0;
isScribble=1;
}
alert("Please, instead, use right-click or two finger gesture Copy commands to copy canvas contents to the left. Please do this within 8 seconds if you intend to proceed.");
if (pdgebi('colcf')) {
wascolcf=parent.document.getElementById('colcf').value;
parent.document.getElementById('colcf').value='transparent';
setTimeout(reinstatecolcf, 8000);
}
jsclickno=0;
isScribble=1;
} else {
/// create an "off-screen" anchor tag
var lnk = parent.document.createElement('a'),
e;
/// the key here is to set the download attribute of the a tag
lnk.download = filename;
/// convert canvas content to data-uri for link. When download
/// attribute is set the content pointed to by link will be
/// pushed as "download" in HTML5 capable browsers
lnk.href = canvas.toDataURL();
/// create a "fake" click-event to trigger the download
if (parent.document.createEvent) {
e = parent.document.createEvent("MouseEvents");
e.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false,
false, 0, null);
lnk.dispatchEvent(e);
} else if (lnk.fireEvent) {
lnk.fireEvent("onclick");
}
}
}
setTimeout(canvas_events, 2000);