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.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

Binary file not shown.

View File

@ -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

View File

@ -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: <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;
},
loadSettings: function(data, cb) {

Binary file not shown.

View File

@ -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: <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;
},
loadSettings: function(data, cb) {

Binary file not shown.

View File

@ -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

View File

@ -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: <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;
},
loadSettings: function(data, cb) {

Binary file not shown.

View File

@ -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"
}
]

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<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>
</gupdate>

View File

@ -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"
}
]

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<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>
</gupdate>

View File

@ -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: <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
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
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,10 +196,12 @@ ThreadWatcher =
ThreadWatcher.fetchAllStatus()
fetchAllStatus: ->
ThreadWatcher.db.forceSync()
ThreadWatcher.unreaddb.forceSync()
QuoteYou.db?.forceSync()
return unless (threads = ThreadWatcher.getAll()).length
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

View File

@ -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})

View File

@ -19,10 +19,34 @@ 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
@save =>
if postID
return unless @data.boards[boardID]?[threadID]
delete @data.boards[boardID][threadID][postID]
@ -33,7 +57,6 @@ class DataBoard
@deleteIfEmpty {boardID}
else
delete @data.boards[boardID]
@save()
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
@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
@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

View File

@ -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"
}