usmandurrany / Youtube-to-ytPAK

// ==UserScript==
// @name       Youtube-to-ytPAK
// @namespace  http://www.facebook.com/usmandgreat
// @version    0.1
// @description  Simple Youtube to ytPAK redirector
// @copyright  2014+, Usman Durrani
// @run-at document-start
// @include *
// ==/UserScript==
var current_location = window.document.location;
 var res = current_location.toString().split("v="); 

redirectToPage("youtube.com/", "http://www.ytpak.com");
redirectToPage("http://www.youtube.com/", "http://www.ytpak.com");
redirectToPage("https://www.youtube.com/", "http://www.ytpak.com");
redirectToPage("http://www.youtube.com/watch?v="+res[1], "http://www.ytpak.com/?component=video&task=view&id="+res[1]);
redirectToPage("https://www.youtube.com/watch?v="+res[1], "http://www.ytpak.com/?component=video&task=view&id="+res[1]);


function redirectToPage(page1, page2){
if(window.location.href.indexOf(page1) != -1){
    window.location.href = page2;
}
}