Dota 2 Hero Build Editor: Author Note Fix

Fixes an issue with the hero builder that removes the author note on mouseover

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Dota 2 Hero Build Editor: Author Note Fix
// @version      0.1
// @description  Fixes an issue with the hero builder that removes the author note on mouseover
// @author       Luxocracy
// @match        http://www.dota2.com/workshop/builds*
// @grant        GM_addStyle
// @namespace https://greasyfork.org/users/30239
// ==/UserScript==

(function() {
	/*jshint multistr: true */
    'use strict';

	GM_addStyle('\
	#editTooltip.fixedTooltip {\
		position: absolute;\
		text-align: left;\
		float: left;\
		border: solid #000 1px;\
		background-color: #111;\
		width: 410px;\
		padding: 12px;\
		background: -moz-linear-gradient(top, #2e2e2d, #000000);\
		z-index: 100;\
	}');

	var editTooltip;
	var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if(mutation.addedNodes.length > 0 && mutation.addedNodes[0].id === "editTooltip") {
                editTooltip = document.querySelector('#editTooltip');
				editTooltip.className = 'fixedTooltip';
                observer.disconnect();
            }
        });
    });

    observer.observe(document.querySelector('body'), { childList: true, subtree: true });
})();