From 989ed8e7879435661b46fb21ab4cd5e3d58dab9d Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 9 May 2014 22:40:09 -0700 Subject: [PATCH] improve SoundCloud embed --- src/Linkification/Linkify.coffee | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index cd998f812..cb5cf13cb 100755 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -320,20 +320,12 @@ Linkify = , key: 'SoundCloud' regExp: /.*(?:soundcloud.com\/|snd.sc\/)([^#\&\?]*).*/ - style: 'height: auto; width: 500px; display: inline-block;' + style: 'border: 0; width: 500px; height: 400px;' el: (a) -> - div = $.el 'div', - className: "soundcloud" - name: "soundcloud" - $.ajax( - "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/#{a.dataset.uid}" - onloadend: -> - div.innerHTML = '' - div.firstChild.src = JSON.parse(@responseText).html.match(/\bsrc="([^"]+)"/)[1] - false) - div + $.el 'iframe', + src: "//w.soundcloud.com/player/?visual=true&show_comments=false&url=https%3A%2F%2Fsoundcloud.com%2F#{encodeURIComponent a.dataset.uid}" title: - api: (uid) -> "//soundcloud.com/oembed?show_artwork=false&&maxwidth=500px&show_comments=false&format=json&url=https://www.soundcloud.com/#{uid}" + api: (uid) -> "//soundcloud.com/oembed?format=json&url=https%3A%2F%2Fsoundcloud.com%2F#{encodeURIComponent uid}" text: (_) -> _.title , key: 'StrawPoll'