Merge pull request #1 from Spittie/url

Url
This commit is contained in:
Spittie 2014-02-13 18:39:53 +01:00
commit 20f78d0eaf
53 changed files with 205 additions and 101 deletions

View File

@ -1,3 +1,13 @@
### v1.3.6
*2014-02-13*
**Spittie**
- Upload images directly from urls
![Upload from url](src/General/img/changelog/1.3.6.png)
- Add gfycat.com embedding
- Replace some icons with fontawesome
- Add Metro favicons (lel)
### v1.3.5
*2014-02-10*

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.3.5 - 2014-02-11
* 4chan X - Version 1.3.6 - 2014-02-13
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
// @version 1.3.5
// @version 1.3.6
// @minGMVer 1.13
// @minFFVer 26
// @namespace 4chan-X
@ -18,5 +18,5 @@
// @run-at document-start
// @updateURL https://github.com/Spittie/4chan-x/raw/stable/builds/4chan-X.meta.js
// @downloadURL https://github.com/Spittie/4chan-x/raw/stable/builds/4chan-X.user.js
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAF5JREFUeNrtkTESABAQxPD/R6tsE2dUGYUtFJvLDKf93KevHJAjpBorAQWSBIKqFASC4G0pCAkm4GfaEvgYXl0T6HBaE97f0vmnfYHbZOMLZCx9ISdKWwjOWZSC8GYm4SUGwfYgqI4AAAAASUVORK5CYII=
// ==/UserScript==

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 185 B

View File

@ -1,6 +1,6 @@
{
"name": "4chan X",
"version": "1.3.5",
"version": "1.3.6",
"manifest_version": 2,
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"icons": {

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
postMessage({version:'1.3.5'},'*')
postMessage({version:'1.3.6'},'*')

View File

@ -1,6 +1,6 @@
{
"name": "4chan-X",
"version": "1.3.5",
"version": "1.3.6",
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": {
"name": "4chan X",

View File

@ -21,7 +21,6 @@
<div id=dump-list-container>
<div id=dump-list></div>
<a id=add-post href=javascript:; title="Add a post" tabindex=50>+</a>
</div>
</div>
<div id=file-n-submit>
<span id=qr-filename-container class=field tabindex=60>
@ -42,4 +41,4 @@
</form>
<datalist id="list-name"></datalist>
<datalist id="list-email"></datalist>
<datalist id="list-sub"></datalist>
<datalist id="list-sub"></datalist>

BIN
src/General/img/changelog/1.1.18.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src/General/img/changelog/1.2.0.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 355 KiB

BIN
src/General/img/emoji/SS-sage.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 576 B

After

Width:  |  Height:  |  Size: 565 B

BIN
src/General/img/emoji/arch.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 567 B

After

Width:  |  Height:  |  Size: 563 B

BIN
src/General/img/emoji/centos.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 B

After

Width:  |  Height:  |  Size: 556 B

BIN
src/General/img/emoji/fedora.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 627 B

BIN
src/General/img/emoji/freebsd.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 919 B

BIN
src/General/img/emoji/gentoo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 879 B

BIN
src/General/img/emoji/gnu.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 607 B

BIN
src/General/img/emoji/madotsuki.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 230 B

BIN
src/General/img/emoji/mint.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1006 B

After

Width:  |  Height:  |  Size: 1004 B

BIN
src/General/img/emoji/ponyo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 883 B

BIN
src/General/img/emoji/rabite.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
src/General/img/emoji/sabayon.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

After

Width:  |  Height:  |  Size: 829 B

BIN
src/General/img/emoji/trisquel.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

After

Width:  |  Height:  |  Size: 814 B

BIN
src/General/img/emoji/ubuntu.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 293 B

After

Width:  |  Height:  |  Size: 171 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 171 B

BIN
src/General/img/icon16.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 154 B

BIN
src/General/img/icon48.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

BIN
src/General/img/links/gist.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 667 B

BIN
src/General/img/links/installgentoo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 B

After

Width:  |  Height:  |  Size: 729 B

BIN
src/General/img/links/liveleak.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

After

Width:  |  Height:  |  Size: 740 B

BIN
src/General/img/links/pastebin.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 839 B

BIN
src/General/img/links/vimeo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 307 B

View File

@ -334,6 +334,12 @@ Linkify =
div = $.el 'iframe',
src: "http://pastebin.com/embed_iframe.php?i=#{a.dataset.uid}"
gfycat:
regExp: /.*gfycat.com\/(?:iframe\/)?(\S*)/
el: (a) ->
div = $.el 'iframe',
src: "http://gfycat.com/iframe/#{a.dataset.uid}"
SoundCloud:
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/
style: 'height: auto; width: 500px; display: inline-block;'

View File

@ -17,7 +17,7 @@ QR.captcha =
placeholder: 'Focus to load reCAPTCHA'
autocomplete: 'off'
spellcheck: false
tabIndex: 55
tabIndex: 45
@nodes =
img: imgContainer.firstChild
input: input

View File

@ -267,49 +267,69 @@ QR =
QR.open()
QR.handleFiles files
$.addClass QR.nodes.el, 'dump'
handleBlob: (blob) ->
return if blob.type is null
QR.error "Unsupported file type."
return unless blob.type in QR.mimeTypes
QR.error "Unsupported file type."
QR.handleFiles([blob])
handleUrl: ->
<% if (type === 'crx') { %>
url = prompt("Insert an url:")
return if url == null
return if url is null
<% if (type === 'crx') { %>
xhr = new XMLHttpRequest();
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onload = (e) ->
if this.readyState == this.DONE && xhr.status == 200
urlBlob = new Blob([this.response], {type : this.getResponseHeader('content-type')})
console.log(urlBlob.type)
return if urlBlob.type == null
unless urlBlob.type in QR.mimeTypes
QR.error "Unsupported file type."
QR.handleFiles([urlBlob])
if @readyState is @DONE && xhr.status is 200
urlBlob = new Blob([@response], {type : @getResponseHeader('content-type')})
urlBlob.name = url.substr(url.lastIndexOf('/')+1, url.length)
QR.handleBlob(urlBlob)
return
else
QR.error "Can't load image."
return
xhr.onerror = (e) ->
QR.error "Can't load image."
return
xhr.send()
return
<% } %>
<% if (type === 'currently-not-working-userscript') { %>
<% if (type === 'userscript') { %>
GM_xmlhttpRequest {
method: "GET",
url: url,
responseType: 'blob',
overrideMimeType: "text/plain; charset=x-user-defined",
onload: (xhr) ->
urlBlob = new Blob([xhr.response], {type: 'image/png'})
QR.handleFiles([urlBlob])
r = xhr.responseText
data = new Uint8Array(r.length)
i = 0
while i < r.length
data[i] = r.charCodeAt(i)
i++
#QUALITY coding at work
header = xhr.responseHeaders
start = header.indexOf("Content-Type: ") + 14
end = header.substr(start, header.length).indexOf("\n") - 1
mime = header.substr(start, end)
return if mime is null
urlBlob = new Blob([data], {type: mime})
urlBlob.name = url.substr(url.lastIndexOf('/')+1, url.length)
QR.handleBlob(urlBlob)
return
onerror: (xhr) ->
QR.error "Can't load image."
}
return
<% } %>
handleFiles: (files) ->
if @ isnt QR # file input

View File

@ -157,7 +157,7 @@ QR.post = class
return
setFile: (@file) ->
@filename = file.name || "File from url"
@filename = file.name
@filesize = $.bytesToString file.size
@nodes.label.hidden = false if QR.spoiler
URL.revokeObjectURL @URL
@ -262,4 +262,4 @@ QR.post = class
(if oldIndex < newIndex then $.after else $.before) @, el
post = QR.posts.splice(oldIndex, 1)[0]
QR.posts.splice newIndex, 0, post
QR.status()
QR.status()