Merge branch 'duckness' into v3

Conflicts:
	CHANGELOG.md
	LICENSE
	builds/4chan-X.user.js
	builds/crx/script.js
	src/Linkification/Linkify.coffee
	src/Posting/QR.captcha.coffee
	src/Posting/QR.coffee
This commit is contained in:
Zixaphir 2014-04-03 14:47:16 -07:00
commit 46478eb4d0
11 changed files with 222 additions and 122 deletions

View File

@ -1,3 +1,10 @@
**duckness**:
- Merge changes from Mayhem fork
**ccd0**:
- Embedding for direct video links
- Merge changes from Mayhem fork
**MayhemYDG**:
- Fix captcha submission:
Captchas were reloaded the instant a post was submitted to 4chan. Unfortunately, a recent change to reCAPTCHA made it so reloading captchas invalidates the ones that loaded but not yet used. This is now fixed by only unloading the captcha, and only load new ones after the post is submitted.<br>
@ -68,7 +75,6 @@
### v1.4.1
*2014-03-01*
**Spittie**
- Check image dimension before uploading

View File

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

View File

@ -2,9 +2,11 @@ Personal fork of Seaweed's 4chan X.
#### [Why 4chan X needs to access data on every site?](https://github.com/Spittie/4chan-x/wiki/Why-4chan-X-needs-to-access-data-from-every-website%3F)
##[Install](https://github.com/Spittie/4chan-x/raw/master/builds/4chan-X.user.js) (Firefox)
##[Install](https://github.com/Spittie/4chan-x/raw/master/builds/crx.crx) (Chrom*)
##[Install](../../raw/master/builds/4chan-X.user.js) (Firefox)
##[Install](../../raw/master/builds/crx.crx) (Chrom*)
<!---
##[Install](http://a.pomf.se/tkhuwm.xpi) (Firefox Mobile)
-->
## If you have any problems, try resetting your 4chan X settings

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -1360,6 +1360,10 @@ div.boardTitle {
background: transparent url('data:image/png;base64,<%= grunt.file.read("src/General/img/links/installgentoo.png", {encoding: "base64"}) %>') center left no-repeat!important;
padding-left: 18px;
}
.linkify.video {
background: transparent url('data:image/png;base64,<%= grunt.file.read("src/General/img/links/video.png", {encoding: "base64"}) %>') center left no-repeat!important;
padding-left: 18px;
}
/* Gallery */
#a-gallery {

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

View File

@ -2,6 +2,9 @@ Linkify =
init: ->
return if !Conf['Linkify']
@types = {}
@types[type.key] = type for type in @ordered_types
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
@ -147,8 +150,9 @@ Linkify =
services: (link) ->
{href} = link
for key, type of Linkify.types when match = type.regExp.exec href
return [key, match[1], match[2], link]
for type in Linkify.ordered_types when match = type.regExp.exec href
return if type.dummy
return [type.key, match[1], match[2], link]
return
embed: (data) ->
@ -242,16 +246,16 @@ Linkify =
embed.dataset.title = text if Conf['Embedding'] and status in [200, 304]
link.textContent = text if link
types:
audio:
ordered_types: [
key: 'audio'
regExp: /(.*\.(mp3|ogg|wav))$/
el: (a) ->
$.el 'audio',
controls: 'controls'
preload: 'auto'
src: a.dataset.uid
gist:
,
key: 'gist'
regExp: /.*(?:gist.github.com.*\/)([^\/][^\/]*)$/
el: (a) ->
div = $.el 'iframe',
@ -261,27 +265,27 @@ Linkify =
api: (uid) -> "https://api.github.com/gists/#{uid}"
text: ({files}) ->
return file for file of files when files.hasOwnProperty file
image:
,
key: 'image'
regExp: /(http|www).*\.(gif|png|jpg|jpeg|bmp)$/
style: 'border: 0; width: auto; height: auto;'
el: (a) ->
$.el 'div',
innerHTML: "<a target=_blank href='#{a.dataset.href}'><img src='#{a.dataset.href}'></a>"
InstallGentoo:
,
key: 'InstallGentoo'
regExp: /.*(?:paste.installgentoo.com\/view\/)([0-9a-z_]+)/
el: (a) ->
$.el 'iframe',
src: "http://paste.installgentoo.com/view/embed/#{a.dataset.uid}"
Twitter:
,
key: 'Twitter'
regExp: /.*twitter.com\/(.+\/status\/\d+)/
el: (a) ->
$.el 'iframe',
src: "https://twitframe.com/show?url=https://twitter.com/#{a.dataset.uid}"
LiveLeak:
,
key: 'LiveLeak'
regExp: /.*(?:liveleak.com\/view.+i=)([0-9a-z_]+)/
el: (a) ->
el = $.el 'iframe',
@ -291,8 +295,8 @@ Linkify =
frameborder: "0"
el.setAttribute "allowfullscreen", "true"
el
MediaCrush:
,
key: 'MediaCrush'
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i
style: 'border: 0;'
el: (a) ->
@ -323,20 +327,20 @@ Linkify =
else
"ERROR: No valid filetype."
el
pastebin:
,
key: 'pastebin'
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/
el: (a) ->
div = $.el 'iframe',
src: "http://pastebin.com/embed_iframe.php?i=#{a.dataset.uid}"
gfycat:
,
key: 'gfycat'
regExp: /.*gfycat.com\/(?:iframe\/)?(\S*)/
el: (a) ->
div = $.el 'iframe',
src: "http://gfycat.com/iframe/#{a.dataset.uid}"
SoundCloud:
,
key: 'SoundCloud'
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/
style: 'height: auto; width: 500px; display: inline-block;'
el: (a) ->
@ -352,15 +356,15 @@ Linkify =
title:
api: (uid) -> "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/#{uid}"
text: (_) -> _.title
StrawPoll:
,
key: 'StrawPoll'
regExp: /strawpoll\.me\/(?:embed_\d+\/)?(\d+)/
style: 'border: 0; width: 600px; height: 406px;'
el: (a) ->
$.el 'iframe',
src: "http://strawpoll.me/embed_1/#{a.dataset.uid}"
TwitchTV:
,
key: 'TwitchTV'
regExp: /.*(?:twitch.tv\/)([^#\&\?]*).*/
style: "border: none; width: 640px; height: 360px;"
el: (a) ->
@ -384,15 +388,15 @@ Linkify =
<param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" />
<param name="flashvars" value="hostname=www.twitch.tv&channel=#{channel}&auto_play=true&start_volume=25" />
"""
Vocaroo:
,
key: 'Vocaroo'
regExp: /.*(?:vocaroo.com\/)([^#\&\?]*).*/
style: 'border: 0; width: 150px; height: 45px;'
el: (a) ->
$.el 'object',
innerHTML: "<embed src='http://vocaroo.com/player.swf?playMediaID=#{a.dataset.uid.replace /^i\//, ''}&autoplay=0' wmode='opaque' width='150' height='45' pluginspage='http://get.adobe.com/flashplayer/' type='application/x-shockwave-flash'></embed>"
Vimeo:
,
key: 'Vimeo'
regExp: /.*(?:vimeo.com\/)([^#\&\?]*).*/
el: (a) ->
$.el 'iframe',
@ -400,15 +404,15 @@ Linkify =
title:
api: (uid) -> "https://vimeo.com/api/oembed.json?url=http://vimeo.com/#{uid}"
text: (_) -> _.title
Vine:
,
key: 'Vine'
regExp: /.*(?:vine.co\/)([^#\&\?]*).*/
style: 'border: none; width: 500px; height: 500px;'
el: (a) ->
$.el 'iframe',
src: "https://vine.co/#{a.dataset.uid}/card"
YouTube:
,
key: 'YouTube'
regExp: /.*(?:youtu.be\/|youtube.*v=|youtube.*\/embed\/|youtube.*\/v\/|youtube.*videos\/)([^#\&\?]*)\??(t\=.*)?/
el: (a) ->
el = $.el 'iframe',
@ -418,4 +422,22 @@ Linkify =
title:
api: (uid) -> "https://gdata.youtube.com/feeds/api/videos/#{uid}?alt=json&fields=title/text(),yt:noembed,app:control/yt:state/@reasonCode"
text: (data) -> data.entry.title.$t
,
# dummy entries: not implemented yet but included to prevent them being wrongly embedded as a subsequent type
key: 'Loopvid'
regExp: /.*loopvid.appspot.com\/.*/
dummy: true
,
key: 'MediaFire'
regExp: /.*mediafire.com\/.*/
dummy: true
,
key: 'video'
regExp: /(.*\.(ogv|webm|mp4))$/
el: (a) ->
$.el 'video',
controls: 'controls'
preload: 'auto'
src: a.dataset.uid
]

View File

@ -16,8 +16,8 @@ QR.captcha =
spellcheck: false
tabIndex: 45
@nodes =
img: imgContainer.firstChild
input: input
img: imgContainer.firstChild
input: input
$.on input, 'blur', QR.focusout
$.on input, 'focus', QR.focusin

View File

@ -747,6 +747,8 @@ QR =
# Remove the obnoxious 4chan Pass ad.
if /mistyped/i.test err.textContent
err = 'You seem to have mistyped the CAPTCHA.'
else if /expired/i.test err.textContent
err = 'This CAPTCHA is no longer valid because it has expired.'
QR.cooldown.auto = false
# Too many frequent mistyped captchas will auto-ban you!
# On connection error, the post most likely didn't go through.