diff --git a/builds/4chan-X.js b/builds/4chan-X.js index 5551493f8..a03880712 100644 --- a/builds/4chan-X.js +++ b/builds/4chan-X.js @@ -336,7 +336,7 @@ i = this.length; while (i--) { if (this[i] === object) { - break; + return i; } } return i; @@ -350,6 +350,7 @@ arg = args[_i]; this.push.apply(this, arg); } + return this; }; Array.prototype.remove = function(object) { @@ -4325,6 +4326,21 @@ return div = $.el('iframe', { src: "http://www.purplegene.com/script?url=https://gist.github.com/" + this.name + ".js" }); + }, + title: { + api: function() { + return "https://api.github.com/gists/" + this.name; + }, + text: function() { + var file, response; + + response = JSON.parse(this.responseText).files; + for (file in response) { + if (response.hasOwnProperty(file)) { + return file; + } + } + } } } }, diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index aab994a64..cfb50849c 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -333,7 +333,7 @@ i = this.length; while (i--) { if (this[i] === object) { - break; + return i; } } return i; @@ -347,6 +347,7 @@ arg = args[_i]; this.push.apply(this, arg); } + return this; }; Array.prototype.remove = function(object) { @@ -4321,6 +4322,21 @@ return div = $.el('iframe', { src: "http://www.purplegene.com/script?url=https://gist.github.com/" + this.name + ".js" }); + }, + title: { + api: function() { + return "https://api.github.com/gists/" + this.name; + }, + text: function() { + var file, response; + + response = JSON.parse(this.responseText).files; + for (file in response) { + if (response.hasOwnProperty(file)) { + return file; + } + } + } } } }, diff --git a/builds/crx/script.js b/builds/crx/script.js index 5bc9b4120..4f869a85e 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -315,7 +315,7 @@ i = this.length; while (i--) { if (this[i] === object) { - break; + return i; } } return i; @@ -329,6 +329,7 @@ arg = args[_i]; this.push.apply(this, arg); } + return this; }; Array.prototype.remove = function(object) { @@ -4324,6 +4325,21 @@ return div = $.el('iframe', { src: "http://www.purplegene.com/script?url=https://gist.github.com/" + this.name + ".js" }); + }, + title: { + api: function() { + return "https://api.github.com/gists/" + this.name; + }, + text: function() { + var file, response; + + response = JSON.parse(this.responseText).files; + for (file in response) { + if (response.hasOwnProperty(file)) { + return file; + } + } + } } } }, diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index 1dfa9940a..19fef9019 100644 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -16,14 +16,14 @@ Array::contains = (object) -> Array::indexOf = (object) -> i = @length while i-- - break if @[i] is object + return i if @[i] is object return i Array::pushArrays = -> args = arguments for arg in args @push.apply @, arg - return + return @ Array::remove = (object) -> if (index = @indexOf object) > -1 diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 356ebad0f..2fc8ed524 100644 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -212,6 +212,11 @@ Linkify = div = $.el 'iframe', # Github doesn't allow embedding straight from the site, so we use an external site to bypass that. src: "http://www.purplegene.com/script?url=https://gist.github.com/#{@name}.js" + title: + api: -> "https://api.github.com/gists/#{@name}" + text: -> + response = JSON.parse(@responseText).files + return file for file of response when response.hasOwnProperty file embedder: (a) -> return [a] unless Conf['Link Title']