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($, {
log: typeof (_base = console.log).bind === "function" ? _base.bind(console) : void 0,
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase(),
ready: function(fc) {
var cb;
if (/interactive|complete/.test(d.readyState)) return setTimeout(fc);
@ -1739,7 +1740,7 @@
<label id=spoilerLabel><input type=checkbox id=spoiler> Spoiler Image</label>\
<div class=warning></div>\
</form>');
if (Conf['Remember QR size'] && Main.engine === 'gecko') {
if (Conf['Remember QR size'] && $.engine === 'gecko') {
$.on(ta = $('textarea', QR.el), 'mouseup', function() {
return $.set('QR.size', this.style.cssText);
});
@ -1894,7 +1895,7 @@
QR.status({
progress: '...'
});
if (Main.engine === 'gecko' && reply.file) {
if ($.engine === 'gecko' && reply.file) {
file = {};
reader = new FileReader();
reader.onload = function() {
@ -2015,7 +2016,7 @@
var boundary, callbacks, form, i, name, opts, parts, toBin, url, val;
url = data.postURL;
delete data.postURL;
if (Main.engine === 'gecko' && data.upfile) {
if ($.engine === 'gecko' && data.upfile) {
if (!data.binary) {
toBin = function(data, name, val) {
var bb, r;
@ -3762,7 +3763,7 @@
url = href + '?' + Date.now();
}
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 $.ajax(url, {
@ -3901,7 +3902,7 @@
}
if (!$.id('navtopr')) return;
$.addClass(d.body, "chanx_" + (VERSION.split('.')[1]));
$.addClass(d.body, Main.engine);
$.addClass(d.body, $.engine);
_ref = ['navtop', 'navbot'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
nav = _ref[_i];
@ -4048,7 +4049,6 @@
target = e.target;
if (target.nodeName === 'TABLE') return Main.node([Main.preParse(target)]);
},
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase(),
callbacks: [],
css: '\
/* dialog styling */\

View File

@ -269,6 +269,7 @@ $.extend = (object, properties) ->
$.extend $,
# XXX GreaseMonkey can't into console.log.bind
log: console.log.bind? console
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase()
ready: (fc) ->
if /interactive|complete/.test d.readyState
# Execute the functions in parallel.
@ -1434,7 +1435,7 @@ QR =
<div class=warning></div>
</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', ->
$.set 'QR.size', @style.cssText
ta.style.cssText = $.get 'QR.size', ''
@ -1576,7 +1577,7 @@ QR =
# Provide some feedback that we're starting to submit.
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
# We plan to allow postMessaging Files and FileLists across origins,
# that just needs a more in depth security review.
@ -1695,7 +1696,7 @@ QR =
delete data.postURL
# 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.
unless data.binary
toBin = (data, name, val) ->
@ -3129,7 +3130,7 @@ ImageExpand =
timeoutID = setTimeout ImageExpand.expand, 10000, thumb, url
# Only Chrome let userscript break through cross domain requests.
# 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),
type: 'head'
@ -3278,7 +3279,7 @@ Main =
unless $.id 'navtopr'
return
$.addClass d.body, "chanx_#{VERSION.split('.')[1]}"
$.addClass d.body, Main.engine
$.addClass d.body, $.engine
for nav in ['navtop', 'navbot']
$.addClass $("a[href$='/#{Main.BOARD}/']", $.id nav), 'current'
form = $ 'form[name=delform]'
@ -3388,7 +3389,6 @@ Main =
{target} = e
Main.node [Main.preParse target] if target.nodeName is 'TABLE'
engine: /WebKit|Presto|Gecko/.exec(navigator.userAgent)[0].toLowerCase()
callbacks: []
css: '
/* dialog styling */