cf17c7ab by Jeff Balicki

js changes

1 parent 7dbc1e0c
1 //var pluginUrl = "http://localhost:8888/Forms"; 1 var pluginUrl = window.location.protocol+'//'+window.location.host;
2 //var pdf_customizer = "http://localhost:8888/pdf-customizer/public"; 2 var pdf_customizer = "http://pdf-customizer.synapsus.co";
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 8
9 var imageHeight=""; 9 var imageHeight="";
...@@ -87,7 +87,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) { ...@@ -87,7 +87,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
87 var ctx = c.getContext("2d"); 87 var ctx = c.getContext("2d");
88 ctx.save(); 88 ctx.save();
89 ctx.lineWidth=2; 89 ctx.lineWidth=2;
90 ctx.strokeStyle="#F7A800"; 90 ctx.strokeStyle= $('.callout').css("background-color")
91 ctx.roundRect(scaleRight, scaleDown, scalewidth, scaleheight, 5).stroke(); 91 ctx.roundRect(scaleRight, scaleDown, scalewidth, scaleheight, 5).stroke();
92 //ctx.rect(scaleRight, scaleDown, scalewidth, scaleheight ); 92 //ctx.rect(scaleRight, scaleDown, scalewidth, scaleheight );
93 //console.log(scaleRight, scaleDown, scalewidth, scaleheight); 93 //console.log(scaleRight, scaleDown, scalewidth, scaleheight);
...@@ -179,7 +179,7 @@ function pickPdfFromList(json) { ...@@ -179,7 +179,7 @@ function pickPdfFromList(json) {
179 pdflist += "</div>"; 179 pdflist += "</div>";
180 } 180 }
181 181
182 strVar += ' <div class="callout primary"><div class="row column"> <h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>'; 182 strVar += ' <div id="callout" class="callout primary"><div class="row column"> <h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>';
183 strVar += '</div></div></div><div id="contentAreaOver"></div> '; 183 strVar += '</div></div></div><div id="contentAreaOver"></div> ';
184 document.getElementById('contentArea').innerHTML = strVar; 184 document.getElementById('contentArea').innerHTML = strVar;
185 }); 185 });
...@@ -230,20 +230,23 @@ function changePdfOptions(json, edit) { ...@@ -230,20 +230,23 @@ function changePdfOptions(json, edit) {
230 var pdfChange = ""; 230 var pdfChange = "";
231 var f = 0; 231 var f = 0;
232 232
233 var windowWidth = 0.68 * $(window).width(); 233 var windowWidth = 0.90 * $(".layout-grid").width();
234 var windowHeight = 0.86 * $(window).height(); 234 var windowHeight = 0.90 * $(".layout-grid").height();
235
235 236
236 var windowHBG = 0.923 * $(window).height(); 237 var windowHBG = 0.923 * $(window).height();
237 var pwidth = parseInt(json[0].pwidth); 238 var pwidth = parseInt(json[0].pwidth);
238 var pheight = parseInt(json[0].pheight); 239 var pheight = parseInt(json[0].pheight);
239 240
241 //console.log( windowWidth+' '+windowHeight);
242 //console.log( pwidth+' '+pheight);
240 if(pwidth > pheight){ 243 if(pwidth > pheight){
241 //console.log('wide') 244 //console.log('wide')
242 var scaleImage = windowWidth / pwidth; 245 var scaleImage = windowWidth / pwidth;
243 var imageHeight = pheight * scaleImage; 246 var imageHeight = pheight * scaleImage;
244 var imageWidth = windowWidth; 247 var imageWidth = windowWidth;
245 var imgLeft = 0; 248 var imgLeft = 0;
246 var imgTop = 25; 249 var imgTop = 40;
247 }else{ 250 }else{
248 var scaleImage = windowHeight / pheight; 251 var scaleImage = windowHeight / pheight;
249 var imageHeight = windowHeight; 252 var imageHeight = windowHeight;
...@@ -317,13 +320,13 @@ function changePdfOptions(json, edit) { ...@@ -317,13 +320,13 @@ function changePdfOptions(json, edit) {
317 init_instance_callback: function(editor) { 320 init_instance_callback: function(editor) {
318 var editorDoc = document.getElementById(editor.id + '_ifr'); 321 var editorDoc = document.getElementById(editor.id + '_ifr');
319 var editorDocContent = editorDoc.contentDocument; 322 var editorDocContent = editorDoc.contentDocument;
320 editorDoc.style.border = "2px solid #131212"; 323 editorDoc.style.border = "0px solid #131212";
321 editorDocContent.body.style.backgroundColor = "#131212"; 324 editorDocContent.body.style.backgroundColor = "#131212";
322 editorDocContent.body.style.color = "#ccc"; 325 editorDocContent.body.style.color = "#ccc";
323 }, 326 },
324 setup: function(editor) { 327 setup: function(editor) {
325 editor.on('focus', function(e) { 328 editor.on('focus', function(e) {
326 console.log(editor.id); 329 //console.log(editor.id);
327 330
328 var editorDoc = document.getElementById(editor.id + '_ifr'); 331 var editorDoc = document.getElementById(editor.id + '_ifr');
329 var editorDocContent = editorDoc.contentDocument; 332 var editorDocContent = editorDoc.contentDocument;
...@@ -333,7 +336,7 @@ function changePdfOptions(json, edit) { ...@@ -333,7 +336,7 @@ function changePdfOptions(json, edit) {
333 //$(this).css('border', '2px solid #F7A800 !important'); 336 //$(this).css('border', '2px solid #F7A800 !important');
334 }); 337 });
335 editor.on('blur', function(e) { 338 editor.on('blur', function(e) {
336 console.log('out' + editor.id); 339 //console.log('out' + editor.id);
337 var editorDoc = document.getElementById(editor.id + '_ifr'); 340 var editorDoc = document.getElementById(editor.id + '_ifr');
338 var editorDocContent = editorDoc.contentDocument; 341 var editorDocContent = editorDoc.contentDocument;
339 editorDoc.style.border = "2px solid #131212"; 342 editorDoc.style.border = "2px solid #131212";
...@@ -358,7 +361,7 @@ function changePdfOptions(json, edit) { ...@@ -358,7 +361,7 @@ function changePdfOptions(json, edit) {
358 $(".fileupload").change(function(e) { 361 $(".fileupload").change(function(e) {
359 var target = e.target; 362 var target = e.target;
360 files = e.target.files; 363 files = e.target.files;
361 console.log(files); 364 // console.log(files);
362 365
363 if(files.length >= 1) { 366 if(files.length >= 1) {
364 for (var i = 0, file; file = files[i]; i++) { 367 for (var i = 0, file; file = files[i]; i++) {
...@@ -418,7 +421,7 @@ function changePdfOptions(json, edit) { ...@@ -418,7 +421,7 @@ function changePdfOptions(json, edit) {
418 } 421 }
419 });} 422 });}
420 var form = $("#changes"); 423 var form = $("#changes");
421 console.log(form); 424 //console.log(form);
422 425
423 returnfileOptions(imagefiles, form); 426 returnfileOptions(imagefiles, form);
424 return false; 427 return false;
...@@ -501,8 +504,8 @@ function returnOptions(form) { ...@@ -501,8 +504,8 @@ function returnOptions(form) {
501 } 504 }
502 jsonReturn += ' ]}'; 505 jsonReturn += ' ]}';
503 506
504 var windowWidth = 0.68 * $(window).width(); 507 var windowWidth = 0.75 * $("#wrapper").width();
505 var windowHeight = 0.86 * $(window).height(); 508 var windowHeight = 0.75 * $("#wrapper").height();
506 509
507 var windowHBG = 0.923 * $(window).height(); 510 var windowHBG = 0.923 * $(window).height();
508 var pwidth = parseInt(json[0].pwidth); 511 var pwidth = parseInt(json[0].pwidth);
...@@ -554,7 +557,7 @@ function returnOptions(form) { ...@@ -554,7 +557,7 @@ function returnOptions(form) {
554 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>'; 557 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>';
555 document.getElementById('changes').innerHTML = strVar3; 558 document.getElementById('changes').innerHTML = strVar3;
556 559
557 //console.log(data); 560 // console.log(data);
558 561
559 // $('#changes').show(); 562 // $('#changes').show();
560 563
......