Nico Nickname

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل 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);
})();