diff options
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 | }); | ||