Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
mNo edit summary
m added ratio correction for tooltip width
Line 102: Line 102:
  var _activeTooltipIdx = -1;
  var _activeTooltipIdx = -1;
  var _posCorrectionX = 20; var _posCorrectionY = 10;
  var _posCorrectionX = 20; var _posCorrectionY = 10;
var _ratioWidth = 5; var _ratioHeight = 1;
function checkElementByClassComp() {
function checkElementByClassComp() {
if (document.getElementsByClassName == undefined) {
if (document.getElementsByClassName == undefined) {
Line 152: Line 153:
var frameObj = document.getElementById('tooltipframeidx-' + _activeTooltipIdx);
var frameObj = document.getElementById('tooltipframeidx-' + _activeTooltipIdx);
var windowSize = getWindowSize();
var windowSize = getWindowSize();
if(frameObj.offsetWidth < frameObj.offsetHeight)
{
frameObj.style.width = (_ratioWidth / (_ratioWidth + _ratioHeight)) * (frameObj.offsetWidth + frameObj.offsetHeight);
}
var maxTooltipWidth = windowSize.width > 800 ? (0.6 * windowSize.width) : (0.8 * windowSize.width);
var maxTooltipWidth = windowSize.width > 800 ? (0.6 * windowSize.width) : (0.8 * windowSize.width);