aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/gradientpicker.reel/gradientpicker.js2
-rwxr-xr-xjs/controllers/color-controller.js4
-rwxr-xr-xjs/controllers/document-controller.js9
-rwxr-xr-xjs/document/html-document.js97
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js10
-rw-r--r--js/mediators/io-mediator.js8
-rwxr-xr-xjs/panels/Color/colorpanelpopup.reel/colorpanelpopup.js13
-rwxr-xr-xjs/panels/Panel.reel/Panel.html20
-rwxr-xr-xjs/panels/Panel.reel/Panel.js4
-rwxr-xr-xjs/panels/PanelContainer.reel/PanelContainer.js77
-rw-r--r--js/panels/Timeline/Collapser.js70
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.html129
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js190
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.html14
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js560
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html136
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js138
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js10
18 files changed, 870 insertions, 621 deletions
diff --git a/js/components/gradientpicker.reel/gradientpicker.js b/js/components/gradientpicker.reel/gradientpicker.js
index 0940be3c..da4e8c0f 100755
--- a/js/components/gradientpicker.reel/gradientpicker.js
+++ b/js/components/gradientpicker.reel/gradientpicker.js
@@ -397,7 +397,7 @@ exports.GradientPicker = Montage.create(Component, {
397 actionEvent.initEvent(type, true, true); 397 actionEvent.initEvent(type, true, true);
398 actionEvent.type = type; 398 actionEvent.type = type;
399 actionEvent.wasSetByCode = userInitiated; 399 actionEvent.wasSetByCode = userInitiated;
400 actionEvent.gradient = {stops: this.value, mode: this.mode, css: css}; 400 actionEvent.gradient = {stops: this.value, mode: this.mode, gradientMode: this.mode, css: css};
401 this.dispatchEvent(actionEvent); 401 this.dispatchEvent(actionEvent);
402 } 402 }
403 } 403 }
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js
index a6e41dd3..53573baf 100755
--- a/js/controllers/color-controller.js
+++ b/js/controllers/color-controller.js
@@ -259,6 +259,7 @@ exports.ColorController = Montage.create(Component, {
259 //Radial gradient 259 //Radial gradient
260 gradient.stops = []; 260 gradient.stops = [];
261 gradient.mode = 'radial'; 261 gradient.mode = 'radial';
262 gradient.gradientMode = 'radial';
262 gradient.css = css; 263 gradient.css = css;
263 // 264 //
264 arr = css.split('%,'); 265 arr = css.split('%,');
@@ -284,6 +285,7 @@ exports.ColorController = Montage.create(Component, {
284 //Linear gradient 285 //Linear gradient
285 gradient.stops = []; 286 gradient.stops = [];
286 gradient.mode = 'linear'; 287 gradient.mode = 'linear';
288 gradient.gradientMode = 'linear';
287 gradient.css = css; 289 gradient.css = css;
288 // 290 //
289 arr = css.split('from('); 291 arr = css.split('from(');
@@ -317,7 +319,7 @@ exports.ColorController = Montage.create(Component, {
317 } 319 }
318 } 320 }
319 //Creating gradient object 321 //Creating gradient object
320 color = {mode: 'gradient', value: {stops: gradient.stops, mode: gradient.mode, css: css}}; 322 color = {mode: 'gradient', value: {stops: gradient.stops, mode: gradient.mode, gradientMode: gradient.gradientMode, css: css}};
321 } else if (css){ 323 } else if (css){
322 //Simple solid color 324 //Simple solid color
323 color = this.parseCssToColor(css); 325 color = this.parseCssToColor(css);
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 194496a6..a8056519 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -336,14 +336,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
336 nextDocumentIndex = closeDocumentIndex - 1; 336 nextDocumentIndex = closeDocumentIndex - 1;
337 } 337 }
338 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); 338 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]);
339 if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();}
339 this._removeDocumentView(doc.container); 340 this._removeDocumentView(doc.container);
340 }else if(this._documents.length === 0){ 341 }else if(this._documents.length === 0){
342 if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){
343 this.activeDocument.pauseAndStopVideos();
344 }
341 this.activeDocument = null; 345 this.activeDocument = null;
342 this._removeDocumentView(doc.container); 346 this._removeDocumentView(doc.container);
343 this.application.ninja.stage.stageView.hideRulers(); 347 this.application.ninja.stage.stageView.hideRulers();
344 document.getElementById("iframeContainer").style.display="block"; 348 document.getElementById("iframeContainer").style.display="block";
345 349
346 this.application.ninja.stage.hideCanvas(true); 350 this.application.ninja.stage.hideCanvas(true);
351 }else{//closing inactive document tab - just clear DOM
352 if(typeof doc.pauseAndStopVideos !== "undefined"){
353 doc.pauseAndStopVideos();
354 }
355 this._removeDocumentView(doc.container);
347 } 356 }
348 357
349 NJevent("closeDocument", doc.uri); 358 NJevent("closeDocument", doc.uri);
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 80930af2..23b55e92 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -437,8 +437,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
437 } else if (prop.indexOf('url') !== -1) { //From CSS property 437 } else if (prop.indexOf('url') !== -1) { //From CSS property
438 //TODO: Add functionality 438 //TODO: Add functionality
439 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/')); 439 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/'));
440 prop = prop.replace(/[^()\\""\\'']+/g, test); 440 prop = prop.replace(/[^()\\""\\'']+/g, cssUrlToNinjaUrl);
441 function test (s) { 441 function cssUrlToNinjaUrl (s) {
442 if (s !== 'url') { 442 if (s !== 'url') {
443 s = docRootUrl + s; 443 s = docRootUrl + s;
444 } 444 }
@@ -451,9 +451,12 @@ exports.HTMLDocument = Montage.create(TextDocument, {
451 // 451 //
452 function ninjaUrlPrepend (url) { 452 function ninjaUrlPrepend (url) {
453 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/')); 453 var docRootUrl = this.application.ninja.coreIoApi.rootUrl+escape((this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]).replace(/\/\//gi, '/'));
454 return '"'+docRootUrl+url.replace(/\"/gi, '')+'"'; 454 if (url.indexOf('data:image') !== -1) {
455 return url;
456 } else {
457 return '"'+docRootUrl+url.replace(/\"/gi, '')+'"';
458 }
455 } 459 }
456
457 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 460 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
458 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 461 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
459 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 462 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -570,8 +573,22 @@ exports.HTMLDocument = Montage.create(TextDocument, {
570 } 573 }
571 // 574 //
572 fileCouldDirUrl = this._document.styleSheets[i].href.split(this._document.styleSheets[i].href.split('/')[this._document.styleSheets[i].href.split('/').length-1])[0]; 575 fileCouldDirUrl = this._document.styleSheets[i].href.split(this._document.styleSheets[i].href.split('/')[this._document.styleSheets[i].href.split('/').length-1])[0];
573 prefixUrl = 'url('+fileCouldDirUrl; //This should be re-written with better RegEx 576
574 tag.innerHTML = cssData.content.replace(/url\(/gi, prefixUrl); 577 tag.innerHTML = cssData.content.replace(/url\(()(.+?)\1\)/g, detectUrl);
578
579 function detectUrl (prop) {
580 return prop.replace(/[^()\\""\\'']+/g, prefixUrl);;
581 }
582
583 function prefixUrl (url) {
584 if (url !== 'url') {
585 if (!url.match(/(\b(?:(?:https?|ftp|file|[A-Za-z]+):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gi)) {
586 url = fileCouldDirUrl+url;
587 }
588 }
589 return url;
590 }
591
575 //Looping through DOM to insert style tag at location of link element 592 //Looping through DOM to insert style tag at location of link element
576 query = this._templateDocument.html.querySelectorAll(['link']); 593 query = this._templateDocument.html.querySelectorAll(['link']);
577 for (var j in query) { 594 for (var j in query) {
@@ -600,12 +617,9 @@ exports.HTMLDocument = Montage.create(TextDocument, {
600 } 617 }
601 } 618 }
602 } 619 }
603
604
605
606
607 /* 620 /*
608//TODO: Figure out cross-domain XHR issue, might need cloud to handle 621
622 //TODO: Figure out cross-domain XHR issue, might need cloud to handle
609 var xhr = new XMLHttpRequest(); 623 var xhr = new XMLHttpRequest();
610 xhr.open("GET", this._document.styleSheets[i].href, true); 624 xhr.open("GET", this._document.styleSheets[i].href, true);
611 xhr.send(); 625 xhr.send();
@@ -613,20 +627,24 @@ exports.HTMLDocument = Montage.create(TextDocument, {
613 if (xhr.readyState === 4) { 627 if (xhr.readyState === 4) {
614 console.log(xhr); 628 console.log(xhr);
615 } 629 }
616*/
617 //tag.innerHTML = xhr.responseText //xhr.response; 630 //tag.innerHTML = xhr.responseText //xhr.response;
618 tag.innerHTML = 'noRULEjustHACK{background: #000}' 631 */
619 //Currently no external styles will load if unable to load via XHR request 632 //Temp rule so it's registered in the array
620 633 tag.innerHTML = 'noRULEjustHACK{background: #000}';
621 //Disabling external style sheets 634 //Disabling external style sheets
622 query = this._templateDocument.html.querySelectorAll(['link']); 635 query = this._templateDocument.html.querySelectorAll(['link']);
623 for (var k in query) { 636 for (var k in query) {