From f0c185c1e784f9b84424e9211d2e96749b287e4d Mon Sep 17 00:00:00 2001 From: Jordan Bates Date: Thu, 18 Apr 2013 11:03:02 -0700 Subject: [PATCH] Override mime type, avoid element not found error in updater --- builds/4chan-X.js | 3 ++- builds/4chan-X.user.js | 1 + builds/crx/script.js | 3 ++- src/lib/$.coffee | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 8402f8522..3f85d878f 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -351,6 +351,7 @@ } type = opts.type, cred = opts.cred, headers = opts.headers, upCallbacks = opts.upCallbacks, form = opts.form, sync = opts.sync; r = new XMLHttpRequest(); + r.overrideMimeType('text/html'); type || (type = form && 'post' || 'get'); r.open(type, url, !sync); for (key in headers) { @@ -4806,7 +4807,7 @@ hashScroll: function() { var post; - if (!(post = $.id(this.location.hash.slice(1)))) { + if (!(post = this.location.hash.slice(1))) { return; } if ((Get.postFromRoot(post)).isHidden) { diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 482ddec2e..bb942cd70 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -348,6 +348,7 @@ } type = opts.type, cred = opts.cred, headers = opts.headers, upCallbacks = opts.upCallbacks, form = opts.form, sync = opts.sync; r = new XMLHttpRequest(); + r.overrideMimeType('text/html'); type || (type = form && 'post' || 'get'); r.open(type, url, !sync); for (key in headers) { diff --git a/builds/crx/script.js b/builds/crx/script.js index fb4c06ff8..09ee47da5 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -303,6 +303,7 @@ } type = opts.type, cred = opts.cred, headers = opts.headers, upCallbacks = opts.upCallbacks, form = opts.form, sync = opts.sync; r = new XMLHttpRequest(); + r.overrideMimeType('text/html'); type || (type = form && 'post' || 'get'); r.open(type, url, !sync); for (key in headers) { @@ -4719,7 +4720,7 @@ hashScroll: function() { var post; - if (!(post = $.id(this.location.hash.slice(1)))) { + if (!(post = this.location.hash.slice(1))) { return; } if ((Get.postFromRoot(post)).isHidden) { diff --git a/src/lib/$.coffee b/src/lib/$.coffee index c97d870a5..59b6c1195 100644 --- a/src/lib/$.coffee +++ b/src/lib/$.coffee @@ -77,6 +77,7 @@ $.extend $, ajax: (url, callbacks, opts={}) -> {type, cred, headers, upCallbacks, form, sync} = opts r = new XMLHttpRequest() + r.overrideMimeType 'text/html' type or= form and 'post' or 'get' r.open type, url, !sync for key, val of headers