Merge Mayhem X
This commit is contained in:
commit
b8062b0323
@ -10338,8 +10338,26 @@
|
||||
};
|
||||
|
||||
Main = {
|
||||
init: function(items) {
|
||||
var db, flatten, _i, _len;
|
||||
init: function() {
|
||||
var db, flatten, pathname, _i, _len, _ref;
|
||||
pathname = location.pathname.split('/');
|
||||
g.BOARD = new Board(pathname[1]);
|
||||
if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') {
|
||||
return;
|
||||
}
|
||||
g.VIEW = (function() {
|
||||
switch (pathname[2]) {
|
||||
case 'res':
|
||||
return 'thread';
|
||||
case 'catalog':
|
||||
return 'catalog';
|
||||
default:
|
||||
return 'index';
|
||||
}
|
||||
})();
|
||||
if (g.VIEW === 'thread') {
|
||||
g.THREADID = +pathname[3];
|
||||
}
|
||||
flatten = function(parent, obj) {
|
||||
var key, val;
|
||||
if (obj instanceof Array) {
|
||||
@ -10362,15 +10380,18 @@
|
||||
}
|
||||
Conf['selectedArchives'] = {};
|
||||
Conf['CachedTitles'] = [];
|
||||
$.get(Conf, Main.initFeatures);
|
||||
Conf['archives'] = Redirect.archives;
|
||||
$.get(Conf, function(items) {
|
||||
$.extend(Conf, items);
|
||||
return Main.initFeatures();
|
||||
});
|
||||
$.on(d, '4chanMainInit', Main.initStyle);
|
||||
return $.asap((function() {
|
||||
return d.head && $('link[rel="shortcut icon"]', d.head) || d.readyState !== 'loading';
|
||||
}), Main.initStyle);
|
||||
},
|
||||
initFeatures: function(items) {
|
||||
initFeatures: function() {
|
||||
var init, pathname, _ref;
|
||||
Conf = items;
|
||||
pathname = location.pathname.split('/');
|
||||
g.BOARD = new Board(pathname[1]);
|
||||
if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') {
|
||||
@ -10543,9 +10564,7 @@
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!$.hasClass(doc, 'fourchan-x')) {
|
||||
Main.initStyle();
|
||||
}
|
||||
Main.initStyle();
|
||||
if (board = $('.board')) {
|
||||
threads = [];
|
||||
posts = [];
|
||||
|
||||
@ -10323,8 +10323,26 @@
|
||||
};
|
||||
|
||||
Main = {
|
||||
init: function(items) {
|
||||
var db, flatten, _i, _len;
|
||||
init: function() {
|
||||
var db, flatten, pathname, _i, _len, _ref;
|
||||
pathname = location.pathname.split('/');
|
||||
g.BOARD = new Board(pathname[1]);
|
||||
if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') {
|
||||
return;
|
||||
}
|
||||
g.VIEW = (function() {
|
||||
switch (pathname[2]) {
|
||||
case 'res':
|
||||
return 'thread';
|
||||
case 'catalog':
|
||||
return 'catalog';
|
||||
default:
|
||||
return 'index';
|
||||
}
|
||||
})();
|
||||
if (g.VIEW === 'thread') {
|
||||
g.THREADID = +pathname[3];
|
||||
}
|
||||
flatten = function(parent, obj) {
|
||||
var key, val;
|
||||
if (obj instanceof Array) {
|
||||
@ -10347,15 +10365,27 @@
|
||||
}
|
||||
Conf['selectedArchives'] = {};
|
||||
Conf['CachedTitles'] = [];
|
||||
$.get(Conf, Main.initFeatures);
|
||||
Conf['archives'] = Redirect.archives;
|
||||
$.get(Conf, function(items) {
|
||||
$.extend(Conf, items);
|
||||
if (!items) {
|
||||
new Notification('error', $.el('span', {
|
||||
innerHTML: "It seems like your 4chan X settings became corrupted due to a <a href=\"https://code.google.com/p/chromium/issues/detail?id=261623\" target=_blank>Chrome bug</a>.<br>\nUnfortunately, you'll have to <a href=\"https://github.com/MayhemYDG/4chan-x/wiki/FAQ#known-problems\" target=_blank>fix it yourself</a>."
|
||||
}));
|
||||
Main.logError({
|
||||
message: 'Chrome Storage API bug',
|
||||
error: new Error(chrome.runtime.lastError.message || 'no lastError.message')
|
||||
});
|
||||
}
|
||||
return Main.initFeatures();
|
||||
});
|
||||
$.on(d, '4chanMainInit', Main.initStyle);
|
||||
return $.asap((function() {
|
||||
return d.head && $('link[rel="shortcut icon"]', d.head) || d.readyState !== 'loading';
|
||||
}), Main.initStyle);
|
||||
},
|
||||
initFeatures: function(items) {
|
||||
initFeatures: function() {
|
||||
var init, pathname, _ref;
|
||||
Conf = items;
|
||||
pathname = location.pathname.split('/');
|
||||
g.BOARD = new Board(pathname[1]);
|
||||
if ((_ref = g.BOARD.ID) === 'z' || _ref === 'fk') {
|
||||
@ -10528,9 +10558,7 @@
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!$.hasClass(doc, 'fourchan-x')) {
|
||||
Main.initStyle();
|
||||
}
|
||||
Main.initStyle();
|
||||
if (board = $('.board')) {
|
||||
threads = [];
|
||||
posts = [];
|
||||
|
||||
@ -1,5 +1,18 @@
|
||||
Main =
|
||||
init: (items) ->
|
||||
init: ->
|
||||
pathname = location.pathname.split '/'
|
||||
g.BOARD = new Board pathname[1]
|
||||
return if g.BOARD.ID in ['z', 'fk']
|
||||
g.VIEW =
|
||||
switch pathname[2]
|
||||
when 'res'
|
||||
'thread'
|
||||
when 'catalog'
|
||||
'catalog'
|
||||
else
|
||||
'index'
|
||||
if g.VIEW is 'thread'
|
||||
g.THREADID = +pathname[3]
|
||||
# flatten Config into Conf
|
||||
# and get saved or default values
|
||||
flatten = (parent, obj) ->
|
||||
@ -16,15 +29,28 @@ Main =
|
||||
Conf[db] = boards: {}
|
||||
Conf['selectedArchives'] = {}
|
||||
Conf['CachedTitles'] = []
|
||||
|
||||
$.get Conf, Main.initFeatures
|
||||
Conf['archives'] = Redirect.archives
|
||||
$.get Conf, (items) ->
|
||||
$.extend Conf, items
|
||||
<% if (type === 'crx') { %>
|
||||
unless items
|
||||
new Notification 'error', $.el 'span',
|
||||
innerHTML: """
|
||||
It seems like your <%= meta.name %> settings became corrupted due to a <a href="https://code.google.com/p/chromium/issues/detail?id=261623" target=_blank>Chrome bug</a>.<br>
|
||||
Unfortunately, you'll have to <a href="https://github.com/MayhemYDG/4chan-x/wiki/FAQ#known-problems" target=_blank>fix it yourself</a>.
|
||||
"""
|
||||
# Track resolution of this bug.
|
||||
Main.logError
|
||||
message: 'Chrome Storage API bug'
|
||||
error: new Error chrome.runtime.lastError.message or 'no lastError.message'
|
||||
<% } %>
|
||||
Main.initFeatures()
|
||||
|
||||
$.on d, '4chanMainInit', Main.initStyle
|
||||
$.asap (-> d.head and $('link[rel="shortcut icon"]', d.head) or d.readyState isnt 'loading'),
|
||||
Main.initStyle
|
||||
|
||||
initFeatures: (items) ->
|
||||
Conf = items
|
||||
initFeatures: ->
|
||||
|
||||
pathname = location.pathname.split '/'
|
||||
g.BOARD = new Board pathname[1]
|
||||
@ -39,7 +65,6 @@ Main =
|
||||
'index'
|
||||
if g.VIEW is 'thread'
|
||||
g.THREADID = +pathname[3]
|
||||
|
||||
switch location.hostname
|
||||
when 'api.4chan.org'
|
||||
return
|
||||
@ -180,9 +205,8 @@ Main =
|
||||
location.replace href or "/#{g.BOARD}/"
|
||||
return
|
||||
|
||||
unless $.hasClass doc, 'fourchan-x'
|
||||
# Something might have gone wrong!
|
||||
Main.initStyle()
|
||||
# Something might have gone wrong!
|
||||
Main.initStyle()
|
||||
|
||||
if board = $ '.board'
|
||||
threads = []
|
||||
|
||||
0
src/General/html/Monitoring/ThreadWatcher.html
Normal file → Executable file
0
src/General/html/Monitoring/ThreadWatcher.html
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user