Created
December 18, 2013 22:39
-
-
Save syoichi/8031106 to your computer and use it in GitHub Desktop.
ニコニコ動画の非公式APIの変更に暫定的に対応したnicovideo Thumbinfo popupのパッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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