From 1e2aa40e22f75aa75e3300943fc03ccf348b325f Mon Sep 17 00:00:00 2001 From: James Campos Date: Tue, 12 Jun 2012 10:02:32 -0700 Subject: [PATCH] mayhem --- 4chan_x.user.js | 11 ++--------- script.coffee | 5 ++--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 477fb133f..1a959c2fc 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -330,10 +330,7 @@ } type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data; r = new XMLHttpRequest(); - if (data) { - type || (type = 'post'); - } - type || (type = 'get'); + type || (type = data && 'post' || 'get'); r.open(type, url, true); for (key in headers) { val = headers[key]; @@ -341,11 +338,7 @@ } $.extend(r, callbacks); $.extend(r.upload, upCallbacks); - if (typeof data === 'string') { - r.sendAsBinary(data); - } else { - r.send(data); - } + r.send(data); return r; }, cache: function(url, cb) { diff --git a/script.coffee b/script.coffee index da202318b..6005d5a37 100644 --- a/script.coffee +++ b/script.coffee @@ -276,14 +276,13 @@ $.extend $, ajax: (url, callbacks, opts={}) -> {type, headers, upCallbacks, data} = opts r = new XMLHttpRequest() - type or= 'post' if data - type or= 'get' + type or= data and 'post' or 'get' r.open type, url, true for key, val of headers r.setRequestHeader key, val $.extend r, callbacks $.extend r.upload, upCallbacks - if typeof data is 'string' then r.sendAsBinary data else r.send data + r.send data r cache: (url, cb) -> if req = $.cache.requests[url]