Skip to content

Instantly share code, notes, and snippets.

@syoichi
Created December 18, 2013 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syoichi/8031106 to your computer and use it in GitHub Desktop.
Save syoichi/8031106 to your computer and use it in GitHub Desktop.
ニコニコ動画の非公式APIの変更に暫定的に対応したnicovideo Thumbinfo popupのパッチ
@@ -1998,8 +1998,19 @@ var NicovideoContentGenerator = function() {
var p = $N('p', {'class': ClassNames.get('description')});
if(this.getData('parsedDescription') !== undefined)
p.innerHTML = this.getData('parsedDescription');
- else
- p.appendChild(this.getData('description').parseNicovideoDescription());
+ else {
+ let desc = this.getData('description').parseNicovideoDescription(),
+ links = desc.querySelectorAll('a'),
+ range = new Range();
+
+ for (let link of links) {
+ link.textContent = link.outerHTML;
+ }
+
+ range.selectNodeContents(document.body);
+
+ p.appendChild(range.createContextualFragment(desc.textContent));
+ }
var uniqueID = this.popup.uniqueID;
Array.forEach(
p.getElementsByTagName('a'),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment