/usr/share/icinga/htdocs/js/skinnytip.js is in icinga-cgi 1.10.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | /////////////////////////////////////////////////////////////////////
//SkinnyTip 2.00 - Elliott Brueggeman - April 19, 2007
//JavaScript Popup Tooltip Library
//Project Homepage: http://www.ebrueggeman.com/skinnytip
//Documentation available on project homepage
////////////////////////////////////////////////////////////////////
//Rights: Free for personal use and corporate use if sites
//include a link to the project homepage
//////////////////////////////////////////////////////////////////////
//Call mouse capture handler function on page load
captureMouse();
//CUSTOM VARS - Initialized below
var v_divname;
var v_text;
var v_title;
var v_xoffset;
var v_yoffset;
var v_backcolor;
var v_bordercolor;
var v_textcolor;
var v_titletextcolor;
var v_width;
var v_border;
var v_title_padding;
var v_content_padding;
var v_fontface;
var v_fontsize;
var v_titlefontsize;
//INTERNAL VARIABLES
var v_xcoordinate = 0;
var v_ycoordinate = 0;
var v_visible = 0;
var v_havemouse = 0;
var v_layer = null;
function tooltip(displaytext, title, commands) {
//Reset variables for this tool tip
init_tooltip();
//Title and Text
v_title=title;
v_text=displaytext;
//Parse commands if any
parseCommands(commands);
//Parse offsets as int
v_xoffset=parseInt(v_xoffset);
v_yoffset=parseInt(v_yoffset);
if (v_layer) {
v_layer=getLayer(v_divname);
}
if (!(v_layer=createDivContainer())) {
return false;
}
mainMethod();
}
function init_tooltip() {
v_divname = 'tiplayer';
v_text = 'Default Text';
v_title = '';
//UI Variables
v_xoffset = 15;
v_yoffset = 15;
v_backcolor = '#FFFFCC';
v_bordercolor = '#FFCC66';
v_textcolor = '#000000';
v_titletextcolor = '#000000';
v_width = 300;
v_border = 2;
v_title_padding = '1px';
v_content_padding = '1px 3px';
v_fontface = 'Arial, Helvetica, Sans-Serif';
v_fontsize = 14;
v_titlefontsize = 14;
//SYSTEM VARIABLES
v_visible = 0;
v_layer = null;
}
function parseCommands(commands) {
if (commands != null) {
var comArray = commands.split(',');
for (var i = 0; i < comArray.length; i++) {
var args = comArray[i].split(':');
eval('v_' + trimWhitespace(args[0]) + '="' + trimWhitespace(args[1]) + '"');
}
}
}
// Clears popups if appropriate
function hideTip() {
if (v_visible == 1) {
if (v_layer != null) {
v_layer.style.visibility = 'hidden';
v_visible = 0;
}
}
return true;
}
function mainMethod() {
v_visible = 0;
var html = makeHTML(v_text, v_title);
createPopup(html);
//if we have mouse coordinates, position layer and make visible
if (v_havemouse == 1) {
positionLayer();
v_visible = 1;
v_layer.style.visibility = 'visible';
}
}
function makeHTML(text, title) {
var container_style = 'width:' + v_width + 'px;';
container_style += 'border:' + v_border + 'px solid ' + v_bordercolor + ';';
container_style += 'background-color:' + v_backcolor + ';';
container_style += 'font-family:' + v_fontface + ';';
container_style += 'font-size:' + v_fontsize + 'px;';
var title_style = 'background-color:' + v_bordercolor + ';';
title_style += 'padding:' + v_title_padding + ';';
title_style += 'color:' + v_titletextcolor + ';';
var content_style = 'padding:' + v_content_padding + ';';
content_style += 'color:' + v_textcolor + ';';
var txt = '<div id="skinnytip_container" style="' + container_style + '">';
if (title!=null && title.length>0) {
txt += '<div id="skinnytip_title" style="' + title_style + '">' + title + '</div>';
}
txt += '<div id="skinnytip_content" style="' + content_style + '">' + text + '</div>';
txt += '</div>';
return txt;
}
//Positions popup according to mouse input
function positionLayer() {
var placeX = 300;
var placeY = 300;
//get final placement
placeX = horizontalPlacement();
placeY = verticalPlacement();
//Move the object
v_layer.style.left = placeX + 'px';
v_layer.style.top = placeY + 'px';
}
//called when the mouse moves
//sets mouse related variables
function mouseMoveHandler(e) {
if (!e) {
e = event;
}
if (e.clientX) {
//if there is an x pos property
//GET MOUSE LOCATION
v_xcoordinate = mouseX(e);
v_ycoordinate = mouseY(e);
v_havemouse = 1;
}
if (v_visible == 1) {
positionLayer();
}
}
//get mouse x coordinate
function mouseX(evt) {
if (evt.pageX) return evt.pageX;
else if (evt.clientX) {
return evt.clientX + (document.documentElement.scrollLeft ?
document.documentElement.scrollLeft :
document.body.scrollLeft);
}
else {
return null;
}
}
//get mouse y coordinate
function mouseY(evt) {
if (evt.pageY) {
return evt.pageY;
}
else if (evt.clientY) {
return evt.clientY + (document.documentElement.scrollTop ?
document.documentElement.scrollTop :
document.body.scrollTop);
}
else {
return null;
}
}
//Set mouse handler
function captureMouse() {
document.onmousemove = mouseMoveHandler;
}
//Creates the popup
function createPopup(input) {
var popupwidth = v_width;
var text;
var zindex;
text = createBackLayer(popupwidth,zindex++);
text += '<div style="position: absolute; top: 0; left: 0; width: ' + popupwidth + 'px; z-index: ' + zindex + ';">' + input + '</div>';
if (typeof v_layer.innerHTML != 'undefined') {
v_layer.innerHTML = text;
}
//After writing html measure height of backlayer to set height of iframe
var backlayer=self.document.getElementById("backdrop");
var container=self.document.getElementById("skinnytip_container");
backlayer.height = container.offsetHeight;
}
//Back layer prevents forms from showing through popups
function createBackLayer(width, Z) {
//Create backdrop with 0 height
return '<iframe id="backdrop" frameborder="0" scrolling="no" width="' + width + '" height="0" style="z-index: ' + Z + '; filter: Beta(Style=0,Opacity=0);"><p></iframe>';
}
//get horizontal box placement
function horizontalPlacement() {
placeX = v_xcoordinate + v_xoffset;
return placeX;
}
//get vertical box placement
function verticalPlacement() {
return v_ycoordinate + v_yoffset;
}
// create the div container for popup content if it doesn't exist
function createDivContainer() {
var divContainer = self.document.getElementById(v_divname);
return divContainer;
}
function trimWhitespace(str) {
while(str.charAt(0) == (" ") ) {
str = str.substring(1);
}
while(str.charAt(str.length-1) == " " ) {
str = str.substring(0,str.length-1);
}
return str;
}
|