Mayhem made responseType JSON default for any URL containing .json.
This commit is contained in:
parent
f133da454d
commit
b62d82bed0
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.3.2 - 2014-01-22
|
||||
* 4chan X - Version 1.3.2 - 2014-01-24
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.3.2 - 2014-01-22
|
||||
* 4chan X - Version 1.3.2 - 2014-01-24
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -7431,12 +7431,13 @@
|
||||
}
|
||||
return $.ajax("//api.4chan.org/" + post.board + "/res/" + post.thread + ".json", {
|
||||
onload: function() {
|
||||
var i, postObj;
|
||||
var i, postObj, posts;
|
||||
if (this.status !== 200) {
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
while (postObj = JSON.parse(this.response).posts[i++]) {
|
||||
posts = this.response.posts;
|
||||
while (postObj = posts[i++]) {
|
||||
if (postObj.no === post.ID) {
|
||||
break;
|
||||
}
|
||||
@ -8261,7 +8262,7 @@
|
||||
switch (response.status) {
|
||||
case 200:
|
||||
case 304:
|
||||
text = "" + (service.text(JSON.parse(response.responseText)));
|
||||
text = "" + (service.text(response.response));
|
||||
if (Conf['Embedding']) {
|
||||
embed.dataset.title = text;
|
||||
}
|
||||
@ -8357,7 +8358,7 @@
|
||||
if (status !== 200 && status !== 304) {
|
||||
return div.innerHTML = "ERROR " + status;
|
||||
}
|
||||
files = JSON.parse(this.response).files;
|
||||
files = this.response.files;
|
||||
_ref = ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg'];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
type = _ref[_i];
|
||||
@ -12155,13 +12156,13 @@
|
||||
}
|
||||
},
|
||||
clean: function() {
|
||||
var posts, threads;
|
||||
posts = g.posts, threads = g.threads;
|
||||
var board;
|
||||
g.threads.forEach(function(thread) {
|
||||
return thread.collect();
|
||||
});
|
||||
QuoteBacklink.containers = {};
|
||||
return $.rmAll($('.board'));
|
||||
board = $('.board');
|
||||
return $.replace(board, board.cloneNode(false));
|
||||
},
|
||||
features: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]],
|
||||
disconnect: function() {
|
||||
@ -12260,7 +12261,6 @@
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var fullBoardList, onload, req;
|
||||
req = null;
|
||||
fullBoardList = $('#full-board-list', Header.boardList);
|
||||
$.rmClass($('.current', fullBoardList), 'current');
|
||||
$.addClass($("a[href*='/" + boardID + "/']", fullBoardList), 'current');
|
||||
@ -12276,7 +12276,7 @@
|
||||
return;
|
||||
}
|
||||
try {
|
||||
_ref = JSON.parse(req.response).boards;
|
||||
_ref = req.response.boards;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
aboard = _ref[_i];
|
||||
if (!(aboard.board === boardID)) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript
|
||||
/*
|
||||
* 4chan X - Version 1.3.2 - 2014-01-22
|
||||
* 4chan X - Version 1.3.2 - 2014-01-24
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
@ -7446,12 +7446,13 @@
|
||||
}
|
||||
return $.ajax("//api.4chan.org/" + post.board + "/res/" + post.thread + ".json", {
|
||||
onload: function() {
|
||||
var i, postObj;
|
||||
var i, postObj, posts;
|
||||
if (this.status !== 200) {
|
||||
return;
|
||||
}
|
||||
i = 0;
|
||||
while (postObj = JSON.parse(this.response).posts[i++]) {
|
||||
posts = this.response.posts;
|
||||
while (postObj = posts[i++]) {
|
||||
if (postObj.no === post.ID) {
|
||||
break;
|
||||
}
|
||||
@ -8254,7 +8255,7 @@
|
||||
switch (response.status) {
|
||||
case 200:
|
||||
case 304:
|
||||
text = "" + (service.text(JSON.parse(response.responseText)));
|
||||
text = "" + (service.text(response.response));
|
||||
if (Conf['Embedding']) {
|
||||
embed.dataset.title = text;
|
||||
}
|
||||
@ -8350,7 +8351,7 @@
|
||||
if (status !== 200 && status !== 304) {
|
||||
return div.innerHTML = "ERROR " + status;
|
||||
}
|
||||
files = JSON.parse(this.response).files;
|
||||
files = this.response.files;
|
||||
_ref = ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg'];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
type = _ref[_i];
|
||||
@ -12154,13 +12155,13 @@
|
||||
}
|
||||
},
|
||||
clean: function() {
|
||||
var posts, threads;
|
||||
posts = g.posts, threads = g.threads;
|
||||
var board;
|
||||
g.threads.forEach(function(thread) {
|
||||
return thread.collect();
|
||||
});
|
||||
QuoteBacklink.containers = {};
|
||||
return $.rmAll($('.board'));
|
||||
board = $('.board');
|
||||
return $.replace(board, board.cloneNode(false));
|
||||
},
|
||||
features: [['Thread Excerpt', ThreadExcerpt], ['Unread Count', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Expansion', ExpandThread]],
|
||||
disconnect: function() {
|
||||
@ -12259,7 +12260,6 @@
|
||||
},
|
||||
updateBoard: function(boardID) {
|
||||
var fullBoardList, onload, req;
|
||||
req = null;
|
||||
fullBoardList = $('#full-board-list', Header.boardList);
|
||||
$.rmClass($('.current', fullBoardList), 'current');
|
||||
$.addClass($("a[href*='/" + boardID + "/']", fullBoardList), 'current');
|
||||
@ -12275,7 +12275,7 @@
|
||||
return;
|
||||
}
|
||||
try {
|
||||
_ref = JSON.parse(req.response).boards;
|
||||
_ref = req.response.boards;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
aboard = _ref[_i];
|
||||
if (!(aboard.board === boardID)) {
|
||||
|
||||
@ -33,15 +33,12 @@ Navigate =
|
||||
return
|
||||
|
||||
clean: ->
|
||||
{posts, threads} = g
|
||||
|
||||
# Garbage collection
|
||||
g.threads.forEach (thread) -> thread.collect()
|
||||
|
||||
QuoteBacklink.containers = {}
|
||||
|
||||
# Delete nodes
|
||||
$.rmAll $ '.board'
|
||||
board = $('.board')
|
||||
$.replace board, board.cloneNode false
|
||||
|
||||
features: [
|
||||
['Thread Excerpt', ThreadExcerpt]
|
||||
@ -112,8 +109,6 @@ Navigate =
|
||||
}[g.VIEW]()
|
||||
|
||||
updateBoard: (boardID) ->
|
||||
req = null
|
||||
|
||||
fullBoardList = $ '#full-board-list', Header.boardList
|
||||
$.rmClass $('.current', fullBoardList), 'current'
|
||||
$.addClass $("a[href*='/#{boardID}/']", fullBoardList), 'current'
|
||||
@ -129,7 +124,7 @@ Navigate =
|
||||
return unless req.status is 200
|
||||
|
||||
try
|
||||
for aboard in JSON.parse(req.response).boards when aboard.board is boardID
|
||||
for aboard in req.response.boards when aboard.board is boardID
|
||||
board = aboard
|
||||
break
|
||||
|
||||
|
||||
@ -201,7 +201,8 @@ Gallery =
|
||||
$.ajax "//api.4chan.org/#{post.board}/res/#{post.thread}.json", onload: ->
|
||||
return if @status isnt 200
|
||||
i = 0
|
||||
while postObj = JSON.parse(@response).posts[i++]
|
||||
{posts} = @response
|
||||
while postObj = posts[i++]
|
||||
break if postObj.no is post.ID
|
||||
unless postObj.no
|
||||
return post.kill()
|
||||
|
||||
@ -241,7 +241,7 @@ Linkify =
|
||||
service = Linkify.types[key].title
|
||||
switch response.status
|
||||
when 200, 304
|
||||
text = "#{service.text JSON.parse response.responseText}"
|
||||
text = "#{service.text response.response}"
|
||||
if Conf['Embedding']
|
||||
embed.dataset.title = text
|
||||
when 404
|
||||
@ -304,7 +304,7 @@ Linkify =
|
||||
$.cache "https://mediacru.sh/#{a.dataset.uid}.json", ->
|
||||
{status} = @
|
||||
return div.innerHTML = "ERROR #{status}" unless status in [200, 304]
|
||||
{files} = JSON.parse @response
|
||||
{files} = @response
|
||||
for type in ['video/mp4', 'video/ogv', 'image/svg+xml', 'image/png', 'image/gif', 'image/jpeg', 'image/svg', 'audio/mpeg']
|
||||
for file in files
|
||||
if file.type is type
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user