mirror of
https://github.com/linuxserver/core.git
synced 2026-02-20 05:07:19 +08:00
simplify code for dynamically setting year
This commit is contained in:
parent
6e23b7834b
commit
64526b7876
@ -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 *****/
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="c9Copyright">
|
||||
<p>© 2010 — {0} Cloud9 Inc. All rights reserved</p>
|
||||
<p>© 2010 — {YEAR} Cloud9 Inc. All rights reserved</p>
|
||||
</div>
|
||||
</div>
|
||||
</a:window>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user