NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @author sw.East
// @name HWM Title tooltip
// @description Title tooltip
// @copyright 2013, sw.East (http://www.bb-hwm.ru/)
// @version 0.02
// @include *//*.heroeswm.*/*
// @include *//178.248.235.15/*
// @include *//*.lordswm.*/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js
// @grant GM_addStyle
// @updateURL https://openuserjs.org/meta/chesheerk/HWM_Durability_Artifacts_Green_Color_(_HWM_cyfral_strength_).meta.js
// @downloadURL https://openuserjs.org/install/chesheerk/HWM_Durability_Artifacts_(_HWM_cyfral_strength_).user.js
// @copyright 2013-2018, sw.East (https://www.heroeswm.ru/pl_info.php?id=3541252)
// @license MIT
// ==/UserScript==
/**
* ============= Style =============
*/
GM_addStyle ( `
#tooltip {
position: absolute;
left: -2000px;
background: #dedede;
padding: 5px;
border: 1px solid #fff;
width: auto;
max-width: 670px;
z-index: 5;
}
#tooltip p {
margin: 0;
padding: 0;
color: #fff;
background: #222;
padding: 2px 7px;
text-align: left;
white-space: pre-wrap;
}
` );
/* Style End */
// tooltip
$(function() {
// Default tooltip settings
var offsetX = 15;
var offsetY = 15;
var TooltipOpacity = 0.8;
// Select all tags having a title attribute
$('[title]').mouseenter(function(e) {
// Get the value of the title attribute
var Tooltip = $(this).attr('title');
if(Tooltip !== '') {
// Tooltip exists. Assign it to a custom attribute
$(this).attr('customTooltip',Tooltip);
// Empty title attribute (to ensure that native browser tooltip is not shown)
$(this).attr('title','');
}
// Assign customTooltip to variable
var customTooltip = $(this).attr('customTooltip');
// Tooltip exists?
if(customTooltip !== '') {
// Append tooltip element to body
$("body").append('<div id="tooltip"><p>' + customTooltip + '</p></div>');
// FadeIn effect for Tooltip
$('#tooltip').fadeIn('300');
$('#tooltip').fadeTo('20',TooltipOpacity);
}
}).mousemove(function(e) {
var X = e.pageX;
var Y = e.pageY;
// Assign tooltip position
$('#tooltip').css('left', X + offsetX );
$('#tooltip').css('top', Y + offsetY );
}).mouseleave(function() {
// Remove tooltip element
$("body").children('div#tooltip').remove();
});
});
$(document).ready(function(){
//simple_tooltip("a img","tooltip");
simple_tooltip("table img","tooltip");
});
// the end