Fix #33 (I think...)

This commit is contained in:
Jordan Bates 2013-04-30 05:37:03 -07:00
parent 63a380b8c7
commit 878690131e
6 changed files with 57 additions and 89 deletions

View File

@ -1,3 +1,6 @@
seaweedchan:
- Fix various embedding issues
### 1.1.4 - 2013-04-29
seaweedchan:
- Change ESC functionality in QR to autohide if Persistent QR is enabled

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.1.4 - 2013-04-29
* 4chan X - Version 1.1.4 - 2013-04-30
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -18,7 +18,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.1.4 - 2013-04-29
* 4chan X - Version 1.1.4 - 2013-04-30
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4199,7 +4199,7 @@
}
},
toggle: function() {
var el, embed, items, style, type, url;
var el, embed, style, type, url;
embed = this.previousElementSibling;
if (this.className.contains("embedded")) {
@ -4213,17 +4213,7 @@
this.textContent = '(embed)';
} else {
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
if (style = type.style) {
el.style.cssText = style;
} else {
items = {
'embedWidth': Config['embedWidth'],
'embedHeight': Config['embedHeight']
};
$.get(items, function(items) {
return el.style.cssText = "border: 0; width: " + items['embedWidth'] + "px; height: " + items['embedHeight'] + "px";
});
}
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
this.textContent = '(unembed)';
}
$.replace(embed, el);
@ -4291,6 +4281,7 @@
},
SoundCloud: {
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/,
style: 'height: auto; width: 500px; display: inline-block;',
el: function() {
var div;
@ -4298,22 +4289,21 @@
className: "soundcloud",
name: "soundcloud"
});
return $.ajax("//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=" + (this.getAttribute('data-originalURL')) + "&color=" + (Style.colorToHex(Themes[Conf['theme']]['Background Color'])), {
$.ajax("//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + this.name, {
div: div,
onloadend: function() {
return this.div.innerHTML = JSON.parse(this.responseText).html;
}
}, false);
}
},
pastebin: {
regExp: /.*(?:pastebin.com\/)([^#\&\?]*).*/,
el: function() {
var div;
return div = $.el('iframe', {
src: "http://pastebin.com/embed_iframe.php?i=" + this.name
});
return div;
},
title: {
api: function() {
return "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + this.name;
},
text: function() {
return JSON.parse(this.responseText).title;
}
}
}
},

View File

@ -18,7 +18,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.1.4 - 2013-04-29
* 4chan X - Version 1.1.4 - 2013-04-30
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4195,7 +4195,7 @@
}
},
toggle: function() {
var el, embed, items, style, type, url;
var el, embed, style, type, url;
embed = this.previousElementSibling;
if (this.className.contains("embedded")) {
@ -4209,17 +4209,7 @@
this.textContent = '(embed)';
} else {
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
if (style = type.style) {
el.style.cssText = style;
} else {
items = {
'embedWidth': Config['embedWidth'],
'embedHeight': Config['embedHeight']
};
$.get(items, function(items) {
return el.style.cssText = "border: 0; width: " + items['embedWidth'] + "px; height: " + items['embedHeight'] + "px";
});
}
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
this.textContent = '(unembed)';
}
$.replace(embed, el);
@ -4287,6 +4277,7 @@
},
SoundCloud: {
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/,
style: 'height: auto; width: 500px; display: inline-block;',
el: function() {
var div;
@ -4294,22 +4285,21 @@
className: "soundcloud",
name: "soundcloud"
});
return $.ajax("//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=" + (this.getAttribute('data-originalURL')) + "&color=" + (Style.colorToHex(Themes[Conf['theme']]['Background Color'])), {
$.ajax("//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + this.name, {
div: div,
onloadend: function() {
return this.div.innerHTML = JSON.parse(this.responseText).html;
}
}, false);
}
},
pastebin: {
regExp: /.*(?:pastebin.com\/)([^#\&\?]*).*/,
el: function() {
var div;
return div = $.el('iframe', {
src: "http://pastebin.com/embed_iframe.php?i=" + this.name
});
return div;
},
title: {
api: function() {
return "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + this.name;
},
text: function() {
return JSON.parse(this.responseText).title;
}
}
}
},

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.1.4 - 2013-04-29
* 4chan X - Version 1.1.4 - 2013-04-30
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -4198,7 +4198,7 @@
}
},
toggle: function() {
var el, embed, items, style, type, url;
var el, embed, style, type, url;
embed = this.previousElementSibling;
if (this.className.contains("embedded")) {
@ -4212,17 +4212,7 @@
this.textContent = '(embed)';
} else {
el = (type = Linkify.types[this.getAttribute("data-service")]).el.call(this);
if (style = type.style) {
el.style.cssText = style;
} else {
items = {
'embedWidth': Config['embedWidth'],
'embedHeight': Config['embedHeight']
};
$.get(items, function(items) {
return el.style.cssText = "border: 0; width: " + items['embedWidth'] + "px; height: " + items['embedHeight'] + "px";
});
}
el.style.cssText = (style = type.style) ? style : "border: 0; width: 640px; height: 390px";
this.textContent = '(unembed)';
}
$.replace(embed, el);
@ -4290,6 +4280,7 @@
},
SoundCloud: {
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/,
style: 'height: auto; width: 500px; display: inline-block;',
el: function() {
var div;
@ -4297,22 +4288,21 @@
className: "soundcloud",
name: "soundcloud"
});
return $.ajax("//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=" + (this.getAttribute('data-originalURL')) + "&color=" + (Style.colorToHex(Themes[Conf['theme']]['Background Color'])), {
$.ajax("//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + this.name, {
div: div,
onloadend: function() {
return this.div.innerHTML = JSON.parse(this.responseText).html;
}
}, false);
}
},
pastebin: {
regExp: /.*(?:pastebin.com\/)([^#\&\?]*).*/,
el: function() {
var div;
return div = $.el('iframe', {
src: "http://pastebin.com/embed_iframe.php?i=" + this.name
});
return div;
},
title: {
api: function() {
return "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/" + this.name;
},
text: function() {
return JSON.parse(this.responseText).title;
}
}
}
},

View File

@ -126,20 +126,15 @@ Linkify =
@textContent = '(embed)'
# Embed
else
# We create an element to embed
el = (type = Linkify.types[@getAttribute("data-service")]).el.call @
# Set style values.
if style = type.style
el.style.cssText = style
el.style.cssText = if style = type.style
style
else
items =
'embedWidth': Config['embedWidth']
'embedHeight': Config['embedHeight']
$.get items, (items) ->
el.style.cssText = "border: 0; width: #{items['embedWidth']}px; height: #{items['embedHeight']}px"
"border: 0; width: 640px; height: 390px"
@textContent = '(unembed)'
@ -187,23 +182,23 @@ Linkify =
src: @name
SoundCloud:
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/
regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/
style: 'height: auto; width: 500px; display: inline-block;'
el: ->
div = $.el 'div',
className: "soundcloud"
name: "soundcloud"
name: "soundcloud"
$.ajax(
"//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=#{@getAttribute 'data-originalURL'}&color=#{Style.colorToHex Themes[Conf['theme']]['Background Color']}"
"//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/#{@name}"
div: div
onloadend: ->
@div.innerHTML = JSON.parse(@responseText).html
false)
div
title:
api: -> "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/#{@name}"
text: -> JSON.parse(@responseText).title
pastebin:
regExp: /.*(?:pastebin.com\/)([^#\&\?]*).*/
el: ->
div = $.el 'iframe',
src: "http://pastebin.com/embed_iframe.php?i=#{@name}"
embedder: (a) ->
return [a] unless Conf['Embedding']