Merge branch 'v3' into json

Conflicts:
	builds/4chan-X.user.js
	builds/crx/script.js
	src/Archive/Redirect.coffee
This commit is contained in:
Zixaphir 2014-01-11 12:09:33 -07:00
commit b3c33bb39b
4 changed files with 46 additions and 14 deletions

View File

@ -2522,7 +2522,7 @@
return $.addClass(Index.button, 'fa-spin'); return $.addClass(Index.button, 'fa-spin');
}, },
load: function(e, pageNum) { load: function(e, pageNum) {
var err, nTimeout, notice, req, timeEl; var err, nTimeout, notice, req, timeEl, _ref;
$.rmClass(Index.button, 'fa-spin'); $.rmClass(Index.button, 'fa-spin');
req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout; req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout;
if (nTimeout) { if (nTimeout) {
@ -2536,6 +2536,17 @@
notice.close(); notice.close();
return; return;
} }
if ((_ref = req.status) !== 200 && _ref !== 304) {
err = "Index refresh failed. Error " + req.statusText + " (" + req.status + ")";
if (notice) {
notice.setType('warning');
notice.el.lastElementChild.textContent = err;
setTimeout(notice.close, $.SECOND);
} else {
new Notice('warning', err, 1);
}
return;
}
try { try {
if (req.status === 200) { if (req.status === 200) {
Index.parse(JSON.parse(req.response), pageNum); Index.parse(JSON.parse(req.response), pageNum);
@ -2548,9 +2559,9 @@
if (notice) { if (notice) {
notice.setType('error'); notice.setType('error');
notice.el.lastElementChild.textContent = 'Index refresh failed.'; notice.el.lastElementChild.textContent = 'Index refresh failed.';
setTimeout(notice.close, 2 * $.SECOND); setTimeout(notice.close, $.SECOND);
} else { } else {
new Notice('error', 'Index refresh failed.', 2); new Notice('error', 'Index refresh failed.', 1);
} }
return; return;
} }
@ -10074,8 +10085,8 @@
} }
}, { }, {
name: "4plebs", name: "4plebs",
boards: ["hr", "pol", "s4s", "tg", "tv", "x"], boards: ["hr", "o", "pol", "s4s", "tg", "tv", "x"],
files: ["hr", "pol", "s4s", "tg", "tv", "x"], files: ["hr", "o", "pol", "s4s", "tg", "tv", "x"],
data: { data: {
domain: "archive.4plebs.org", domain: "archive.4plebs.org",
http: true, http: true,

View File

@ -2532,7 +2532,7 @@
return $.addClass(Index.button, 'fa-spin'); return $.addClass(Index.button, 'fa-spin');
}, },
load: function(e, pageNum) { load: function(e, pageNum) {
var err, nTimeout, notice, req, timeEl; var err, nTimeout, notice, req, timeEl, _ref;
$.rmClass(Index.button, 'fa-spin'); $.rmClass(Index.button, 'fa-spin');
req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout; req = Index.req, notice = Index.notice, nTimeout = Index.nTimeout;
if (nTimeout) { if (nTimeout) {
@ -2546,6 +2546,17 @@
notice.close(); notice.close();
return; return;
} }
if ((_ref = req.status) !== 200 && _ref !== 304) {
err = "Index refresh failed. Error " + req.statusText + " (" + req.status + ")";
if (notice) {
notice.setType('warning');
notice.el.lastElementChild.textContent = err;
setTimeout(notice.close, $.SECOND);
} else {
new Notice('warning', err, 1);
}
return;
}
try { try {
if (req.status === 200) { if (req.status === 200) {
Index.parse(JSON.parse(req.response), pageNum); Index.parse(JSON.parse(req.response), pageNum);
@ -2558,9 +2569,9 @@
if (notice) { if (notice) {
notice.setType('error'); notice.setType('error');
notice.el.lastElementChild.textContent = 'Index refresh failed.'; notice.el.lastElementChild.textContent = 'Index refresh failed.';
setTimeout(notice.close, 2 * $.SECOND); setTimeout(notice.close, $.SECOND);
} else { } else {
new Notice('error', 'Index refresh failed.', 2); new Notice('error', 'Index refresh failed.', 1);
} }
return; return;
} }
@ -10063,8 +10074,8 @@
} }
}, { }, {
name: "4plebs", name: "4plebs",
boards: ["hr", "pol", "s4s", "tg", "tv", "x"], boards: ["hr", "o", "pol", "s4s", "tg", "tv", "x"],
files: ["hr", "pol", "s4s", "tg", "tv", "x"], files: ["hr", "o", "pol", "s4s", "tg", "tv", "x"],
data: { data: {
domain: "archive.4plebs.org", domain: "archive.4plebs.org",
http: true, http: true,

View File

@ -54,8 +54,8 @@ Redirect =
software: "foolfuuka" software: "foolfuuka"
, ,
name: "4plebs" name: "4plebs"
boards: ["hr", "pol", "s4s", "tg", "tv", "x"] boards: ["hr", "o", "pol", "s4s", "tg", "tv", "x"]
files: ["hr", "pol", "s4s", "tg", "tv", "x"] files: ["hr", "o", "pol", "s4s", "tg", "tv", "x"]
data: data:
domain: "archive.4plebs.org" domain: "archive.4plebs.org"
http: true http: true

View File

@ -263,6 +263,16 @@ Index =
notice.close() notice.close()
return return
if req.status not in [200, 304]
err = "Index refresh failed. Error #{req.statusText} (#{req.status})"
if notice
notice.setType 'warning'
notice.el.lastElementChild.textContent = err
setTimeout notice.close, $.SECOND
else
new Notice 'warning', err, 1
return
try try
if req.status is 200 if req.status is 200
Index.parse JSON.parse(req.response), pageNum Index.parse JSON.parse(req.response), pageNum
@ -274,9 +284,9 @@ Index =
if notice if notice
notice.setType 'error' notice.setType 'error'
notice.el.lastElementChild.textContent = 'Index refresh failed.' notice.el.lastElementChild.textContent = 'Index refresh failed.'
setTimeout notice.close, 2 * $.SECOND setTimeout notice.close, $.SECOND
else else
new Notice 'error', 'Index refresh failed.', 2 new Notice 'error', 'Index refresh failed.', 1
return return
timeEl = $ '#index-last-refresh', Index.navLinks timeEl = $ '#index-last-refresh', Index.navLinks