[Pkg-mozext-commits] [nosquint] 07/13: Remove all-defaults site on timestamp update
David Prévot
taffit at moszumanska.debian.org
Tue Apr 28 01:41:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 2.1.7
in repository nosquint.
commit 7ceb392029d80e4c50f85c11e1ab656db57c2cce
Author: Jason Tackaberry <tack at urandom.ca>
Date: Sun Mar 31 19:53:31 2013 -0400
Remove all-defaults site on timestamp update
---
src/content/prefs.js | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/src/content/prefs.js b/src/content/prefs.js
index 2edb489..5a7852e 100644
--- a/src/content/prefs.js
+++ b/src/content/prefs.js
@@ -492,6 +492,12 @@ NoSquint.prefs = NoSquint.ns(function() { with(NoSquint) {
pruneTimer = this.winFunc('setTimeout', function() { pruneTimer = null; NSQ.prefs.pruneSites(); }, 24*60*60*1000);
};
+ this.isSiteRecordDefault = function(record) {
+ if ([record[0]].concat(record.slice(3)).toString() == [0, 0, '0', '0', false, '0', '0', false].toString())
+ return true;
+ else
+ return false;
+ }
/* Updates the site list for the given site name to set the given levels
* (2-tuple of [text, full]), and then queues a site list save.
@@ -528,8 +534,7 @@ NoSquint.prefs = NoSquint.ns(function() { with(NoSquint) {
// Check newly updated record against defaults. If all values are default, we
// remove the record.
- if ([record[0]].concat(record.slice(3)).toString() == [0, 0, '0', '0', false, '0', '0', false].toString())
- // All defaults.
+ if (this.isSiteRecordDefault(record))
delete this.sites[site];
debug('updateSiteList(): site=' + site + ', record=' + record);
@@ -543,14 +548,16 @@ NoSquint.prefs = NoSquint.ns(function() { with(NoSquint) {
this.updateSiteTimestamp = function(site) {
if (!site || !this.sites[site])
return;
-
- this.sites[site][1] = new Date().getTime();
- this.sites[site][2] += 1;
- if (this.rememberSites)
- // Save updated timestamp. Timestamps are only updated on
- // the first page accessed for a given visit to that site,
- // so this shouldn't be too bad.
- this.queueSaveSiteList();
+ if (this.isSiteRecordDefault(this.sites[site]))
+ delete this.sites[site];
+ else {
+ this.sites[site][1] = new Date().getTime();
+ this.sites[site][2] += 1;
+ }
+ // Save updated timestamp. Timestamps are only updated on
+ // the first page accessed for a given visit to that site,
+ // so this shouldn't be too bad.
+ this.queueSaveSiteList(false);
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/nosquint.git
More information about the Pkg-mozext-commits
mailing list