From 6e23b7834b04ed035a15d6b2c0b651dd6cd7d3ff Mon Sep 17 00:00:00 2001
From: Ozcan Ovunc
Date: Wed, 24 Jan 2018 11:44:36 +0000
Subject: [PATCH 1/2] Set year of c9.ide.help dinamically
---
plugins/c9.ide.help/help.js | 10 ++++++++++
plugins/c9.ide.help/help.xml | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/plugins/c9.ide.help/help.js b/plugins/c9.ide.help/help.js
index 22420ec3..892445e6 100644
--- a/plugins/c9.ide.help/help.js
+++ b/plugins/c9.ide.help/help.js
@@ -22,6 +22,9 @@ define(function(require, exports, module) {
var aboutDialog;
function load() {
+ var year = (new Date()).getFullYear();
+ markup = formatString(markup, year);
+
menus.addItemByPath("Cloud9/About Cloud9", new ui.item({
onclick: function() { showAbout(); }
}), 100, plugin);
@@ -135,6 +138,13 @@ define(function(require, exports, module) {
var version = c9.version.replace(/([a-f\d]{10})[a-f\d]{30}/, "$1");
document.getElementById("c9Version").textContent = "Version " + version;
}
+
+ function formatString(str) {
+ var args = Array.prototype.slice.call(arguments).slice(1);
+ return str.replace(/{(\d+)}/g, function(match, number) {
+ return typeof args[number] != 'undefined' ? args[number] : match;
+ });
+ }
/***** Lifecycle *****/
diff --git a/plugins/c9.ide.help/help.xml b/plugins/c9.ide.help/help.xml
index a34a9fb8..e457cbc5 100644
--- a/plugins/c9.ide.help/help.xml
+++ b/plugins/c9.ide.help/help.xml
@@ -25,7 +25,7 @@
-
© 2010 — 2017 Cloud9 Inc. All rights reserved
+
© 2010 — {0} Cloud9 Inc. All rights reserved
From 64526b78765196a9b4dcac781ecb3287ef6ca21e Mon Sep 17 00:00:00 2001
From: nightwing
Date: Wed, 7 Feb 2018 22:08:25 +0400
Subject: [PATCH 2/2] simplify code for dynamically setting year
---
plugins/c9.ide.help/help.js | 12 +-----------
plugins/c9.ide.help/help.xml | 2 +-
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/plugins/c9.ide.help/help.js b/plugins/c9.ide.help/help.js
index 892445e6..1411fa34 100644
--- a/plugins/c9.ide.help/help.js
+++ b/plugins/c9.ide.help/help.js
@@ -22,9 +22,6 @@ define(function(require, exports, module) {
var aboutDialog;
function load() {
- var year = (new Date()).getFullYear();
- markup = formatString(markup, year);
-
menus.addItemByPath("Cloud9/About Cloud9", new ui.item({
onclick: function() { showAbout(); }
}), 100, plugin);
@@ -121,7 +118,7 @@ define(function(require, exports, module) {
ui.insertCss(css, options.staticPrefix, plugin);
// Create UI elements
- ui.insertMarkup(null, markup, plugin);
+ ui.insertMarkup(null, markup.replace(/{YEAR}/g, new Date().getFullYear()), plugin);
aboutDialog = plugin.getElement("aboutDialog");
@@ -138,13 +135,6 @@ define(function(require, exports, module) {
var version = c9.version.replace(/([a-f\d]{10})[a-f\d]{30}/, "$1");
document.getElementById("c9Version").textContent = "Version " + version;
}
-
- function formatString(str) {
- var args = Array.prototype.slice.call(arguments).slice(1);
- return str.replace(/{(\d+)}/g, function(match, number) {
- return typeof args[number] != 'undefined' ? args[number] : match;
- });
- }
/***** Lifecycle *****/
diff --git a/plugins/c9.ide.help/help.xml b/plugins/c9.ide.help/help.xml
index e457cbc5..df7e7b70 100644
--- a/plugins/c9.ide.help/help.xml
+++ b/plugins/c9.ide.help/help.xml
@@ -25,7 +25,7 @@
-
© 2010 — {0} Cloud9 Inc. All rights reserved
+
© 2010 — {YEAR} Cloud9 Inc. All rights reserved