0b793245 by Jeff Balicki

commit

1 parent c67ac37d
1 //var pluginUrl = "http://localhost:8888/Forms"; 1 var pluginUrl = "http://localhost:8888/Forms";
2 //var pdf_customizer = "http://localhost:8888/pdf-customizer/public"; 2 var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
3 3
4 4
5 var pluginUrl = "http://contact.gotenzing.com"; 5 //var pluginUrl = "http://contact.gotenzing.com";
6 var pdf_customizer = "http://pdf-customizer.synapsus.co"; 6 //var pdf_customizer = "http://pdf-customizer.synapsus.co";
7 7
8 function getAuth() { 8 function getAuth() {
9 jQuery(document).ready(function($) { 9 jQuery(document).ready(function($) {
...@@ -75,13 +75,13 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) { ...@@ -75,13 +75,13 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
75 var scaleRight = right * scaleW; 75 var scaleRight = right * scaleW;
76 var scalewidth = width * scaleW; 76 var scalewidth = width * scaleW;
77 var scaleheight = height * scaleH; 77 var scaleheight = height * scaleH;
78 var radius = '50'; 78
79 var c = document.getElementById("Canvas"); 79 var c = document.getElementById("Canvas");
80 var ctx = c.getContext("2d"); 80 var ctx = c.getContext("2d");
81 ctx.save(); 81 ctx.save();
82 ctx.lineWidth=2; 82 ctx.lineWidth=2;
83 ctx.strokeStyle="#F7A800"; 83 ctx.strokeStyle="#F7A800";
84 ctx.roundRect(scaleRight, scaleDown, scalewidth, scaleheight, 20).stroke(); 84 ctx.roundRect(scaleRight, scaleDown, scalewidth, scaleheight, 5).stroke();
85 //ctx.rect(scaleRight, scaleDown, scalewidth, scaleheight ); 85 //ctx.rect(scaleRight, scaleDown, scalewidth, scaleheight );
86 //console.log(scaleRight, scaleDown, scalewidth, scaleheight); 86 //console.log(scaleRight, scaleDown, scalewidth, scaleheight);
87 //console.log($("Canvas").height(), $("Canvas").width(), scaleW, scaleH); 87 //console.log($("Canvas").height(), $("Canvas").width(), scaleW, scaleH);
...@@ -196,12 +196,12 @@ function changePdfOptions(json) { ...@@ -196,12 +196,12 @@ function changePdfOptions(json) {
196 196
197 var scaleImage = 400 / json[0].pwidth; 197 var scaleImage = 400 / json[0].pwidth;
198 var imageHeight = json[0].pheight * scaleImage; 198 var imageHeight = json[0].pheight * scaleImage;
199 var imageWidth = '400'; 199 var imageWidth = 400;
200 console.log(json[0].pheight, scaleImage, imageHeight); 200 console.log(json[0].pheight, scaleImage, imageHeight);
201 201
202 pdflist += '<div id="pdfPreview" class="column">'; 202 pdflist += '<div id="pdfPreview" class="column">';
203 // pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">'; 203 // pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">';
204 pdflist += '<canvas id="Canvas" width="' + imageWidth + '" height="' + imageHeight + '" style=" margin-top:60px; border-style: solid; border-width:1px; background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:' + imageWidth + 'px ' + imageHeight + 'px"></div>'; 204 pdflist += '<canvas id="Canvas" width="' + imageWidth + '" height="' + imageHeight + '" style=" margin-top:30px; border-style: solid; border-width:1px; background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:' + imageWidth + 'px ' + imageHeight + 'px"></div>';
205 pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>'; 205 pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>';
206 pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">'; 206 pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">';
207 for (i = 0; i < json.length; ++i) { 207 for (i = 0; i < json.length; ++i) {
...@@ -233,48 +233,12 @@ function changePdfOptions(json) { ...@@ -233,48 +233,12 @@ function changePdfOptions(json) {
233 strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>'; 233 strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>';
234 strVar2 += ''; 234 strVar2 += '';
235 strVar2 += ' </div></div><div id="wrapper" class="black small-up-2 medium-up-3 large-up-3">'; 235 strVar2 += ' </div></div><div id="wrapper" class="black small-up-2 medium-up-3 large-up-3">';
236 strVar2 += pdflist + '<div id="changesColumn" style="height:' + $("#changes").height() + ';" class="column" >' + pdfChange + '<div id="tezingLogo"></div></div><div id="pdfFooter"></div></div>'; 236 strVar2 += pdflist + '<div id="changesColumn" class="column" >' + pdfChange + '<div id="tezingLogo"></div></div><div id="pdfFooter"></div></div>';
237 237
238 document.getElementById('contentArea').innerHTML = strVar2; 238 document.getElementById('contentArea').innerHTML = strVar2;
239 document.getElementById('google_drive').innerHTML = " "; 239 document.getElementById('google_drive').innerHTML = " ";
240 240
241 if ($(window).width() > 700) {
242
243 $('#pdfPreview').css('position', 'relative');
244 var stickySidebar = $('#pdfPreview');
245
246 if (stickySidebar.length > 0) {
247 var stickyHeight = stickySidebar.height(),
248 sidebarTop = stickySidebar.offset().top;
249 }
250
251 // on scroll move the sidebar
252 $(window).scroll(function() {
253 if (stickySidebar.length > 0) {
254 var scrollTop = $(window).scrollTop();
255
256 if (sidebarTop < scrollTop) {
257 stickySidebar.css('top', scrollTop - sidebarTop);
258 241
259 // stop the sticky sidebar at the footer to avoid overlapping
260 var sidebarBottom = stickySidebar.offset().top + stickyHeight,
261 stickyStop = $('#changesColumn').offset().top + $('#changesColumn').height();
262 if (stickyStop < sidebarBottom) {
263 var stopPosition = $('#changesColumn').height() - stickyHeight;
264 stickySidebar.css('top', stopPosition);
265 }
266 } else {
267 stickySidebar.css('top', '0');
268 }
269 }
270 });
271
272 $(window).resize(function() {
273 if (stickySidebar.length > 0) {
274 stickyHeight = stickySidebar.height();
275 }
276 });
277 }
278 242
279 var tinymces = tinymce.init({ 243 var tinymces = tinymce.init({
280 selector: '.textarea', 244 selector: '.textarea',
...@@ -298,7 +262,7 @@ function changePdfOptions(json) { ...@@ -298,7 +262,7 @@ function changePdfOptions(json) {
298 var editorDocContent = editorDoc.contentDocument; 262 var editorDocContent = editorDoc.contentDocument;
299 editorDoc.style.border = "2px solid #F7A800"; 263 editorDoc.style.border = "2px solid #F7A800";
300 264
301 //$('#' + editor.id).trigger("focus"); 265 $('#' + editor.id).trigger("onfocus");
302 //$(this).css('border', '2px solid #F7A800 !important'); 266 //$(this).css('border', '2px solid #F7A800 !important');
303 }); 267 });
304 editor.on('blur', function(e) { 268 editor.on('blur', function(e) {
...@@ -308,7 +272,7 @@ function changePdfOptions(json) { ...@@ -308,7 +272,7 @@ function changePdfOptions(json) {
308 editorDoc.style.border = "2px solid #131212"; 272 editorDoc.style.border = "2px solid #131212";
309 273
310 //$(this).css('border', '0px solid #F7A800 !important'); 274 //$(this).css('border', '0px solid #F7A800 !important');
311 //HideBox(); 275 HideBox();
312 }); 276 });
313 } 277 }
314 }); 278 });
......