Main.engine -> $.engine

This commit is contained in:
James Campos 2012-03-15 23:56:21 -07:00
parent aac5089b49
commit 3b0f041648
2 changed files with 12 additions and 12 deletions

View File

@ -310,6 +310,7 @@
$.extend($, { $.extend($, {
log: typeof (_base = console.log).bind === "function" ? _base.bind(console) : void 0, log: typeof (_base = console.log).bind === "function" ? _base.bind(console) : void 0,
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase(),
ready: function(fc) { ready: function(fc) {
var cb; var cb;
if (/interactive|complete/.test(d.readyState)) return setTimeout(fc); if (/interactive|complete/.test(d.readyState)) return setTimeout(fc);
@ -1739,7 +1740,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'] && Main.engine === 'gecko') { if (Conf['Remember QR size'] && $.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);
}); });
@ -1894,7 +1895,7 @@
QR.status({ QR.status({
progress: '...' progress: '...'
}); });
if (Main.engine === 'gecko' && reply.file) { if ($.engine === 'gecko' && reply.file) {
file = {}; file = {};
reader = new FileReader(); reader = new FileReader();
reader.onload = function() { reader.onload = function() {
@ -2015,7 +2016,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 (Main.engine === 'gecko' && data.upfile) { if ($.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;
@ -3762,7 +3763,7 @@
url = href + '?' + Date.now(); url = href + '?' + Date.now();
} }
timeoutID = setTimeout(ImageExpand.expand, 10000, thumb, url); timeoutID = setTimeout(ImageExpand.expand, 10000, thumb, url);
if (!(Main.engine === 'webkit' && url.split('/')[2] === 'images.4chan.org')) { if (!($.engine === 'webkit' && url.split('/')[2] === 'images.4chan.org')) {
return; return;
} }
return $.ajax(url, { return $.ajax(url, {
@ -3901,7 +3902,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, Main.engine); $.addClass(d.body, $.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];
@ -4048,7 +4049,6 @@
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

@ -269,6 +269,7 @@ $.extend = (object, properties) ->
$.extend $, $.extend $,
# XXX GreaseMonkey can't into console.log.bind # XXX GreaseMonkey can't into console.log.bind
log: console.log.bind? console log: console.log.bind? console
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase()
ready: (fc) -> ready: (fc) ->
if /interactive|complete/.test d.readyState if /interactive|complete/.test d.readyState
# Execute the functions in parallel. # Execute the functions in parallel.
@ -1434,7 +1435,7 @@ QR =
<div class=warning></div> <div class=warning></div>
</form>' </form>'
if Conf['Remember QR size'] and Main.engine is 'gecko' if Conf['Remember QR size'] and $.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', ''
@ -1576,7 +1577,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 Main.engine is 'gecko' and reply.file if $.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.
@ -1695,7 +1696,7 @@ QR =
delete data.postURL delete data.postURL
# File with filename upload fix from desuwa # File with filename upload fix from desuwa
if Main.engine is 'gecko' and data.upfile if $.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) ->
@ -3129,7 +3130,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 Main.engine is 'webkit' and url.split('/')[2] is 'images.4chan.org' return unless $.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'
@ -3278,7 +3279,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, Main.engine $.addClass d.body, $.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]'
@ -3388,7 +3389,6 @@ 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 */