1var win_height = 0; 2var node = new Array(); 3var active = 0; 4var centered = false; 5var open = false; 6var adjust = 0; 7var mousemove = false; 8var previous_node = 0; 9var current_node = 0; 10var processing = false; 11 12var preloadFrame = 1; 13var preloadActive = false; 14var preloadAnimTimer; 15var output; 16var lheight; 17 18$(document).ready(function() 19{ 20 formatting('body'); 21 makeNodes(); 22 23 var loading_image = new Image(); 24 loading_image.onload = function() { lheight = loading_image.height; } 25 loading_image.src = baseurl + '/ndxzsite/img/loading/dark-small2.png'; 26}); 27 28$(window).resize(function() 29{ 30 win_height = $(window).height(); 31 32 if (open == true) 33 { 34 // these all need to be same 35 $('#overlay').css('height', win_height + 'px'); 36 $('#dialog').css('height', win_height + 'px'); 37 $('#inner-content').css('height', win_height + 'px'); 38 $('a.link').css('height', win_height); 39 } 40}); 41 42// need to set window resize functions too 43 44function next() 45{ 46 if (processing == false) 47 { 48 processing = true; 49 var tmp = node.length; 50 active = active + 1; 51 if ((active + 1) > tmp) active = 0; 52 getNode(node[active]); 53 } 54} 55 56function previous() 57{ 58 if (processing == false) 59 { 60 processing = true; 61 var tmp = node.length; 62 active = active - 1; 63 if ((active + 1) == 0) active = (tmp - 1); 64 getNode(node[active]); 65 } 66} 67 68function getNode(id) 69{ 70 processing = true; 71 72 loading(); 73 74 $('#o' + previous_node).remove(); 75 76 // put the loading-dock here 77 // preload the image 78 // need to make sure it's an image 79 var filesrc = $('a#aaa' + id).attr('href'); 80 81 // is it an image? 82 //$("a:has(img)") 83 var match = filesrc.match(/gif|jpg|jpeg|png/gi); 84 85 if (match != null) var image = new Image(); 86 87 // get the grow content via ajax 88 $.post(baseurl + '/ndxzsite/plugin/ajax.php', { jxs : 'ndxzbox', i : id, center : centered, height : win_height }, 89 function(html) 90 { 91 if (match == null) 92 { 93 current_node = id; 94 preloadActive = false; 95 fillOverlay(html.output, html.width, html.height, html.description); 96 updatePosition(id); 97 //preloadActive = false; 98 //$('#loading-dock').hide(); 99 processing = false; 100 } 101 else 102 { 103 image.onload = function() 104 { 105 current_node = id; 106 preloadActive = false; 107 fillOverlay(html.output, html.width, html.height, html.description); 108 updatePosition(id); 109 //preloadActive = false; 110 //$('#loading-dock').hide(); 111 processing = false; 112 }; 113 image.src = filesrc; 114 } 115 }, 'json'); 116 117 return false; 118} 119 120 121 122function updatePosition(id) 123{ 124 //var tmp = node.length; 125 126 var html = active + 1; 127 html += ' / ' 128 html += node.length; 129 $('#position').html(html); 130 //alert( $('#pic-holder').height() ); 131} 132 133function makeNodes() { 134 var count = 0; 135 $('.picture_holder a').each(function() 136 { 137 var tmp = $(this).attr('id'); 138 if (tmp) { 139 node[count] = tmp.replace('aaa', ''); 140 count++; 141 } 142 }); 143} 144 145 146function formatting(context_selector) 147{ 148 var context = $(context_selector); 149 win_height = $(window).height(); 150 151 $('.overlay', context).click(function() { 152 overlay(context, $(this)); 153 return false; 154 }); 155} 156 157 158function preloadImages() 159{ 160 161} 162 163 164function overlay(context, trigger) 165{ 166 open = true; 167 168 var url = trigger.attr('href'); 169 var id = trigger.attr('id').replace('aaa', ''); 170 171 current_node = id; 172 173 openOverlay(); 174 loading(); 175 176 // need to advance the 'active' node for next and previous functions 177 active = jQuery.inArray(id, node); 178 179 var filesrc = $('a#aaa' + id).attr('href'); 180 181 // is it an image? 182 //$("a:has(img)") 183 var match = filesrc.match(/gif|jpg|jpeg|png/gi); 184 185 if (match != null) var image = new Image(); 186 187 // get the grow content via ajax 188 $.post(baseurl + '/ndxzsite/plugin/ajax.php', { jxs : 'ndxzbox', i : id, center : centered, height : win_height }, 189 function(html) 190 { 191 if (match == null) 192 { 193 current_node = id; 194 preloadActive = false; 195 fillOverlay(html.output, html.width, html.height, html.description); 196 updatePosition(id); 197 //preloadActive = false; 198 //$('#loading-dock').hide(); 199 processing = false; 200 } 201 else 202 { 203 image.onload = function() 204 { 205 current_node = id; 206 preloadActive = false;
207 fillOverlay(html.output, html.width, html.height, html.description); 208 updatePosition(id); 209 //preloadActive = false; 210 //$('#loading-dock').hide(); 211 processing = false; 212 }; 213 image.src = filesrc; 214 } 215 }, 'json'); 216 //}); 217 218 // we should start preloading the images here... 219 220 return false; 221} 222 223 224function show_loader() 225{ 226 var h = $(window).height(); 227 var w = $(window).width(); 228 229 $('#loading-dock').css({'top' : ((h - 35) / 2), 'left' : ((w - 35) / 2)}); 230 $('#loading-dock').fadeIn(1000); 231} 232 233 234// Get Current Y position 235function getYScroll() 236{ 237 var yScroll; 238 if (self.pageYOffset) { 239 yScroll = self.pageYOffset; 240 } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict 241 yScroll = document.documentElement.scrollTop; 242 } else if (document.body) {// all other Explorers 243 yScroll = document.body.scrollTop; 244 } 245 //alert(yScroll); 246 return yScroll; 247} 248 249// 250// getPageSize() 251// Returns array with page width, height and window width, height 252// Core code from - quirksmode.com 253// Edit for Firefox by pHaez 254// 255function getPageSize() 256{ 257 var xScroll, yScroll; 258 259 if (window.innerHeight && window.scrollMaxY) { 260 xScroll = window.innerWidth + window.scrollMaxX; 261 yScroll = window.innerHeight + window.scrollMaxY; 262 } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac 263 xScroll = document.body.scrollWidth; 264 yScroll = document.body.scrollHeight; 265 } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari 266 xScroll = document.body.offsetWidth; 267 yScroll = document.body.offsetHeight; 268 } 269 270 var windowWidth, windowHeight; 271 272 if (self.innerHeight) { // all except Explorer 273 if(document.documentElement.clientWidth){ 274 windowWidth = document.documentElement.clientWidth; 275 } else { 276 windowWidth = self.innerWidth; 277 } 278 windowHeight = self.innerHeight; 279 } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode 280 windowWidth = document.documentElement.clientWidth; 281 windowHeight = document.documentElement.clientHeight; 282 } else if (document.body) { // other Explorers 283 windowWidth = document.body.clientWidth; 284 windowHeight = document.body.clientHeight; 285 } 286 287 // for small pages with total height less then height of the viewport 288 if(yScroll < windowHeight){ 289 var pageHeight = windowHeight; 290 } else { 291 var pageHeight = yScroll; 292 } 293 294 // for small pages with total width less then width of the viewport 295 if(xScroll < windowWidth){ 296 var pageWidth = xScroll; 297 } else { 298 var pageWidth = windowWidth; 299 } 300 301 var arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 302 return arrayPageSize; 303} 304 305 306 307function openOverlay() 308{ 309 var yScroll = getYScroll(); 310 var arrayPageSize = getPageSize(); 311 312 var append = "<div id='overlay' class='" + theme + "-overlay'></div>"; 313 append += "<div id='dialog' class='" + theme + "-dialog'>"; 314 append += "<div id='inner-content'>"; 315 append += "<div id='inner-top'></div>"; 316 append += "<div id='inner-bot'><div id='position'></div></div>"; 317 append += "<div id='loading-dock'></div>"; 318 append += "<div class='the-content'></div>"; 319 //append += "<div id='dialog-close-layer'><a href='#' onclick=\"closeOverlay(); return false;\"> </a></div></div>"; 320 append += "<div id='dialog-close'><a href='#' onclick=\"closeOverlay(); return false;\">Close</a></div>"; 321 append += "</div>"; 322 append += "</div>"; 323 324 $('body').append(append); 325 326 $('#overlay').css('height', win_height + 'px'); 327 $('#inner-content').css('height', win_height + 'px'); 328 329 $('#overlay').fadeIn('fast'); 330 $('#dialog').css('top', '0'); 331} 332 333 334 335function movement() 336{ 337 if (mousemove == true) 338 { 339 //alert('yo'); 340 //$('#inner-top').fadeOut('slow'); 341 } 342} 343 344 345// need more research on this 346function resize() 347{ 348 var yScroll = getYScroll(); 349 // the next line is important 350 //$('#dialog').css('top', yScroll); 351 //$('#dialog').css({'position' : 'fixed'}); 352} 353 354function check_the_numbers(imgx, imgy) 355{ 356 var win = $(window).height(); 357 358 // height is bigger than browser window height 359 if ((parseInt(adjust) + parseInt(imgy)) > win) 360 { 361 var found = $('#o' + current_node + ' #innerd').find('img'); 362 363 if (found.length == 0) 364 { 365 // resize the image 366 var new_height = imgy; 367 var new_width = imgx; 368 } 369 else 370 { 371 // resize the image
372 //var new_height = imgy - parseInt(adjust); 373 //var new_width = parseInt((new_height * imgx) / imgy); 374 375 var new_height = win - 120; 376 var new_width = parseInt((new_height * imgx) / imgy); 377 378 $('#o' + current_node + ' #innerd img').attr('width', new_width); 379 $('#o' + current_node + ' #innerd img').attr('height', new_height); 380 } 381 382 // and padding? 383 var new_padding = parseInt(new_height) + parseInt(adjust); 384 var tmp = parseInt((((win - new_padding)) / 2)); 385 386 $('#o' + current_node + ' #innerd').css('padding-top', tmp); 387 $('a.link').css('height', $(window).height()); 388 } 389 else 390 { 391 var found = $('#innerd').find('img'); 392 if (found.length == 0) 393 { 394 //alert('no img2'); 395 var new_height = imgy; 396 var new_width = imgx; 397 } 398 else 399 { 400 // resize the image 401 var new_height = imgy; 402 var new_width = parseInt((new_height * imgx) / imgy); 403 404 $('#o' + current_node + ' #innerd img').attr('width', new_width); 405 $('#o' + current_node + ' #innerd img').attr('height', new_height); 406 } 407 408 // and padding? 409 var new_padding = parseInt(new_height) + parseInt(adjust); 410 var tmp = parseInt((((win - new_padding)) / 2)); 411 412 $('#o' + current_node + ' #innerd').css('padding-top', tmp); 413 $('a.link').css('height', $(window).height()); 414 } 415} 416 417 418function fillOverlay(content, imgx, imgy, description) 419{ 420 $('#loading-dock').hide(); 421 422 if (previous_node == 0) 423 { 424 $('.the-content').html(content); 425 } 426 else 427 { 428 $('.the-content').append(content); 429 } 430 431 432 (description != null) ? $('#inner-top').html(description) : ''; 433 434 check_the_numbers(imgx, imgy); 435 436 $('#o' + current_node).css('z-index', 11); 437 438 // need to figure out how to remove the previous div 439 //$('#o' + previous_node).remove(); 440 //if (previous_node != 0) $('#o' + previous_node).fadeOut(500); 441 $('#o' + current_node).fadeIn(1000); 442 443 previous_node = current_node; 444} 445 446 447function closeOverlay() 448{ 449 open = false; 450 active = 0; 451 452 $('#overlay').fadeOut('fast', function() { 453 $('#overlay').remove(); 454 }); 455 $('#dialog').fadeOut('fast', function() { 456 $('#dialog').remove(); 457 }); 458 459 // research this 460 $('#dialog').css({'position' : 'absolute'}); 461} 462 463 464 465function addError(title, text, context) 466{ 467 $('.content', context).prepend('<div class="message message-error"><h3>' + title + '</h3><p>' + text + '</p></div>'); 468 formatting(context); 469} 470 471function ajaxError(context) { 472 addError('Communication error', 'The browser could not communicate with the server. Please try again later.', context); 473} 474 475function toggleVisibility(div) 476{ 477 $(div).css({'visibility' : 'visible'}); 478} 479 480 481function isOverlay(context) { 482 if (context.attr('id') == 'dialog') return true; 483 else return false; 484} 485 486function isSet( variable ) 487{ 488 return( typeof( variable ) != 'undefined' ); 489} 490 491$(document).keydown(function(e) 492{ 493 if (open == true) 494 { 495 if (e.keyCode == 37) { 496 previous(); 497 return false; 498 } 499 500 if (e.keyCode == 39) { 501 next(); 502 return false; 503 } 504 // esc 505 if (e.keyCode == 27) { 506 closeOverlay(); 507 return false; 508 } 509 } 510}); 511 512 513/// loading 514function loading() 515{ 516 // get height of current #slideshow 517 //var h = $('#slideshow').height(); 518 519 //preloadActive = true; 520 //preloadAnimStart(); 521 522 // replacement div 523 var html = "<div class='loading' style='background-image: url(" + baseurl + "/ndxzsite/img/loading/" + theme + "-small2.png);'> </div>"; 524 //var html = "<div id='loading'><img id='loadimage' src='" + baseurl + "/ndxzsite/img/loading-" + theme + "-large.gif' /></div>"; 525 //html += "</div>"; 526 527 //$('#slideshow').replaceWith(html); 528 529 var h = $(window).height(); 530 var w = $(window).width(); 531 532 $('#loading-dock').html(html); 533 $('#loading-dock').css({'top' : ((h - 50) / 2), 'left' : ((w - 50) / 2)}); 534 $('#loading-dock').fadeIn(1000); 535 536 preloadActive = true; 537 preloadAnimStart(); 538} 539 540// adapted from Cabel/Panic Fancyzoom - credited totally goes to him 541// http://www.panic.com 542function preloadAnimStart() 543{ 544 preloadTime = new Date(); 545 preloadFrame = 1; preloadActive = true; 546 preloadAnimTimer = setInterval('preloadAnim()', 100); 547} 548 549function preloadAnim(from) 550{ 551 var frames = (lheight / 24); 552 553 if (preloadActive != false) 554 { 555 $('.loading').css('background-position', 'center ' + (-24 * preloadFrame) + 'px'); 556 preloadFrame++; 557 if (preloadFrame > (frames - 1)) { preloadFrame = 0; } 558 } 559 else 560 { 561 clearInterval(preloadAnimTimer); 562 preloadAnimTimer = 0; 563 preloadActive = false;
564 } 565}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.