dwb: youtube-mplayer and startup-noautoreload.

master
Pierre Neidhardt 2013-05-28 10:31:00 +02:00
parent 2148e6178b
commit 681d09e21b
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,13 @@
//!javascript
// Prevents previously-opened tabs from reloading all at once after a restart.
execute("set load-on-focus true");
var sigId = signals.connect("navigation", function(wv) {
if (wv == tabs.current)
{
execute("set load-on-focus false");
signals.disconnect(sigId);
}
});

View File

@ -0,0 +1,11 @@
//!javascript
// Opens YouTube videos with mplayer.
var regex = new RegExp("http(.*)://www.youtube.com/watch\\?(.*&)*v=.*");
signals.connect("navigation", function (wv, frame, request) {
if (wv.mainFrame == frame && regex.test(request.uri))
system.spawn("sh -c 'mplayer \"$(youtube-dl -g " + request.uri + ")\"'");
return false;
});