engine -> Main.engine

This commit is contained in:
James Campos 2012-03-15 23:23:46 -07:00
parent b814cdf16a
commit 9eebb9464b
2 changed files with 13 additions and 14 deletions

View File

@ -73,7 +73,7 @@
*/ */
(function() { (function() {
var $, $$, Anonymize, AutoGif, Conf, Config, DAY, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, HOUR, ImageExpand, ImageHover, Keybinds, MINUTE, Main, NAMESPACE, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, SECOND, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, Unread, Updater, VERSION, Watcher, d, engine, flatten, ui, _base; var $, $$, Anonymize, AutoGif, Conf, Config, DAY, ExpandComment, ExpandThread, Favicon, FileInfo, Filter, GetTitle, HOUR, ImageExpand, ImageHover, Keybinds, MINUTE, Main, NAMESPACE, Nav, Options, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, Quotify, Redirect, ReplyHiding, ReportButton, RevealSpoilers, SECOND, Sauce, StrikethroughQuotes, ThreadHiding, ThreadStats, Threading, Time, TitlePost, Unread, Updater, VERSION, Watcher, d, flatten, ui, _base;
Config = { Config = {
main: { main: {
@ -220,8 +220,6 @@
DAY = 24 * HOUR; DAY = 24 * HOUR;
engine = /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase();
d = document; d = document;
ui = { ui = {
@ -1741,7 +1739,7 @@
<label id=spoilerLabel><input type=checkbox id=spoiler> Spoiler Image</label>\ <label id=spoilerLabel><input type=checkbox id=spoiler> Spoiler Image</label>\
<div class=warning></div>\ <div class=warning></div>\
</form>'); </form>');
if (Conf['Remember QR size'] && engine === 'gecko') { if (Conf['Remember QR size'] && Main.engine === 'gecko') {
$.on(ta = $('textarea', QR.el), 'mouseup', function() { $.on(ta = $('textarea', QR.el), 'mouseup', function() {
return $.set('QR.size', this.style.cssText); return $.set('QR.size', this.style.cssText);
}); });
@ -1896,7 +1894,7 @@
QR.status({ QR.status({
progress: '...' progress: '...'
}); });
if (engine === 'gecko' && reply.file) { if (Main.engine === 'gecko' && reply.file) {
file = {}; file = {};
reader = new FileReader(); reader = new FileReader();
reader.onload = function() { reader.onload = function() {
@ -2017,7 +2015,7 @@
var boundary, callbacks, form, i, name, opts, parts, toBin, url, val; var boundary, callbacks, form, i, name, opts, parts, toBin, url, val;
url = data.postURL; url = data.postURL;
delete data.postURL; delete data.postURL;
if (engine === 'gecko' && data.upfile) { if (Main.engine === 'gecko' && data.upfile) {
if (!data.binary) { if (!data.binary) {
toBin = function(data, name, val) { toBin = function(data, name, val) {
var bb, r; var bb, r;
@ -3764,7 +3762,7 @@
url = href + '?' + Date.now(); url = href + '?' + Date.now();
} }
timeoutID = setTimeout(ImageExpand.expand, 10000, thumb, url); timeoutID = setTimeout(ImageExpand.expand, 10000, thumb, url);
if (!(engine === 'webkit' && url.split('/')[2] === 'images.4chan.org')) { if (!(Main.engine === 'webkit' && url.split('/')[2] === 'images.4chan.org')) {
return; return;
} }
return $.ajax(url, { return $.ajax(url, {
@ -3903,7 +3901,7 @@
} }
if (!$.id('navtopr')) return; if (!$.id('navtopr')) return;
$.addClass(d.body, "chanx_" + (VERSION.split('.')[1])); $.addClass(d.body, "chanx_" + (VERSION.split('.')[1]));
$.addClass(d.body, engine); $.addClass(d.body, Main.engine);
_ref = ['navtop', 'navbot']; _ref = ['navtop', 'navbot'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
nav = _ref[_i]; nav = _ref[_i];
@ -4050,6 +4048,7 @@
target = e.target; target = e.target;
if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]); if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]);
}, },
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase(),
callbacks: [], callbacks: [],
css: '\ css: '\
/* dialog styling */\ /* dialog styling */\

View File

@ -173,7 +173,6 @@ SECOND = 1000
MINUTE = 60*SECOND MINUTE = 60*SECOND
HOUR = 60*MINUTE HOUR = 60*MINUTE
DAY = 24*HOUR DAY = 24*HOUR
engine = /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase()
d = document d = document
ui = ui =
@ -1435,7 +1434,7 @@ QR =
<div class=warning></div> <div class=warning></div>
</form>' </form>'
if Conf['Remember QR size'] and engine is 'gecko' if Conf['Remember QR size'] and Main.engine is 'gecko'
$.on ta = $('textarea', QR.el), 'mouseup', -> $.on ta = $('textarea', QR.el), 'mouseup', ->
$.set 'QR.size', @style.cssText $.set 'QR.size', @style.cssText
ta.style.cssText = $.get 'QR.size', '' ta.style.cssText = $.get 'QR.size', ''
@ -1577,7 +1576,7 @@ QR =
# Provide some feedback that we're starting to submit. # Provide some feedback that we're starting to submit.
QR.status progress: '...' QR.status progress: '...'
if engine is 'gecko' and reply.file if Main.engine is 'gecko' and reply.file
# https://bugzilla.mozilla.org/show_bug.cgi?id=673742 # https://bugzilla.mozilla.org/show_bug.cgi?id=673742
# We plan to allow postMessaging Files and FileLists across origins, # We plan to allow postMessaging Files and FileLists across origins,
# that just needs a more in depth security review. # that just needs a more in depth security review.
@ -1696,7 +1695,7 @@ QR =
delete data.postURL delete data.postURL
# File with filename upload fix from desuwa # File with filename upload fix from desuwa
if engine is 'gecko' and data.upfile if Main.engine is 'gecko' and data.upfile
# All of this is fucking retarded. # All of this is fucking retarded.
unless data.binary unless data.binary
toBin = (data, name, val) -> toBin = (data, name, val) ->
@ -3130,7 +3129,7 @@ ImageExpand =
timeoutID = setTimeout ImageExpand.expand, 10000, thumb, url timeoutID = setTimeout ImageExpand.expand, 10000, thumb, url
# Only Chrome let userscript break through cross domain requests. # Only Chrome let userscript break through cross domain requests.
# Don't check it 404s in the archivers. # Don't check it 404s in the archivers.
return unless engine is 'webkit' and url.split('/')[2] is 'images.4chan.org' return unless Main.engine is 'webkit' and url.split('/')[2] is 'images.4chan.org'
$.ajax url, onreadystatechange: (-> clearTimeout timeoutID if @status is 404), $.ajax url, onreadystatechange: (-> clearTimeout timeoutID if @status is 404),
type: 'head' type: 'head'
@ -3279,7 +3278,7 @@ Main =
unless $.id 'navtopr' unless $.id 'navtopr'
return return
$.addClass d.body, "chanx_#{VERSION.split('.')[1]}" $.addClass d.body, "chanx_#{VERSION.split('.')[1]}"
$.addClass d.body, engine $.addClass d.body, Main.engine
for nav in ['navtop', 'navbot'] for nav in ['navtop', 'navbot']
$.addClass $("a[href$='/#{Main.BOARD}/']", $.id nav), 'current' $.addClass $("a[href$='/#{Main.BOARD}/']", $.id nav), 'current'
form = $ 'form[name=delform]' form = $ 'form[name=delform]'
@ -3389,6 +3388,7 @@ Main =
{target} = e {target} = e
Main.node [Main.preParse target] if target.nodeName is 'TABLE' Main.node [Main.preParse target] if target.nodeName is 'TABLE'
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase()
callbacks: [] callbacks: []
css: ' css: '
/* dialog styling */ /* dialog styling */