Merge branch 'master' into multisite

This commit is contained in:
name 2017-12-11 01:54:12 -08:00
commit 447f0ac060
19 changed files with 108 additions and 56 deletions

View File

@ -4,6 +4,9 @@
### v1.13.14 ### 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)] **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 - Fix bug causing Quick Reply errors. #1652

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.13.14.11 // @version 1.13.14.12
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X beta // @name 4chan X beta
// @version 1.13.14.11 // @version 1.13.14.12
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -159,7 +159,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.14.11', VERSION: '1.13.14.12',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -11368,7 +11368,7 @@ Settings = (function() {
} }
}, },
upgrade: function(data, version) { 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 = {}; changes = {};
set = function(key, value) { set = function(key, value) {
return data[key] = changes[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: <a href=\"https://desuarchive.org/qa/thread/1769829/\" target=\"_blank\"><br>What features from 4chan X do you wish were available on other sites you use?</a>"
});
new Notice('info', message);
}
return changes; return changes;
}, },
loadSettings: function(data, cb) { loadSettings: function(data, cb) {

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.14.11 // @version 1.13.14.12
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -159,7 +159,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.14.11', VERSION: '1.13.14.12',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -11368,7 +11368,7 @@ Settings = (function() {
} }
}, },
upgrade: function(data, version) { 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 = {}; changes = {};
set = function(key, value) { set = function(key, value) {
return data[key] = changes[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: <a href=\"https://desuarchive.org/qa/thread/1769829/\" target=\"_blank\"><br>What features from 4chan X do you wish were available on other sites you use?</a>"
});
new Notice('info', message);
}
return changes; return changes;
}, },
loadSettings: function(data, cb) { loadSettings: function(data, cb) {

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.14.11 // @version 1.13.14.12
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.13.14.11 // @version 1.13.14.12
// @minGMVer 1.14 // @minGMVer 1.14
// @minFFVer 26 // @minFFVer 26
// @namespace 4chan-X // @namespace 4chan-X
@ -159,7 +159,7 @@ docSet = function() {
}; };
g = { g = {
VERSION: '1.13.14.11', VERSION: '1.13.14.12',
NAMESPACE: '4chan X.', NAMESPACE: '4chan X.',
boards: {} boards: {}
}; };
@ -11368,7 +11368,7 @@ Settings = (function() {
} }
}, },
upgrade: function(data, version) { 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 = {}; changes = {};
set = function(key, value) { set = function(key, value) {
return data[key] = changes[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: <a href=\"https://desuarchive.org/qa/thread/1769829/\" target=\"_blank\"><br>What features from 4chan X do you wish were available on other sites you use?</a>"
});
new Notice('info', message);
}
return changes; return changes;
}, },
loadSettings: function(data, cb) { loadSettings: function(data, cb) {

Binary file not shown.

View File

@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": { "4chan-x@4chan-x.net": {
"updates": [ "updates": [
{ {
"version": "1.13.14.11", "version": "1.13.14.12",
"update_link": "https://www.4chan-x.net/builds/4chan-X-beta.crx" "update_link": "https://www.4chan-x.net/builds/4chan-X-beta.crx"
} }
] ]

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.13.14.11' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.13.14.12' />
</app> </app>
</gupdate> </gupdate>

View File

@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": { "4chan-x@4chan-x.net": {
"updates": [ "updates": [
{ {
"version": "1.13.14.11", "version": "1.13.14.12",
"update_link": "https://www.4chan-x.net/builds/4chan-X.crx" "update_link": "https://www.4chan-x.net/builds/4chan-X.crx"
} }
] ]

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'> <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'> <app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.13.14.11' /> <updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.13.14.12' />
</app> </app>
</gupdate> </gupdate>

View File

@ -440,6 +440,12 @@ Settings =
list = data['jsWhitelist'].split('\n') list = data['jsWhitelist'].split('\n')
if 'https://cdnjs.cloudflare.com' not in list and 'https://cdn.mathjax.org' in list if 'https://cdnjs.cloudflare.com' not in list and 'https://cdn.mathjax.org' in list
set 'jsWhitelist', data['jsWhitelist'] + '\n\nhttps://cdnjs.cloudflare.com' set 'jsWhitelist', data['jsWhitelist'] + '\n\nhttps://cdnjs.cloudflare.com'
if compareString < '00001.00013.00014.00012'
message = $.el 'div',
<%= html(
'Feedback request: <a href="https://desuarchive.org/qa/thread/1769829/" target="_blank"><br>What features from 4chan X do you wish were available on other sites you use?</a>'
) %>
new Notice 'info', message
changes changes
loadSettings: (data, cb) -> loadSettings: (data, cb) ->

View File

@ -185,9 +185,8 @@ ThreadWatcher =
interval = if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR interval = if ThreadWatcher.unreadEnabled and Conf['Show Unread Count'] then 5 * $.MINUTE else 2 * $.HOUR
now = Date.now() now = Date.now()
unless now - interval < (db.data.lastChecked or 0) <= now unless now - interval < (db.data.lastChecked or 0) <= now
ThreadWatcher.fetchAllStatus() # calls forceSync ThreadWatcher.fetchAllStatus()
db.data.lastChecked = now db.setLastChecked()
db.save()
ThreadWatcher.timeout = setTimeout ThreadWatcher.fetchAuto, interval ThreadWatcher.timeout = setTimeout ThreadWatcher.fetchAuto, interval
buttonFetchAll: -> buttonFetchAll: ->
@ -197,13 +196,15 @@ ThreadWatcher =
ThreadWatcher.fetchAllStatus() ThreadWatcher.fetchAllStatus()
fetchAllStatus: -> fetchAllStatus: ->
ThreadWatcher.db.forceSync() dbs = [ThreadWatcher.db, ThreadWatcher.unreaddb, QuoteYou.db].filter((x) -> x)
ThreadWatcher.unreaddb.forceSync() n = 0
QuoteYou.db?.forceSync() for db in dbs
return unless (threads = ThreadWatcher.getAll()).length db.forceSync ->
for thread in threads if (++n) is dbs.length
ThreadWatcher.fetchStatus thread threads = ThreadWatcher.getAll()
return for thread in threads
ThreadWatcher.fetchStatus thread
return
fetchStatus: (thread, force) -> fetchStatus: (thread, force) ->
{boardID, threadID, data} = thread {boardID, threadID, data} = thread

View File

@ -5,8 +5,8 @@ QuoteYou =
@db = new DataBoard 'yourPosts' @db = new DataBoard 'yourPosts'
$.sync 'Remember Your Posts', (enabled) -> Conf['Remember Your Posts'] = enabled $.sync 'Remember Your Posts', (enabled) -> Conf['Remember Your Posts'] = enabled
$.on d, 'QRPostSuccessful', (e) -> $.on d, 'QRPostSuccessful', (e) ->
$.forceSync 'Remember Your Posts' $.get 'Remember Your Posts', Conf['Remember Your Posts'], (items) ->
if Conf['Remember Your Posts'] return unless items['Remember Your Posts']
{boardID, threadID, postID} = e.detail {boardID, threadID, postID} = e.detail
(QuoteYou.db.set {boardID, threadID, postID, val: true}) (QuoteYou.db.set {boardID, threadID, postID, val: true})

View File

@ -19,21 +19,44 @@ class DataBoard
else else
@data = (@allData[Site.hostname] or= boards: {}) @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}) -> delete: ({boardID, threadID, postID}) ->
$.forceSync @key @save =>
if postID if postID
return unless @data.boards[boardID]?[threadID] return unless @data.boards[boardID]?[threadID]
delete @data.boards[boardID][threadID][postID] delete @data.boards[boardID][threadID][postID]
@deleteIfEmpty {boardID, threadID} @deleteIfEmpty {boardID, threadID}
else if threadID else if threadID
return unless @data.boards[boardID] return unless @data.boards[boardID]
delete @data.boards[boardID][threadID] delete @data.boards[boardID][threadID]
@deleteIfEmpty {boardID} @deleteIfEmpty {boardID}
else else
delete @data.boards[boardID] delete @data.boards[boardID]
@save()
deleteIfEmpty: ({boardID, threadID}) -> deleteIfEmpty: ({boardID, threadID}) ->
if threadID if threadID
@ -44,24 +67,29 @@ class DataBoard
delete @data.boards[boardID] delete @data.boards[boardID]
set: (data, cb) -> set: (data, cb) ->
$.forceSync @key @save =>
@setUnsafe data, cb @setUnsafe data
, cb
setUnsafe: ({boardID, threadID, postID, val}, cb) -> setUnsafe: ({boardID, threadID, postID, val}) ->
if postID isnt undefined if postID isnt undefined
((@data.boards[boardID] or= {})[threadID] or= {})[postID] = val ((@data.boards[boardID] or= {})[threadID] or= {})[postID] = val
else if threadID isnt undefined else if threadID isnt undefined
(@data.boards[boardID] or= {})[threadID] = val (@data.boards[boardID] or= {})[threadID] = val
else else
@data.boards[boardID] = val @data.boards[boardID] = val
@save cb
extend: ({boardID, threadID, postID, val, rm}, cb) -> extend: ({boardID, threadID, postID, val, rm}, cb) ->
$.forceSync @key @save =>
oldVal = @get {boardID, threadID, postID, val: {}} oldVal = @get {boardID, threadID, postID, val: {}}
delete oldVal[key] for key in rm or [] delete oldVal[key] for key in rm or []
$.extend oldVal, val $.extend oldVal, val
@setUnsafe {boardID, threadID, postID, val: oldVal}, cb @setUnsafe {boardID, threadID, postID, val: oldVal}
, cb
setLastChecked: ->
@save =>
@data.lastChecked = Date.now()
get: ({boardID, threadID, postID, defaultValue}) -> get: ({boardID, threadID, postID, defaultValue}) ->
if board = @data.boards[boardID] if board = @data.boards[boardID]
@ -80,11 +108,7 @@ class DataBoard
thread thread
val or defaultValue val or defaultValue
forceSync: ->
$.forceSync @key
clean: -> clean: ->
$.forceSync @key
for boardID, val of @data.boards for boardID, val of @data.boards
@deleteIfEmpty {boardID} @deleteIfEmpty {boardID}
@ -115,7 +139,7 @@ class DataBoard
threads[ID] = board[ID] if ID of board threads[ID] = board[ID] if ID of board
@data.boards[boardID] = threads @data.boards[boardID] = threads
@deleteIfEmpty {boardID} @deleteIfEmpty {boardID}
@save() $.set @key, @allData
onSync: (data) => onSync: (data) =>
@initData data @initData data

View File

@ -1,4 +1,4 @@
{ {
"version": "1.13.14.11", "version": "1.13.14.12",
"date": "2017-12-10T02:17:48.734Z" "date": "2017-12-10T05:43:12.525Z"
} }