From 6ff97ef63c91c5cccfec36675cd92a9d89d940f3 Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 4 May 2010 10:18:16 +0000 Subject: 広告混じりの場合に対処 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37358 d0d07461-0603-4401-acd4-de1884942a52 --- stella.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/stella.js b/stella.js index 53e9593..2596a8f 100644 --- a/stella.js +++ b/stella.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = すてら For Niconico/YouTube/Vimeo, Add control commands and information display(on status line). ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。 - 0.26.5 + 0.26.6 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -809,6 +809,7 @@ Thanks: } YouTubePlayer.getIDfromURL = function (url) let ([_, r] = url.match(/[?;&]v=([-\w]+)/)) r; + YouTubePlayer.isVideoURL = function (url) /^https?:\/\/(www\.)?youtube\.com\/watch\?.+/(url); YouTubePlayer.OUTER_NODES = [ 'old-masthead', @@ -924,9 +925,12 @@ Thanks: let result = []; let doc = content.document; for each (let item in Array.slice(doc.querySelectorAll('.video-list-item'))) { + let url = item.querySelector('a').href; + if (!YouTubePlayer.isVideoURL(url)) + continue; result.push( new RelatedID( - YouTubePlayer.getIDfromURL(item.querySelector('a').href), + YouTubePlayer.getIDfromURL(url), item.querySelector('span.title').textContent, item.querySelector('img').src ) -- cgit v1.2.3