Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a single property in Local Storage instead of many #176

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/.modules/autoupdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,25 @@ function updateCheck(notifier) {
// - called at the end of the main script if function exists
function CheckForNewVersion(popup) {
var today = (new Date().setHours(0, 0, 0, 0));
var LastUpdateCheckDay = GetStorage("LastUpdateCheckDay");
if (LastUpdateCheckDay == null) { //first time visitor
var LastUpdateCheckDay = settings.lastUpdateCheckDay;
if (LastUpdateCheckDay === 0) { //first time visitor
ShowMessage(popup, "Please read this!", 'Thanks for installing this script. \
Please note that you can EDIT the texts inline by double-clicking them. \
For other options, please see the README at <a href="https://github.com/Benjol/SE-AutoReviewComments" target="_blank">here</a>.',
function() {});
} else if (LastUpdateCheckDay != today) {
updateCheck(function(newver, oldver, install_url) {
if (newver != GetStorage("LastVersionAcknowledged")) {
if (newver !== settings.lastVersionAcknowledged) {
ShowMessage(popup, "New Version!", 'A new version (' + newver + ') of the <a href="http://stackapps.com/q/2116">AutoReviewComments</a> userscript is now available, see the <a href="https://github.com/Benjol/SE-AutoReviewComments/releases">release notes</a> for details or <a href="' + install_url + '">click here</a> to install now.',
function() {
SetStorage("LastVersionAcknowledged", newver);
settings.lastVersionAcknowledged = newver;
saveSettings();
});
}
});
}
SetStorage("LastUpdateCheckDay", today);
settings.lastUpdateCheckDay = today;
saveSettings();
}

/* How does this work?
Expand Down
8 changes: 4 additions & 4 deletions src/.templates/option.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<li>
<input id="comment-$ID$" type="radio" name="commentreview" />
<label for="comment-$ID$">
<span id="name-$ID$" class="action-name">$NAME$</span>
<span id="desc-$ID$" class="action-desc">$DESCRIPTION$</span>
<label>
<input type="radio" name="commentreview">
<span class="action-name">$NAME$</span>
<span class="action-desc">$DESCRIPTION$</span>
<button class="quick-insert" title="Insert now">↓</button>
</label>
</li>
Loading