1
+ − 1
/*
+ − 2
* The jBox menu system. Written by Dan Fuhry and licensed under the GPL.
+ − 3
*/
+ − 4
+ − 5
// Cache of DOM and event objects, used in setTimeout() calls due to scope rules
+ − 6
var jBoxObjCache = new Object();
+ − 7
+ − 8
// Cache of "correct" heights for unordered list objects used in submenus. Helps the animation routine know what height it's aiming for.
+ − 9
var jBoxMenuHeights = new Object();
+ − 10
+ − 11
// Blocks animations from running if there's already an animation going on the same object
+ − 12
var jBoxSlideBlocker = new Object();
+ − 13
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 14
// Switch to enable or disable jBox slide animation
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 15
var jBox_slide_enable = true;
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 16
1
+ − 17
// Speed at which the menus should slide open. 1 to 100 or -1 to disable.
+ − 18
// Setting this higher than 100 will cause an infinite loop in the browser.
+ − 19
// Default is 80 - anything higher than 90 means exponential speed increase
+ − 20
var slide_speed = 80;
+ − 21
+ − 22
// Inertia value to start with
+ − 23
// Default is 0
+ − 24
var inertia_base = 0;
+ − 25
+ − 26
// Value added to inertia_base on each frame - generally 1 to 3 is good, with 1 being slowest animation
+ − 27
// Default is 1
+ − 28
var inertia_inc = 1;
+ − 29
+ − 30
// Opacity that menus should fade to. 1 to 100 or -1 to disable fades. This only works if the slide effect is also enabled.
+ − 31
// Default is 100
+ − 32
var jBox_opacity = 100;
+ − 33
+ − 34
// Adds the jBox CSS to the HTML header. Called on window onload.
40
+ − 35
var jBoxInit = function()
1
+ − 36
{
+ − 37
setTimeout('jBoxBatchSetup();', 200);
+ − 38
}
582
+ − 39
addOnloadHook(jBoxInit);
1
+ − 40
+ − 41
// Initializes each menu.
+ − 42
function jBoxBatchSetup()
+ − 43
{
57
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
diff
changeset
+ − 44
if ( KILL_SWITCH )
b354deeaa4c4
Vastly improved compatibility with older versions of IE, particularly 5.0, through the use of a kill switch that turns off all AJAX functions
Dan
diff
changeset
+ − 45
return false;
1
+ − 46
var menus = document.getElementsByClassName('div', 'menu_nojs');
+ − 47
if ( menus.length > 0 )
+ − 48
{
+ − 49
for ( var i in menus )
+ − 50
{
+ − 51
if ( typeof(menus[i]) != 'object')
+ − 52
continue; // toJSONString() compatibility
+ − 53
jBoxSetup(menus[i]);
+ − 54
}
+ − 55
}
+ − 56
}
+ − 57
+ − 58
// Initializes a div with a jBox menu in it.
+ − 59
function jBoxSetup(obj)
+ − 60
{
420
+ − 61
$dynano(obj).addClass('menu');
1
+ − 62
removeTextNodes(obj);
40
+ − 63
+ − 64
for ( var i = 0; i < obj.childNodes.length; i++ )
1
+ − 65
{
+ − 66
/* normally this would be done in about 2 lines of code, but javascript is so picky..... */
+ − 67
if ( obj.childNodes[i] )
+ − 68
{
+ − 69
if ( obj.childNodes[i].tagName )
+ − 70
{
40
+ − 71
if ( obj.childNodes[i].tagName == 'A' )
1
+ − 72
{
40
+ − 73
// if ( is_Safari ) alert('It\'s an A: '+obj);
+ − 74
if ( obj.childNodes[i].nextSibling )
1
+ − 75
{
40
+ − 76
// alert("Next sibling: " + obj.childNodes[i].nextSibling);
+ − 77
if ( obj.childNodes[i].nextSibling.tagName )
1
+ − 78
{
40
+ − 79
if ( obj.childNodes[i].nextSibling.tagName == 'UL' || ( obj.childNodes[i].nextSibling.tagName.toLowerCase() == 'div' && obj.childNodes[i].nextSibling.className == 'submenu' ) )
+ − 80
{
+ − 81
// Calculate height
+ − 82
var ul = obj.childNodes[i].nextSibling;
+ − 83
domObjChangeOpac(0, ul);
+ − 84
ul.style.display = 'block';
680
+ − 85
ul.style.zIndex = getHighestZ() + 2;
806
+ − 86
var links = ul.getElementsByTagName('a');
+ − 87
for ( var j = 0; j < links.length; j++ )
+ − 88
{
+ − 89
links[j].onmouseup = function()
+ − 90
{
+ − 91
var ul = this;
+ − 92
while ( ul.tagName != 'UL' && ul.tagName != 'DIV' && ul.tagName != 'BODY' )
+ − 93
ul = ul.parentNode;
+ − 94
if ( ul.tagName == 'BODY' )
+ − 95
return false;
+ − 96
jBoxHideMenu(ul.previousSibling, ul);
+ − 97
}
+ − 98
}
40
+ − 99
var dim = fetch_dimensions(ul);
+ − 100
if ( !ul.id )
+ − 101
ul.id = 'jBoxmenuobj_' + Math.floor(Math.random() * 10000000);
+ − 102
jBoxMenuHeights[ul.id] = parseInt(dim['h']) - 2; // subtract 2px for border width
853
+ − 103
+ − 104
if ( dim['w'] + $dynano(ul).Left() > getWidth() || $dynano(ul).hasClass('jbox_right') )
+ − 105
{
+ − 106
$dynano(ul).addClass('jbox_right');
+ − 107
ul.jbox_width = $dynano(ul).Width();
+ − 108
}
+ − 109
40
+ − 110
ul.style.display = 'none';
+ − 111
domObjChangeOpac(100, ul);
+ − 112
+ − 113
// Setup events
+ − 114
obj.childNodes[i].onmouseover = function() { jBoxOverHandler(this); };
+ − 115
obj.childNodes[i].onmouseout = function(e) { jBoxOutHandler(this, e); };
+ − 116
obj.childNodes[i].nextSibling.onmouseout = function(e) { jBoxOutHandler(this, e); };
523
+ − 117
if ( is_iPhone )
+ − 118
{
+ − 119
obj.childNodes[i].onclick = function() { jBoxOverHandler(this); return false; };
+ − 120
}
40
+ − 121
}
1
+ − 122
}
+ − 123
}
+ − 124
}
+ − 125
}
+ − 126
}
+ − 127
}
+ − 128
}
+ − 129
+ − 130
// Called when user hovers mouse over a submenu
+ − 131
function jBoxOverHandler(obj)
+ − 132
{
40
+ − 133
// if ( is_Safari )
+ − 134
// alert('Safari and over');
1
+ − 135
// Random ID used to track the object to perform on
+ − 136
var seed = Math.floor(Math.random() * 1000000);
+ − 137
jBoxObjCache[seed] = obj;
+ − 138
+ − 139
// Sleep for a (little more than a tenth of a) second to see if the user really wants the menu to expand
+ − 140
setTimeout('if(isOverObj(jBoxObjCache['+seed+'], false, false)) jBoxOverHandlerBin(jBoxObjCache['+seed+']);', 150);
+ − 141
}
+ − 142
+ − 143
// Displays a menu.
+ − 144
function jBoxOverHandlerBin(obj)
+ − 145
{
+ − 146
var others = obj.parentNode.getElementsByTagName('ul');
+ − 147
for ( var i in others )
+ − 148
{
+ − 149
if(typeof(others[i]) == 'object')
+ − 150
{
+ − 151
others[i].style.display = 'none';
420
+ − 152
$dynano(others[i].previousSibling).rmClass('liteselected');
1
+ − 153
}
+ − 154
}
+ − 155
var others = obj.parentNode.getElementsByTagName('div');
+ − 156
for ( var i in others )
+ − 157
{
+ − 158
if(typeof(others[i]) == 'object')
+ − 159
{
+ − 160
if ( others[i].className == 'submenu' )
+ − 161
{
+ − 162
others[i].style.display = 'none';
420
+ − 163
$dynano(others[i].previousSibling).rmClass('liteselected');
1
+ − 164
}
+ − 165
}
+ − 166
}
+ − 167
if(obj.nextSibling.tagName.toLowerCase() == 'ul' || ( obj.nextSibling.tagName.toLowerCase() == 'div' && obj.nextSibling.className == 'submenu' ))
+ − 168
{
582
+ − 169
$dynano(obj).addClass('liteselected');
128
01955bf53f96
Improved ban control page and allowed multiple entries/IP ranges; changed some parameters on jBox; user level changes are logged now
Dan
diff
changeset
+ − 170
//obj.className = 'liteselected';
1
+ − 171
var ul = obj.nextSibling;
+ − 172
var dim = fetch_dimensions(obj);
+ − 173
var off = fetch_offset(obj);
+ − 174
var dimh = parseInt(dim['h']);
+ − 175
var offtop = parseInt(off['top']);
+ − 176
var top = dimh + offtop;
853
+ − 177
if ( $dynano(ul).hasClass('jbox_right') )
+ − 178
{
+ − 179
left = $dynano(obj).Left() + $dynano(obj).Width() - ul.jbox_width; // ( link left + link width ) - ul width
+ − 180
}
+ − 181
else
+ − 182
{
+ − 183
left = off['left'];
+ − 184
}
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 185
if ( jBox_slide_enable )
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 186
{
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 187
domObjChangeOpac(0, ul);
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 188
}
1
+ − 189
ul.style.left = left + 'px';
+ − 190
ul.style.top = top + 'px';
+ − 191
ul.style.clip = 'rect(auto,auto,auto,auto)';
+ − 192
ul.style.overflow = 'visible';
+ − 193
ul.style.display = 'block';
21
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 194
if ( jBox_slide_enable )
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 195
{
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 196
slideOut(ul);
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 197
}
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 198
else
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 199
{
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 200
domObjChangeOpac(100, ul);
663fcf528726
Updated all version numbers back to Banshee; a few preliminary steps towards full UTF-8 support in page URLs
Dan
diff
changeset
+ − 201
}
1
+ − 202
}
+ − 203
}
+ − 204
+ − 205
function jBoxOutHandler(obj, event)
+ − 206
{
+ − 207
var seed = Math.floor(Math.random() * 1000000);
+ − 208
var seed2 = Math.floor(Math.random() * 1000000);
+ − 209
jBoxObjCache[seed] = obj;
+ − 210
jBoxObjCache[seed2] = event;
+ − 211
setTimeout('jBoxOutHandlerBin(jBoxObjCache['+seed+'], jBoxObjCache['+seed2+']);', 750);
+ − 212
}
+ − 213
+ − 214
function jBoxOutHandlerBin(obj, event)
+ − 215
{
+ − 216
var caller = obj.tagName.toLowerCase();
+ − 217
if(caller == 'a')
+ − 218
{
+ − 219
a = obj;
+ − 220
ul = obj.nextSibling;
+ − 221
}
+ − 222
else if(caller == 'ul' || caller == 'div')
+ − 223
{
+ − 224
a = obj.previousSibling;
+ − 225
ul = obj;
+ − 226
}
+ − 227
else
+ − 228
{
+ − 229
return false;
+ − 230
}
+ − 231
+ − 232
if (!isOverObj(a, false, event) && !isOverObj(ul, true, event))
+ − 233
{
806
+ − 234
jBoxHideMenu(a, ul);
1
+ − 235
}
+ − 236
+ − 237
return true;
+ − 238
}
+ − 239
806
+ − 240
function jBoxHideMenu(a, ul)
+ − 241
{
+ − 242
$dynano(a).rmClass('liteselected');
+ − 243
+ − 244
if ( jBox_slide_enable )
+ − 245
{
+ − 246
slideIn(ul);
+ − 247
}
+ − 248
else
+ − 249
{
+ − 250
ul.style.display = 'none';
+ − 251
}
+ − 252
}
+ − 253
1
+ − 254
// Slide an element downwards until it is at full height.
+ − 255
// First parameter should be a DOM object with style.display = block and opacity = 0.
+ − 256
+ − 257
var sliderobj = new Object();
+ − 258
+ − 259
function slideOut(obj)
+ − 260
{
+ − 261
if ( jBoxSlideBlocker[obj.id] )
+ − 262
return false;
+ − 263
+ − 264
jBoxSlideBlocker[obj.id] = true;
+ − 265
+ − 266
if ( slide_speed == -1 )
+ − 267
{
+ − 268
obj.style.display = 'block';
+ − 269
return false;
+ − 270
}
+ − 271
+ − 272
var currentheight = 0;
+ − 273
var targetheight = jBoxMenuHeights[obj.id];
+ − 274
var inertiabase = inertia_base;
+ − 275
var inertiainc = inertia_inc;
+ − 276
slideStep(obj, 0);
+ − 277
domObjChangeOpac(100, obj);
+ − 278
obj.style.overflow = 'hidden';
+ − 279
+ − 280
// Don't edit past here
+ − 281
var timercnt = 0;
+ − 282
+ − 283
var seed = Math.floor(Math.random() * 1000000);
+ − 284
sliderobj[seed] = obj;
+ − 285
+ − 286
var framecnt = 0;
+ − 287
+ − 288
while(true)
+ − 289
{
+ − 290
framecnt++;
+ − 291
timercnt += ( 100 - slide_speed );
+ − 292
inertiabase += inertiainc;
+ − 293
currentheight += inertiabase;
+ − 294
if ( currentheight > targetheight )
+ − 295
currentheight = targetheight;
+ − 296
setTimeout('slideStep(sliderobj['+seed+'], '+currentheight+', '+targetheight+');', timercnt);
+ − 297
if ( currentheight >= targetheight )
+ − 298
break;
+ − 299
}
+ − 300
timercnt = timercnt + ( 100 - slide_speed );
+ − 301
setTimeout('jBoxSlideBlocker[sliderobj['+seed+'].id] = false;', timercnt);
+ − 302
var opacstep = jBox_opacity / framecnt;
+ − 303
var opac = 0;
+ − 304
var timerstep = 0;
+ − 305
domObjChangeOpac(0, obj);
+ − 306
while(true)
+ − 307
{
+ − 308
timerstep += ( 100 - slide_speed );
+ − 309
opac += opacstep;
+ − 310
setTimeout('domObjChangeOpac('+opac+', sliderobj['+seed+']);', timerstep);
+ − 311
if ( opac >= jBox_opacity )
+ − 312
break;
+ − 313
}
+ − 314
}
+ − 315
+ − 316
function slideIn(obj)
+ − 317
{
+ − 318
if ( obj.style.display != 'block' )
+ − 319
return false;
+ − 320
+ − 321
if ( jBoxSlideBlocker[obj.id] )
+ − 322
return false;
+ − 323
+ − 324
jBoxSlideBlocker[obj.id] = true;
+ − 325
+ − 326
var targetheight = 0;
+ − 327
var dim = fetch_dimensions(obj);
+ − 328
var currentheight = jBoxMenuHeights[obj.id];
+ − 329
var origheight = currentheight;
+ − 330
var inertiabase = inertia_base;
+ − 331
var inertiainc = inertia_inc;
+ − 332
domObjChangeOpac(100, obj);
+ − 333
obj.style.overflow = 'hidden';
+ − 334
+ − 335
// Don't edit past here
+ − 336
var timercnt = 0;
+ − 337
+ − 338
var seed = Math.floor(Math.random() * 1000000);
+ − 339
sliderobj[seed] = obj;
+ − 340
+ − 341
var framecnt = 0;
+ − 342
+ − 343
for(var j = 0;j<100;j++) // while(true)
+ − 344
{
+ − 345
framecnt++;
+ − 346
timercnt = timercnt + ( 100 - slide_speed );
+ − 347
inertiabase = inertiabase + inertiainc;
+ − 348
currentheight = currentheight - inertiabase;
+ − 349
if ( currentheight < targetheight )
+ − 350
currentheight = targetheight;
+ − 351
setTimeout('slideStep(sliderobj['+seed+'], '+currentheight+');', timercnt);
+ − 352
if ( currentheight <= targetheight )
+ − 353
break;
+ − 354
}
+ − 355
timercnt += ( 100 - slide_speed );
+ − 356
setTimeout('sliderobj['+seed+'].style.display="none";sliderobj['+seed+'].style.height="'+origheight+'px";jBoxSlideBlocker[sliderobj['+seed+'].id] = false;', timercnt);
+ − 357
+ − 358
var opacstep = jBox_opacity / framecnt;
+ − 359
var opac = jBox_opacity;
+ − 360
var timerstep = 0;
+ − 361
domObjChangeOpac(100, obj);
+ − 362
while(true)
+ − 363
{
+ − 364
timerstep += ( 100 - slide_speed );
+ − 365
opac -= opacstep;
+ − 366
setTimeout('domObjChangeOpac('+opac+', sliderobj['+seed+']);', timerstep);
+ − 367
if ( opac <= 0 )
+ − 368
break;
+ − 369
}
+ − 370
+ − 371
}
+ − 372
+ − 373
function slideStep(obj, height, maxheight)
+ − 374
{
+ − 375
obj.style.height = height + 'px';
+ − 376
//obj.style.clip = 'rect(3px,auto,'+maxheight+'px,auto)';
+ − 377
obj.style.overflow = 'hidden';
+ − 378
//obj.style.clip = 'rect('+height+'px,0px,'+maxheight+'px,auto);';
+ − 379
}
+ − 380
+ − 381
function isOverObj(obj, bias, event)
+ − 382
{
+ − 383
var fieldUL = new Object();
+ − 384
var dim = fetch_dimensions(obj);
+ − 385
var off = fetch_offset(obj);
+ − 386
fieldUL['top'] = off['top'];
+ − 387
fieldUL['left'] = off['left'];
+ − 388
fieldUL['right'] = off['left'] + dim['w'];
+ − 389
fieldUL['bottom'] = off['top'] + dim['h'];
+ − 390
394
+ − 391
var mouseY_local = mouseY + getScrollOffset();
+ − 392
+ − 393
// document.getElementById('debug').innerHTML = '<br />Mouse: x: '+mouseX+', y:' + mouseY + '<br />' + document.getElementById('debug').innerHTML;
1
+ − 394
+ − 395
if(bias)
+ − 396
{
+ − 397
if ( ( mouseX < fieldUL['left'] + 2 || mouseX > fieldUL['right'] - 5 ) ||
394
+ − 398
( mouseY_local < fieldUL['top'] - 2 || mouseY_local > fieldUL['bottom'] - 2 ) )
1
+ − 399
{
+ − 400
return false;
+ − 401
}
+ − 402
}
+ − 403
else
+ − 404
{
+ − 405
if ( ( mouseX < fieldUL['left'] || mouseX > fieldUL['right'] ) ||
394
+ − 406
( mouseY_local < fieldUL['top'] || mouseY_local > fieldUL['bottom'] ) )
1
+ − 407
return false;
+ − 408
}
+ − 409
+ − 410
return true;
+ − 411
}
+ − 412
+ − 413
function jBoxGarbageCollection(e)
+ − 414
{
+ − 415
setMousePos(e);
+ − 416
var menus = document.getElementsByClassName('div', 'menu');
+ − 417
if ( menus.length > 0 )
+ − 418
{
+ − 419
for ( var i in menus )
+ − 420
{
+ − 421
if ( typeof(menus[i]) != 'object')
+ − 422
continue; // toJSONString() compatibility
+ − 423
var uls = menus[i].getElementsByTagName('ul');
+ − 424
if ( uls.length > 0 )
+ − 425
{
+ − 426
for ( var j = 0; j < uls.length; j++ )
+ − 427
{
+ − 428
if ( !isOverObj(uls[j], false, e) )
+ − 429
{
420
+ − 430
$dynano(uls[j].previousSibling).rmClass('liteselected');
1
+ − 431
//uls[j].style.display = 'none';
+ − 432
slideIn(uls[j]);
+ − 433
}
+ − 434
}
+ − 435
}
+ − 436
var uls = getElementsByClassName(menus[i], 'divs', 'submenu');
+ − 437
if ( uls.length > 0 )
+ − 438
{
+ − 439
for ( var j = 0; j < uls.length; j++ )
+ − 440
{
+ − 441
if ( !isOverObj(uls[j], false, e) )
+ − 442
{
420
+ − 443
$dynano(uls[j].previousSibling).rmClass('liteselected');
1
+ − 444
//uls[j].style.display = 'none';
+ − 445
slideIn(uls[j]);
+ − 446
}
+ − 447
}
+ − 448
}
+ − 449
}
+ − 450
}
+ − 451
}
+ − 452
+ − 453
document.onclick = jBoxGarbageCollection;
+ − 454
+ − 455
var getElementsByClassName = function(parent, type, cls) {
+ − 456
if(!type)
+ − 457
type = '*';
+ − 458
ret = new Array();
865
+ − 459
if ( !parent )
+ − 460
return ret;
1
+ − 461
el = parent.getElementsByTagName(type);
40
+ − 462
for ( var i = 0; i < el.length; i++ )
1
+ − 463
{
+ − 464
if ( typeof(el[i]) != 'object')
+ − 465
continue; // toJSONString() compatibility
+ − 466
if(el[i].className)
+ − 467
{
+ − 468
if(el[i].className.indexOf(' ') > 0)
+ − 469
{
+ − 470
classes = el[i].className.split(' ');
+ − 471
}
+ − 472
else
+ − 473
{
+ − 474
classes = new Array();
+ − 475
classes.push(el[i].className);
+ − 476
}
+ − 477
if ( in_array(cls, classes) )
+ − 478
ret.push(el[i]);
+ − 479
}
+ − 480
}
+ − 481
return ret;
+ − 482
}
+ − 483
+ − 484
document.getElementsByClassName = function(type, cls) {
+ − 485
return getElementsByClassName(document, type, cls);
+ − 486
}
+ − 487
+ − 488
function setMousePos(event)
+ − 489
{
+ − 490
if(IE)
+ − 491
{
+ − 492
if(!event)
+ − 493
{
+ − 494
event = window.event;
+ − 495
}
+ − 496
clX = event.clientX;
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
diff
changeset
+ − 497
if ( document.body )
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
diff
changeset
+ − 498
sL = document.body.scrollLeft;
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
diff
changeset
+ − 499
else
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
diff
changeset
+ − 500
sL = 0;
1
+ − 501
mouseX = clX + sL;
80
cb7dde69c301
Improved and enabled HTML optimization algorithm; enabled gzip compression; added but did not test at all the tag cloud class in includes/tagcloud.php, this is still very preliminary and not ready for any type of production use
Dan
diff
changeset
+ − 502
mouseY = event.clientY + ( document.body ? document.body.scrollTop : 0 );
1
+ − 503
return;
+ − 504
}
+ − 505
if( typeof(event.clientX) == 'number' )
+ − 506
{
+ − 507
mouseX = event.clientX;
+ − 508
mouseY = event.clientY;
+ − 509
return;
+ − 510
}
+ − 511
else if( typeof(event.layerX) == 'number' )
+ − 512
{
+ − 513
mouseX = event.layerX;
+ − 514
mouseY = event.layerY;
+ − 515
return;
+ − 516
}
+ − 517
else if( typeof(event.offsetX) == 'number' )
+ − 518
{
+ − 519
mouseX = event.offsetX;
+ − 520
mouseY = event.offsetY;
+ − 521
return;
+ − 522
}
+ − 523
else if( typeof(event.screenX) == 'number' )
+ − 524
{
+ − 525
mouseX = event.screenX;
+ − 526
mouseY = event.screenY;
+ − 527
return;
+ − 528
}
+ − 529
else if( typeof(event.x) == 'number' )
+ − 530
{
+ − 531
mouseX = event.x;
+ − 532
mouseY = event.y;
+ − 533
return;
+ − 534
}
+ − 535
}
+ − 536
+ − 537
document.onmousemove = function(e)
+ − 538
{
+ − 539
setMousePos(e);
+ − 540
};
+ − 541
582
+ − 542
function removeTextNodes(obj)
+ − 543
{
+ − 544
if(obj)
+ − 545
{
+ − 546
if(typeof(obj.tagName) != 'string' || ( String(obj) == '[object Text]' && is_Safari ) )
+ − 547
{
+ − 548
if ( ( obj.nodeType == 3 && obj.data.match(/^([\s]*)$/ig) ) ) // || ( typeof(obj.innerHTML) == undefined && is_Safari ) )
+ − 549
{
+ − 550
obj.parentNode.removeChild(obj);
+ − 551
return;
+ − 552
}
+ − 553
}
+ − 554
if(obj.firstChild)
+ − 555
{
+ − 556
for(var i = 0; i < obj.childNodes.length; i++)
+ − 557
{
+ − 558
removeTextNodes(obj.childNodes[i]);
+ − 559
}
+ − 560
}
+ − 561
}
1
+ − 562
}
+ − 563