-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.js
More file actions
148 lines (123 loc) · 6.52 KB
/
help.js
File metadata and controls
148 lines (123 loc) · 6.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/**
* Help menu for the Cloud 9 IDE
*
* @author Garen J. Torikian
*
* @copyright 2011, Cloud9 IDE, Inc
* @license GPLv3 <http://www.gnu.org/licenses/gpl.txt>
*/
define(function(require, exports, module) {
var ide = require("core/ide");
var ext = require("core/ext");
var menus = require("ext/menus/menus");
var markup = require("text!ext/help/help.xml");
var css = require("text!ext/help/style.css");
var skin = require("text!ext/help/skin.xml");
module.exports = ext.register("ext/help/help", {
name: "Help Menu",
dev: "Cloud9 IDE, Inc.",
alone: true,
type: ext.GENERAL,
nodes: [],
markup: markup,
css: css,
panels: {},
skin: {
id: "help-skin",
data: skin,
"media-path": ide.staticPrefix + "/ext/help/images/"
},
showingAll: true,
hook : function(){
var _self = this;
var mnuHelp = new apf.menu();
this.nodes.push(
menus.addItemByPath("Help/", mnuHelp, 100000)
);
var c = 0;
menus.addItemByPath("Help/About", new apf.item({ onclick : function(){ _self.showAbout(); }}), c += 100);
menus.addItemByPath("Help/IDE Status", new apf.item({ onclick : function(){window.open('http://status.c9.io'); }}), c += 100);
var mnuChangelog = menus.addItemByPath("Help/Changelog", new apf.item({ onclick : function(){ window.open('http://c9.io/site/tag/changelog/') }}), c += 100);
menus.addItemByPath("Help/~", new apf.divider(), c += 100);
menus.addItemByPath("Help/Documentation", new apf.item({ onclick : function(){ window.open('https://docs.c9.io') }}), c += 100);
ide.addEventListener("hook.ext/keybindings_default/keybindings_default", function(c, e) {
menus.addItemByPath("Help/Keyboard Shortcuts", new apf.item({ onclick : function(){ e.ext.keybindings(); }}), c);
}.bind(this, c += 100));
ide.addEventListener("hook.ext/quickstart/quickstart", function(c, e) {
menus.addItemByPath("Help/Quick Start", new apf.item({ onclick : function(){ e.ext.launchQS(); }}), c);
}.bind(this, c += 100));
ide.addEventListener("hook.ext/guidedtour/guidedtour", function(c, e) {
menus.addItemByPath("Help/Take a Guided Tour", new apf.item({ onclick : function(){ e.ext.launchGT(); }}), c);
}.bind(this, c += 100));
menus.addItemByPath("Help/~", new apf.divider(), c += 100);
menus.addItemByPath("Help/Support/", null, c += 100);
menus.addItemByPath("Help/~", new apf.divider(), c += 100);
menus.addItemByPath("Help/Learning/", null, c += 100);
menus.addItemByPath("Help/~", new apf.divider(), c += 100);
menus.addItemByPath("Help/Get in Touch/", null, c += 100);
c = 0;
menus.addItemByPath("Help/Support/FAQ", new apf.item({ onclick : function(){ window.open('http://support.cloud9ide.com/forums/20346041-frequently-asked-questions'); }}), c += 100);
menus.addItemByPath("Help/Support/Troubleshooting Tips", new apf.item({ onclick : function(){ window.open('http://support.cloud9ide.com/forums/20329737-troubleshooting') }}), c += 100);
c = 0;
menus.addItemByPath("Help/Learning/YouTube Channel for Cloud9 IDE", new apf.item({ onclick : function(){ window.open('http://www.youtube.com/user/c9ide/videos?view=pl'); }}), c += 100);
c = 0;
menus.addItemByPath("Help/Get in Touch/Blog", new apf.item({ onclick : function(){ window.open('http://blog.c9.io/'); }}), c += 100);
menus.addItemByPath("Help/Get in Touch/Twitter (for Cloud9 IDE support)", new apf.item({ onclick : function(){ window.open('https://twitter.com/#!/C9Support'); }}), c += 100);
menus.addItemByPath("Help/Get in Touch/Twitter (for general Cloud9 tweets)", new apf.item({ onclick : function(){ window.open('https://twitter.com/#!/cloud9ide'); }}), c += 100);
menus.addItemByPath("Help/Get in Touch/Facebook", new apf.item({ onclick : function(){ window.open('https://www.facebook.com/Cloud9IDE'); }}), c += 100);
if (window.cloud9config.hosted || (ide.local && ide.onLine)) {
mnuHelp.addEventListener("prop.visible", function(e) {
if (e.value) {
var blogURL = window.location.protocol + "//" + window.location.host + "/site/?json=get_tag_posts&tag_slug=changelog";
var response = apf.ajax(blogURL, {
method: "GET",
contentType: "application/json",
async: true,
data: JSON.stringify({
agent: navigator.userAgent,
type: "C9 SERVER EXCEPTION"
}),
callback: function( data, state) {
if (state == apf.SUCCESS) {
if (data !== undefined) {
var jsonBlog = JSON.parse(data);
var latestDate = jsonBlog.posts[0].date;
mnuChangelog.setAttribute("caption", mnuChangelog.caption + " (" + latestDate.split(" ")[0].replace(/-/g, ".") + ")");
}
}
}
});
mnuHelp.removeEventListener("prop.visible", arguments.callee);
}
});
}
},
init: function(amlNode) {
apf.importCssString((this.css || ""));
},
showAbout: function() {
ext.initExtension(this);
aboutDialog.show();
document.getElementById("c9Version").innerHTML = apf.escapeXML("Version " + window.cloud9config.version);
},
launchTwitter: function() {
alert("Let's go to Twitter!");
},
enable: function() {
this.nodes.each(function(item) {
item.enable();
});
},
disable: function() {
this.nodes.each(function(item) {
item.disable();
});
},
destroy: function() {
this.nodes.each(function(item) {
item.destroy(true, true);
});
this.nodes = [];
}
});
});