Make easy eslint fixes to links.js
This commit is contained in:
parent
258ec41f90
commit
10c667e42c
1 changed files with 17 additions and 17 deletions
|
@ -6,20 +6,20 @@ var ytidregex = /watch\?v=([A-Za-z0-9\-_]+)/;
|
||||||
|
|
||||||
//grab the notes and loop through them
|
//grab the notes and loop through them
|
||||||
var notes = document.querySelectorAll('.e-content');
|
var notes = document.querySelectorAll('.e-content');
|
||||||
for(var i = 0; i < notes.length; i++) {
|
for (var i = 0; i < notes.length; i++) {
|
||||||
//get Youtube ID
|
//get Youtube ID
|
||||||
var ytid = notes[i].textContent.match(ytidregex);
|
var ytid = notes[i].textContent.match(ytidregex);
|
||||||
if(ytid !== null) {
|
if (ytid !== null) {
|
||||||
var id = ytid[1];
|
var id = ytid[1];
|
||||||
var iframe = document.createElement('iframe');
|
var iframe = document.createElement('iframe');
|
||||||
iframe.classList.add('youtube');
|
iframe.classList.add('youtube');
|
||||||
iframe.setAttribute('src', '//www.youtube.com/embed/' + id);
|
iframe.setAttribute('src', '//www.youtube.com/embed/' + id);
|
||||||
iframe.setAttribute('frameborder', 0);
|
iframe.setAttribute('frameborder', 0);
|
||||||
iframe.setAttribute('allowfullscreen', 'true');
|
iframe.setAttribute('allowfullscreen', 'true');
|
||||||
notes[i].appendChild(iframe);
|
notes[i].appendChild(iframe);
|
||||||
}
|
}
|
||||||
//now linkify everything
|
//now linkify everything
|
||||||
var orig = notes[i].innerHTML;
|
var orig = notes[i].innerHTML;
|
||||||
var linked = autolinker.link(orig);
|
var linked = autolinker.link(orig);
|
||||||
notes[i].innerHTML = linked;
|
notes[i].innerHTML = linked;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue