diff --git a/CHANGELOG.md b/CHANGELOG.md index 74dcf5310..9d9c17f22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ ### v1.13.14 +**v1.13.14.12** *(2017-12-10)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.14.12/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.14.12/builds/4chan-X-noupdate.crx)] +- Feedback request. + **v1.13.14.11** *(2017-12-10)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.14.11/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.14.11/builds/4chan-X-noupdate.crx)] - Fix bug causing Quick Reply errors. #1652 diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 1378c4b1d..7137c59b8 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 ac52967d1..2ad871b5b 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.14.11 +// @version 1.13.14.12 // @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 e733d4117..bc65421ee 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.14.11 +// @version 1.13.14.12 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -159,7 +159,7 @@ docSet = function() { }; g = { - VERSION: '1.13.14.11', + VERSION: '1.13.14.12', NAMESPACE: '4chan X.', boards: {} }; @@ -11368,7 +11368,7 @@ Settings = (function() { } }, upgrade: function(data, version) { - var addCSS, addSauces, boardID, changes, compareString, corrupted, j, k, key, len, len1, list, name, record, ref, ref1, ref2, ref3, ref4, ref5, ref6, rice, set, setD, type, uids, val, val2, value; + var addCSS, addSauces, boardID, changes, compareString, corrupted, j, k, key, len, len1, list, message, name, record, ref, ref1, ref2, ref3, ref4, ref5, ref6, rice, set, setD, type, uids, val, val2, value; changes = {}; set = function(key, value) { return data[key] = changes[key] = value; @@ -11601,6 +11601,12 @@ Settings = (function() { } } } + if (compareString < '00001.00013.00014.00012') { + message = $.el('div', { + innerHTML: "Feedback request:
What features from 4chan X do you wish were available on other sites you use?
" + }); + new Notice('info', message); + } return changes; }, loadSettings: function(data, cb) { diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 3913ccea8..b1dd654fe 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 c857e9df6..8bfe0dce8 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.14.11 +// @version 1.13.14.12 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -159,7 +159,7 @@ docSet = function() { }; g = { - VERSION: '1.13.14.11', + VERSION: '1.13.14.12', NAMESPACE: '4chan X.', boards: {} }; @@ -11368,7 +11368,7 @@ Settings = (function() { } }, upgrade: function(data, version) { - var addCSS, addSauces, boardID, changes, compareString, corrupted, j, k, key, len, len1, list, name, record, ref, ref1, ref2, ref3, ref4, ref5, ref6, rice, set, setD, type, uids, val, val2, value; + var addCSS, addSauces, boardID, changes, compareString, corrupted, j, k, key, len, len1, list, message, name, record, ref, ref1, ref2, ref3, ref4, ref5, ref6, rice, set, setD, type, uids, val, val2, value; changes = {}; set = function(key, value) { return data[key] = changes[key] = value; @@ -11601,6 +11601,12 @@ Settings = (function() { } } } + if (compareString < '00001.00013.00014.00012') { + message = $.el('div', { + innerHTML: "Feedback request:
What features from 4chan X do you wish were available on other sites you use?
" + }); + new Notice('info', message); + } return changes; }, loadSettings: function(data, cb) { diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 01c547ec7..5a9cb9719 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 02fc19edd..b09825048 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.13.14.11 +// @version 1.13.14.12 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index a0dc22387..205bdb8d0 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.13.14.11 +// @version 1.13.14.12 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -159,7 +159,7 @@ docSet = function() { }; g = { - VERSION: '1.13.14.11', + VERSION: '1.13.14.12', NAMESPACE: '4chan X.', boards: {} }; @@ -11368,7 +11368,7 @@ Settings = (function() { } }, upgrade: function(data, version) { - var addCSS, addSauces, boardID, changes, compareString, corrupted, j, k, key, len, len1, list, name, record, ref, ref1, ref2, ref3, ref4, ref5, ref6, rice, set, setD, type, uids, val, val2, value; + var addCSS, addSauces, boardID, changes, compareString, corrupted, j, k, key, len, len1, list, message, name, record, ref, ref1, ref2, ref3, ref4, ref5, ref6, rice, set, setD, type, uids, val, val2, value; changes = {}; set = function(key, value) { return data[key] = changes[key] = value; @@ -11601,6 +11601,12 @@ Settings = (function() { } } } + if (compareString < '00001.00013.00014.00012') { + message = $.el('div', { + innerHTML: "Feedback request:
What features from 4chan X do you wish were available on other sites you use?
" + }); + new Notice('info', message); + } return changes; }, loadSettings: function(data, cb) { diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 6731b7d7c..c28c71d91 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.json b/builds/updates-beta.json index 2d0c8132c..970ff8001 100644 --- a/builds/updates-beta.json +++ b/builds/updates-beta.json @@ -3,7 +3,7 @@ "4chan-x@4chan-x.net": { "updates": [ { - "version": "1.13.14.11", + "version": "1.13.14.12", "update_link": "https://www.4chan-x.net/builds/4chan-X-beta.crx" } ] diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index 666dbbc59..e64ceeb37 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.json b/builds/updates.json index 2c5e821ad..caeb93f16 100644 --- a/builds/updates.json +++ b/builds/updates.json @@ -3,7 +3,7 @@ "4chan-x@4chan-x.net": { "updates": [ { - "version": "1.13.14.11", + "version": "1.13.14.12", "update_link": "https://www.4chan-x.net/builds/4chan-X.crx" } ] diff --git a/builds/updates.xml b/builds/updates.xml index efdf75d02..fdfa326ad 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index 8f8c5fbc2..670a9cd4b 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -440,6 +440,12 @@ Settings = list = data['jsWhitelist'].split('\n') if 'https://cdnjs.cloudflare.com' not in list and 'https://cdn.mathjax.org' in list set 'jsWhitelist', data['jsWhitelist'] + '\n\nhttps://cdnjs.cloudflare.com' + if compareString < '00001.00013.00014.00012' + message = $.el 'div', + <%= html( + 'Feedback request:
What features from 4chan X do you wish were available on other sites you use?
' + ) %> + new Notice 'info', message changes loadSettings: (data, cb) -> diff --git a/src/Monitoring/ThreadWatcher.coffee b/src/Monitoring/ThreadWatcher.coffee index 144a8a34b..8264b748c 100644 --- a/src/Monitoring/ThreadWatcher.coffee +++ b/src/Monitoring/ThreadWatcher.coffee @@ -185,9 +185,8 @@ ThreadWatcher = interval = if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR now = Date.now() unless now - interval < (db.data.lastChecked or 0) <= now - ThreadWatcher.fetchAllStatus() # calls forceSync - db.data.lastChecked = now - db.save() + ThreadWatcher.fetchAllStatus() + db.setLastChecked() ThreadWatcher.timeout = setTimeout ThreadWatcher.fetchAuto, interval buttonFetchAll: -> @@ -197,13 +196,15 @@ ThreadWatcher = ThreadWatcher.fetchAllStatus() fetchAllStatus: -> - ThreadWatcher.db.forceSync() - ThreadWatcher.unreaddb.forceSync() - QuoteYou.db?.forceSync() - return unless (threads = ThreadWatcher.getAll()).length - for thread in threads - ThreadWatcher.fetchStatus thread - return + dbs = [ThreadWatcher.db, ThreadWatcher.unreaddb, QuoteYou.db].filter((x) -> x) + n = 0 + for db in dbs + db.forceSync -> + if (++n) is dbs.length + threads = ThreadWatcher.getAll() + for thread in threads + ThreadWatcher.fetchStatus thread + return fetchStatus: (thread, force) -> {boardID, threadID, data} = thread diff --git a/src/Quotelinks/QuoteYou.coffee b/src/Quotelinks/QuoteYou.coffee index 6749a68e1..2190eae9d 100644 --- a/src/Quotelinks/QuoteYou.coffee +++ b/src/Quotelinks/QuoteYou.coffee @@ -5,8 +5,8 @@ QuoteYou = @db = new DataBoard 'yourPosts' $.sync 'Remember Your Posts', (enabled) -> Conf['Remember Your Posts'] = enabled $.on d, 'QRPostSuccessful', (e) -> - $.forceSync 'Remember Your Posts' - if Conf['Remember Your Posts'] + $.get 'Remember Your Posts', Conf['Remember Your Posts'], (items) -> + return unless items['Remember Your Posts'] {boardID, threadID, postID} = e.detail (QuoteYou.db.set {boardID, threadID, postID, val: true}) diff --git a/src/classes/DataBoard.coffee b/src/classes/DataBoard.coffee index d308ec544..26aa24414 100644 --- a/src/classes/DataBoard.coffee +++ b/src/classes/DataBoard.coffee @@ -19,21 +19,44 @@ class DataBoard else @data = (@allData[Site.hostname] or= boards: {}) - save: (cb) -> $.set @key, @allData, cb + changes: [] + + save: (change, cb) -> + snapshot1 = JSON.stringify @allData + change() + {changes} = @ + changes.push change + $.get @key, {boards: {}}, (items) => + @initData items[@key] + snapshot2 = JSON.stringify @allData + c() for c in changes + $.set @key, @allData, => + @changes = [] + @sync?() if snapshot1 isnt snapshot2 + cb?() + + forceSync: (cb) -> + snapshot1 = JSON.stringify @allData + {changes} = @ + $.get @key, {boards: {}}, (items) => + @initData items[@key] + snapshot2 = JSON.stringify @allData + c() for c in changes + @sync?() if snapshot1 isnt snapshot2 + cb?() delete: ({boardID, threadID, postID}) -> - $.forceSync @key - if postID - return unless @data.boards[boardID]?[threadID] - delete @data.boards[boardID][threadID][postID] - @deleteIfEmpty {boardID, threadID} - else if threadID - return unless @data.boards[boardID] - delete @data.boards[boardID][threadID] - @deleteIfEmpty {boardID} - else - delete @data.boards[boardID] - @save() + @save => + if postID + return unless @data.boards[boardID]?[threadID] + delete @data.boards[boardID][threadID][postID] + @deleteIfEmpty {boardID, threadID} + else if threadID + return unless @data.boards[boardID] + delete @data.boards[boardID][threadID] + @deleteIfEmpty {boardID} + else + delete @data.boards[boardID] deleteIfEmpty: ({boardID, threadID}) -> if threadID @@ -44,24 +67,29 @@ class DataBoard delete @data.boards[boardID] set: (data, cb) -> - $.forceSync @key - @setUnsafe data, cb + @save => + @setUnsafe data + , cb - setUnsafe: ({boardID, threadID, postID, val}, cb) -> + setUnsafe: ({boardID, threadID, postID, val}) -> if postID isnt undefined ((@data.boards[boardID] or= {})[threadID] or= {})[postID] = val else if threadID isnt undefined (@data.boards[boardID] or= {})[threadID] = val else @data.boards[boardID] = val - @save cb extend: ({boardID, threadID, postID, val, rm}, cb) -> - $.forceSync @key - oldVal = @get {boardID, threadID, postID, val: {}} - delete oldVal[key] for key in rm or [] - $.extend oldVal, val - @setUnsafe {boardID, threadID, postID, val: oldVal}, cb + @save => + oldVal = @get {boardID, threadID, postID, val: {}} + delete oldVal[key] for key in rm or [] + $.extend oldVal, val + @setUnsafe {boardID, threadID, postID, val: oldVal} + , cb + + setLastChecked: -> + @save => + @data.lastChecked = Date.now() get: ({boardID, threadID, postID, defaultValue}) -> if board = @data.boards[boardID] @@ -80,11 +108,7 @@ class DataBoard thread val or defaultValue - forceSync: -> - $.forceSync @key - clean: -> - $.forceSync @key for boardID, val of @data.boards @deleteIfEmpty {boardID} @@ -115,7 +139,7 @@ class DataBoard threads[ID] = board[ID] if ID of board @data.boards[boardID] = threads @deleteIfEmpty {boardID} - @save() + $.set @key, @allData onSync: (data) => @initData data diff --git a/version.json b/version.json index b075fce69..8701023af 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "1.13.14.11", - "date": "2017-12-10T02:17:48.734Z" + "version": "1.13.14.12", + "date": "2017-12-10T05:43:12.525Z" } \ No newline at end of file