diff options
author | Valerio Virgillito | 2012-02-14 13:11:19 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-14 13:11:19 -0800 |
commit | 3eb735bdc9016b889e9066be680ebd9fbc0c60c0 (patch) | |
tree | 3119aa07bdde5aecc3af2d29ff67b83c48601e10 /js/components/about-box.reel/about-box.js | |
parent | df898049b2990f456a305eb18434b887468225cf (diff) | |
parent | 997ce3fb65f27b3d6f331f63b5dc22d3c7fb8f1e (diff) | |
download | ninja-3eb735bdc9016b889e9066be680ebd9fbc0c60c0.tar.gz |
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js/components/about-box.reel/about-box.js')
-rw-r--r-- | js/components/about-box.reel/about-box.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/js/components/about-box.reel/about-box.js b/js/components/about-box.reel/about-box.js new file mode 100644 index 00000000..1a0825ff --- /dev/null +++ b/js/components/about-box.reel/about-box.js | |||
@@ -0,0 +1,76 @@ | |||
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 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component, | ||
9 | Popup = require("montage/ui/popup/popup.reel").Popup; | ||
10 | |||
11 | var AboutBox = exports.AboutBox = Montage.create(Component, { | ||
12 | _ninjaVersionString: { | ||
13 | enumerable: false, | ||
14 | value: null | ||
15 | }, | ||
16 | |||
17 | _popup: { | ||
18 | enumerable: false, | ||
19 | value: null | ||
20 | }, | ||
21 | |||
22 | captureMouseup: { | ||
23 | value: function(event) { | ||
24 | document.removeEventListener("mouseup", this, true); | ||
25 | this._popup.hide(); | ||
26 | } | ||
27 | }, | ||
28 | |||
29 | captureMousedown: { | ||
30 | value: function(event) { | ||
31 | // ignore clicks on our links to the license, credits or project page | ||
32 | if(event._event.srcElement.className !== 'aboutBoxAnchor') { | ||
33 | document.addEventListener("mouseup", this, true); | ||
34 | document.removeEventListener("mousedown", this, true); | ||
35 | } | ||
36 | } | ||
37 | }, | ||
38 | |||
39 | prepareForDraw: { | ||
40 | value: function() { | ||
41 | if(this._ninjaVersionString == null) { | ||
42 | this._ninjaVersionString = this.application.ninja.ninjaVersion; | ||
43 | } | ||
44 | |||
45 | if(this._ninjaVersionString) { | ||
46 | var verNum = document.getElementById("aboutBoxVersionNumber"); | ||
47 | if(verNum) { | ||
48 | verNum.innerHTML = this._ninjaVersionString; | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | }, | ||
53 | draw: { | ||
54 | enumerable: false, | ||
55 | value: function() { | ||
56 | } | ||
57 | }, | ||
58 | |||
59 | show: { | ||
60 | value: function() { | ||
61 | document.addEventListener("mousedown", this, true); | ||
62 | var popup = this.application._alertPopup, about; | ||
63 | if(!popup) { | ||
64 | popup = Popup.create(); | ||
65 | this._popup = popup; | ||
66 | |||
67 | popup.modal = true; | ||
68 | this.application._alertPopup = popup; | ||
69 | |||
70 | about = AboutBox.create(); | ||
71 | popup.content = about; | ||
72 | } | ||
73 | popup.show(); | ||
74 | } | ||
75 | } | ||
76 | }); | ||