diff --git a/CHANGELOG.md b/CHANGELOG.md
index 710050532..29fba2d31 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@
### v1.13.10
+**v1.13.10.4** *(2017-07-29)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.10.4/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.10.4/builds/4chan-X-noupdate.crx)]
+- Reduce disk reads preformed by QR Cooldown.
+- Change the MD5 Quick Filter button from a trash can to an X.
+
**v1.13.10.3** *(2017-07-26)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.10.3/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.10.3/builds/4chan-X-noupdate.crx)]
- Fix double sticky icon bug on /f/.
diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx
index 9f54d949d..a200ac961 100644
Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ
diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js
index 4a530e778..dc94e6458 100644
--- a/builds/4chan-X-beta.meta.js
+++ b/builds/4chan-X-beta.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
-// @version 1.13.10.3
+// @version 1.13.10.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js
index 0bec94144..2161133de 100644
--- a/builds/4chan-X-beta.user.js
+++ b/builds/4chan-X-beta.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
-// @version 1.13.10.3
+// @version 1.13.10.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -153,7 +153,7 @@ docSet = function() {
};
g = {
- VERSION: '1.13.10.3',
+ VERSION: '1.13.10.4',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -16398,7 +16398,7 @@ FileInfo = (function() {
},
f: function() {
return {
- innerHTML: ""
+ innerHTML: ""
};
},
p: function() {
@@ -22277,6 +22277,7 @@ QR = (function() {
return;
}
this.data = Conf['cooldowns'];
+ this.changes = {};
return $.sync('cooldowns', this.sync);
},
setup: function() {
@@ -22324,6 +22325,7 @@ QR = (function() {
postID: postID
});
}
+ QR.cooldown.save();
return QR.cooldown.start();
},
addDelay: function(post, delay) {
@@ -22334,6 +22336,7 @@ QR = (function() {
cooldown = QR.cooldown.categorize(post);
cooldown.delay = delay;
QR.cooldown.set(g.BOARD.ID, Date.now(), cooldown);
+ QR.cooldown.save();
return QR.cooldown.start();
},
addMute: function(delay) {
@@ -22344,6 +22347,7 @@ QR = (function() {
type: 'mute',
delay: delay
});
+ QR.cooldown.save();
return QR.cooldown.start();
},
"delete": function(post) {
@@ -22351,15 +22355,14 @@ QR = (function() {
if (!QR.cooldown.data) {
return;
}
- $.forceSync('cooldowns');
cooldowns = ((base = QR.cooldown.data)[name = post.board.ID] || (base[name] = {}));
for (id in cooldowns) {
cooldown = cooldowns[id];
if ((cooldown.delay == null) && cooldown.threadID === post.thread.ID && cooldown.postID === post.ID) {
- delete cooldowns[id];
+ QR.cooldown.set(post.board.ID, id, null);
}
}
- return QR.cooldown.save([post.board.ID]);
+ return QR.cooldown.save();
},
secondsDeletion: function(post) {
var cooldown, cooldowns, seconds, start;
@@ -22388,31 +22391,49 @@ QR = (function() {
};
}
},
- set: function(scope, id, value) {
- var base, cooldowns;
- $.forceSync('cooldowns');
- cooldowns = ((base = QR.cooldown.data)[scope] || (base[scope] = {}));
- cooldowns[id] = value;
- return $.set('cooldowns', QR.cooldown.data);
- },
- save: function(scopes) {
- var data, i, len, scope;
- data = QR.cooldown.data;
- for (i = 0, len = scopes.length; i < len; i++) {
- scope = scopes[i];
- if (scope in data && !Object.keys(data[scope]).length) {
- delete data[scope];
+ mergeChange: function(data, scope, id, value) {
+ if (value) {
+ return (data[scope] || (data[scope] = {}))[id] = value;
+ } else if (scope in data) {
+ delete data[scope][id];
+ if (Object.keys(data[scope]).length === 0) {
+ return delete data[scope];
}
}
- return $.set('cooldowns', data);
+ },
+ set: function(scope, id, value) {
+ var base;
+ QR.cooldown.mergeChange(QR.cooldown.data, scope, id, value);
+ return ((base = QR.cooldown.changes)[scope] || (base[scope] = {}))[id] = value;
+ },
+ save: function() {
+ var changes;
+ changes = QR.cooldown.changes;
+ if (!Object.keys(changes).length) {
+ return;
+ }
+ return $.get('cooldowns', {}, function(arg) {
+ var cooldowns, id, ref, scope, value;
+ cooldowns = arg.cooldowns;
+ for (scope in QR.cooldown.changes) {
+ ref = QR.cooldown.changes[scope];
+ for (id in ref) {
+ value = ref[id];
+ QR.cooldown.mergeChange(cooldowns, scope, id, value);
+ }
+ QR.cooldown.data = cooldowns;
+ }
+ return $.set('cooldowns', cooldowns, function() {
+ return QR.cooldown.changes = {};
+ });
+ });
},
update: function() {
var base, cooldown, cooldowns, elapsed, i, len, maxDelay, nCooldowns, now, ref, ref1, save, scope, seconds, start, suffix, threadID, type, update;
if (!QR.cooldown.isCounting) {
return;
}
- $.forceSync('cooldowns');
- save = [];
+ save = false;
nCooldowns = 0;
now = Date.now();
ref = QR.cooldown.categorize(QR.posts[0]), type = ref.type, threadID = ref.threadID;
@@ -22427,14 +22448,14 @@ QR = (function() {
start = +start;
elapsed = Math.floor((now - start) / $.SECOND);
if (elapsed < 0) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
continue;
}
if (cooldown.delay != null) {
if (cooldown.delay <= elapsed) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
} else if ((cooldown.type === type && cooldown.threadID === threadID) || cooldown.type === 'mute') {
seconds = Math.max(seconds, cooldown.delay - elapsed);
}
@@ -22445,8 +22466,8 @@ QR = (function() {
maxDelay = Math.max(maxDelay, parseInt(Conf['customCooldown'], 10));
}
if (maxDelay <= elapsed) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
continue;
}
if ((type === 'thread') === (cooldown.threadID === cooldown.postID) && cooldown.boardID !== g.BOARD.ID) {
@@ -22460,8 +22481,8 @@ QR = (function() {
nCooldowns += Object.keys(cooldowns).length;
}
}
- if (save.length) {
- QR.cooldown.save(save);
+ if (save) {
+ QR.cooldown.save;
}
if (nCooldowns) {
clearTimeout(QR.cooldown.timeout);
diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx
index 8ff97dde6..f68cddd98 100644
Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ
diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js
index 81943e209..3e2e87bcc 100644
--- a/builds/4chan-X-noupdate.user.js
+++ b/builds/4chan-X-noupdate.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.13.10.3
+// @version 1.13.10.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -153,7 +153,7 @@ docSet = function() {
};
g = {
- VERSION: '1.13.10.3',
+ VERSION: '1.13.10.4',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -16398,7 +16398,7 @@ FileInfo = (function() {
},
f: function() {
return {
- innerHTML: ""
+ innerHTML: ""
};
},
p: function() {
@@ -22277,6 +22277,7 @@ QR = (function() {
return;
}
this.data = Conf['cooldowns'];
+ this.changes = {};
return $.sync('cooldowns', this.sync);
},
setup: function() {
@@ -22324,6 +22325,7 @@ QR = (function() {
postID: postID
});
}
+ QR.cooldown.save();
return QR.cooldown.start();
},
addDelay: function(post, delay) {
@@ -22334,6 +22336,7 @@ QR = (function() {
cooldown = QR.cooldown.categorize(post);
cooldown.delay = delay;
QR.cooldown.set(g.BOARD.ID, Date.now(), cooldown);
+ QR.cooldown.save();
return QR.cooldown.start();
},
addMute: function(delay) {
@@ -22344,6 +22347,7 @@ QR = (function() {
type: 'mute',
delay: delay
});
+ QR.cooldown.save();
return QR.cooldown.start();
},
"delete": function(post) {
@@ -22351,15 +22355,14 @@ QR = (function() {
if (!QR.cooldown.data) {
return;
}
- $.forceSync('cooldowns');
cooldowns = ((base = QR.cooldown.data)[name = post.board.ID] || (base[name] = {}));
for (id in cooldowns) {
cooldown = cooldowns[id];
if ((cooldown.delay == null) && cooldown.threadID === post.thread.ID && cooldown.postID === post.ID) {
- delete cooldowns[id];
+ QR.cooldown.set(post.board.ID, id, null);
}
}
- return QR.cooldown.save([post.board.ID]);
+ return QR.cooldown.save();
},
secondsDeletion: function(post) {
var cooldown, cooldowns, seconds, start;
@@ -22388,31 +22391,49 @@ QR = (function() {
};
}
},
- set: function(scope, id, value) {
- var base, cooldowns;
- $.forceSync('cooldowns');
- cooldowns = ((base = QR.cooldown.data)[scope] || (base[scope] = {}));
- cooldowns[id] = value;
- return $.set('cooldowns', QR.cooldown.data);
- },
- save: function(scopes) {
- var data, i, len, scope;
- data = QR.cooldown.data;
- for (i = 0, len = scopes.length; i < len; i++) {
- scope = scopes[i];
- if (scope in data && !Object.keys(data[scope]).length) {
- delete data[scope];
+ mergeChange: function(data, scope, id, value) {
+ if (value) {
+ return (data[scope] || (data[scope] = {}))[id] = value;
+ } else if (scope in data) {
+ delete data[scope][id];
+ if (Object.keys(data[scope]).length === 0) {
+ return delete data[scope];
}
}
- return $.set('cooldowns', data);
+ },
+ set: function(scope, id, value) {
+ var base;
+ QR.cooldown.mergeChange(QR.cooldown.data, scope, id, value);
+ return ((base = QR.cooldown.changes)[scope] || (base[scope] = {}))[id] = value;
+ },
+ save: function() {
+ var changes;
+ changes = QR.cooldown.changes;
+ if (!Object.keys(changes).length) {
+ return;
+ }
+ return $.get('cooldowns', {}, function(arg) {
+ var cooldowns, id, ref, scope, value;
+ cooldowns = arg.cooldowns;
+ for (scope in QR.cooldown.changes) {
+ ref = QR.cooldown.changes[scope];
+ for (id in ref) {
+ value = ref[id];
+ QR.cooldown.mergeChange(cooldowns, scope, id, value);
+ }
+ QR.cooldown.data = cooldowns;
+ }
+ return $.set('cooldowns', cooldowns, function() {
+ return QR.cooldown.changes = {};
+ });
+ });
},
update: function() {
var base, cooldown, cooldowns, elapsed, i, len, maxDelay, nCooldowns, now, ref, ref1, save, scope, seconds, start, suffix, threadID, type, update;
if (!QR.cooldown.isCounting) {
return;
}
- $.forceSync('cooldowns');
- save = [];
+ save = false;
nCooldowns = 0;
now = Date.now();
ref = QR.cooldown.categorize(QR.posts[0]), type = ref.type, threadID = ref.threadID;
@@ -22427,14 +22448,14 @@ QR = (function() {
start = +start;
elapsed = Math.floor((now - start) / $.SECOND);
if (elapsed < 0) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
continue;
}
if (cooldown.delay != null) {
if (cooldown.delay <= elapsed) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
} else if ((cooldown.type === type && cooldown.threadID === threadID) || cooldown.type === 'mute') {
seconds = Math.max(seconds, cooldown.delay - elapsed);
}
@@ -22445,8 +22466,8 @@ QR = (function() {
maxDelay = Math.max(maxDelay, parseInt(Conf['customCooldown'], 10));
}
if (maxDelay <= elapsed) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
continue;
}
if ((type === 'thread') === (cooldown.threadID === cooldown.postID) && cooldown.boardID !== g.BOARD.ID) {
@@ -22460,8 +22481,8 @@ QR = (function() {
nCooldowns += Object.keys(cooldowns).length;
}
}
- if (save.length) {
- QR.cooldown.save(save);
+ if (save) {
+ QR.cooldown.save;
}
if (nCooldowns) {
clearTimeout(QR.cooldown.timeout);
diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx
index 5923e3a9c..b55731c65 100644
Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ
diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js
index 2ad1de03b..10c9645be 100644
--- a/builds/4chan-X.meta.js
+++ b/builds/4chan-X.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.13.10.3
+// @version 1.13.10.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index a742ecb49..592ad76cc 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.13.10.3
+// @version 1.13.10.4
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -153,7 +153,7 @@ docSet = function() {
};
g = {
- VERSION: '1.13.10.3',
+ VERSION: '1.13.10.4',
NAMESPACE: '4chan X.',
boards: {}
};
@@ -16398,7 +16398,7 @@ FileInfo = (function() {
},
f: function() {
return {
- innerHTML: ""
+ innerHTML: ""
};
},
p: function() {
@@ -22277,6 +22277,7 @@ QR = (function() {
return;
}
this.data = Conf['cooldowns'];
+ this.changes = {};
return $.sync('cooldowns', this.sync);
},
setup: function() {
@@ -22324,6 +22325,7 @@ QR = (function() {
postID: postID
});
}
+ QR.cooldown.save();
return QR.cooldown.start();
},
addDelay: function(post, delay) {
@@ -22334,6 +22336,7 @@ QR = (function() {
cooldown = QR.cooldown.categorize(post);
cooldown.delay = delay;
QR.cooldown.set(g.BOARD.ID, Date.now(), cooldown);
+ QR.cooldown.save();
return QR.cooldown.start();
},
addMute: function(delay) {
@@ -22344,6 +22347,7 @@ QR = (function() {
type: 'mute',
delay: delay
});
+ QR.cooldown.save();
return QR.cooldown.start();
},
"delete": function(post) {
@@ -22351,15 +22355,14 @@ QR = (function() {
if (!QR.cooldown.data) {
return;
}
- $.forceSync('cooldowns');
cooldowns = ((base = QR.cooldown.data)[name = post.board.ID] || (base[name] = {}));
for (id in cooldowns) {
cooldown = cooldowns[id];
if ((cooldown.delay == null) && cooldown.threadID === post.thread.ID && cooldown.postID === post.ID) {
- delete cooldowns[id];
+ QR.cooldown.set(post.board.ID, id, null);
}
}
- return QR.cooldown.save([post.board.ID]);
+ return QR.cooldown.save();
},
secondsDeletion: function(post) {
var cooldown, cooldowns, seconds, start;
@@ -22388,31 +22391,49 @@ QR = (function() {
};
}
},
- set: function(scope, id, value) {
- var base, cooldowns;
- $.forceSync('cooldowns');
- cooldowns = ((base = QR.cooldown.data)[scope] || (base[scope] = {}));
- cooldowns[id] = value;
- return $.set('cooldowns', QR.cooldown.data);
- },
- save: function(scopes) {
- var data, i, len, scope;
- data = QR.cooldown.data;
- for (i = 0, len = scopes.length; i < len; i++) {
- scope = scopes[i];
- if (scope in data && !Object.keys(data[scope]).length) {
- delete data[scope];
+ mergeChange: function(data, scope, id, value) {
+ if (value) {
+ return (data[scope] || (data[scope] = {}))[id] = value;
+ } else if (scope in data) {
+ delete data[scope][id];
+ if (Object.keys(data[scope]).length === 0) {
+ return delete data[scope];
}
}
- return $.set('cooldowns', data);
+ },
+ set: function(scope, id, value) {
+ var base;
+ QR.cooldown.mergeChange(QR.cooldown.data, scope, id, value);
+ return ((base = QR.cooldown.changes)[scope] || (base[scope] = {}))[id] = value;
+ },
+ save: function() {
+ var changes;
+ changes = QR.cooldown.changes;
+ if (!Object.keys(changes).length) {
+ return;
+ }
+ return $.get('cooldowns', {}, function(arg) {
+ var cooldowns, id, ref, scope, value;
+ cooldowns = arg.cooldowns;
+ for (scope in QR.cooldown.changes) {
+ ref = QR.cooldown.changes[scope];
+ for (id in ref) {
+ value = ref[id];
+ QR.cooldown.mergeChange(cooldowns, scope, id, value);
+ }
+ QR.cooldown.data = cooldowns;
+ }
+ return $.set('cooldowns', cooldowns, function() {
+ return QR.cooldown.changes = {};
+ });
+ });
},
update: function() {
var base, cooldown, cooldowns, elapsed, i, len, maxDelay, nCooldowns, now, ref, ref1, save, scope, seconds, start, suffix, threadID, type, update;
if (!QR.cooldown.isCounting) {
return;
}
- $.forceSync('cooldowns');
- save = [];
+ save = false;
nCooldowns = 0;
now = Date.now();
ref = QR.cooldown.categorize(QR.posts[0]), type = ref.type, threadID = ref.threadID;
@@ -22427,14 +22448,14 @@ QR = (function() {
start = +start;
elapsed = Math.floor((now - start) / $.SECOND);
if (elapsed < 0) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
continue;
}
if (cooldown.delay != null) {
if (cooldown.delay <= elapsed) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
} else if ((cooldown.type === type && cooldown.threadID === threadID) || cooldown.type === 'mute') {
seconds = Math.max(seconds, cooldown.delay - elapsed);
}
@@ -22445,8 +22466,8 @@ QR = (function() {
maxDelay = Math.max(maxDelay, parseInt(Conf['customCooldown'], 10));
}
if (maxDelay <= elapsed) {
- delete cooldowns[start];
- save.push(scope);
+ QR.cooldown.set(scope, start, null);
+ save = true;
continue;
}
if ((type === 'thread') === (cooldown.threadID === cooldown.postID) && cooldown.boardID !== g.BOARD.ID) {
@@ -22460,8 +22481,8 @@ QR = (function() {
nCooldowns += Object.keys(cooldowns).length;
}
}
- if (save.length) {
- QR.cooldown.save(save);
+ if (save) {
+ QR.cooldown.save;
}
if (nCooldowns) {
clearTimeout(QR.cooldown.timeout);
diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip
index ffb3b7d21..8fd411d4c 100644
Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ
diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml
index 3891d78ca..308135157 100644
--- a/builds/updates-beta.xml
+++ b/builds/updates-beta.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/builds/updates.xml b/builds/updates.xml
index d6d4af996..d3229b64c 100644
--- a/builds/updates.xml
+++ b/builds/updates.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/version.json b/version.json
index 57bb50bd6..89526d7a3 100644
--- a/version.json
+++ b/version.json
@@ -1,4 +1,4 @@
{
- "version": "1.13.10.3",
- "date": "2017-07-26T06:11:58.491Z"
+ "version": "1.13.10.4",
+ "date": "2017-07-29T05:40:52.111Z"
}
\ No newline at end of file