forked from deepjyoti30/startpage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to show version in the settings
- Loading branch information
1 parent
9276172
commit 0be6920
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
window.onload = function() { | ||
this.populateVersionInSettings(); | ||
this.initBody(); | ||
this.listenForSettings(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Handle version related methods | ||
*/ | ||
|
||
const VERSION = "v0.3" | ||
|
||
|
||
function populateVersionInSettings() { | ||
/** | ||
* This method will populate the version field in the | ||
* settings modal. | ||
* | ||
* This should be called once only since the version is | ||
* constant throughout and changes with a new release (new installation) | ||
*/ | ||
const versionElementId = "current--version--startpage" | ||
document.getElementById(versionElementId).innerHTML = generateVersionString(VERSION) | ||
} | ||
|
||
function generateVersionString(version) { | ||
/** | ||
* Generate the version string to populate in the element. | ||
* | ||
* @param {string} version - The version to use in the version string | ||
* | ||
* @returns {string} - Returns a generated string to be used to show the version | ||
* and the product name. | ||
*/ | ||
return `startpage - ${version}` | ||
} |