Try to consolidate
This commit is contained in:
parent
a02afb8c38
commit
ec35cb6742
@ -12523,7 +12523,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
initReady: function() {
|
initReady: function() {
|
||||||
var GMver, err, errors, href, i, passLink, post, postRoot, posts, styleSelector, thread, threadRoot, v, _i, _j, _len, _len1, _ref, _ref1, _ref2;
|
var GMver, err, href, i, threadRoot, v, _i, _len, _ref, _ref1;
|
||||||
if ((_ref = d.title) === '4chan - Temporarily Offline' || _ref === '4chan - 404 Not Found') {
|
if ((_ref = d.title) === '4chan - Temporarily Offline' || _ref === '4chan - 404 Not Found') {
|
||||||
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
||||||
href = Redirect.to('thread', {
|
href = Redirect.to('thread', {
|
||||||
@ -12537,11 +12537,35 @@
|
|||||||
}
|
}
|
||||||
Main.initStyle();
|
Main.initStyle();
|
||||||
if (g.VIEW === 'thread' && (threadRoot = $('.thread'))) {
|
if (g.VIEW === 'thread' && (threadRoot = $('.thread'))) {
|
||||||
|
Main.initThread(threadRoot);
|
||||||
|
}
|
||||||
|
GMver = GM_info.version.split('.');
|
||||||
|
_ref1 = "1.13".split('.');
|
||||||
|
for (i = _i = 0, _len = _ref1.length; _i < _len; i = ++_i) {
|
||||||
|
v = _ref1[i];
|
||||||
|
if (v < GMver[i]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (v === GMver[i]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
new Notice('warning', "Your version of Greasemonkey is outdated (v" + GM_info.version + " instead of v1.13 minimum) and 4chan X may not operate correctly.", 30);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return localStorage.getItem('4chan-settings');
|
||||||
|
} catch (_error) {
|
||||||
|
err = _error;
|
||||||
|
return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initThread: function(threadRoot) {
|
||||||
|
var err, errors, passLink, post, postRoot, posts, styleSelector, thread, _i, _len, _ref;
|
||||||
thread = new Thread(+threadRoot.id.slice(1), g.BOARD);
|
thread = new Thread(+threadRoot.id.slice(1), g.BOARD);
|
||||||
posts = [];
|
posts = [];
|
||||||
_ref1 = $$('.thread > .postContainer', threadRoot);
|
_ref = $$('.thread > .postContainer', threadRoot);
|
||||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
postRoot = _ref1[_i];
|
postRoot = _ref[_i];
|
||||||
try {
|
try {
|
||||||
posts.push(post = new Post(postRoot, thread, g.BOARD, {
|
posts.push(post = new Post(postRoot, thread, g.BOARD, {
|
||||||
isOriginalMarkup: true
|
isOriginalMarkup: true
|
||||||
@ -12572,28 +12596,7 @@
|
|||||||
$.on(passLink, 'click', function() {
|
$.on(passLink, 'click', function() {
|
||||||
return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0');
|
return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0');
|
||||||
});
|
});
|
||||||
$.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
|
return $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GMver = GM_info.version.split('.');
|
|
||||||
_ref2 = "1.13".split('.');
|
|
||||||
for (i = _j = 0, _len1 = _ref2.length; _j < _len1; i = ++_j) {
|
|
||||||
v = _ref2[i];
|
|
||||||
if (v < GMver[i]) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (v === GMver[i]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
new Notice('warning', "Your version of Greasemonkey is outdated (v" + GM_info.version + " instead of v1.13 minimum) and 4chan X may not operate correctly.", 30);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return localStorage.getItem('4chan-settings');
|
|
||||||
} catch (_error) {
|
|
||||||
err = _error;
|
|
||||||
return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
callbackNodes: function(klass, nodes) {
|
callbackNodes: function(klass, nodes) {
|
||||||
|
|||||||
@ -12510,7 +12510,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
initReady: function() {
|
initReady: function() {
|
||||||
var err, errors, href, passLink, post, postRoot, posts, styleSelector, thread, threadRoot, _i, _len, _ref, _ref1;
|
var err, href, threadRoot, _ref;
|
||||||
if ((_ref = d.title) === '4chan - Temporarily Offline' || _ref === '4chan - 404 Not Found') {
|
if ((_ref = d.title) === '4chan - Temporarily Offline' || _ref === '4chan - 404 Not Found') {
|
||||||
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
if (Conf['404 Redirect'] && g.VIEW === 'thread') {
|
||||||
href = Redirect.to('thread', {
|
href = Redirect.to('thread', {
|
||||||
@ -12524,11 +12524,22 @@
|
|||||||
}
|
}
|
||||||
Main.initStyle();
|
Main.initStyle();
|
||||||
if (g.VIEW === 'thread' && (threadRoot = $('.thread'))) {
|
if (g.VIEW === 'thread' && (threadRoot = $('.thread'))) {
|
||||||
|
Main.initThread(threadRoot);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return localStorage.getItem('4chan-settings');
|
||||||
|
} catch (_error) {
|
||||||
|
err = _error;
|
||||||
|
return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
initThread: function(threadRoot) {
|
||||||
|
var err, errors, passLink, post, postRoot, posts, styleSelector, thread, _i, _len, _ref;
|
||||||
thread = new Thread(+threadRoot.id.slice(1), g.BOARD);
|
thread = new Thread(+threadRoot.id.slice(1), g.BOARD);
|
||||||
posts = [];
|
posts = [];
|
||||||
_ref1 = $$('.thread > .postContainer', threadRoot);
|
_ref = $$('.thread > .postContainer', threadRoot);
|
||||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
postRoot = _ref1[_i];
|
postRoot = _ref[_i];
|
||||||
try {
|
try {
|
||||||
posts.push(post = new Post(postRoot, thread, g.BOARD, {
|
posts.push(post = new Post(postRoot, thread, g.BOARD, {
|
||||||
isOriginalMarkup: true
|
isOriginalMarkup: true
|
||||||
@ -12559,15 +12570,7 @@
|
|||||||
$.on(passLink, 'click', function() {
|
$.on(passLink, 'click', function() {
|
||||||
return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0');
|
return window.open('//sys.4chan.org/auth', 'This will steal your data.', 'left=0,top=0,width=500,height=255,toolbar=0,resizable=0');
|
||||||
});
|
});
|
||||||
$.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
|
return $.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return localStorage.getItem('4chan-settings');
|
|
||||||
} catch (_error) {
|
|
||||||
err = _error;
|
|
||||||
return new Notice('warning', 'Cookies need to be enabled on 4chan for 4chan X to operate properly.', 30);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
callbackNodes: function(klass, nodes) {
|
callbackNodes: function(klass, nodes) {
|
||||||
|
|||||||
@ -118,7 +118,23 @@ Main =
|
|||||||
# Something might have gone wrong!
|
# Something might have gone wrong!
|
||||||
Main.initStyle()
|
Main.initStyle()
|
||||||
|
|
||||||
if g.VIEW is 'thread' and threadRoot = $ '.thread'
|
Main.initThread threadRoot if g.VIEW is 'thread' and threadRoot = $ '.thread'
|
||||||
|
|
||||||
|
<% if (type === 'userscript') { %>
|
||||||
|
GMver = GM_info.version.split '.'
|
||||||
|
for v, i in "<%= meta.min.greasemonkey %>".split '.'
|
||||||
|
break if v < GMver[i]
|
||||||
|
continue if v is GMver[i]
|
||||||
|
new Notice 'warning', "Your version of Greasemonkey is outdated (v#{GM_info.version} instead of v<%= meta.min.greasemonkey %> minimum) and <%= meta.name %> may not operate correctly.", 30
|
||||||
|
break
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
try
|
||||||
|
localStorage.getItem '4chan-settings'
|
||||||
|
catch err
|
||||||
|
new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to operate properly.', 30
|
||||||
|
|
||||||
|
initThread: (threadRoot) ->
|
||||||
thread = new Thread +threadRoot.id[1..], g.BOARD
|
thread = new Thread +threadRoot.id[1..], g.BOARD
|
||||||
posts = []
|
posts = []
|
||||||
for postRoot in $$ '.thread > .postContainer', threadRoot
|
for postRoot in $$ '.thread > .postContainer', threadRoot
|
||||||
@ -146,22 +162,6 @@ Main =
|
|||||||
'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'
|
'left=0,top=0,width=500,height=255,toolbar=0,resizable=0'
|
||||||
$.before styleSelector.previousSibling, [$.tn '['; passLink, $.tn ']\u00A0\u00A0']
|
$.before styleSelector.previousSibling, [$.tn '['; passLink, $.tn ']\u00A0\u00A0']
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
<% if (type === 'userscript') { %>
|
|
||||||
GMver = GM_info.version.split '.'
|
|
||||||
for v, i in "<%= meta.min.greasemonkey %>".split '.'
|
|
||||||
break if v < GMver[i]
|
|
||||||
continue if v is GMver[i]
|
|
||||||
new Notice 'warning', "Your version of Greasemonkey is outdated (v#{GM_info.version} instead of v<%= meta.min.greasemonkey %> minimum) and <%= meta.name %> may not operate correctly.", 30
|
|
||||||
break
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
try
|
|
||||||
localStorage.getItem '4chan-settings'
|
|
||||||
catch err
|
|
||||||
new Notice 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to operate properly.', 30
|
|
||||||
|
|
||||||
callbackNodes: (klass, nodes) ->
|
callbackNodes: (klass, nodes) ->
|
||||||
i = 0
|
i = 0
|
||||||
cb = klass.callbacks
|
cb = klass.callbacks
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user