|
|
@ -48,6 +48,29 @@
|
|
48
|
48
|
return el;
|
|
49
|
49
|
}
|
|
50
|
50
|
}, {
|
|
|
51
|
re: /https?:\/\/.*soundcloud.com\/.*/,
|
|
|
52
|
fn: function(match, msgEl) {
|
|
|
53
|
var el = document.createElement('a');
|
|
|
54
|
el.href = match[0];
|
|
|
55
|
el.textContent = match[0];
|
|
|
56
|
|
|
|
57
|
var xhr = new XMLHttpRequest();
|
|
|
58
|
xhr.open('GET', 'https://soundcloud.com/oembed?format=json&maxwidth=450&maxheight=315&url=' + match[0]);
|
|
|
59
|
xhr.onreadystatechange = function() {
|
|
|
60
|
if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
|
|
|
61
|
var data = JSON.parse(xhr.responseText);
|
|
|
62
|
|
|
|
63
|
var tmpEl = document.createElement("div");
|
|
|
64
|
tmpEl.innerHTML = data.html;
|
|
|
65
|
|
|
|
66
|
msgEl.replaceChild(tmpEl.firstChild, el);
|
|
|
67
|
}
|
|
|
68
|
}
|
|
|
69
|
xhr.send();
|
|
|
70
|
|
|
|
71
|
return el;
|
|
|
72
|
}
|
|
|
73
|
}, {
|
|
51
|
74
|
re: /https?:\/\/vimeo.com\/([0-9]+).*/,
|
|
52
|
75
|
fn: function(match) {
|
|
53
|
76
|
var el = document.createElement("iframe");
|