mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 03:48:53 +00:00
[ticket/6466] Get rid of useless variables and functions in tooltip.js
PHPBB3-6466
This commit is contained in:
parent
75e1cbdc77
commit
abf0be4b4c
2 changed files with 15 additions and 27 deletions
|
@ -1858,6 +1858,7 @@ li.pagination ul {
|
||||||
color: #000;
|
color: #000;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid #AAA;
|
border: 1px solid #AAA;
|
||||||
|
opacity: .95;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tooltip span.top {
|
.tooltip span.top {
|
||||||
|
|
|
@ -14,8 +14,7 @@ phpBB Development Team:
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var head_text, tooltips;
|
var tooltips = [];
|
||||||
tooltips = [];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable tooltip replacements for selects
|
* Enable tooltip replacements for selects
|
||||||
|
@ -26,12 +25,6 @@ tooltips = [];
|
||||||
function enable_tooltips_select(id, headline, sub_id) {
|
function enable_tooltips_select(id, headline, sub_id) {
|
||||||
var $links, hold;
|
var $links, hold;
|
||||||
|
|
||||||
head_text = headline;
|
|
||||||
|
|
||||||
if (!document.getElementById || !document.getElementsByTagName) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
hold = document.createElement('span');
|
hold = document.createElement('span');
|
||||||
hold.id = '_tooltip_container';
|
hold.id = '_tooltip_container';
|
||||||
hold.setAttribute('id', '_tooltip_container');
|
hold.setAttribute('id', '_tooltip_container');
|
||||||
|
@ -49,10 +42,10 @@ function enable_tooltips_select(id, headline, sub_id) {
|
||||||
|
|
||||||
if (sub_id) {
|
if (sub_id) {
|
||||||
if ($this.parent().attr('id').substr(0, sub_id.length) === sub_id) {
|
if ($this.parent().attr('id').substr(0, sub_id.length) === sub_id) {
|
||||||
prepare($this);
|
prepare($this, headline);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
prepare($this);
|
prepare($this, headline);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -61,8 +54,9 @@ function enable_tooltips_select(id, headline, sub_id) {
|
||||||
* Prepare elements to replace
|
* Prepare elements to replace
|
||||||
*
|
*
|
||||||
* @param {object} $element Element to prepare for tooltips
|
* @param {object} $element Element to prepare for tooltips
|
||||||
|
* @param {string} head_text Text heading to display
|
||||||
*/
|
*/
|
||||||
function prepare($element) {
|
function prepare($element, head_text) {
|
||||||
var tooltip, text, desc, title;
|
var tooltip, text, desc, title;
|
||||||
|
|
||||||
text = $element.attr('data-title');
|
text = $element.attr('data-title');
|
||||||
|
@ -71,17 +65,15 @@ function prepare($element) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltip = create_element('span', 'tooltip');
|
|
||||||
|
|
||||||
title = create_element('span', 'top');
|
title = create_element('span', 'top');
|
||||||
title.appendChild(document.createTextNode(head_text));
|
title.appendChild(document.createTextNode(head_text));
|
||||||
tooltip.appendChild(title);
|
|
||||||
|
|
||||||
desc = create_element('span', 'bottom');
|
desc = create_element('span', 'bottom');
|
||||||
desc.innerHTML = text;
|
desc.innerHTML = text;
|
||||||
tooltip.appendChild(desc);
|
|
||||||
|
|
||||||
set_opacity(tooltip);
|
tooltip = create_element('span', 'tooltip');
|
||||||
|
tooltip.appendChild(title);
|
||||||
|
tooltip.appendChild(desc);
|
||||||
|
|
||||||
tooltips[$element.attr('data-id')] = tooltip;
|
tooltips[$element.attr('data-id')] = tooltip;
|
||||||
$element.on('mouseover', show_tooltip);
|
$element.on('mouseover', show_tooltip);
|
||||||
|
@ -112,17 +104,12 @@ function hide_tooltip($element) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set opacity on tooltip element
|
* Create new element
|
||||||
*/
|
*
|
||||||
function set_opacity(element) {
|
* @param {string} tag HTML tag
|
||||||
element.style.filter = 'alpha(opacity:95)';
|
* @param {string} c Element's class
|
||||||
element.style.KHTMLOpacity = '0.95';
|
*
|
||||||
element.style.MozOpacity = '0.95';
|
* @return {object} Created element
|
||||||
element.style.opacity = '0.95';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create new element
|
|
||||||
*/
|
*/
|
||||||
function create_element(tag, c) {
|
function create_element(tag, c) {
|
||||||
var x = document.createElement(tag);
|
var x = document.createElement(tag);
|
||||||
|
|
Loading…
Add table
Reference in a new issue