Feedly Youtube Playlist and Open Multiple Links

try to take over the world!

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Feedly Youtube Playlist and Open Multiple Links
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://feedly.com/*
// @grant        none
// ==/UserScript==

(function () {
'use strict';

    var stateObj = {
    foo: "bar",
};

   // var isYoutube = window.location.href.indexOf('youtube') > -1 ? true:false;

    var doStuff = function(){
     var isYoutube = window.location.href.indexOf('youtube') > -1 ? true:false;
var t = document.getElementsByClassName('unread')
//var ctr = 10;
var ctr = parseInt(document.getElementsByClassName("hint centered")[0].innerText.split(" ")[1], 10);
//ctr = ctr -1;
var index = 0
var aa = []
//await sleep(2000);
Array.prototype.forEach.call(t, function(e) {
if(index<ctr) {
var link = e.getAttribute('data-alternate-link')
aa.push(link)
demo(e);
} else if(index===(ctr-1)) {
playlist(aa)
end()
}
index += 1
});
playlist(aa)
end()
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

async function demo(e) {
await sleep(2000);
e.click()
}

async function end() {
await sleep(4000);
document.getElementsByClassName('giant-mark-as-read')[0].click()
}

function playlist(aa){

var URI = "http://www.youtube.com/watch_videos?video_ids=";
var final = URI;
var counter = 1;
aa.forEach(function(n, index) {

if(isYoutube) {
   if(counter <= ctr) { // As youtube only allows 20 videos/playlist in this case
final += n.split("?v=")[1] + ","
counter += 1;
} else {
console.log(final);
final = URI;
counter = 1;
final += n.split("?v=")[1] + ","
counter += 1;
}
   } else{
   window.open(n)
   }

});
    if(isYoutube){
        console.log(final);
window.open(final);
    }


}
    }

    document.onkeydown = function(evt) {
    evt = evt || window.event;
    if (evt.keyCode == 81) {

        doStuff();
    }
};


  // document.getElementsByClassName('titleBar')[0].onclick = function(e){
      // doStuff()
//}
})();