Created
November 15, 2014 02:54
-
-
Save Qofar/602be030bff732d9d93b to your computer and use it in GitHub Desktop.
[NicoCache_nl] feedlyから;キーでfetch開始する
This file contains hidden or 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
// ==UserScript== | |
// @name feedly_nicofetch | |
// @version 1.0 | |
// @include http://feedly.com/* | |
// @include https://feedly.com/* | |
// @grant GM_xmlhttpRequest | |
// @require http://www.nicovideo.jp/local/nlMovieFetcher.js | |
// ==/UserScript== | |
(function(){ | |
window.nlMovieFetcher.prototype.callAPI = function(param, callback) { | |
GM_xmlhttpRequest({ | |
method: 'GET', | |
url: "http://www.nicovideo.jp/cache/fetch?"+param, | |
onload: callback | |
}); | |
} | |
document.addEventListener('keydown', function(e) { | |
if (e.keyCode === 59 && //[;] key | |
!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey && | |
!/^input|^textarea/i.test(e.target.tagName)) { | |
var item = document.querySelector(".u100Frame.selectedEntry"); | |
if(!item) return; | |
var href = item.getAttribute("data-alternate-link"); | |
if(href.indexOf("http://www.nicovideo.jp/watch/") !== 0) return; | |
var id = href.substring(href.lastIndexOf("/") + 1); | |
var div = document.createElement("div"); | |
div.className = "headerInfo-links left"; | |
var headerInfo = item.querySelector(".headerInfo.headerInfo-article"); | |
headerInfo.appendChild(div); | |
nicofetch(div, id, 0); | |
} | |
}, false); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment