Last active
August 12, 2016 08:06
-
-
Save ElfhirDev/923d58dd70503fcb97996ddb47b9cdc9 to your computer and use it in GitHub Desktop.
Make Youtube Playlist on the Fly
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 yt-make-playlist | |
| // @namespace yt-make-playlist | |
| // @include https://www.youtube.com/* | |
| // @version 1.1 | |
| // @grant none | |
| // @require https://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.6/zepto.min.js | |
| // ==/UserScript== | |
| $(document).ready(function () { | |
| var ids = []; | |
| $('.yt-lockup-video').on('click', function (e) { | |
| // alt + click | |
| if (e.altKey) { | |
| e.preventDefault(); | |
| ids.push($(this).data('context-item-id')); | |
| } | |
| }); | |
| $(document).on('keydown', function (e) { | |
| // alt + p | |
| if (e.altKey && e.which == 80) { | |
| var playlist_url = 'http://www.youtube.com/watch_videos?video_ids=' + ids.toString(); | |
| if (window.open(playlist_url) == null) { | |
| document.location.href = playlist_url; | |
| } | |
| } | |
| }); | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use alt+ click on YouTube icon image on a List Page (Default Home page, Hot page, Subscriptions page),
in order to add videos on the playlist.
Use alt + p to open a new window (new tab or new window depends on your browser settings), or change the current url if it failed,
with the playlist you have made