|
|
|
|
|
|
45
|
var xhr = new XMLHttpRequest();
|
45
|
var xhr = new XMLHttpRequest();
|
|
46
|
xhr.open('GET', oembedEndpoint + '?format=json&maxwidth=450&url=' + url);
|
46
|
xhr.open('GET', oembedEndpoint + '?format=json&maxwidth=450&url=' + url);
|
|
47
|
xhr.onreadystatechange = function() {
|
47
|
xhr.onreadystatechange = function() {
|
|
48
|
if (xhr.readyState == XMLHttpRequest.DONE) {
|
|
|
|
49
|
console.log(url, xhr.status);
|
|
|
|
|
|
48
|
if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
|
|
50
|
var tmpEl = document.createElement('div');
|
49
|
var tmpEl = document.createElement('div');
|
|
51
|
tmpEl.innerHTML = JSON.parse(xhr.responseText).html;
|
50
|
tmpEl.innerHTML = JSON.parse(xhr.responseText).html;
|
|
52
|
el.parentElement.replaceChild(tmpEl.firstChild, el);
|
51
|
el.parentElement.replaceChild(tmpEl.firstChild, el);
|