YouTubeのタイトルをいじる

検索結果やユーザページはタイトルが"YouTube - Broadcast Yourself"に固定されているところをわかりやすくしてみる。

// ==UserScript==
// @name        Fix YouTube Title
// @namespace   http://d.hatena.ne.jp/higeorange/
// @include     http://*youtube.com/results*
// @include     http://*youtube.com/profile*
// ==/UserScript==

(function() {
    var l = document.location.href;
    if(l.indexOf('youtube.com/results') > 0) {
        var query = l.match(/search_query=([\w\+]*)&/)[1].replace(/\+/,' ');
        document.title = 'YouTube : Search for ' + query;
    } else if(l.indexOf('youtube.com/profile') > 0) {
        var user = l.match(/user=(\w*)/)[1];
        document.title = 'YouTube : [User] ' + user;
    }
})();

検索結果ページだと"YouTube : Search for 検索文字"
ユーザページだと"YouTube : [User] ユーザ名"
となる。


他にもタイトル固定のページはたくさんあるけど気が向いたら改良する。

修正 14:45