11ddae0a by Jeff Balicki

more object

1 parent be58a396
//var pluginUrl = window.location.protocol + '//' + window.location.host + '/commonwell';
//var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
var pluginUrl = window.location.protocol + '//' + window.location.host + '/commonwell';
var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
var pluginUrl = window.location.protocol + '//' + window.location.host;
var pdf_customizer = "https://pdf-customizer.synapsus.co";
//var pluginUrl = "http://contact.gotenzing.com";
//var pdf_customizer = "http://pdf-customizer.synapsus.co";
var imageHeight = "";
var imageWidth = "";
var edit = false;
var setpage;
var imgLeft;
var imgTop;
var windowHBG;
var PageChangeOn;
function getAuth() {
......@@ -67,7 +71,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
jQuery(document).ready(function($) {
$('span').hide();
$('#span' + count).show();
// $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")");
// $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")");
var Qc = document.getElementById("Canvas");
var Qctx = Qc.getContext("2d");
......@@ -90,19 +94,22 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
ctx.lineWidth = 2;
ctx.strokeStyle = $('.callout').css("background-color")
ctx.roundRect(scaleRight, scaleDown, scalewidth, scaleheight, 5).stroke();
console.log(PageChangeOn , setpage);
if(PageChangeOn != setpage ){
document.getElementById("preview").checked = true;
$('#changes').trigger('submit');
}
});
setpage = PageChangeOn;
}
function findUserInfoMatch(data) {
}
function HideBox(kind) {
function HideBox(kind,page) {
jQuery(document).ready(function($) {
$('span').hide();
......@@ -111,6 +118,7 @@ function HideBox(kind) {
var Qctx = Qc.getContext("2d");
Qctx.clearRect(0, 0, Qc.width, Qc.height);
Qctx.restore();
if (kind != 'file') {
document.getElementById("preview").checked = true;
$('#changes').trigger('submit');
......@@ -120,12 +128,13 @@ function HideBox(kind) {
}
function HideBoxwithdate() {
function HideBoxwithdate(kind,page) {
jQuery(document).ready(function($) {
var Qc = document.getElementById("Canvas");
var Qctx = Qc.getContext("2d");
Qctx.clearRect(0, 0, Qc.width, Qc.height);
Qctx.restore();
});
......@@ -133,6 +142,18 @@ function HideBoxwithdate() {
}
function setPage(page) {
setpage = page;
}
function setPageChangeOn(page) {
PageChangeOn = page;
}
function fullScreen() {
jQuery(document).ready(function($) {
$('#bbox').toggleClass('fullscreen');
......@@ -202,20 +223,50 @@ function pickPdfFromList(json) {
}
function setTinyMce() {
jQuery(document).ready(function($) {
var tinymces = tinymce.init({
selector: '.textarea',
entity_encoding: "raw",
menubar: false,
toolbar: ' bold italic',
remove_linebreaks: false,
remove_trailing_brs: false,
init_instance_callback: function(editor) {
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "0px solid #131212";
editorDocContent.body.style.backgroundColor = "#131212";
editorDocContent.body.style.color = "#ccc";
},
setup: function(editor) {
editor.on('focus', function(e) {
//console.log(editor.id);
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "2px solid #0096D6";
function changePdfOptions(json, edit) {
jQuery(function($) {
if (edit == false) {
$('#contentAreaOver').hide();
}
$('#' + editor.id).trigger("onfocus");
//$(this).css('border', '2px solid #F7A800 !important');
});
editor.on('blur', function(e) {
//console.log('out' + editor.id);
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "0px solid #131212";
json = JSON.parse(json);
//$(this).css('border', '0px solid #F7A800 !important');
HideBox();
});
}
});
$(document).ready(function() {
});
}
function setDatePicker() {
jQuery(document).ready(function($) {
$("#changescontentdate").datepicker({
plugins: "tabfocus",
......@@ -232,6 +283,71 @@ function changePdfOptions(json, edit) {
});
});
}
function getPdfSize(json) {
jQuery(document).ready(function($) {
json = JSON.parse(json);
//console.log(json);
var windowWidth = 0.90 * $(".layout-grid").width();
var windowHeight = 0.90 * $(".layout-grid").height();
vwindowHBG = 0.923 * $(window).height();
pwidth = parseInt(json[0].pwidth);
pheight = parseInt(json[0].pheight);
if (pwidth > pheight) {
var scaleImage = windowWidth / pwidth;
vimageHeight = pheight * scaleImage;
vimageWidth = windowWidth;
vimgLeft = 0;
vimgTop = 40;
} else {
var scaleImage = windowHeight / pheight;
vimageHeight = windowHeight;
vimageWidth = pwidth * scaleImage;
vimgLeft = 30;
vimgTop = 2;
}
setPdfSize(vimgLeft, vimgTop, vwindowHBG, vimageHeight, vimageWidth);
});
}
function setPdfSize(vimgLeft, vimgTop, vwindowHBG, vimageHeight, vimageWidth) {
console.log(vimgLeft, vimgTop, vwindowHBG, vimageHeight, vimageWidth);
imgLeft = vimgLeft;
imgTop = vimgTop;
windowHBG = vwindowHBG;
imageHeight = vimageHeight;
imageWidth = vimageWidth;
}
function changePdfOptions(json, edit) {
getPdfSize(json);
jQuery(function($) {
if (edit == false) {
$('#contentAreaOver').hide();
}
json = JSON.parse(json);
$(document).ready(function() {
setDatePicker();
$("#changes").validate({
errorPlacement: function(error, element) {
var isFile = $(element).attr('type') == 'file';
......@@ -249,31 +365,7 @@ function changePdfOptions(json, edit) {
var pdflist = "";
var pdfChange = "";
var f = 0;
var windowWidth = 0.90 * $(".layout-grid").width();
var windowHeight = 0.90 * $(".layout-grid").height();
var windowHBG = 0.923 * $(window).height();
var pwidth = parseInt(json[0].pwidth);
var pheight = parseInt(json[0].pheight);
//console.log( windowWidth+' '+windowHeight);
//console.log( pwidth+' '+pheight);
if (pwidth > pheight) {
//console.log('wide')
var scaleImage = windowWidth / pwidth;
var imageHeight = pheight * scaleImage;
var imageWidth = windowWidth;
var imgLeft = 0;
var imgTop = 40;
} else {
var scaleImage = windowHeight / pheight;
var imageHeight = windowHeight;
var imageWidth = pwidth * scaleImage;
var imgLeft = 30;
var imgTop = 2;
}
// console.log('windowWidth'+windowWidth ,'windowHeight'+windowHeight,'pheight'+json[0].pheight,'pwidth'+json[0].pwidth,'imageWidth'+imageWidth, 'imageHeight'+imageHeight);
......@@ -283,32 +375,34 @@ function changePdfOptions(json, edit) {
pdflist += '<canvas id="Canvas" width="' + imageWidth + '" height="' + imageHeight + '" style=" background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:' + imageWidth + 'px ' + imageHeight + 'px; position: relative; z-index: 10; margin-top:' + imgTop + '%; display: block; margin-left: auto; margin-right: auto; border-style: solid; border-width:1px; background-size:' + imageWidth + 'px ' + imageHeight + 'px"></canvas><div id="pdfPreviewInner" style=" position: relative; top: -' + imageHeight + 'px;"></div></div>';
pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>';
pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">';
setPage(json[0].pages);
for (i = 0; i < json.length; ++i) {
var example = json[0].folder + '/' + json[i].example;
if (json[i].change_type == "textflow") {
pdfChange += json[i].names + ': <textarea onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontent' + [f] + '" class="textarea required" value="' + json[i].content + '" name="content[' + i + ']">' + json[i].content + '</textarea>';
pdfChange += json[i].names + ': <textarea onfocusout="HideBox(\'textflow\')" onfocus="setPageChangeOn(\''+json[i].pages+'\'),ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontent' + [f] + '" class="textarea required" value="' + json[i].content + '" name="content[' + i + ']">' + json[i].content + '</textarea>';
++f;
pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>';
}
if (json[i].change_type == "text") {
pdfChange += json[i].names + ': <input onfocusout="HideBox()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontent[' + i + ']" type="text" class="required" name="content[' + i + ']" value="' + json[i].content + '"">';
pdfChange += json[i].names + ': <input onfocusout="HideBox(\'text\')" onfocus="setPageChangeOn(\''+json[i].pages+'\'),ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontent[' + i + ']" type="text" class="required" name="content[' + i + ']" value="' + json[i].content + '"">';
pdfChange += '<span class="tip" id="span' + i + '">' + json[i].tips + '</span><br/>';
}
if (json[i].change_type == "img") {
if (edit == true) {
pdfChange += '<input value="' + json[i].content + '" tabindex="-1" class="required" id="hiddenchangescontent[' + i + ']" type="hidden" name="content[' + i + ']" >';
pdfChange += json[i].names + ':<label onfocusout="HideBox(\'file\')" onfocus=" ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input tabindex="-1" class="fileupload upload" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button">' + json[i].content + '</span><strong>Browse</strong></span></label>';
pdfChange += json[i].names + ':<label onfocusout="HideBox(\'file\')" onfocus="setPageChangeOn(\''+json[i].pages+'\'),ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input tabindex="-1" class="fileupload upload" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button">' + json[i].content + '</span><strong>Browse</strong></span></label>';
} else {
pdfChange += json[i].names + ':<label onfocusout="HideBox(\'file\')" onfocus=" ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input value="' + json[i].content + '" tabindex="-1" class="fileupload upload required" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button">' + json[i].content + '</span><strong>Browse</strong></span></label>';
pdfChange += json[i].names + ':<label onfocusout="HideBox(\'file\')" onfocus="setPageChangeOn(\''+json[i].pages+'\'), ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input value="' + json[i].content + '" tabindex="-1" class="fileupload upload required" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button">' + json[i].content + '</span><strong>Browse</strong></span></label>';
}
pdfChange += '<span class="tip" id="span' + i + '">' + json[i].tips + '</span><br/>';
pdfChange += '<span class="tip" id="span' + i + '">' + json[i].tips + '</span><br/>';
}
if (json[i].change_type == "date") {
pdfChange += json[i].names + ': <input onfocusout="HideBoxwithdate()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontentdate" type="text" class="required date" name="content[' + i + ']" value="' + json[i].content + '"">';
pdfChange += '<span class="tip" id="span' + i + '"> </span><br/>';
pdfChange += json[i].names + ': <input onfocusout="HideBoxwithdate(\'date\')" onfocus="setPageChangeOn(\''+json[i].pages+'\'),ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontentdate" type="text" class="required date" name="content[' + i + ']" value="' + json[i].content + '"">';
pdfChange += '<span class="tip" id="span' + i + '"> </span><br/>';
}
if (json[i].change_type == "user") {
......@@ -320,8 +414,8 @@ function changePdfOptions(json, edit) {
} else {
var content_string = json[i].content;
}
pdfChange += json[i].names + ': <input onfocusout="HideBox()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontent[' + i + ']" type="text" class="required" name="content[' + i + ']" value="' + content_string + '"">';
pdfChange += '<span class="tip" id="span' + i + '">' + json[i].tips + '</span><br/>';
pdfChange += json[i].names + ': <input onfocusout="HideBox()" onfocus="ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="changescontent[' + i + ']" type="text" class="required" name="content[' + i + ']" value="' + content_string + '"">';
pdfChange += '<span class="tip" id="span' + i + '">' + json[i].tips + '</span><br/>';
}
......@@ -335,7 +429,7 @@ function changePdfOptions(json, edit) {
strVar2 += '';
strVar2 += '';
strVar2 += '</div><div id="wrapper" class="black small-up-2 medium-up-3 large-up-3" style="height:' + windowHBG + 'px;"> <a class="closeEditer"><i class="fa fa-times fa-1x"></i></a>';
strVar2 += pdflist + '<div id="changesColumn" style="height:' + windowHBG + 'px;" class="column" >' + pdfChange + '<div id="tezingLogo"></div><div id="controls"></div></div><div id="pdfFooter"></div></div>';
strVar2 += pdflist + '<div id="changesColumn" style="height:' + windowHBG + 'px;" class="column" >' + pdfChange + '<div id="tezingLogo"></div><div id="controls"></div></div></div>';
document.getElementById('contentAreaOver').innerHTML = strVar2;
......@@ -347,43 +441,8 @@ function changePdfOptions(json, edit) {
//document.getElementById('google_drive').innerHTML = " ";
}
var tinymces = tinymce.init({
selector: '.textarea',
entity_encoding: "raw",
menubar: false,
toolbar: ' bold italic',
remove_linebreaks: false,
remove_trailing_brs: false,
init_instance_callback: function(editor) {
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "0px solid #131212";
editorDocContent.body.style.backgroundColor = "#131212";
editorDocContent.body.style.color = "#ccc";
},
setup: function(editor) {
editor.on('focus', function(e) {
//console.log(editor.id);
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "2px solid #F7A800";
$('#' + editor.id).trigger("onfocus");
//$(this).css('border', '2px solid #F7A800 !important');
});
editor.on('blur', function(e) {
//console.log('out' + editor.id);
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "2px solid #131212";
//$(this).css('border', '0px solid #F7A800 !important');
HideBox();
});
}
});
setTinyMce();
$('.closeEditer').click(function() {
$("#contentAreaOver").slideToggle(function() {
......@@ -442,68 +501,13 @@ function changePdfOptions(json, edit) {
if (el.id)
document.getElementById(el.id).value = el.getContent();
//$('#changes').hide();
tinymce.get(el.id).remove();
});
var ids = [];
if (edit == true) {
$("#changes input[type=file]").each(function() {
if ($(this).get(0).files.length == 0) {
document.getElementById(this.id).remove();
} else {
console.log("hidden" + this.id);
document.getElementById("hidden" + this.id).remove();
}
});
}
var form = $("#changes");
//console.log(form);
returnfileOptions(imagefiles, form, preview = true);
var tinymces = tinymce.init({
selector: '.textarea',
entity_encoding: "raw",
menubar: false,
toolbar: ' bold italic',
remove_linebreaks: false,
remove_trailing_brs: false,
init_instance_callback: function(editor) {
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "0px solid #131212";
editorDocContent.body.style.backgroundColor = "#131212";
editorDocContent.body.style.color = "#ccc";
},
setup: function(editor) {
editor.on('focus', function(e) {
//console.log(editor.id);
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "2px solid #F7A800";
$('#' + editor.id).trigger("onfocus");
//$(this).css('border', '2px solid #F7A800 !important');
});
editor.on('blur', function(e) {
//console.log('out' + editor.id);
var editorDoc = document.getElementById(editor.id + '_ifr');
var editorDocContent = editorDoc.contentDocument;
editorDoc.style.border = "2px solid #131212";
//$(this).css('border', '0px solid #F7A800 !important');
HideBox();
});
}
});
$("#changes").validate().cancelSubmit = true;
......@@ -539,6 +543,7 @@ function changePdfOptions(json, edit) {
});
}
var form = $("#changes");
//console.log(form);
returnfileOptions(imagefiles, form, preview = false);
......@@ -599,6 +604,18 @@ function returnOptions(form, preview) {
$.getJSON(pdf_customizer + "/api/v1/get-pdf/" + id.value, function(dataReturnd) {
var content = [];
for (e = 0; e < form[0].length; ++e) {
if(form[0][e].type != 'button'){
content.push(JSON.stringify(form[0][e].value));
}
}
// Get the element with id summary and set the inner text to the result.
var json = dataReturnd;
......@@ -606,61 +623,70 @@ function returnOptions(form, preview) {
var jsonReturn = '{"pdf":[{"name":"' + json[0].name + '", "folder":"' + json[0].folder + '", "pdfLocation":"' + json[0].file + '","pageWidth":"' + json[0].pwidth + '","pageHeight":"' + json[0].pheight + '", "custId":"' + user_id + '"}],"changes":['
var e = 1;
var o = 1;
for (i = 0; i < json.length; ++i) {
var e = 1;
for (i = 0; i < json.length; ++i) {
var style = JSON.stringify(json[i].style);
var content = JSON.stringify(form[0][e].value);
//console.log(form[0][e].value);
//console.log(json[i].label+' '+json[i].order);
if (content != '""') {
if (content[e] != '""') {
if (o !== 1) {
jsonReturn += ',';
}
jsonReturn += '{"label":"' + json[i].label + '", "locationUp":"' + json[i].locationUp + '", "locationRight":"' + json[i].locationRight + '","width":"' + json[i].width + '","height":"' + json[i].height + '", "pages":"' + json[i].pages + '", "content":' + content + ', "z-index":null, "idstylesPDF":"' + json[i].idstylesPDF + '", "style":' + style + ', "names":"' + json[i].names + '", "example":"' + json[i].example + '", "tips":"' + json[i].tips + '", "order":"' + json[i].order + '", "idchange_typePDF":"' + json[i].idchange_typePDF + '", "change_type":"' + json[i].change_type + '", "fileLocation":"' + pluginUrl + '/wp-content/uploads/pdf/"}';
jsonReturn += '{"label":"' + json[i].label + '", "locationUp":"' + json[i].locationUp + '", "locationRight":"' + json[i].locationRight + '","width":"' + json[i].width + '","height":"' + json[i].height + '", "pages":"' + json[i].pages + '", "content":' + content[e] + ', "z-index":null, "idstylesPDF":"' + json[i].idstylesPDF + '", "style":' + style + ', "names":"' + json[i].names + '", "example":"' + json[i].example + '", "tips":"' + json[i].tips + '", "order":"' + json[i].order + '", "idchange_typePDF":"' + json[i].idchange_typePDF + '", "change_type":"' + json[i].change_type + '", "fileLocation":"' + pluginUrl + '/wp-content/uploads/pdf/"}';
++o
};
++e
++e
}
jsonReturn += ' ]}';
if (preview == false) { url = 'update';
} else { url = 'preview';}
var windowWidth = 0.90 * $(".layout-grid").width();
var windowHeight = 0.90 * $(".layout-grid").height();
$.ajax({
url: "" + pdf_customizer + "/api/" + url,
type: "POST",
dataType: 'json',
data: jsonReturn,
contentType: "application/json",
CrossDomain: true,
success: function(data) {
var windowHBG = 0.923 * $(window).height();
var pwidth = parseInt(json[0].pwidth);
var pheight = parseInt(json[0].pheight);
finalPdf(data, json)
},
error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
alert(xhr.status);
document.getElementById('pdfPreview').innerHTML = xhr.responseText;
}
});
});
});
}
function finalPdf(data, json) {
jQuery(function($) {
//console.log( windowWidth+' '+windowHeight);
//console.log( pwidth+' '+pheight);
if (pwidth > pheight) {
//console.log('wide')
var scaleImage = windowWidth / pwidth;
var imageHeight = pheight * scaleImage;
var imageWidth = windowWidth;
var imgLeft = 0;
var imgTop = 40;
} else {
var scaleImage = windowHeight / pheight;
var imageHeight = windowHeight;
var imageWidth = pwidth * scaleImage;
var imgLeft = 30;
var imgTop = 2;
var url;
}
// console.log(jsonReturn);
if (preview == false) {
......@@ -676,20 +702,8 @@ function returnOptions(form, preview) {
$('#controls').hide();
$('#pdfPreviewInner').show();
$.ajax({
url: "" + pdf_customizer + "/api/" + url,
type: "POST",
dataType: 'json',
data: jsonReturn,
contentType: "application/json",
CrossDomain: true,
success: function(data) {
var strVar2 = ""
strVar2 += '<div id="seepdf" style=" width:' + imageWidth + 'px; height: ' + imageHeight + 'px; overflow: hidden;" ><embed src="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '#page=1&toolbar=0&navpanes=0&scrollbar=0statusbar=0" width="' + imageWidth + '" height="' + imageHeight + '" type="application/pdf" id="pdfloaded"><div id="holddf" style="opacity: 0.0;"></div> </div>';
strVar2 += '<div id="seepdf" style=" width:' + imageWidth + 'px; height: ' + imageHeight + 'px; overflow: hidden;" ><embed src="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '#page='+setpage+'&toolbar=0&navpanes=0&scrollbar=0statusbar=0" width="' + imageWidth + '" height="' + imageHeight + '" type="application/pdf" id="pdfloaded"></div>';
document.getElementById('pdfPreviewInner').innerHTML = strVar2;
var strVar3 = '<div id="button"><input id="editMe" type="submit" value="Edit"><a href="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '" download="' + json[0].file + '" ><input id="downloadMe" type="submit" value="Download"></a> </div>';
......@@ -699,13 +713,13 @@ function returnOptions(form, preview) {
color: "rgba(0, 0, 0, 0.9)"
});
$('#Canvas').LoadingOverlay("show");
$('#Canvas').delay(600).queue(function() {
$('#Canvas').delay(500).queue(function() {
$(this).css("background-image", "");
});
setTimeout(function() {
$('#Canvas').LoadingOverlay("hide", true);
}, 600);
}, 500);
if (preview == false) {
$('#controls').show();
......@@ -719,22 +733,15 @@ function returnOptions(form, preview) {
$('#changes').show();
$("#Canvas").show();
$("#Canvas").css('z-index', '10');
});
$('#downloadMe').click(function() {
$(".closeEditer").click();
});
},
error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
alert(xhr.status);
document.getElementById('pdfPreview').innerHTML = xhr.responseText;
}
});
});
});
});
}
\ No newline at end of file
}
......