Dota 2 Hero Build Editor: Author Note Fix

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

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 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 });
})();