aboutsummaryrefslogtreecommitdiff
path: root/node_modules/montage/ui/popup/notifier.reel
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /node_modules/montage/ui/popup/notifier.reel
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/popup/notifier.reel')
-rwxr-xr-xnode_modules/montage/ui/popup/notifier.reel/notifier.css15
-rwxr-xr-xnode_modules/montage/ui/popup/notifier.reel/notifier.html35
-rwxr-xr-xnode_modules/montage/ui/popup/notifier.reel/notifier.js121
3 files changed, 171 insertions, 0 deletions
diff --git a/node_modules/montage/ui/popup/notifier.reel/notifier.css b/node_modules/montage/ui/popup/notifier.reel/notifier.css
new file mode 100755
index 00000000..fe44ed89
--- /dev/null
+++ b/node_modules/montage/ui/popup/notifier.reel/notifier.css
@@ -0,0 +1,15 @@
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
7.montage-notifier {
8 background-color: #333; /*#FFF1A8*/;
9 color: #fff;
10}
11
12.montage-notifier .montage-notifier-msg {
13 padding: 10px 20px;
14 text-overflow: ellipsis;
15}
diff --git a/node_modules/montage/ui/popup/notifier.reel/notifier.html b/node_modules/montage/ui/popup/notifier.reel/notifier.html
new file mode 100755
index 00000000..71cd2608
--- /dev/null
+++ b/node_modules/montage/ui/popup/notifier.reel/notifier.html
@@ -0,0 +1,35 @@
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<html>
8 <head>
9 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
10 <link rel="stylesheet" type="text/css" href="notifier.css">
11 <script type="text/montage-serialization">
12{
13 "owner": {
14 "module": "montage/ui/popup/notifier.reel",
15 "name": "Notifier",
16 "properties": {
17 "element": {
18 "#": "notifier-main"
19 },
20 "_msgEl": {
21 "#": "notifier-msg"
22 }
23 }
24 }
25}
26 </script>
27
28
29 </head>
30 <body>
31 <div id="notifier-main" class="montage-notifier">
32 <div id="notifier-msg" class="montage-notifier-msg"></div>
33 </div>
34 </body>
35</html>
diff --git a/node_modules/montage/ui/popup/notifier.reel/notifier.js b/node_modules/montage/ui/popup/notifier.reel/notifier.js
new file mode 100755
index 00000000..6346cd19
--- /dev/null
+++ b/node_modules/montage/ui/popup/notifier.reel/notifier.js
@@ -0,0 +1,121 @@
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
7/**
8 @module "montage/ui/popup/notifier.reel"
9 @requires montage/core/core
10 @requires montage/ui/component
11 @requires "montage/ui/popup/popup.reel"
12*/
13var Montage = require("montage").Montage;
14var Component = require("ui/component").Component;
15var Popup = require("ui/popup/popup.reel").Popup;
16
17/**
18 @class module:"montage/ui/popup/notifier.reel".Notifier
19 @extends module:montage/ui/component.Component
20 */
21
22var Notifier = exports.Notifier = Montage.create(Component, /** @lends module:"montage/ui/popup/notifier.reel".Notifier# */ {
23 hasTemplate: {value: true},
24
25 _msgEl: {value: null},
26/**
27 Description TODO
28 @private
29*/
30 _msg: {value: null},
31/**
32 Description TODO
33 @type {Function}
34 @default null
35 */
36 msg: {
37 get: function() {
38 return this._msg;
39 },
40 set: function(value) {
41 if (this._msg !== value) {
42 this._msg = value;
43 this.needsDraw = true;
44 }
45 }
46 },
47/**
48 Description TODO
49 @type {Property}
50 @default {String} null
51 */
52 details: {
53 value: null
54 },
55/**
56 Description TODO
57 @function
58 */
59 draw: {
60 value: function() {
61 this._msgEl.textContent = this.msg;
62 }
63 },
64
65 // Static method to show a Notify dialog
66 /**
67 Displays a small Growl-like notification in a pop-up dialog. The notification can have a timeout that determines how long it appears before being hidden automatically.
68 You can also specify the location of the notification in the browser window (top-left corner, by default).
69 @function
70 @param {String} msg A message to display in the notification.
71 @param {Number} timeout The number of milliseconds to display the notification before it is hidden.
72 @param {Object} Contains two properties named top and left that specify top and left coordinates of the notifiction. By default, notifications are positioned at the top-left corner of the window.
73 */
74 show: {
75 value: function(msg, timeout, position) {
76 var popup = this.application._notifyPopup, notifier;
77 if(!popup) {
78 popup = Popup.create();
79 this.popup = popup;
80 popup.type = 'notify';
81 popup.boxed = false;
82 this.application._notifyPopup = popup;
83
84 notifier = Notifier.create();
85 popup.content = notifier;
86 }
87 notifier = popup.content;
88 //popup.modal = !!modal;
89 notifier.msg = msg;
90
91 if (!position) {
92 // position at the top by default
93 var viewportWidth = window.innerWidth;
94 position = {
95 top: 1,
96 right: 10
97 };
98 }
99 popup.position = position;
100
101 if(timeout) {
102 timeout = parseInt(timeout, 10) || 3000;
103 popup.autoDismiss = timeout;
104 }
105
106 popup.show();
107
108
109 }
110 },
111
112 hide: {
113 value: function() {
114 var popup = this.application._notifyPopup;
115 if(popup) {
116 popup.hide();
117 }
118 }
119 }
120
121});