Nico Nickname

うp主のニックネームを調べるスクリプト

目前為 2014-05-18 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           Nico Nickname
// @namespace      http://web.zgo.jp/
// @description    うp主のニックネームを調べるスクリプト
// @include        http://www.nicovideo.jp/watch/*
// @version 0.0.1.20140518104259
// ==/UserScript==

(function() {

    // var video_id = location.href.match(/watch\/[sn]m(\d+)/)[1];
    var videoTitle = document.getElementsByClassName('video_title')[0];
    var owner = document.getElementsByClassName("img_sq48")[0];
    if (!videoTitle && !owner) return;
    var nickname = owner.alt;//Alt要素

    // var svlink = 'http://www.smilevideo.jp/allegation/allegation/' + video_id + '/';
    //    GM_xmlhttpRequest({
    //        method: 'GET',
    //        url: svlink,
    //        headers: { "User-Agent": "Mozilla/5.0" },
    //        onload: function(res) {
    //            nickname = 'no name'; // can't get nickname
    //            if (/<strong(?:\s*[^>]*|)>(.*?)<\/strong>.*?が投稿/.test(res.responseText)) {
    //                nickname = decodeURIComponent(RegExp.$1);
    //            }
    //            window.gm_nicoNickname = nickname;
    //            var span = document.createElement('span');
    //            //p.setAttribute('class', 'TXT12');
    //            span.style.cssText = 'font-size:small; margin-top:4px; line-height:1.25;';
    //            //cssのスタイルを変える。
    //            span.innerHTML = ' うp主:<a href="http://www.nicochart.jp/name/' + nickname + '" title ="' + nickname + '">' + nickname + '</a>';
    //            videoTitle.appendChild(span); // insert position
    //        },
    //        //nextをfirstにするとタイトル前に表示
    //        onerror: function(res) {
    //            GM_log(res.status + ':' + res.statusText);
    //        }
    //    });

    window.gm_nicoNickname = nickname;
    var span = document.createElement('span');
    //p.setAttribute('class', 'TXT12');
    span.style.cssText = 'font-size:small; margin-top:4px; line-height:1.25;';
    //cssのスタイルを変える。
    span.innerHTML = ' うp主:<a href="http://www.nicochart.jp/name/' + nickname + '" title ="' + nickname + '">' + nickname + '</a>';
    videoTitle.appendChild(span);
})();