diff options
Diffstat (limited to 'js/document/templates/html')
-rwxr-xr-x | js/document/templates/html/index.html | 79 | ||||
-rw-r--r-- | js/document/templates/html/main.js | 57 | ||||
-rwxr-xr-x | js/document/templates/html/package.json | 10 |
3 files changed, 146 insertions, 0 deletions
diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html new file mode 100755 index 00000000..24159841 --- /dev/null +++ b/js/document/templates/html/index.html | |||
@@ -0,0 +1,79 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- <copyright> | ||
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
5 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
6 | </copyright> --> | ||
7 | |||
8 | |||
9 | <!-- | ||
10 | NOTE(s): | ||
11 | All elements in the head of the document to be exclude from I/O | ||
12 | must set the 'data-ninja-template' | ||
13 | data-ninja-template="true" | ||
14 | --> | ||
15 | |||
16 | <!-- TODO: Determine if loading Montage is always needed or if it could be done author-time or on file open --> | ||
17 | |||
18 | <html> | ||
19 | |||
20 | <head> | ||
21 | |||
22 | <style type="text/css" id="nj-stage-stylesheet" data-ninja-template="true"> | ||
23 | * { | ||
24 | -webkit-transition-duration: 0s !important; | ||
25 | -webkit-animation-duration: 0s !important; | ||
26 | -webkit-animation-name: none !important; | ||
27 | } | ||
28 | |||
29 | body { | ||
30 | margin: 0; | ||
31 | padding: 0; | ||
32 | position: absolute; | ||
33 | -webkit-transform-style: preserve-3d; | ||
34 | -webkit-transform: perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); | ||
35 | } | ||
36 | |||
37 | html { | ||
38 | overflow: scroll; | ||
39 | } | ||
40 | |||
41 | html, body { | ||
42 | width: 100%; | ||
43 | height: 100%; | ||
44 | } | ||
45 | |||
46 | ninjaloadinghack { | ||
47 | display: none; | ||
48 | } | ||
49 | |||
50 | .active-element-outline { | ||
51 | outline: #adff2f solid 2px; | ||
52 | } | ||
53 | |||
54 | .nj-preset-transition { | ||
55 | -webkit-transition: all 450ms linear !important; | ||
56 | } | ||
57 | </style> | ||
58 | |||
59 | <script type="text/javascript" data-ninja-template="true"> | ||
60 | function getElement(x,y) { | ||
61 | return document.elementFromPoint(x,y); | ||
62 | } | ||
63 | </script> | ||
64 | |||
65 | <script type="text/javascript" data-package="." src="../../../../node_modules/montage/montage.js" data-ninja-template="true"></script> | ||
66 | |||
67 | <script type="text/montage-serialization" data-ninja-template="true"> | ||
68 | { | ||
69 | "owner": { | ||
70 | "prototype": "main" | ||
71 | } | ||
72 | } | ||
73 | </script> | ||
74 | |||
75 | </head> | ||
76 | |||
77 | <body></body> | ||
78 | |||
79 | </html> \ No newline at end of file | ||
diff --git a/js/document/templates/html/main.js b/js/document/templates/html/main.js new file mode 100644 index 00000000..f45657bb --- /dev/null +++ b/js/document/templates/html/main.js | |||
@@ -0,0 +1,57 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | var Montage = require("montage/core/core").Montage, | ||
7 | Component = require("montage/ui/component").Component, | ||
8 | Template = require("montage/ui/template").Template, | ||
9 | TemplateCreator = require("tools/template/template-creator").TemplateCreator; | ||
10 | |||
11 | exports.Main = Montage.create(Component, { | ||
12 | |||
13 | hasTemplate: { | ||
14 | value: false | ||
15 | }, | ||
16 | |||
17 | /** | ||
18 | * Adding window hooks to callback into this object from Ninja. | ||
19 | */ | ||
20 | templateDidLoad: { | ||
21 | value: function(){ | ||
22 | var self = this; | ||
23 | // | ||
24 | window.addComponent = function(element, data, callback) { | ||
25 | var component; | ||
26 | |||
27 | component = require.async(data.path) | ||
28 | .then(function(component) { | ||
29 | var componentRequire = component[data.name]; | ||
30 | var componentInstance = componentRequire.create(); | ||
31 | |||
32 | componentInstance.element = element; | ||
33 | |||
34 | componentInstance.needsDraw = true; | ||
35 | componentInstance.ownerComponent = self; | ||
36 | |||
37 | callback(componentInstance, element); | ||
38 | }) | ||
39 | .end(); | ||
40 | |||
41 | }; | ||
42 | // | ||
43 | window.mjsTemplateCreator = TemplateCreator.create(); | ||
44 | // | ||
45 | window.mjsTemplate = Template.create(); | ||
46 | |||
47 | |||
48 | // Dispatch event when this template has loaded. | ||
49 | /* | ||
50 | var newEvent = document.createEvent( "CustomEvent" ); | ||
51 | newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); | ||
52 | document.body.dispatchEvent( newEvent ); | ||
53 | */ | ||
54 | |||
55 | } | ||
56 | } | ||
57 | }); \ No newline at end of file | ||
diff --git a/js/document/templates/html/package.json b/js/document/templates/html/package.json new file mode 100755 index 00000000..4f36090a --- /dev/null +++ b/js/document/templates/html/package.json | |||
@@ -0,0 +1,10 @@ | |||
1 | { | ||
2 | "directories": { | ||
3 | "lib": "" | ||
4 | }, | ||
5 | "mappings": { | ||
6 | "montage": "../../../../node_modules/montage/", | ||
7 | "tools": "../../../../node_modules/tools/", | ||
8 | "montage-google": "../../../../node_modules/montage-google/" | ||
9 | } | ||
10 | } \ No newline at end of file | ||