This will get better when MediaCrush's API improves?

This commit is contained in:
Zixaphir 2013-08-10 02:04:41 -07:00
parent e21de118b1
commit 08e7a8a6c4
4 changed files with 64 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.2.25 - 2013-08-09
* 4chan X - Version 1.2.25 - 2013-08-10
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.2.25 - 2013-08-09
* 4chan X - Version 1.2.25 - 2013-08-10
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4385,10 +4385,12 @@
if (this.isClone) {
if (Conf['Embedding']) {
i = 0;
items = $$('.embedded', this.nodes.comment);
items = $$('.embed', this.nodes.comment);
while (el = items[i++]) {
$.on(el, "click", Linkify.cb.toggle);
Linkify.cb.toggle.call(el);
$.on(el, 'click', Linkify.cb.toggle);
if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
}
}
return;
@ -4676,6 +4678,15 @@
});
}
},
MediaCrush: {
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i,
style: 'border: 0; width: 640px; height: 480px; resize: both;',
el: function(a) {
return $.el('iframe', {
src: "https://mediacru.sh/" + a.dataset.uid
});
}
},
pastebin: {
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/,
el: function(a) {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.2.25 - 2013-08-09
* 4chan X - Version 1.2.25 - 2013-08-10
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4390,10 +4390,12 @@
if (this.isClone) {
if (Conf['Embedding']) {
i = 0;
items = $$('.embedded', this.nodes.comment);
items = $$('.embed', this.nodes.comment);
while (el = items[i++]) {
$.on(el, "click", Linkify.cb.toggle);
Linkify.cb.toggle.call(el);
$.on(el, 'click', Linkify.cb.toggle);
if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
}
}
return;
@ -4681,6 +4683,15 @@
});
}
},
MediaCrush: {
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i,
style: 'border: 0; width: 640px; height: 480px; resize: both;',
el: function(a) {
return $.el('iframe', {
src: "https://mediacru.sh/" + a.dataset.uid
});
}
},
pastebin: {
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/,
el: function(a) {

View File

@ -36,10 +36,10 @@ Linkify =
if @isClone
if Conf['Embedding']
i = 0
items = $$ '.embedded', @nodes.comment
items = $$ '.embed', @nodes.comment
while el = items[i++]
$.on el, "click", Linkify.cb.toggle
Linkify.cb.toggle.call el
$.on el, 'click', Linkify.cb.toggle
Linkify.cb.toggle.call el if $.hasClass el, 'embedded'
return
@ -279,6 +279,36 @@ Linkify =
$.el 'object',
innerHTML: "<embed src='http://www.liveleak.com/e/#{a.dataset.uid}?autostart=true' wmode='opaque' width='640' height='390' pluginspage='http://get.adobe.com/flashplayer/' type='application/x-shockwave-flash'></embed>"
MediaCrush:
regExp: /.*(?:mediacru.sh\/)([0-9a-z_]+)/i
style: 'border: 0; width: 640px; height: 480px; resize: both;'
el: (a) ->
$.el 'iframe',
src: "https://mediacru.sh/#{a.dataset.uid}"
# MediaCrush CORS When?
#
# el = $.el 'div'
# $.cache "https://mediacru.sh/#{a.dataset.uid}.json", ->
# {status} = @
# return unless [200, 304].contains status
# {files} = JSON.parse req.response
# file = file for file of files when files.hasOwnProperty file
# el.innerHTML = switch file.type
# when 'video/mp4', 'video/ogv'
# """
#<video autoplay loop>
# <source src="https://mediacru.sh/#{a.dataset.uid}.mp4" type="video/mp4;">
# <source src="https://mediacru.sh/#{a.dataset.uid}.ogv" type="video/ogg; codecs='theora, vorbis'">
#</video>"""
# when 'image/png', 'image/gif', 'image/jpeg'
# "<a target=_blank href='#{a.dataset.href}'><img src='https://mediacru.sh/#{file.file}'></a>"
# when 'image/svg', 'image/svg+xml'
# "<embed src='https://mediacru.sh/#{file.file}' type='image/svg+xml' />"
# when 'audio/mpeg'
# "<audio controls><source src='https://mediacru.sh/#{file.file}'></audio>"
# el
pastebin:
regExp: /.*(?:pastebin.com\/(?!u\/))([^#\&\?]*).*/
el: (a) ->