aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/_toDelete/html-document.js (renamed from js/document/html-document.js)147
-rwxr-xr-xjs/document/_toDelete/text-document.js (renamed from js/document/text-document.js)0
-rwxr-xr-xjs/document/document-html.js469
-rwxr-xr-xjs/document/document-text.js57
-rwxr-xr-xjs/document/helpers/url-parser.js86
-rwxr-xr-xjs/document/helpers/webgl-helper.js218
-rwxr-xr-xjs/document/models/base.js214
-rwxr-xr-xjs/document/models/html.js76
-rwxr-xr-xjs/document/models/text.js57
-rw-r--r--js/document/templates/app/main.js (renamed from js/document/templates/montage-web/main.reel/main.js)18
-rwxr-xr-xjs/document/templates/app/package.json (renamed from js/document/templates/montage-html/package.json)1
-rwxr-xr-xjs/document/templates/banner/index.html108
-rwxr-xr-xjs/document/templates/html/index.html83
-rwxr-xr-xjs/document/templates/montage-html/default_html.css74
-rwxr-xr-xjs/document/templates/montage-html/index.html48
-rw-r--r--js/document/templates/montage-html/main.reel/main.js48
-rwxr-xr-xjs/document/templates/montage-web/default_html.css28
-rwxr-xr-xjs/document/templates/montage-web/index.html38
-rwxr-xr-xjs/document/templates/montage-web/package.json8
-rwxr-xr-xjs/document/templates/preview/banner.html64
-rwxr-xr-xjs/document/views/base.js48
-rwxr-xr-xjs/document/views/code.js142
-rwxr-xr-xjs/document/views/design.js431
23 files changed, 1710 insertions, 753 deletions
diff --git a/js/document/html-document.js b/js/document/_toDelete/html-document.js
index fc803c49..1bb643ac 100755
--- a/js/document/html-document.js
+++ b/js/document/_toDelete/html-document.js
@@ -208,8 +208,8 @@ exports.HTMLDocument = Montage.create(TextDocument, {
208 { 208 {
209 /* 209 /*
210 // Use this code to test the runtime version of WebGL 210 // Use this code to test the runtime version of WebGL
211 var cdm = new NinjaCvsRt.CanvasDataManager(); 211 var cvsDataMngr = Object.create(NinjaCvsRt.CanvasDataManager, {});
212 cdm.loadGLData(elt, value, null ); 212 cvsDataMngr.loadGLData(elt, value);
213 */ 213 */
214 214
215 // /* 215 // /*
@@ -453,55 +453,6 @@ exports.HTMLDocument = Montage.create(TextDocument, {
453 } 453 }
454 }, 454 },
455 455
456 /**
457 * Return the specified inline attribute from the element.
458 */
459 GetElementAttribute: {
460 value: function(element, attribute) {
461
462 var value;
463
464 if(attribute === "src") {
465 return element[attribute].replace(window.location.href, '');
466 }
467
468 value = element[attribute];
469
470 if(value !== undefined) return value;
471// if(value || value === false) return [value, "inline"];
472
473 // 3.
474 //value = this._document.defaultView.getComputedStyle(element,null).getPropertyValue(attribute);
475 //if(value) return value;
476
477 return null;
478 }
479 },
480
481 GetElementStyle: {
482 value: function(element, style) {
483// return this._queryStylesheets(element, style);
484 }
485 },
486
487 SetStyle: {
488 value: function(type, selector, style, value) {
489 try {
490 for(var j=0; j<this._stylesheets.length;j++){
491 for(var i=0; i<this._stylesheets[j].cssRules.length;i++) {
492 if(this._stylesheets[j].cssRules[i].selectorText === type + selector) {
493 this._stylesheets[j].cssRules[i].style[style] = value;
494
495 return true;
496 }
497 }
498 }
499 } catch(err) {
500 console.log("Cannot change the style of selector: " + selector + " " + err);
501 }
502 }
503 },
504
505 GetElementFromPoint: { 456 GetElementFromPoint: {
506 value: function(x, y) { 457 value: function(x, y) {
507 return this._window.getElement(x,y); 458 return this._window.getElement(x,y);
@@ -918,97 +869,5 @@ exports.HTMLDocument = Montage.create(TextDocument, {
918 //Error 869 //Error
919 } 870 }
920 } 871 }
921 }, 872 }
922 ////////////////////////////////////////////////////////////////////
923 saveAppState:{
924 enumerable: false,
925 value: function () {
926
927 this.savedLeftScroll = this.application.ninja.stage._iframeContainer.scrollLeft;
928 this.savedTopScroll = this.application.ninja.stage._iframeContainer.scrollTop;
929
930 this.gridHorizontalSpacing = this.application.ninja.stage.drawUtils.gridHorizontalSpacing;
931 this.gridVerticalSpacing = this.application.ninja.stage.drawUtils.gridVerticalSpacing;
932
933 if(typeof this.application.ninja.selectedElements !== 'undefined'){
934 this.selectionModel = this.application.ninja.selectedElements.slice(0);
935 }
936
937 this.draw3DGrid = this.application.ninja.appModel.show3dGrid;
938
939 //persist a clone of history per document
940 this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0);
941 this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0);
942 this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start
943
944 //pause videos on switching or closing the document, so that the browser does not keep downloading the media data
945 this.pauseVideos();
946 }
947 },
948
949 ////////////////////////////////////////////////////////////////////
950 restoreAppState:{
951 enumerable: false,
952 value: function () {
953 this.application.ninja.stage.drawUtils.gridHorizontalSpacing = this.gridHorizontalSpacing;
954 this.application.ninja.stage.drawUtils.gridVerticalSpacing = this.gridVerticalSpacing;
955
956 if((this.savedLeftScroll !== null) && (this.savedTopScroll !== null)){
957 this.application.ninja.stage._iframeContainer.scrollLeft = this.savedLeftScroll;
958 this.application.ninja.stage._iframeContainer.scrollTop = this.savedTopScroll;
959 this.application.ninja.stage.handleScroll();
960 }
961
962 this.application.ninja.currentSelectedContainer = this.documentRoot;
963 if(this.selectionModel){
964 this.application.ninja.selectedElements = this.selectionModel.slice(0);
965 }
966
967 this.application.ninja.appModel.show3dGrid = this.draw3DGrid;
968
969 this.application.ninja.undocontroller.undoQueue = this.undoStack.slice(0);
970 this.application.ninja.undocontroller.redoQueue = this.redoStack.slice(0);
971
972
973 }
974 },
975 ////////////////////////////////////////////////////////////////////
976 /**
977 *pause videos on switching or closing the document, so that the browser does not keep downloading the media data
978 */
979 pauseVideos:{
980 value:function(){
981 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
982 for(i=0;i<videosArr.length;i++){
983 if(!videosArr[i].paused){
984 videosArr[i].pause();
985 }
986 }
987 }
988 },
989
990 /**
991 * remove the video src on closing the document, so that the browser does not keep downloading the media data, if the tag does not get garbage collected
992 *removeSrc : boolean to remove the src if the video... set only in the close document flow
993 */
994 stopVideos:{
995 value:function(){
996 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
997 for(i=0;i<videosArr.length;i++){
998 videosArr[i].src = "";
999 }
1000 }
1001 },
1002 pauseAndStopVideos:{
1003 value:function(){
1004 var videosArr = this.documentRoot.getElementsByTagName("video"), i=0;
1005 for(i=0;i<videosArr.length;i++){
1006 if(!videosArr[i].paused){
1007 videosArr[i].pause();
1008 }
1009 videosArr[i].src = "";
1010 }
1011 }
1012 }
1013 ////////////////////////////////////////////////////////////////////
1014}); \ No newline at end of file 873}); \ No newline at end of file
diff --git a/js/document/text-document.js b/js/document/_toDelete/text-document.js
index 2574b67c..2574b67c 100755
--- a/js/document/text-document.js
+++ b/js/document/_toDelete/text-document.js
diff --git a/js/document/document-html.js b/js/document/document-html.js
index 89717dd6..c60a12a2 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -6,361 +6,172 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
6 6
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component; 10 Component = require("montage/ui/component").Component,
11 HtmlDocumentModel = require("js/document/models/html").HtmlDocumentModel; 11 HtmlDocumentModel = require("js/document/models/html").HtmlDocumentModel,
12 DesignDocumentView = require("js/document/views/design").DesignDocumentView;
12//////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////
13// 14//
14exports.HtmlDocument = Montage.create(Component, { 15exports.HtmlDocument = Montage.create(Component, {
15 //////////////////////////////////////////////////////////////////// 16 ////////////////////////////////////////////////////////////////////