1/** 2 * Name: Highslide JS 3 * Version: 5.0.0 (2016-05-24) 4 * Config: default +events +unobtrusive +imagemap +slideshow +positioning +transitions +viewport +thumbstrip +inline +ajax +iframe +flash 5 * Author: Torstein Hønsi 6 * Support: www.highslide.com/support 7 * License: MIT 8 */ 9if (!hs) { var hs = { 10// Language strings 11lang : { 12 cssDirection: 'ltr', 13 loadingText : 'Loading...', 14 loadingTitle : 'Click to cancel', 15 focusTitle : 'Click to bring to front', 16 fullExpandTitle : 'Expand to actual size (f)', 17 creditsText : 'Powered by <i>Highslide JS</i>', 18 creditsTitle : 'Go to the Highslide JS homepage', 19 previousText : 'Previous', 20 nextText : 'Next', 21 moveText : 'Move', 22 closeText : 'Close', 23 closeTitle : 'Close (esc)', 24 resizeTitle : 'Resize', 25 playText : 'Play', 26 playTitle : 'Play slideshow (spacebar)', 27 pauseText : 'Pause', 28 pauseTitle : 'Pause slideshow (spacebar)', 29 previousTitle : 'Previous (arrow left)', 30 nextTitle : 'Next (arrow right)', 31 moveTitle : 'Move', 32 fullExpandText : '1:1', 33 number: 'Image %1 of %2', 34 restoreTitle : 'Click to close image, click and drag to move. Use arrow keys for next and previous.' 35}, 36// See http://highslide.com/ref for examples of settings 37graphicsDir : 'highslide/graphics/', 38expandCursor : 'zoomin.cur', // null disables 39restoreCursor : 'zoomout.cur', // null disables 40expandDuration : 250, // milliseconds 41restoreDuration : 250, 42marginLeft : 15, 43marginRight : 15, 44marginTop : 15, 45marginBottom : 15, 46zIndexCounter : 1001, // adjust to other absolutely positioned elements 47loadingOpacity : 0.75, 48allowMultipleInstances: true, 49numberOfImagesToPreload : 5, 50outlineWhileAnimating : 2, // 0 = never, 1 = always, 2 = HTML only 51outlineStartOffset : 3, // ends at 10 52padToMinWidth : false, // pad the popup width to make room for wide caption 53fullExpandPosition : 'bottom right', 54fullExpandOpacity : 1, 55showCredits : true, // you can set this to false if you want 56creditsHref : 'http://highslide.com/', 57creditsTarget : '_self', 58enableKeyListener : true, 59openerTagNames : ['a', 'area'], // Add more to allow slideshow indexing 60transitions : [], 61transitionDuration: 250, 62dimmingOpacity: 0, // Lightbox style dimming background 63dimmingDuration: 50, // 0 for instant dimming 64 65allowWidthReduction : false, 66allowHeightReduction : true, 67preserveContent : true, // Preserve changes made to the content and position of HTML popups. 68objectLoadTime : 'before', // Load iframes 'before' or 'after' expansion. 69cacheAjax : true, // Cache ajax popups for instant display. Can be overridden for each popup. 70anchor : 'auto', // where the image expands from 71align : 'auto', // position in the client (overrides anchor) 72targetX: null, // the id of a target element 73targetY: null, 74dragByHeading: true, 75minWidth: 200, 76minHeight: 200, 77allowSizeReduction: true, // allow the image to reduce to fit client size. If false, this overrides minWidth and minHeight 78outlineType : 'drop-shadow', // set null to disable outlines 79skin : { 80 controls: 81 '<div class="highslide-controls"><ul>'+ 82 '<li class="highslide-previous">'+ 83 '<a href="#" title="{hs.lang.previousTitle}">'+ 84 '<span>{hs.lang.previousText}</span></a>'+ 85 '</li>'+ 86 '<li class="highslide-play">'+ 87 '<a href="#" title="{hs.lang.playTitle}">'+ 88 '<span>{hs.lang.playText}</span></a>'+ 89 '</li>'+ 90 '<li class="highslide-pause">'+ 91 '<a href="#" title="{hs.lang.pauseTitle}">'+ 92 '<span>{hs.lang.pauseText}</span></a>'+ 93 '</li>'+ 94 '<li class="highslide-next">'+ 95 '<a href="#" title="{hs.lang.nextTitle}">'+ 96 '<span>{hs.lang.nextText}</span></a>'+ 97 '</li>'+ 98 '<li class="highslide-move">'+ 99 '<a href="#" title="{hs.lang.moveTitle}">'+ 100 '<span>{hs.lang.moveText}</span></a>'+ 101 '</li>'+ 102 '<li class="highslide-full-expand">'+ 103 '<a href="#" title="{hs.lang.fullExpandTitle}">'+ 104 '<span>{hs.lang.fullExpandText}</span></a>'+ 105 '</li>'+ 106 '<li class="highslide-close">'+ 107 '<a href="#" title="{hs.lang.closeTitle}" >'+ 108 '<span>{hs.lang.closeText}</span></a>'+ 109 '</li>'+ 110 '</ul></div>' 111 , 112 contentWrapper: 113 '<div class="highslide-header"><ul>'+
114 '<li class="highslide-previous">'+ 115 '<a href="#" title="{hs.lang.previousTitle}" onclick="return hs.previous(this)">'+ 116 '<span>{hs.lang.previousText}</span></a>'+ 117 '</li>'+ 118 '<li class="highslide-next">'+ 119 '<a href="#" title="{hs.lang.nextTitle}" onclick="return hs.next(this)">'+ 120 '<span>{hs.lang.nextText}</span></a>'+ 121 '</li>'+ 122 '<li class="highslide-move">'+ 123 '<a href="#" title="{hs.lang.moveTitle}" onclick="return false">'+ 124 '<span>{hs.lang.moveText}</span></a>'+ 125 '</li>'+ 126 '<li class="highslide-close">'+ 127 '<a href="#" title="{hs.lang.closeTitle}" onclick="return hs.close(this)">'+ 128 '<span>{hs.lang.closeText}</span></a>'+ 129 '</li>'+ 130 '</ul></div>'+ 131 '<div class="highslide-body"></div>'+ 132 '<div class="highslide-footer"><div>'+ 133 '<span class="highslide-resize" title="{hs.lang.resizeTitle}"><span></span></span>'+ 134 '</div></div>' 135}, 136// END OF YOUR SETTINGS 137 138 139// declare internal properties 140preloadTheseImages : [], 141continuePreloading: true, 142expanders : [], 143overrides : [ 144 'allowSizeReduction', 145 'useBox', 146 'anchor', 147 'align', 148 'targetX', 149 'targetY', 150 'outlineType', 151 'outlineWhileAnimating', 152 'captionId', 153 'captionText', 154 'captionEval', 155 'captionOverlay', 156 'headingId', 157 'headingText', 158 'headingEval', 159 'headingOverlay', 160 'creditsPosition', 161 'dragByHeading', 162 'autoplay', 163 'numberPosition', 164 'transitions', 165 'dimmingOpacity', 166 167 'width', 168 'height', 169 170 'contentId', 171 'allowWidthReduction', 172 'allowHeightReduction', 173 'preserveContent', 174 'maincontentId', 175 'maincontentText', 176 'maincontentEval', 177 'objectType', 178 'cacheAjax', 179 'objectWidth', 180 'objectHeight', 181 'objectLoadTime', 182 'swfOptions', 183 'wrapperClassName', 184 'minWidth', 185 'minHeight', 186 'maxWidth', 187 'maxHeight', 188 'pageOrigin', 189 'slideshowGroup', 190 'easing', 191 'easingClose', 192 'fadeInOut', 193 'src' 194], 195overlays : [], 196idCounter : 0, 197oPos : { 198 x: ['leftpanel', 'left', 'center', 'right', 'rightpanel'], 199 y: ['above', 'top', 'middle', 'bottom', 'below'] 200}, 201mouse: {}, 202headingOverlay: {}, 203captionOverlay: {}, 204swfOptions: { flashvars: {}, params: {}, attributes: {} }, 205timers : [], 206 207slideshows : [], 208tabbables : [], 209pendingOutlines : {}, 210sleeping : [], 211preloadTheseAjax : [], 212cacheBindings : [], 213cachedGets : {}, 214clones : {}, 215onReady: [], 216nextActive :0, 217uaVersion: document.documentMode || parseFloat((navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1]), 218ie : (document.all && !window.opera), 219//ie : navigator && /MSIE [678]/.test(navigator.userAgent), // ie9 compliant? 220safari : /Safari/.test(navigator.userAgent), 221geckoMac : /Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent), 222 223$ : function (id) { 224 if (id) return document.getElementById(id); 225}, 226 227push : function (arr, val) { 228 arr[arr.length] = val; 229}, 230 231createElement : function (tag, attribs, styles, parent, nopad) { 232 var el = document.createElement(tag); 233 if (attribs) hs.extend(el, attribs); 234 if (nopad) hs.setStyles(el, {padding: 0, border: 'none', margin: 0}); 235 if (styles) hs.setStyles(el, styles); 236 if (parent) parent.appendChild(el); 237 return el; 238}, 239 240extend : function (el, attribs) { 241 for (var x in attribs) el[x] = attribs[x]; 242 return el; 243}, 244 245setStyles : function (el, styles) { 246 for (var x in styles) { 247 if (hs.ieLt9 && x == 'opacity') { 248 if (styles[x] > 0.99) el.style.removeAttribute('filter'); 249 else el.style.filter = 'alpha(opacity='+ (styles[x] * 100) +')'; 250 } 251 else el.style[x] = styles[x]; 252 } 253}, 254animate: function(el, prop, opt) { 255 var start, 256 end, 257 unit; 258 if (typeof opt != 'object' || opt === null) { 259 var args = arguments; 260 opt = { 261 duration: args[2], 262 easing: args[3], 263 complete: args[4] 264 }; 265 } 266 if (typeof opt.duration != 'number') opt.duration = 250; 267 opt.easing = Math[opt.easing] || Math.easeInQuad; 268 opt.curAnim = hs.extend({}, prop); 269 for (var name in prop) { 270 var e = new hs.fx(el, opt , name ); 271 272 start = parseFloat(hs.css(el, name)) || 0; 273 end = parseFloat(prop[name]); 274 unit = name != 'opacity' ? 'px' : ''; 275 276 e.custom( start, end, unit ); 277 } 278}, 279css: function(el, prop) { 280 if (el.style[prop]) { 281 return el.style[prop]; 282 } else if (document.defaultView) { 283 return document.defaultView.getComputedStyle(el, null).getPropertyValue(prop); 284 285 } else { 286 if (prop == 'opacity') prop = 'filter'; 287 var val = el.currentStyle[prop.replace(/\-(\w)/g, function (a, b){ return b.toUpperCase(); })]; 288 if (prop == 'filter') 289 val = val.replace(/alpha\(opacity=([0-9]+)\)/, 290 function (a, b) { return b / 100 }); 291 return val === '' ? 1 : val; 292 } 293}, 294 295getPageSize : function () { 296 var d = document, w = window, iebody = d.compatMode && d.compatMode != 'BackCompat' 297 ? d.documentElement : d.body, 298 ieLt9 = hs.ie && (hs.uaVersion < 9 || typeof pageXOffset == 'undefined'); 299 300 var width = ieLt9 ? iebody.clientWidth : 301 (d.documentElement.clientWidth || self.innerWidth),
302 height = ieLt9 ? iebody.clientHeight : self.innerHeight; 303 hs.page = { 304 width: width, 305 height: height, 306 scrollLeft: ieLt9 ? iebody.scrollLeft : pageXOffset, 307 scrollTop: ieLt9 ? iebody.scrollTop : pageYOffset 308 }; 309 return hs.page; 310}, 311 312getPosition : function(el) { 313 if (/area/i.test(el.tagName)) { 314 var imgs = document.getElementsByTagName('img'); 315 for (var i = 0; i < imgs.length; i++) { 316 var u = imgs[i].useMap; 317 if (u && u.replace(/^.*?#/, '') == el.parentNode.name) { 318 el = imgs[i]; 319 break; 320 } 321 } 322 } 323 var p = { x: el.offsetLeft, y: el.offsetTop }; 324 while (el.offsetParent) { 325 el = el.offsetParent; 326 p.x += el.offsetLeft; 327 p.y += el.offsetTop; 328 if (el != document.body && el != document.documentElement) { 329 p.x -= el.scrollLeft; 330 p.y -= el.scrollTop; 331 } 332 } 333 return p; 334}, 335 336expand : function(a, params, custom, type) { 337 hs.params = params; 338 if (!a) a = hs.createElement('a', null, { display: 'none' }, hs.container); 339 if (typeof a.getParams == 'function') return params; 340 if (type == 'html') { 341 for (var i = 0; i < hs.sleeping.length; i++) { 342 if (hs.sleeping[i] && hs.sleeping[i].a == a) { 343 hs.sleeping[i].awake(); 344 hs.sleeping[i] = null; 345 return false; 346 } 347 } 348 hs.hasHtmlExpanders = true; 349 //hs.createVideoHtml(params); 350 } 351 try { 352 new hs.Expander(a, params, custom, type); 353 return false; 354 } catch (e) { return true; } 355}, 356 357// createVideoHtml: function(params){ 358// var id = "vidid" + Math.floor(Date.now() / 1000); 359// var videoHtml = '<video id="' + id + '" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width="600" height="400"></video>'; 360// var $videoWrapper = $('#' + params.contentId + ' .video-wrapper'); 361 362// if($videoWrapper.length == 1){ 363// $videoWrapper.html(videoHtml); 364// } else { 365// return; 366// $('#' + params.myId).html(videoHtml); 367// } 368 369// var dataSetup = {}; 370// dataSetup.src = params.videoUrl; 371 372// if(params.host == 'youtube'){ 373// dataSetup.techOrder = ['youtube']; 374// dataSetup.sources = [{ type: 'video/youtube', src: params.videoUrl}]; 375// } 376 377// if(params.host == 'vimeo'){ 378// dataSetup.techOrder = ['vimeo']; 379// dataSetup.sources = [{ type: 'video/vimeo', src: params.videoUrl}]; 380// } 381 382// if(params.host == 'local'){ 383// dataSetup.sources = [{ src: params.videoUrl }]; 384// } 385 386// videojs($('#' + id)[0], dataSetup, function(){ 387// this.load(); 388// }); 389// }, 390 391makeVideoId: function(){ 392 return "vidid" + Math.floor(Date.now() / 1000); 393}, 394 395createVideoHtml: function(id){ 396 var wid_w,wid_h; 397 398 wid_w = $(window).width()/2; 399 wid_h = wid_w / (16/9); 400 401 return '<video id="' + id + '" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto" width=" '+ wid_w +'" height=" '+ wid_h +'"></video>'; 402}, 403 404loadVideo: function(params, id){ 405 var dataSetup = {}; 406 dataSetup.src = params.videoUrl; 407 408 if(params.host == 'youtube'){ 409 dataSetup.techOrder = ['youtube']; 410 dataSetup.sources = [{ type: 'video/youtube', src: params.videoUrl}]; 411 } 412 413 if(params.host == 'vimeo'){ 414 dataSetup.techOrder = ['vimeo']; 415 dataSetup.sources = [{ type: 'video/vimeo', src: params.videoUrl}]; 416 } 417 418 if(params.host == 'local'){ 419 dataSetup.sources = [{ src: params.videoUrl }]; 420 } 421 422 videojs($('#' + id)[0], dataSetup, function(){ 423 var player = this; 424 425 // SMBWMGR-3963 426 // if(window.gallerySlider.options.muted){ 427 // player.muted(true); 428 // } 429 430 // if(window.gallerySlider.options.autoPlayVideo){ 431 // player.play(); 432 // } 433 }); 434}, 435 436htmlExpand : function(a, params, custom) { 437 return hs.expand(a, params, custom, 'html'); 438}, 439 440getSelfRendered : function() { 441 return hs.createElement('div', { 442 className: 'highslide-html-content', 443 innerHTML: hs.replaceLang(hs.skin.contentWrapper) 444 }); 445}, 446getElementByClass : function (el, tagName, className) { 447 var els = el.getElementsByTagName(tagName); 448 for (var i = 0; i < els.length; i++) { 449 if ((new RegExp(className)).test(els[i].className)) { 450 return els[i]; 451 } 452 } 453 return null; 454}, 455replaceLang : function(s) { 456 s = s.replace(/\s/g, ' '); 457 var re = /{hs\.lang\.([^}]+)\}/g, 458 matches = s.match(re), 459 lang; 460 if (matches) for (var i = 0; i < matches.length; i++) { 461 lang = matches[i].replace(re, "$1"); 462 if (typeof hs.lang[lang] != 'undefined') s = s.replace(matches[i], hs.lang[lang]); 463 } 464 return s; 465}, 466 467 468setClickEvents : function () { 469 var els = document.getElementsByTagName('a'); 470 for (var i = 0; i < els.length; i++) { 471 var type = hs.isUnobtrusiveAnchor(els[i]); 472 if (type && !els[i].hsHasSetClick) { 473 (function(){ 474 var t = type; 475 if (hs.fireEvent(hs, 'onSetClickEvent', { element: els[i], type: t })) { 476 els[i].onclick =(type == 'image') ?function() { return hs.expand(this) }: 477 function() { return hs.htmlExpand(this, { objectType: t } );}; 478 } 479 })(); 480 els[i].hsHasSetClick = true; 481 } 482 } 483 hs.getAnchors(); 484}, 485isUnobtrusiveAnchor: function(el) { 486 if (el.rel == 'highslide') return 'image'; 487 else if (el.rel == 'highslide-ajax') return 'ajax'; 488 else if (el.rel == 'highslide-iframe') return 'iframe'; 489 else if (el.rel == 'highslide-swf') return 'swf'; 490}, 491 492getCacheBinding : function (a) { 493 for (var i = 0; i < hs.cacheBindings.length; i++) { 494 if (hs.cacheBindings[i][0] == a) { 495 var c = hs.cacheBindings[i][1]; 496 hs.cacheBindings[i][1] = c.cloneNode(1); 497 return c; 498 } 499 } 500 return null; 501}, 502 503preloadAjax : function (e) { 504 var arr = hs.getAnchors(); 505 for (var i = 0; i < arr.htmls.length; i++) { 506 var a = arr.htmls[i]; 507 if (hs.getParam(a, 'objectType') == 'ajax' && hs.getParam(a, 'cacheAjax')) 508 hs.push(hs.preloadTheseAjax, a); 509 } 510 511 hs.preloadAjaxElement(0); 512}, 513 514preloadAjaxElement : function (i) { 515 if (!hs.preloadTheseAjax[i]) return; 516 var a = hs.preloadTheseAjax[i]; 517 var cache = hs.getNode(hs.getParam(a, 'contentId')); 518 if (!cache) cache = hs.getSelfRendered();
519 var ajax = new hs.Ajax(a, cache, 1); 520 ajax.onError = function () { }; 521 ajax.onLoad = function () { 522 hs.push(hs.cacheBindings, [a, cache]); 523 hs.preloadAjaxElement(i + 1); 524 }; 525 ajax.run(); 526}, 527 528focusTopmost : function() { 529 var topZ = 0, 530 topmostKey = -1, 531 expanders = hs.expanders, 532 exp, 533 zIndex; 534 for (var i = 0; i < expanders.length; i++) { 535 exp = expanders[i]; 536 if (exp) { 537 zIndex = exp.wrapper.style.zIndex; 538 if (zIndex && zIndex > topZ) { 539 topZ = zIndex; 540 topmostKey = i; 541 } 542 } 543 } 544 if (topmostKey == -1) hs.focusKey = -1; 545 else expanders[topmostKey].focus(); 546}, 547 548getParam : function (a, param) { 549 a.getParams = a.onclick; 550 var p = a.getParams ? a.getParams() : null; 551 a.getParams = null; 552 553 return (p && typeof p[param] != 'undefined') ? p[param] : 554 (typeof hs[param] != 'undefined' ? hs[param] : null); 555}, 556 557getSrc : function (a) { 558 var src = hs.getParam(a, 'src'); 559 if (src) return src; 560 return a.href; 561}, 562 563getNode : function (id) { 564 var node = hs.$(id), clone = hs.clones[id], a = {}; 565 if (!node && !clone) return null; 566 if (!clone) { 567 clone = node.cloneNode(true); 568 clone.id = ''; 569 hs.clones[id] = clone; 570 return node; 571 } else { 572 return clone.cloneNode(true); 573 } 574}, 575 576discardElement : function(d) { 577 if (d) hs.garbageBin.appendChild(d); 578 hs.garbageBin.innerHTML = ''; 579}, 580dim : function(exp) { 581 if (!hs.dimmer) { 582 isNew = true; 583 hs.dimmer = hs.createElement ('div', { 584 className: 'highslide-dimming highslide-viewport-size', 585 owner: '', 586 onclick: function() { 587 if (hs.fireEvent(hs, 'onDimmerClick')) 588 589 hs.close(); 590 } 591 }, { 592 visibility: 'visible', 593 opacity: 0 594 }, hs.container, true); 595 596 if (/(Android|iPad|iPhone|iPod)/.test(navigator.userAgent)) { 597 var body = document.body; 598 function pixDimmerSize() { 599 hs.setStyles(hs.dimmer, { 600 width: body.scrollWidth +'px', 601 height: body.scrollHeight +'px' 602 }); 603 } 604 pixDimmerSize(); 605 hs.addEventListener(window, 'resize', pixDimmerSize); 606 } 607 } 608 hs.dimmer.style.display = ''; 609 610 var isNew = hs.dimmer.owner == ''; 611 hs.dimmer.owner += '|'+ exp.key; 612 613 if (isNew) { 614 if (hs.geckoMac && hs.dimmingGeckoFix) 615 hs.setStyles(hs.dimmer, { 616 background: 'url('+ hs.graphicsDir + 'geckodimmer.png)', 617 opacity: 1 618 }); 619 else 620 hs.animate(hs.dimmer, { opacity: exp.dimmingOpacity }, hs.dimmingDuration); 621 } 622}, 623undim : function(key) { 624 if (!hs.dimmer) return; 625 if (typeof key != 'undefined') hs.dimmer.owner = hs.dimmer.owner.replace('|'+ key, ''); 626 627 if ( 628 (typeof key != 'undefined' && hs.dimmer.owner != '') 629 || (hs.upcoming && hs.getParam(hs.upcoming, 'dimmingOpacity')) 630 ) return; 631 632 if (hs.geckoMac && hs.dimmingGeckoFix) hs.dimmer.style.display = 'none'; 633 else hs.animate(hs.dimmer, { opacity: 0 }, hs.dimmingDuration, null, function() { 634 hs.dimmer.style.display = 'none'; 635 }); 636}, 637transit : function (adj, exp) { 638 var last = exp || hs.getExpander(); 639 exp = last; 640 if (hs.upcoming) return false; 641 else hs.last = last; 642 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 643 try { 644 hs.upcoming = adj; 645 adj.onclick(); 646 } catch (e){ 647 hs.last = hs.upcoming = null; 648 } 649 try { 650 if (!adj || exp.transitions[1] != 'crossfade') 651 exp.close(); 652 } catch (e) {} 653 return false; 654}, 655 656previousOrNext : function (el, op) { 657 var exp = hs.getExpander(el); 658 if (exp) return hs.transit(exp.getAdjacentAnchor(op), exp); 659 else return false; 660}, 661 662previous : function (el) { 663 return hs.previousOrNext(el, -1); 664}, 665 666next : function (el) { 667 return hs.previousOrNext(el, 1); 668}, 669 670keyHandler : function(e) { 671 if (!e) e = window.event; 672 if (!e.target) e.target = e.srcElement; // ie 673 if (typeof e.target.form != 'undefined') return true; // form element has focus 674 if (!hs.fireEvent(hs, 'onKeyDown', e)) return true; 675 var exp = hs.getExpander(); 676 677 var op = null; 678 switch (e.keyCode) { 679 case 70: // f 680 if (exp) exp.doFullExpand(); 681 return true; 682 case 32: // Space 683 op = 2; 684 break; 685 case 34: // Page Down 686 case 39: // Arrow right 687 case 40: // Arrow down 688 op = 1; 689 break; 690 case 8: // Backspace 691 case 33: // Page Up 692 case 37: // Arrow left 693 case 38: // Arrow up 694 op = -1; 695 break; 696 case 27: // Escape 697 exp.close(); 698 case 13: // Enter 699 op = 0; 700 } 701 if (op !== null) {if (op != 2)hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 702 if (!hs.enableKeyListener) return true; 703 704 if (e.preventDefault) e.preventDefault(); 705 else e.returnValue = false;
706 if (exp) { 707 if (op == 0) { 708 $(':focus').click(); 709 } else if (op == 2) { 710 if (exp.slideshow) exp.slideshow.hitSpace(); 711 } else { 712 if (exp.slideshow) exp.slideshow.pause(); 713 hs.previousOrNext(exp.key, op); 714 } 715 return false; 716 } 717 } 718 return true; 719}, 720 721 722registerOverlay : function (overlay) { 723 hs.push(hs.overlays, hs.extend(overlay, { hsId: 'hsId'+ hs.idCounter++ } )); 724}, 725 726 727addSlideshow : function (options) { 728 var sg = options.slideshowGroup; 729 if (typeof sg == 'object') { 730 for (var i = 0; i < sg.length; i++) { 731 var o = {}; 732 for (var x in options) o[x] = options[x]; 733 o.slideshowGroup = sg[i]; 734 hs.push(hs.slideshows, o); 735 } 736 } else { 737 hs.push(hs.slideshows, options); 738 } 739}, 740 741getWrapperKey : function (element, expOnly) { 742 var el, re = /^highslide-wrapper-([0-9]+)$/; 743 // 1. look in open expanders 744 el = element; 745 while (el.parentNode) { 746 if (el.hsKey !== undefined) return el.hsKey; 747 if (el.id && re.test(el.id)) return el.id.replace(re, "$1"); 748 el = el.parentNode; 749 } 750 // 2. look in thumbnail 751 if (!expOnly) { 752 el = element; 753 while (el.parentNode) { 754 if (el.tagName && hs.isHsAnchor(el)) { 755 for (var key = 0; key < hs.expanders.length; key++) { 756 var exp = hs.expanders[key]; 757 if (exp && exp.a == el) return key; 758 } 759 } 760 el = el.parentNode; 761 } 762 } 763 return null; 764}, 765 766getExpander : function (el, expOnly) { 767 if (typeof el == 'undefined') return hs.expanders[hs.focusKey] || null; 768 if (typeof el == 'number') return hs.expanders[el] || null; 769 if (typeof el == 'string') el = hs.$(el); 770 return hs.expanders[hs.getWrapperKey(el, expOnly)] || null; 771}, 772 773isHsAnchor : function (a) { 774 return (a.onclick && a.onclick.toString().replace(/\s/g, ' ').match(/hs.(htmlE|e)xpand/)); 775}, 776 777reOrder : function () { 778 for (var i = 0; i < hs.expanders.length; i++) 779 if (hs.expanders[i] && hs.expanders[i].isExpanded) hs.focusTopmost(); 780}, 781fireEvent : function (obj, evt, args) { 782 return obj && obj[evt] ? (obj[evt](obj, args) !== false) : true; 783}, 784 785mouseClickHandler : function(e) 786{ 787 if (!e) e = window.event; 788 if (e.button > 1) return true; 789 if (!e.target) e.target = e.srcElement; 790 791 var el = e.target; 792 while (el.parentNode 793 && !(/highslide-(image|move|html|resize)/.test(el.className))) 794 { 795 el = el.parentNode; 796 } 797 var exp = hs.getExpander(el); 798 if (exp && (exp.isClosing || !exp.isExpanded)) return true; 799 800 if (exp && e.type == 'mousedown') { 801 if (e.target.form) return true; 802 var match = el.className.match(/highslide-(image|move|resize)/); 803 if (match) { 804 hs.dragArgs = { 805 exp: exp , 806 type: match[1], 807 left: exp.x.pos, 808 width: exp.x.size, 809 top: exp.y.pos, 810 height: exp.y.size, 811 clickX: e.clientX, 812 clickY: e.clientY 813 }; 814 815 816 hs.addEventListener(document, 'mousemove', hs.dragHandler); 817 if (e.preventDefault) e.preventDefault(); // FF 818 819 if (/highslide-(image|html)-blur/.test(exp.content.className)) { 820 exp.focus(); 821 hs.hasFocused = true; 822 } 823 return false; 824 } 825 else if (/highslide-html/.test(el.className) && hs.focusKey != exp.key) { 826 exp.focus(); 827 exp.doShowHide('hidden'); 828 } 829 } else if (e.type == 'mouseup') { 830 831 hs.removeEventListener(document, 'mousemove', hs.dragHandler); 832 833 if (hs.dragArgs) { 834 if (hs.styleRestoreCursor && hs.dragArgs.type == 'image') 835 hs.dragArgs.exp.content.style.cursor = hs.styleRestoreCursor; 836 var hasDragged = hs.dragArgs.hasDragged; 837 838 if (!hasDragged &&!hs.hasFocused && !/(move|resize)/.test(hs.dragArgs.type)) { 839 if (hs.fireEvent(exp, 'onImageClick')) 840 exp.close(); 841 } 842 else if (hasDragged || (!hasDragged && hs.hasHtmlExpanders)) { 843 hs.dragArgs.exp.doShowHide('hidden'); 844 } 845 846 if (hs.dragArgs.exp.releaseMask) 847 hs.dragArgs.exp.releaseMask.style.display = 'none'; 848 849 if (hasDragged) hs.fireEvent(hs.dragArgs.exp, 'onDrop', hs.dragArgs); 850 hs.hasFocused = false; 851 hs.dragArgs = null; 852 853 } else if (/highslide-image-blur/.test(el.className)) { 854 el.style.cursor = hs.styleRestoreCursor; 855 } 856 } 857 return false; 858}, 859 860dragHandler : function(e) 861{ 862 if (!hs.dragArgs) return true; 863 if (!e) e = window.event; 864 var a = hs.dragArgs, exp = a.exp; 865 if (exp.iframe) { 866 if (!exp.releaseMask) exp.releaseMask = hs.createElement('div', null, 867 { position: 'absolute', width: exp.x.size+'px', height: exp.y.size+'px', 868 left: exp.x.cb+'px', top: exp.y.cb+'px', zIndex: 4, background: (hs.ieLt9 ? 'white' : 'none'), 869 opacity: 0.01 }, 870 exp.wrapper, true); 871 if (exp.releaseMask.style.display == 'none') 872 exp.releaseMask.style.display = ''; 873 } 874 875 a.dX = e.clientX - a.clickX;
876 a.dY = e.clientY - a.clickY; 877 878 var distance = Math.sqrt(Math.pow(a.dX, 2) + Math.pow(a.dY, 2)); 879 if (!a.hasDragged) a.hasDragged = (a.type != 'image' && distance > 0) 880 || (distance > (hs.dragSensitivity || 5)); 881 882 if (a.hasDragged && e.clientX > 5 && e.clientY > 5) { 883 if (!hs.fireEvent(exp, 'onDrag', a)) return false; 884 885 if (a.type == 'resize') exp.resize(a); 886 else { 887 exp.moveTo(a.left + a.dX, a.top + a.dY); 888 if (a.type == 'image') exp.content.style.cursor = 'move'; 889 } 890 } 891 return false; 892}, 893 894wrapperMouseHandler : function (e) { 895 try { 896 if (!e) e = window.event; 897 var over = /mouseover/i.test(e.type); 898 if (!e.target) e.target = e.srcElement; // ie 899 if (!e.relatedTarget) e.relatedTarget = 900 over ? e.fromElement : e.toElement; // ie 901 var exp = hs.getExpander(e.target); 902 if (!exp.isExpanded) return; 903 if (!exp || !e.relatedTarget || hs.getExpander(e.relatedTarget, true) == exp 904 || hs.dragArgs) return; 905 hs.fireEvent(exp, over ? 'onMouseOver' : 'onMouseOut', e); 906 for (var i = 0; i < exp.overlays.length; i++) (function() { 907 var o = hs.$('hsId'+ exp.overlays[i]); 908 if (o && o.hideOnMouseOut) { 909 if (over) hs.setStyles(o, { visibility: 'visible', display: '' }); 910 hs.animate(o, { opacity: over ? o.opacity : 0 }, o.dur); 911 } 912 })(); 913 } catch (e) {} 914}, 915addEventListener : function (el, event, func) { 916 if (el == document && event == 'ready') { 917 hs.push(hs.onReady, func); 918 } 919 try { 920 el.addEventListener(event, func, false); 921 } catch (e) { 922 try { 923 el.detachEvent('on'+ event, func); 924 el.attachEvent('on'+ event, func); 925 } catch (e) { 926 el['on'+ event] = func; 927 } 928 } 929}, 930 931removeEventListener : function (el, event, func) { 932 try { 933 el.removeEventListener(event, func, false); 934 } catch (e) { 935 try { 936 el.detachEvent('on'+ event, func); 937 } catch (e) { 938 el['on'+ event] = null; 939 } 940 } 941}, 942 943preloadFullImage : function (i) { 944 if (hs.continuePreloading && hs.preloadTheseImages[i] && hs.preloadTheseImages[i] != 'undefined') { 945 var img = document.createElement('img'); 946 img.onload = function() { 947 img = null; 948 hs.preloadFullImage(i + 1); 949 }; 950 img.src = hs.preloadTheseImages[i]; 951 } 952}, 953preloadImages : function (number) { 954 if (number && typeof number != 'object') hs.numberOfImagesToPreload = number; 955 956 var arr = hs.getAnchors(); 957 for (var i = 0; i < arr.images.length && i < hs.numberOfImagesToPreload; i++) { 958 hs.push(hs.preloadTheseImages, hs.getSrc(arr.images[i])); 959 } 960 961 // preload outlines 962 if (hs.outlineType) new hs.Outline(hs.outlineType, function () { hs.preloadFullImage(0)} ); 963 else 964 965 hs.preloadFullImage(0); 966 967 // preload cursor 968 if (hs.restoreCursor) var cur = hs.createElement('img', { src: hs.graphicsDir + hs.restoreCursor }); 969}, 970 971 972init : function () { 973 if (!hs.container) { 974 975 hs.ieLt7 = hs.ie && hs.uaVersion < 7; 976 hs.ieLt9 = hs.ie && hs.uaVersion < 9; 977 978 hs.getPageSize(); 979 hs.ie6SSL = hs.ieLt7 && location.protocol == 'https:'; 980 for (var x in hs.langDefaults) { 981 if (typeof hs[x] != 'undefined') hs.lang[x] = hs[x]; 982 else if (typeof hs.lang[x] == 'undefined' && typeof hs.langDefaults[x] != 'undefined') 983 hs.lang[x] = hs.langDefaults[x]; 984 } 985 986 hs.container = hs.createElement('div', { 987 className: 'highslide-container' 988 }, { 989 position: 'absolute', 990 left: 0, 991 top: 0, 992 width: '100%', 993 zIndex: hs.zIndexCounter, 994 direction: 'ltr' 995 }, 996 document.body, 997 true 998 ); 999 hs.loading = hs.createElement('a', { 1000 className: 'highslide-loading', 1001 title: hs.lang.loadingTitle, 1002 innerHTML: hs.lang.loadingText, 1003 href: 'javascript:;' 1004 }, { 1005 position: 'absolute', 1006 top: '-9999px', 1007 opacity: hs.loadingOpacity, 1008 zIndex: 1 1009 }, hs.container 1010 ); 1011 hs.garbageBin = hs.createElement('div', null, { display: 'none' }, hs.container); 1012 hs.viewport = hs.createElement('div', { 1013 className: 'highslide-viewport highslide-viewport-size' 1014 }, { 1015 visibility: (hs.safari && hs.uaVersion < 525) ? 'visible' : 'hidden' 1016 }, hs.container, 1 1017 ); 1018 hs.clearing = hs.createElement('div', null, 1019 { clear: 'both', paddingTop: '1px' }, null, true); 1020 1021 // http://www.robertpenner.com/easing/ 1022 Math.linearTween = function (t, b, c, d) { 1023 return c*t/d + b; 1024 }; 1025 Math.easeInQuad = function (t, b, c, d) { 1026 return c*(t/=d)*t + b; 1027 }; 1028 Math.easeOutQuad = function (t, b, c, d) { 1029 return -c *(t/=d)*(t-2) + b; 1030 }; 1031
1032 hs.hideSelects = hs.ieLt7; 1033 hs.hideIframes = ((window.opera && hs.uaVersion < 9) || navigator.vendor == 'KDE' 1034 || (hs.ieLt7 && hs.uaVersion < 5.5)); 1035 hs.fireEvent(this, 'onActivate'); 1036 } 1037}, 1038ready : function() { 1039 if (hs.isReady) return; 1040 hs.isReady = true; 1041 for (var i = 0; i < hs.onReady.length; i++) hs.onReady[i](); 1042}, 1043 1044updateAnchors : function() { 1045 var el, els, all = [], images = [], htmls = [],groups = {}, re; 1046 1047 for (var i = 0; i < hs.openerTagNames.length; i++) { 1048 els = document.getElementsByTagName(hs.openerTagNames[i]); 1049 for (var j = 0; j < els.length; j++) { 1050 el = els[j]; 1051 re = hs.isHsAnchor(el); 1052 if (re) { 1053 hs.push(all, el); 1054 if (re[0] == 'hs.expand') hs.push(images, el); 1055 else if (re[0] == 'hs.htmlExpand') hs.push(htmls, el); 1056 var g = hs.getParam(el, 'slideshowGroup') || 'none'; 1057 if (!groups[g]) groups[g] = []; 1058 hs.push(groups[g], el); 1059 } 1060 } 1061 } 1062 hs.anchors = { all: all, groups: groups, images: images, htmls: htmls }; 1063 return hs.anchors; 1064 1065}, 1066 1067getAnchors : function() { 1068 return hs.anchors || hs.updateAnchors(); 1069}, 1070 1071 1072close : function(el) { 1073 $("body").unbind('keydown'); 1074 var exp = hs.getExpander(el); 1075 if (exp) exp.close(); 1076 return false; 1077} 1078}; // end hs object 1079hs.fx = function( elem, options, prop ){ 1080 this.options = options; 1081 this.elem = elem; 1082 this.prop = prop; 1083 1084 if (!options.orig) options.orig = {}; 1085}; 1086hs.fx.prototype = { 1087 update: function(){ 1088 (hs.fx.step[this.prop] || hs.fx.step._default)(this); 1089 1090 if (this.options.step) 1091 this.options.step.call(this.elem, this.now, this); 1092 1093 }, 1094 custom: function(from, to, unit){ 1095 this.startTime = (new Date()).getTime(); 1096 this.start = from; 1097 this.end = to; 1098 this.unit = unit;// || this.unit || "px"; 1099 this.now = this.start; 1100 this.pos = this.state = 0; 1101 1102 var self = this; 1103 function t(gotoEnd){ 1104 return self.step(gotoEnd); 1105 } 1106 1107 t.elem = this.elem; 1108 1109 if ( t() && hs.timers.push(t) == 1 ) { 1110 hs.timerId = setInterval(function(){ 1111 var timers = hs.timers; 1112 1113 for ( var i = 0; i < timers.length; i++ ) 1114 if ( !timers[i]() ) 1115 timers.splice(i--, 1); 1116 1117 if ( !timers.length ) { 1118 clearInterval(hs.timerId); 1119 } 1120 }, 13); 1121 } 1122 }, 1123 step: function(gotoEnd){ 1124 var t = (new Date()).getTime(); 1125 if ( gotoEnd || t >= this.options.duration + this.startTime ) { 1126 this.now = this.end; 1127 this.pos = this.state = 1; 1128 this.update(); 1129 1130 this.options.curAnim[ this.prop ] = true; 1131 1132 var done = true; 1133 for ( var i in this.options.curAnim ) 1134 if ( this.options.curAnim[i] !== true ) 1135 done = false; 1136 1137 if ( done ) { 1138 if (this.options.complete) this.options.complete.call(this.elem); 1139 } 1140 return false; 1141 } else { 1142 var n = t - this.startTime; 1143 this.state = n / this.options.duration; 1144 this.pos = this.options.easing(n, 0, 1, this.options.duration);
1145 this.now = this.start + ((this.end - this.start) * this.pos); 1146 this.update(); 1147 } 1148 return true; 1149 } 1150 1151}; 1152 1153hs.extend( hs.fx, { 1154 step: { 1155 1156 opacity: function(fx){ 1157 hs.setStyles(fx.elem, { opacity: fx.now }); 1158 }, 1159 1160 _default: function(fx){ 1161 try { 1162 if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) 1163 fx.elem.style[ fx.prop ] = fx.now + fx.unit; 1164 else 1165 fx.elem[ fx.prop ] = fx.now; 1166 } catch (e) {} 1167 } 1168 } 1169}); 1170 1171hs.Outline = function (outlineType, onLoad) { 1172 this.onLoad = onLoad; 1173 this.outlineType = outlineType; 1174 var v = hs.uaVersion, tr; 1175 1176 this.hasAlphaImageLoader = hs.ie && hs.uaVersion < 7; 1177 if (!outlineType) { 1178 if (onLoad) onLoad(); 1179 return; 1180 } 1181 1182 hs.init(); 1183 this.table = hs.createElement( 1184 'table', { 1185 cellSpacing: 0 1186 }, { 1187 visibility: 'hidden', 1188 position: 'absolute', 1189 borderCollapse: 'collapse', 1190 width: 0 1191 }, 1192 hs.container, 1193 true 1194 ); 1195 var tbody = hs.createElement('tbody', null, null, this.table, 1); 1196 1197 this.td = []; 1198 for (var i = 0; i <= 8; i++) { 1199 if (i % 3 == 0) tr = hs.createElement('tr', null, { height: 'auto' }, tbody, true); 1200 this.td[i] = hs.createElement('td', null, null, tr, true); 1201 var style = i != 4 ? { lineHeight: 0, fontSize: 0} : { position : 'relative' }; 1202 hs.setStyles(this.td[i], style); 1203 }
1204 this.td[4].className = outlineType +' highslide-outline'; 1205 1206 this.preloadGraphic(); 1207}; 1208 1209hs.Outline.prototype = { 1210preloadGraphic : function () { 1211 var src = hs.graphicsDir + (hs.outlinesDir || "outlines/")+ this.outlineType +".png"; 1212 1213 var appendTo = hs.safari && hs.uaVersion < 525 ? hs.container : null; 1214 this.graphic = hs.createElement('img', null, { position: 'absolute', 1215 top: '-9999px' }, appendTo, true); // for onload trigger 1216 1217 var pThis = this; 1218 this.graphic.onload = function() { pThis.onGraphicLoad(); }; 1219 1220 this.graphic.src = src; 1221}, 1222 1223onGraphicLoad : function () { 1224 var o = this.offset = this.graphic.width / 4, 1225 pos = [[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]], 1226 dim = { height: (2*o) +'px', width: (2*o) +'px' }; 1227 for (var i = 0; i <= 8; i++) { 1228 if (pos[i]) { 1229 if (this.hasAlphaImageLoader) { 1230 var w = (i == 1 || i == 7) ? '100%' : this.graphic.width +'px'; 1231 var div = hs.createElement('div', null, { width: '100%', height: '100%', position: 'relative', overflow: 'hidden'}, this.td[i], true); 1232 hs.createElement ('div', null, { 1233 filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+ this.graphic.src + "')", 1234 position: 'absolute', 1235 width: w, 1236 height: this.graphic.height +'px', 1237 left: (pos[i][0]*o)+'px', 1238 top: (pos[i][1]*o)+'px' 1239 }, 1240 div, 1241 true); 1242 } else { 1243 hs.setStyles(this.td[i], { background: 'url('+ this.graphic.src +') '+ (pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'}); 1244 } 1245 1246 if (window.opera && (i == 3 || i ==5)) 1247 hs.createElement('div', null, dim, this.td[i], true); 1248 1249 hs.setStyles (this.td[i], dim); 1250 } 1251 } 1252 this.graphic = null; 1253 if (hs.pendingOutlines[this.outlineType]) hs.pendingOutlines[this.outlineType].destroy(); 1254 hs.pendingOutlines[this.outlineType] = this; 1255 if (this.onLoad) this.onLoad(); 1256}, 1257 1258setPosition : function (pos, offset, vis, dur, easing) { 1259 var exp = this.exp, 1260 stl = exp.wrapper.style, 1261 offset = offset || 0, 1262 pos = pos || { 1263 x: exp.x.pos + offset, 1264 y: exp.y.pos + offset, 1265 w: exp.x.get('wsize') - 2 * offset, 1266 h: exp.y.get('wsize') - 2 * offset 1267 }; 1268 if (vis) this.table.style.visibility = (pos.h >= 4 * this.offset) 1269 ? 'visible' : 'hidden'; 1270 hs.setStyles(this.table, { 1271 left: (pos.x - this.offset) +'px', 1272 top: (pos.y - this.offset) +'px', 1273 width: (pos.w + 2 * this.offset) +'px' 1274 }); 1275 1276 pos.w -= 2 * this.offset; 1277 pos.h -= 2 * this.offset; 1278 hs.setStyles (this.td[4], { 1279 width: pos.w >= 0 ? pos.w +'px' : 0, 1280 height: pos.h >= 0 ? pos.h +'px' : 0 1281 }); 1282 if (this.hasAlphaImageLoader) this.td[3].style.height 1283 = this.td[5].style.height = this.td[4].style.height; 1284 1285}, 1286 1287destroy : function(hide) { 1288 if (hide) this.table.style.visibility = 'hidden'; 1289 else hs.discardElement(this.table); 1290} 1291}; 1292 1293hs.Dimension = function(exp, dim) { 1294 this.exp = exp; 1295 this.dim = dim; 1296 this.ucwh = dim == 'x' ? 'Width' : 'Height'; 1297 this.wh = this.ucwh.toLowerCase(); 1298 this.uclt = dim == 'x' ? 'Left' : 'Top'; 1299 this.lt = this.uclt.toLowerCase(); 1300 this.ucrb = dim == 'x' ? 'Right' : 'Bottom'; 1301 this.rb = this.ucrb.toLowerCase(); 1302 this.p1 = this.p2 = 0; 1303}; 1304hs.Dimension.prototype = { 1305get : function(key) { 1306 switch (key) { 1307 case 'loadingPos': 1308 return this.tpos + this.tb + (this.t - hs.loading['offset'+ this.ucwh]) / 2; 1309 case 'loadingPosXfade': 1310 return this.pos + this.cb+ this.p1 + (this.size - hs.loading['offset'+ this.ucwh]) / 2; 1311 case 'wsize': 1312 return this.size + 2 * this.cb + this.p1 + this.p2; 1313 case 'fitsize': 1314 return this.clientSize - this.marginMin - this.marginMax; 1315 case 'maxsize': 1316 return this.get('fitsize') - 2 * this.cb - this.p1 - this.p2 ; 1317 case 'opos': 1318 return this.pos - (this.exp.outline ? this.exp.outline.offset : 0); 1319 case 'osize': 1320 return this.get('wsize') + (this.exp.outline ? 2*this.exp.outline.offset : 0); 1321 case 'imgPad': 1322 return this.imgSize ? Math.round((this.size - this.imgSize) / 2) : 0; 1323 1324 } 1325}, 1326calcBorders: function() { 1327 // correct for borders 1328 this.cb = (this.exp.content['offset'+ this.ucwh] - this.t) / 2; 1329 1330 this.marginMax = hs['margin'+ this.ucrb]; 1331}, 1332calcThumb: function() { 1333 this.t = this.exp.el[this.wh] ? parseInt(this.exp.el[this.wh]) : 1334 this.exp.el['offset'+ this.ucwh]; 1335 this.tpos = this.exp.tpos[this.dim]; 1336 this.tb = (this.exp.el['offset'+ this.ucwh] - this.t) / 2; 1337 if (this.tpos == 0 || this.tpos == -1) { 1338 this.tpos = (hs.page[this.wh] / 2) + hs.page['scroll'+ this.uclt]; 1339 }; 1340}, 1341calcExpanded: function() { 1342 var exp = this.exp; 1343 this.justify = 'auto'; 1344 1345 // get alignment 1346 if (exp.align == 'center') this.justify = 'center'; 1347 else if (new RegExp(this.lt).test(exp.anchor)) this.justify = null; 1348 else if (new RegExp(this.rb).test(exp.anchor)) this.justify = 'max'; 1349 1350 1351 // size and position 1352 this.pos = this.tpos - this.cb + this.tb; 1353 1354 if (this.maxHeight && this.dim == 'x') 1355 exp.maxWidth = Math.min(exp.maxWidth || this.full, exp.maxHeight * this.full / exp.y.full); 1356 1357 this.size = Math.min(this.full, exp['max'+ this.ucwh] || this.full); 1358 this.minSize = exp.allowSizeReduction ? 1359 Math.min(exp['min'+ this.ucwh], this.full) :this.full; 1360 if (exp.isImage && exp.useBox) { 1361 this.size = exp[this.wh]; 1362 this.imgSize = this.full; 1363 } 1364 if (this.dim == 'x' && hs.padToMinWidth) this.minSize = exp.minWidth; 1365 this.target = exp['target'+ this.dim.toUpperCase()]; 1366 this.marginMin = hs['margin'+ this.uclt]; 1367 this.scroll = hs.page['scroll'+ this.uclt]; 1368 this.clientSize = hs.page[this.wh]; 1369}, 1370setSize: function(i) { 1371 var exp = this.exp; 1372 if (exp.isImage && (exp.useBox || hs.padToMinWidth)) { 1373 this.imgSize = i; 1374 this.size = Math.max(this.size, this.imgSize); 1375 exp.content.style[this.lt] = this.get('imgPad')+'px'; 1376 } else 1377 this.size = i; 1378 1379 exp.content.style[this.wh] = i +'px'; 1380 exp.wrapper.style[this.wh] = this.get('wsize') +'px'; 1381 if (exp.outline) exp.outline.setPosition(); 1382 if (exp.releaseMask) exp.releaseMask.style[this.wh] = i +'px'; 1383 if (this.dim == 'y' && exp.iDoc && exp.body.style.height != 'auto') try { 1384 exp.iDoc.body.style.overflow = 'auto'; 1385 } catch (e) {} 1386 if (exp.isHtml) { 1387 var d = exp.scrollerDiv; 1388 if (this.sizeDiff === undefined) 1389 this.sizeDiff = exp.innerContent['offset'+ this.ucwh] - d['offset'+ this.ucwh]; 1390 d.style[this.wh] = (this.size - this.sizeDiff) +'px'; 1391 1392 if (this.dim == 'x') exp.mediumContent.style.width = 'auto'; 1393 if (exp.body) exp.body.style[this.wh] = 'auto'; 1394 } 1395 if (this.dim == 'x' && exp.overlayBox) exp.sizeOverlayBox(true); 1396 if (this.dim == 'x' && exp.slideshow && exp.isImage) { 1397 if (i == this.full) exp.slideshow.disable('full-expand'); 1398 else exp.slideshow.enable('full-expand'); 1399 } 1400}, 1401setPos: function(i) { 1402 this.pos = i; 1403 this.exp.wrapper.style[this.lt] = i +'px'; 1404 1405 if (this.exp.outline) this.exp.outline.setPosition(); 1406 1407} 1408}; 1409 1410hs.Expander = function(a, params, custom, contentType) { 1411 if (document.readyState && hs.ie && !hs.isReady) { 1412 hs.addEventListener(document, 'ready', function() { 1413 new hs.Expander(a, params, custom, contentType); 1414 }); 1415 return; 1416 } 1417 this.a = a; 1418 this.custom = custom; 1419 this.contentType = contentType || 'image'; 1420 this.isHtml = (contentType == 'html'); 1421 this.isImage = !this.isHtml; 1422 1423 hs.prms = params; 1424 1425 hs.continuePreloading = false;
1426 this.overlays = []; 1427 this.last = hs.last; 1428 hs.last = null; 1429 hs.init(); 1430 var key = this.key = hs.expanders.length; 1431 // override inline parameters 1432 for (var i = 0; i < hs.overrides.length; i++) { 1433 var name = hs.overrides[i]; 1434 this[name] = params && typeof params[name] != 'undefined' ? 1435 params[name] : hs[name]; 1436 } 1437 if (!this.src) this.src = a.href; 1438 1439 // get thumb 1440 var el = (params && params.thumbnailId) ? hs.$(params.thumbnailId) : a; 1441 el = this.thumb = el.getElementsByTagName('img')[0] || el; 1442 this.thumbsUserSetId = el.id || a.id; 1443 if (!hs.fireEvent(this, 'onInit')) return true; 1444 1445 // check if already open 1446 for (var i = 0; i < hs.expanders.length; i++) { 1447 if (hs.expanders[i] && hs.expanders[i].a == a 1448 && !(this.last && this.transitions[1] == 'crossfade')) { 1449 hs.expanders[i].focus(); 1450 return false; 1451 } 1452 } 1453 1454 // cancel other 1455 if (!hs.allowSimultaneousLoading) for (var i = 0; i < hs.expanders.length; i++) { 1456 if (hs.expanders[i] && hs.expanders[i].thumb != el && !hs.expanders[i].onLoadStarted) { 1457 hs.expanders[i].cancelLoading(); 1458 } 1459 } 1460 hs.expanders[key] = this; 1461 if (!hs.allowMultipleInstances && !hs.upcoming) { 1462 if (hs.expanders[key-1]) hs.expanders[key-1].close(); 1463 if (typeof hs.focusKey != 'undefined' && hs.expanders[hs.focusKey]) 1464 hs.expanders[hs.focusKey].close(); 1465 } 1466 1467 // initiate metrics 1468 this.el = el; 1469 this.tpos = this.pageOrigin || hs.getPosition(el); 1470 hs.getPageSize(); 1471 var x = this.x = new hs.Dimension(this, 'x'); 1472 x.calcThumb(); 1473 var y = this.y = new hs.Dimension(this, 'y'); 1474 y.calcThumb(); 1475 if (/area/i.test(el.tagName)) this.getImageMapAreaCorrection(el); 1476 this.wrapper = hs.createElement( 1477 'div', { 1478 id: 'highslide-wrapper-'+ this.key, 1479 className: 'highslide-wrapper' 1480 }, { 1481 visibility: 'hidden', 1482 position: 'absolute', 1483 zIndex: hs.zIndexCounter += 2 1484 }, null, true ); 1485 1486 this.wrapper.onmouseover = this.wrapper.onmouseout = hs.wrapperMouseHandler; 1487 if (this.contentType == 'image' && this.outlineWhileAnimating == 2) 1488 this.outlineWhileAnimating = 0; 1489 1490 // get the outline 1491 if (!this.outlineType 1492 || (this.last && this.isImage && this.transitions[1] == 'crossfade')) { 1493 this[this.contentType +'Create'](); 1494 1495 } else if (hs.pendingOutlines[this.outlineType]) { 1496 this.connectOutline(); 1497 this[this.contentType +'Create'](); 1498 1499 } else { 1500 this.showLoading(); 1501 var exp = this; 1502 new hs.Outline(this.outlineType, 1503 function () { 1504 exp.connectOutline(); 1505 exp[exp.contentType +'Create'](); 1506 } 1507 ); 1508 } 1509 1510 return true; 1511}; 1512 1513hs.Expander.prototype = { 1514error : function(e) { 1515 if (hs.debug) alert ('Line '+ e.lineNumber +': '+ e.message); 1516 else window.location.href = this.src; 1517}, 1518 1519connectOutline : function() { 1520 var outline = this.outline = hs.pendingOutlines[this.outlineType]; 1521 outline.exp = this; 1522 outline.table.style.zIndex = this.wrapper.style.zIndex - 1; 1523 hs.pendingOutlines[this.outlineType] = null; 1524}, 1525 1526showLoading : function() { 1527 if (this.onLoadStarted || this.loading) return; 1528 1529 this.loading = hs.loading; 1530 var exp = this; 1531 this.loading.onclick = function() { 1532 exp.cancelLoading(); 1533 }; 1534 1535 1536 if (!hs.fireEvent(this, 'onShowLoading')) return; 1537 var exp = this, 1538 l = this.x.get('loadingPos') +'px', 1539 t = this.y.get('loadingPos') +'px'; 1540 if (!tgt && this.last && this.transitions[1] == 'crossfade') 1541 var tgt = this.last; 1542 if (tgt) { 1543 l = tgt.x.get('loadingPosXfade') +'px'; 1544 t = tgt.y.get('loadingPosXfade') +'px'; 1545 this.loading.style.zIndex = hs.zIndexCounter++; 1546 } 1547 setTimeout(function () { 1548 if (exp.loading) hs.setStyles(exp.loading, { left: l, top: t, zIndex: hs.zIndexCounter++ })} 1549 , 100); 1550}, 1551 1552imageCreate : function() { 1553 var exp = this; 1554 1555 var img = document.createElement('img'); 1556 this.content = img; 1557 img.onload = function () { 1558 if (hs.expanders[exp.key]) exp.contentLoaded(); 1559 }; 1560 if (hs.blockRightClick) img.oncontextmenu = function() { return false; }; 1561 img.className = 'highslide-image'; 1562 hs.setStyles(img, { 1563 visibility: 'hidden', 1564 display: 'block', 1565 position: 'absolute', 1566 maxWidth: '9999px', 1567 zIndex: 3 1568 }); 1569 img.title = hs.lang.restoreTitle; 1570 if (hs.safari && hs.uaVersion < 525) hs.container.appendChild(img); 1571 if (hs.ie && hs.flushImgSize) img.src = null; 1572 img.src = this.src; 1573 1574 this.showLoading(); 1575}, 1576 1577htmlCreate : function () { 1578 if (!hs.fireEvent(this, 'onBeforeGetContent')) return; 1579 1580 this.content = hs.getCacheBinding(this.a); 1581 //this.content = 'Vladimir Aleksandrov'; 1582 if (!this.content) 1583 this.content = hs.getNode(this.contentId); 1584 if (!this.content) 1585 this.content = hs.getSelfRendered(); 1586 this.getInline(['maincontent']); 1587 if (this.maincontent) { 1588 var body = hs.getElementByClass(this.content, 'div', 'highslide-body'); 1589 if (body) body.appendChild(this.maincontent); 1590 this.maincontent.style.display = 'block'; 1591 } 1592 hs.fireEvent(this, 'onAfterGetContent'); 1593 1594 var innerContent = this.innerContent = this.content; 1595 1596 if (/(swf|iframe)/.test(this.objectType)) this.setObjContainerSize(innerContent); 1597 1598 // the content tree 1599 hs.container.appendChild(this.wrapper); 1600 hs.setStyles( this.wrapper, { 1601 position: 'static', 1602 padding: '0 '+ hs.marginRight +'px 0 '+ hs.marginLeft +'px' 1603 }); 1604 this.content = hs.createElement( 1605 'div', { 1606 className: 'highslide-html' 1607 }, {
1608 position: 'relative', 1609 zIndex: 3, 1610 height: 0, 1611 overflow: 'hidden' 1612 }, 1613 this.wrapper 1614 ); 1615 1616 var videoId = hs.makeVideoId(); 1617 var videoHtml = hs.createVideoHtml(videoId); 1618 innerContent.innerHTML = videoHtml; 1619 1620 this.mediumContent = hs.createElement('div', null, null, this.content, 1); 1621 this.mediumContent.appendChild(innerContent); 1622 1623 hs.loadVideo(hs.params, videoId); 1624 1625 hs.setStyles (innerContent, { 1626 position: 'relative', 1627 display: 'block', 1628 direction: hs.lang.cssDirection || '' 1629 }); 1630 1631 this.width = $(window).width()/2; 1632 this.height = this.width / (16/9); 1633 1634 if (this.width) innerContent.style.width = this.width +'px'; 1635 if (this.height) hs.setStyles(innerContent, { 1636 height: this.height +'px', 1637 overflow: 'hidden' 1638 }); 1639 if (innerContent.offsetWidth < this.minWidth) 1640 innerContent.style.width = this.minWidth +'px'; 1641 1642 1643 1644 if (this.objectType == 'ajax' && !hs.getCacheBinding(this.a)) { 1645 this.showLoading(); 1646 var exp = this; 1647 var ajax = new hs.Ajax(this.a, innerContent); 1648 ajax.src = this.src; 1649 ajax.onLoad = function () { if (hs.expanders[exp.key]) exp.contentLoaded(); }; 1650 ajax.onError = function () { location.href = exp.src; }; 1651 ajax.run(); 1652 } 1653 else 1654 1655 if (this.objectType == 'iframe' && this.objectLoadTime == 'before') { 1656 this.writeExtendedContent(); 1657 } 1658 else 1659 this.contentLoaded(); 1660}, 1661 1662contentLoaded : function() { 1663 try { 1664 if (!this.content) return; 1665 this.content.onload = null; 1666 if (this.onLoadStarted) return; 1667 else this.onLoadStarted = true; 1668 1669 var x = this.x, y = this.y; 1670 1671 if (this.loading) { 1672 hs.setStyles(this.loading, { top: '-9999px' }); 1673 this.loading = null; 1674 hs.fireEvent(this, 'onHideLoading'); 1675 } 1676 if (this.isImage) { 1677 x.full = this.content.width; 1678 y.full = this.content.height; 1679 1680 hs.setStyles(this.content, { 1681 width: x.t +'px', 1682 height: y.t +'px' 1683 }); 1684 this.wrapper.appendChild(this.content); 1685 hs.container.appendChild(this.wrapper); 1686 } else if (this.htmlGetSize) this.htmlGetSize(); 1687 1688 x.calcBorders(); 1689 y.calcBorders(); 1690 1691 hs.setStyles (this.wrapper, { 1692 left: (x.tpos + x.tb - x.cb) +'px', 1693 top: (y.tpos + x.tb - y.cb) +'px' 1694 }); 1695 1696 if(this.isHtml){ 1697 var margins = { 1698 "marginTop": "0", 1699 "marginRight": "auto", 1700 "marginBottom": "0", 1701 "marginLeft": "auto" 1702 }; 1703 1704 $(this.wrapper).find('> div > div, .video-js, vjs-default-skin').css(margins); 1705 }; 1706 1707 this.initSlideshow(); 1708 this.getOverlays(); 1709 1710 var ratio = x.full / y.full; 1711 x.calcExpanded(); 1712 this.justify(x); 1713 1714 y.calcExpanded(); 1715 this.justify(y); 1716 if (this.isHtml) this.htmlSizeOperations(); 1717 if (this.overlayBox) this.sizeOverlayBox(0, 1); 1718 1719 1720 if (this.allowSizeReduction) { 1721 if (this.isImage) 1722 this.correctRatio(ratio); 1723 else this.fitOverlayBox(); 1724 var ss = this.slideshow; 1725 if (ss && this.last && ss.controls && ss.fixedControls) { 1726 var pos = ss.overlayOptions.position || '', p; 1727 for (var dim in hs.oPos) for (var i = 0; i < 5; i++) { 1728 p = this[dim]; 1729 if (pos.match(hs.oPos[dim][i])) { 1730 p.pos = this.last[dim].pos 1731 + (this.last[dim].p1 - p.p1) 1732 + (this.last[dim].size - p.size) * [0, 0, .5, 1, 1][i]; 1733 if (ss.fixedControls == 'fit') { 1734 if (p.pos + p.size + p.p1 + p.p2 > p.scroll + p.clientSize - p.marginMax) 1735 p.pos = p.scroll + p.clientSize - p.size - p.marginMin - p.marginMax - p.p1 - p.p2; 1736 if (p.pos < p.scroll + p.marginMin) p.pos = p.scroll + p.marginMin; 1737 } 1738 } 1739 } 1740 } 1741 if (this.isImage && this.x.full > (this.x.imgSize || this.x.size)) { 1742 this.createFullExpand(); 1743 if (this.overlays.length == 1) this.sizeOverlayBox(); 1744 } 1745 } 1746 this.show(); 1747 1748 } catch (e) { 1749 this.error(e); 1750 } 1751}, 1752 1753 1754setObjContainerSize : function(parent, auto) { 1755 var c = hs.getElementByClass(parent, 'DIV', 'highslide-body'); 1756 if (/(iframe|swf)/.test(this.objectType)) { 1757 if (this.objectWidth) c.style.width = this.objectWidth +'px'; 1758 if (this.objectHeight) c.style.height = this.objectHeight +'px'; 1759 } 1760}, 1761 1762writeExtendedContent : function () { 1763 if (this.hasExtendedContent) return; 1764 var exp = this; 1765 this.body = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body'); 1766 if (this.objectType == 'iframe') { 1767 this.showLoading(); 1768 var ruler = hs.clearing.cloneNode(1); 1769 this.body.appendChild(ruler); 1770 this.newWidth = this.innerContent.offsetWidth; 1771 if (!this.objectWidth) this.objectWidth = ruler.offsetWidth; 1772 var hDiff = this.innerContent.offsetHeight - this.body.offsetHeight, 1773 h = this.objectHeight || hs.page.height - hDiff - hs.marginTop - hs.marginBottom, 1774 onload = this.objectLoadTime == 'before' ?
1775 ' onload="if (hs.expanders['+ this.key +']) hs.expanders['+ this.key +'].contentLoaded()" ' : ''; 1776 this.body.innerHTML += '<iframe name="hs'+ (new Date()).getTime() +'" frameborder="0" key="'+ this.key +'" ' 1777 +' style="width:'+ this.objectWidth +'px; height:'+ h +'px" ' 1778 + onload +' src="'+ this.src +'" allowfullscreen></iframe>'; 1779 this.ruler = this.body.getElementsByTagName('div')[0]; 1780 this.iframe = this.body.getElementsByTagName('iframe')[0]; 1781 1782 if (this.objectLoadTime == 'after') this.correctIframeSize(); 1783 1784 } 1785 if (this.objectType == 'swf') { 1786 this.body.id = this.body.id || 'hs-flash-id-' + this.key; 1787 var a = this.swfOptions; 1788 if (!a.params) a.params = {}; 1789 if (typeof a.params.wmode == 'undefined') a.params.wmode = 'transparent'; 1790 if (swfobject) swfobject.embedSWF(this.src, this.body.id, this.objectWidth, this.objectHeight, 1791 a.version || '7', a.expressInstallSwfurl, a.flashvars, a.params, a.attributes); 1792 } 1793 this.hasExtendedContent = true; 1794}, 1795htmlGetSize : function() { 1796 if (this.iframe && !this.objectHeight) { // loadtime before 1797 this.iframe.style.height = this.body.style.height = this.getIframePageHeight() +'px'; 1798 } 1799 this.innerContent.appendChild(hs.clearing); 1800 if (!this.x.full) this.x.full = this.innerContent.offsetWidth; 1801 this.y.full = this.innerContent.offsetHeight; 1802 this.innerContent.removeChild(hs.clearing); 1803 if (hs.ie && this.newHeight > parseInt(this.innerContent.currentStyle.height)) { // ie css bug 1804 this.newHeight = parseInt(this.innerContent.currentStyle.height); 1805 } 1806 hs.setStyles( this.wrapper, { position: 'absolute', padding: '0'}); 1807 hs.setStyles( this.content, { width: this.x.t +'px', height: this.y.t +'px'}); 1808 1809}, 1810 1811getIframePageHeight : function() { 1812 var h; 1813 try { 1814 var doc = this.iDoc = this.iframe.contentDocument || this.iframe.contentWindow.document; 1815 var clearing = doc.createElement('div'); 1816 clearing.style.clear = 'both'; 1817 doc.body.appendChild(clearing); 1818 h = clearing.offsetTop; 1819 if (hs.ie) h += parseInt(doc.body.currentStyle.marginTop) 1820 + parseInt(doc.body.currentStyle.marginBottom) - 1; 1821 } catch (e) { // other domain 1822 h = 300; 1823 } 1824 return h; 1825}, 1826correctIframeSize : function () { 1827 var wDiff = this.innerContent.offsetWidth - this.ruler.offsetWidth; 1828 hs.discardElement(this.ruler); 1829 if (wDiff < 0) wDiff = 0; 1830 1831 var hDiff = this.innerContent.offsetHeight - this.iframe.offsetHeight; 1832 if (this.iDoc && !this.objectHeight && !this.height && this.y.size == this.y.full) try { 1833 this.iDoc.body.style.overflow = 'hidden'; 1834 } catch (e) {} 1835 hs.setStyles(this.iframe, { 1836 width: Math.abs(this.x.size - wDiff) +'px', 1837 height: Math.abs(this.y.size - hDiff) +'px' 1838 }); 1839 hs.setStyles(this.body, { 1840 width: this.iframe.style.width, 1841 height: this.iframe.style.height 1842 }); 1843 1844 this.scrollingContent = this.iframe; 1845 this.scrollerDiv = this.scrollingContent; 1846 1847}, 1848htmlSizeOperations : function () { 1849 1850 this.setObjContainerSize(this.innerContent); 1851 1852 1853 if (this.objectType == 'swf' && this.objectLoadTime == 'before') this.writeExtendedContent(); 1854 1855 // handle minimum size 1856 if (this.x.size < this.x.full && !this.allowWidthReduction) this.x.size = this.x.full; 1857 if (this.y.size < this.y.full && !this.allowHeightReduction) this.y.size = this.y.full; 1858 this.scrollerDiv = this.innerContent; 1859 hs.setStyles(this.mediumContent, { 1860 position: 'relative', 1861 width: this.x.size +'px' 1862 }); 1863 hs.setStyles(this.innerContent, { 1864 border: 'none', 1865 width: 'auto', 1866 height: 'auto' 1867 }); 1868 var node = hs.getElementByClass(this.innerContent, 'DIV', 'highslide-body'); 1869 if (node && !/(iframe|swf)/.test(this.objectType)) { 1870 var cNode = node; // wrap to get true size 1871 node = hs.createElement(cNode.nodeName, null, {overflow: 'hidden'}, null, true); 1872 cNode.parentNode.insertBefore(node, cNode); 1873 node.appendChild(hs.clearing); // IE6 1874 node.appendChild(cNode); 1875 1876 var wDiff = this.innerContent.offsetWidth - node.offsetWidth; 1877 var hDiff = this.innerContent.offsetHeight - node.offsetHeight; 1878 node.removeChild(hs.clearing); 1879 1880 var kdeBugCorr = hs.safari || navigator.vendor == 'KDE' ? 1 : 0; // KDE repainting bug 1881 hs.setStyles(node, { 1882 width: (this.x.size - wDiff - kdeBugCorr) +'px', 1883 height: (this.y.size - hDiff) +'px', 1884 overflow: 'auto', 1885 position: 'relative' 1886 } 1887 ); 1888 if (kdeBugCorr && cNode.offsetHeight > node.offsetHeight) { 1889 node.style.width = (parseInt(node.style.width) + kdeBugCorr) + 'px'; 1890 } 1891 this.scrollingContent = node; 1892 this.scrollerDiv = this.scrollingContent; 1893 } 1894 if (this.iframe && this.objectLoadTime == 'before') this.correctIframeSize(); 1895 if (!this.scrollingContent && this.y.size < this.mediumContent.offsetHeight) this.scrollerDiv = this.content; 1896 1897 if (this.scrollerDiv == this.content && !this.allowWidthReduction && !/(iframe|swf)/.test(this.objectType)) { 1898 this.x.size += 17; // room for scrollbars 1899 } 1900 if (this.scrollerDiv && this.scrollerDiv.offsetHeight > this.scrollerDiv.parentNode.offsetHeight) { 1901 setTimeout("try { hs.expanders["+ this.key +"].scrollerDiv.style.overflow = 'auto'; } catch(e) {}", 1902 hs.expandDuration); 1903 } 1904}, 1905 1906getImageMapAreaCorrection : function(area) { 1907 var c = area.coords.split(','); 1908 for (var i = 0; i < c.length; i++) c[i] = parseInt(c[i]); 1909 1910 if (area.shape.toLowerCase() == 'circle') { 1911 this.x.tpos += c[0] - c[2]; 1912 this.y.tpos += c[1] - c[2]; 1913 this.x.t = this.y.t = 2 * c[2]; 1914 } else { 1915 var maxX, maxY, minX = maxX = c[0], minY = maxY = c[1]; 1916 for (var i = 0; i < c.length; i++) { 1917 if (i % 2 == 0) { 1918 minX = Math.min(minX, c[i]); 1919 maxX = Math.max(maxX, c[i]); 1920 } else { 1921 minY = Math.min(minY, c[i]); 1922 maxY = Math.max(maxY, c[i]); 1923 } 1924 } 1925 this.x.tpos += minX; 1926 this.x.t = maxX - minX; 1927 this.y.tpos += minY; 1928 this.y.t = maxY - minY; 1929 } 1930}, 1931justify : function (p, moveOnly) { 1932 var tgtArr, tgt = p.target, dim = p == this.x ? 'x' : 'y'; 1933 1934 if (tgt && tgt.match(/ /)) { 1935 tgtArr = tgt.split(' '); 1936 tgt = tgtArr[0]; 1937 } 1938 if (tgt && hs.$(tgt)) { 1939 p.pos = hs.getPosition(hs.$(tgt))[dim]; 1940 if (tgtArr && tgtArr[1] && tgtArr[1].match(/^[-]?[0-9]+px$/)) 1941 p.pos += parseInt(tgtArr[1]); 1942 if (p.size < p.minSize) p.size = p.minSize; 1943 1944 } else if (p.justify == 'auto' || p.justify == 'center') { 1945 1946 var hasMovedMin = false;
1947 1948 var allowReduce = p.exp.allowSizeReduction; 1949 if (p.justify == 'center') 1950 p.pos = Math.round(p.scroll + (p.clientSize + p.marginMin - p.marginMax - p.get('wsize')) / 2); 1951 else 1952 p.pos = Math.round(p.pos - ((p.get('wsize') - p.t) / 2)); 1953 if (p.pos < p.scroll + p.marginMin) { 1954 p.pos = p.scroll + p.marginMin; 1955 hasMovedMin = true; 1956 } 1957 if (!moveOnly && p.size < p.minSize) { 1958 p.size = p.minSize; 1959 allowReduce = false; 1960 } 1961 if (p.pos + p.get('wsize') > p.scroll + p.clientSize - p.marginMax) { 1962 if (!moveOnly && hasMovedMin && allowReduce) { 1963 p.size = Math.min(p.size, p.get(dim == 'y' ? 'fitsize' : 'maxsize')); 1964 } else if (p.get('wsize') < p.get('fitsize')) { 1965 p.pos = p.scroll + p.clientSize - p.marginMax - p.get('wsize'); 1966 } else { // image larger than viewport 1967 p.pos = p.scroll + p.marginMin; 1968 if (!moveOnly && allowReduce) p.size = p.get(dim == 'y' ? 'fitsize' : 'maxsize'); 1969 } 1970 } 1971 1972 if (!moveOnly && p.size < p.minSize) { 1973 p.size = p.minSize; 1974 allowReduce = false; 1975 } 1976 1977 1978 } else if (p.justify == 'max') { 1979 p.pos = Math.floor(p.pos - p.size + p.t); 1980 } 1981 1982 1983 if (p.pos < p.marginMin) { 1984 var tmpMin = p.pos; 1985 p.pos = p.marginMin; 1986 1987 if (allowReduce && !moveOnly) p.size = p.size - (p.pos - tmpMin); 1988 1989 } 1990}, 1991 1992correctRatio : function(ratio) { 1993 var x = this.x, 1994 y = this.y, 1995 changed = false, 1996 xSize = Math.min(x.full, x.size), 1997 ySize = Math.min(y.full, y.size), 1998 useBox = (this.useBox || hs.padToMinWidth); 1999 2000 if (xSize / ySize > ratio) { // width greater 2001 xSize = ySize * ratio; 2002 if (xSize < x.minSize) { // below minWidth 2003 xSize = x.minSize; 2004 ySize = xSize / ratio; 2005 } 2006 changed = true; 2007 2008 } else if (xSize / ySize < ratio) { // height greater 2009 ySize = xSize / ratio; 2010 changed = true; 2011 } 2012 2013 if (hs.padToMinWidth && x.full < x.minSize) { 2014 x.imgSize = x.full; 2015 y.size = y.imgSize = y.full; 2016 } else if (this.useBox) { 2017 x.imgSize = xSize; 2018 y.imgSize = ySize; 2019 } else { 2020 x.size = xSize; 2021 y.size = ySize; 2022 } 2023 changed = this.fitOverlayBox(this.useBox ? null : ratio, changed); 2024 if (useBox && y.size < y.imgSize) { 2025 y.imgSize = y.size; 2026 x.imgSize = y.size * ratio; 2027 } 2028 if (changed || useBox) { 2029 x.pos = x.tpos - x.cb + x.tb; 2030 x.minSize = x.size; 2031 this.justify(x, true); 2032 2033 y.pos = y.tpos - y.cb + y.tb; 2034 y.minSize = y.size; 2035 this.justify(y, true); 2036 if (this.overlayBox) this.sizeOverlayBox(); 2037 } 2038 2039 2040}, 2041fitOverlayBox : function(ratio, changed) { 2042 var x = this.x, y = this.y; 2043 if (this.overlayBox && (this.isImage || this.allowHeightReduction)) { 2044 while (y.size > this.minHeight && x.size > this.minWidth 2045 && y.get('wsize') > y.get('fitsize')) { 2046 y.size -= 10; 2047 if (ratio) x.size = y.size * ratio; 2048 this.sizeOverlayBox(0, 1); 2049 changed = true; 2050 } 2051 } 2052 return changed; 2053}, 2054 2055reflow : function () { 2056 if (this.scrollerDiv) { 2057 var h = /iframe/i.test(this.scrollerDiv.tagName) ? (this.getIframePageHeight() + 1) +'px' : 'auto'; 2058 if (this.body) this.body.style.height = h; 2059 this.scrollerDiv.style.height = h; 2060 this.y.setSize(this.innerContent.offsetHeight); 2061 } 2062}, 2063 2064show : function () { 2065 var x = this.x, y = this.y; 2066 this.doShowHide('hidden'); 2067 hs.fireEvent(this, 'onBeforeExpand'); 2068 if (this.slideshow && this.slideshow.thumbstrip) this.slideshow.thumbstrip.selectThumb(); 2069 2070 // Apply size change 2071 this.changeSize( 2072 1, { 2073 wrapper: { 2074 width : x.get('wsize'), 2075 height : y.get('wsize'), 2076 left: x.pos, 2077 top: y.pos 2078 }, 2079 content: { 2080 left: x.p1 + x.get('imgPad'), 2081 top: y.p1 + y.get('imgPad'), 2082 width:x.imgSize ||x.size, 2083 height:y.imgSize ||y.size 2084 } 2085 }, 2086 hs.expandDuration 2087 ); 2088}, 2089 2090changeSize : function(up, to, dur) { 2091 // transition 2092 var trans = this.transitions, 2093 other = up ? (this.last ? this.last.a : null) : hs.upcoming, 2094 t = (trans[1] && other 2095 && hs.getParam(other, 'transitions')[1] == trans[1]) ? 2096 trans[1] : trans[0]; 2097 2098 if (this[t] && t != 'expand') { 2099 this[t](up, to); 2100 return; 2101 } 2102 2103 if (this.outline && !this.outlineWhileAnimating) { 2104 if (up) this.outline.setPosition(); 2105 else this.outline.destroy( 2106 (this.isHtml && this.preserveContent)); 2107 } 2108 2109 2110 if (!up) this.destroyOverlays(); 2111 2112 var exp = this, 2113 x = exp.x, 2114 y = exp.y, 2115 easing = this.easing; 2116 if (!up) easing = this.easingClose || easing; 2117 var after = up ? 2118 function() { 2119 2120 if (exp.outline) exp.outline.table.style.visibility = "visible"; 2121 setTimeout(function() { 2122 exp.afterExpand(); 2123 }, 50); 2124 }
2124 : 2125 function() { 2126 exp.afterClose(); 2127 }; 2128 if (up) hs.setStyles( this.wrapper, { 2129 width: x.t +'px', 2130 height: y.t +'px' 2131 }); 2132 if (up && this.isHtml) { 2133 hs.setStyles(this.wrapper, { 2134 left: (x.tpos - x.cb + x.tb) +'px', 2135 top: (y.tpos - y.cb + y.tb) +'px' 2136 }); 2137 } 2138 if (this.fadeInOut) { 2139 hs.setStyles(this.wrapper, { opacity: up ? 0 : 1 }); 2140 hs.extend(to.wrapper, { opacity: up }); 2141 } 2142 hs.animate( this.wrapper, to.wrapper, { 2143 duration: dur, 2144 easing: easing, 2145 step: function(val, args) { 2146 if (exp.outline && exp.outlineWhileAnimating && args.prop == 'top') { 2147 var fac = up ? args.pos : 1 - args.pos; 2148 var pos = { 2149 w: x.t + (x.get('wsize') - x.t) * fac, 2150 h: y.t + (y.get('wsize') - y.t) * fac, 2151 x: x.tpos + (x.pos - x.tpos) * fac, 2152 y: y.tpos + (y.pos - y.tpos) * fac 2153 }; 2154 exp.outline.setPosition(pos, 0, 1); 2155 } 2156 if (exp.isHtml) { 2157 if (args.prop == 'left') 2158 exp.mediumContent.style.left = (x.pos - val) +'px'; 2159 if (args.prop == 'top') 2160 exp.mediumContent.style.top = (y.pos - val) +'px'; 2161 } 2162 } 2163 }); 2164 hs.animate( this.content, to.content, dur, easing, after); 2165 if (up) { 2166 this.wrapper.style.visibility = 'visible'; 2167 this.content.style.visibility = 'visible'; 2168 if (this.isHtml) this.innerContent.style.visibility = 'visible'; 2169 this.a.className += ' highslide-active-anchor'; 2170 } 2171}, 2172 2173 2174 2175fade : function(up, to) { 2176 this.outlineWhileAnimating = false; 2177 var exp = this, t = up ? hs.expandDuration : 0; 2178 2179 if (up) { 2180 hs.animate(this.wrapper, to.wrapper, 0); 2181 hs.setStyles(this.wrapper, { opacity: 0, visibility: 'visible' }); 2182 hs.animate(this.content, to.content, 0); 2183 this.content.style.visibility = 'visible'; 2184 2185 hs.animate(this.wrapper, { opacity: 1 }, t, null, 2186 function() { exp.afterExpand(); }); 2187 } 2188 2189 if (this.outline) { 2190 this.outline.table.style.zIndex = this.wrapper.style.zIndex; 2191 var dir = up || -1, 2192 offset = this.outline.offset, 2193 startOff = up ? 3 : offset, 2194 endOff = up? offset : 3; 2195 for (var i = startOff; dir * i <= dir * endOff; i += dir, t += 25) { 2196 (function() { 2197 var o = up ? endOff - i : startOff - i; 2198 setTimeout(function() { 2199 exp.outline.setPosition(0, o, 1); 2200 }, t); 2201 })(); 2202 } 2203 } 2204 2205 2206 if (up) {}//setTimeout(function() { exp.afterExpand(); }, t+50); 2207 else { 2208 setTimeout( function() { 2209 if (exp.outline) exp.outline.destroy(exp.preserveContent); 2210 2211 exp.destroyOverlays(); 2212 2213 hs.animate( exp.wrapper, { opacity: 0 }, hs.restoreDuration, null, function(){ 2214 exp.afterClose(); 2215 }); 2216 }, t); 2217 } 2218}, 2219crossfade : function (up, to, from) { 2220 if (!up) return; 2221 var exp = this, 2222 last = this.last, 2223 x = this.x, 2224 y = this.y, 2225 lastX = last.x, 2226 lastY = last.y, 2227 wrapper = this.wrapper, 2228 content = this.content, 2229 overlayBox = this.overlayBox; 2230 hs.removeEventListener(document, 'mousemove', hs.dragHandler); 2231 2232 $('.close.close-modal').hide(); 2233 2234 hs.setStyles(content, { 2235 width: (x.imgSize || x.size) +'px', 2236 height: (y.imgSize || y.size) +'px' 2237 }); 2238 if (overlayBox) overlayBox.style.overflow = 'visible'; 2239 this.outline = last.outline; 2240 if (this.outline) this.outline.exp = exp; 2241 last.outline = null; 2242 var fadeBox = hs.createElement('div', { 2243 className: 'highslide-'+ this.contentType 2244 }, { 2245 position: 'absolute', 2246 zIndex: 4, 2247 overflow: 'hidden', 2248 display: 'none' 2249 } 2250 ); 2251 var names = { oldImg: last, newImg: this }; 2252 for (var n in names) { 2253 this[n] = names[n].content.cloneNode(!names[n].iframe); // #11 2254 hs.setStyles(this[n], { 2255 position: 'absolute', 2256 border: 0, 2257 visibility: 'visible' 2258 }); 2259 fadeBox.appendChild(this[n]); 2260 } 2261 wrapper.appendChild(fadeBox); 2262 if (this.isHtml) hs.setStyles(this.mediumContent, { 2263 left: 0, 2264 top: 0 2265 }); 2266 if (overlayBox) { 2267 overlayBox.className = ''; 2268 wrapper.appendChild(overlayBox); 2269 } 2270 fadeBox.style.display = ''; 2271 last.content.style.display = 'none'; 2272 2273 2274 if (hs.safari && hs.uaVersion < 525) { 2275 this.wrapper.style.visibility = 'visible'; 2276 } 2277 hs.animate(wrapper, { 2278 width: x.size 2279 }, { 2280 duration: hs.transitionDuration, 2281 step: function(val, args) { 2282 var pos = args.pos, 2283 invPos = 1 - pos; 2284 var prop, 2285 size = {}, 2286 props = ['pos', 'size', 'p1', 'p2']; 2287 for (var n in props) { 2288 prop = props[n]; 2289 size['x'+ prop] = Math.round(invPos * lastX[prop] + pos * x[prop]); 2290 size['y'+ prop] = Math.round(invPos * lastY[prop] + pos * y[prop]); 2291 size.ximgSize = Math.round( 2292 invPos * (lastX.imgSize || lastX.size) + pos * (x.imgSize || x.size)); 2293 size.ximgPad = Math.round(invPos * lastX.get('imgPad') + pos * x.get('imgPad')); 2294 size.yimgSize = Math.round( 2295 invPos * (lastY.imgSize || lastY.size) + pos * (y.imgSize || y.size)); 2296 size.yimgPad = Math.round(invPos * lastY.get('imgPad') + pos * y.get('imgPad')); 2297 } 2298 if (exp.outline) exp.outline.setPosition({ 2299 x: size.xpos, 2300 y: size.ypos, 2301 w: size.xsize + size.xp1 + size.xp2 + 2 * x.cb,
2302 h: size.ysize + size.yp1 + size.yp2 + 2 * y.cb 2303 }); 2304 last.wrapper.style.clip = 'rect(' 2305 + (size.ypos - lastY.pos)+'px, ' 2306 + (size.xsize + size.xp1 + size.xp2 + size.xpos + 2 * lastX.cb - lastX.pos) +'px, ' 2307 + (size.ysize + size.yp1 + size.yp2 + size.ypos + 2 * lastY.cb - lastY.pos) +'px, ' 2308 + (size.xpos - lastX.pos)+'px)'; 2309 2310 hs.setStyles(content, { 2311 top: (size.yp1 + y.get('imgPad')) +'px', 2312 left: (size.xp1 + x.get('imgPad')) +'px', 2313 marginTop: (y.pos - size.ypos) +'px', 2314 marginLeft: (x.pos - size.xpos) +'px' 2315 }); 2316 hs.setStyles(wrapper, { 2317 top: size.ypos +'px', 2318 left: size.xpos +'px', 2319 width: (size.xp1 + size.xp2 + size.xsize + 2 * x.cb)+ 'px', 2320 height: (size.yp1 + size.yp2 + size.ysize + 2 * y.cb) + 'px' 2321 }); 2322 hs.setStyles(fadeBox, { 2323 width: (size.ximgSize || size.xsize) + 'px', 2324 height: (size.yimgSize || size.ysize) +'px', 2325 left: (size.xp1 + size.ximgPad) +'px', 2326 top: (size.yp1 + size.yimgPad) +'px', 2327 visibility: 'visible' 2328 }); 2329 2330 hs.setStyles(exp.oldImg, { 2331 top: (lastY.pos - size.ypos + lastY.p1 - size.yp1 + lastY.get('imgPad') - size.yimgPad)+'px', 2332 left: (lastX.pos - size.xpos + lastX.p1 - size.xp1 + lastX.get('imgPad') - size.ximgPad)+'px' 2333 }); 2334 2335 hs.setStyles(exp.newImg, { 2336 opacity: pos, 2337 top: (y.pos - size.ypos + y.p1 - size.yp1 + y.get('imgPad') - size.yimgPad) +'px', 2338 left: (x.pos - size.xpos + x.p1 - size.xp1 + x.get('imgPad') - size.ximgPad) +'px' 2339 }); 2340 if (overlayBox) hs.setStyles(overlayBox, { 2341 width: size.xsize + 'px', 2342 height: size.ysize +'px', 2343 left: (size.xp1 + x.cb) +'px', 2344 top: (size.yp1 + y.cb) +'px' 2345 }); 2346 }, 2347 complete: function () { 2348 wrapper.style.visibility = content.style.visibility = 'visible'; 2349 content.style.display = 'block'; 2350 hs.discardElement(fadeBox); 2351 exp.afterExpand(); 2352 if (last.isHtml) last.htmlPrepareClose(); // #11 2353 last.afterClose(); 2354 exp.last = null; 2355 } 2356 2357 }); 2358}, 2359reuseOverlay : function(o, el) { 2360 if (!this.last) return false; 2361 for (var i = 0; i < this.last.overlays.length; i++) { 2362 var oDiv = hs.$('hsId'+ this.last.overlays[i]); 2363 if (oDiv && oDiv.hsId == o.hsId) { 2364 this.genOverlayBox(); 2365 oDiv.reuse = this.key; 2366 hs.push(this.overlays, this.last.overlays[i]); 2367 return true; 2368 } 2369 } 2370 return false; 2371}, 2372 2373 2374afterExpand : function() { 2375 this.isExpanded = true; 2376 this.focus(); 2377 2378 if (this.isHtml && this.objectLoadTime == 'after') this.writeExtendedContent(); 2379 if (this.iframe) { 2380 try { 2381 var exp = this, 2382 doc = this.iframe.contentDocument || this.iframe.contentWindow.document; 2383 hs.addEventListener(doc, 'mousedown', function () { 2384 if (hs.focusKey != exp.key) exp.focus(); 2385 }); 2386 } catch(e) {} 2387 if (hs.ie && typeof this.isClosing != 'boolean') // first open 2388 this.iframe.style.width = (this.objectWidth - 1) +'px'; // hasLayout 2389 } 2390 if (this.dimmingOpacity) hs.dim(this); 2391 if (hs.upcoming && hs.upcoming == this.a) hs.upcoming = null; 2392 this.prepareNextOutline(); 2393 var p = hs.page, mX = hs.mouse.x + p.scrollLeft, mY = hs.mouse.y + p.scrollTop; 2394 this.mouseIsOver = this.x.pos < mX && mX < this.x.pos + this.x.get('wsize') 2395 && this.y.pos < mY && mY < this.y.pos + this.y.get('wsize'); 2396 if (this.overlayBox) this.showOverlays(); 2397 hs.fireEvent(this, 'onAfterExpand'); 2398 2399 $('<a onclick="return hs.close(this)" title="Close" class="close close-modal" tabindex="0"></a>').css({ 2400 position: 'absolute', 2401 top: '-15px', 2402 right: '-15px', 2403 height: '30px', 2404 width: '30px', 2405 cursor: 'pointer', 2406 background: 'url(' + hs.graphicsDir + 'close.png)', // adjust the path if necessary 2407 zIndex: 20 2408 }).appendTo('.highslide-wrapper'); 2409 2410 if(hs.prms){ 2411 if(!hs.prms.first && !hs.prms.last){ 2412 $('<div class="nav-arrows">'+ 2413 '<a href="#" class="prev-item" onclick="return hs.previous(this)" title="Previous (left arrow key)" role="link"></a>'+ 2414 '<a href="#" class="next-item" onclick="return hs.next(this)" title="Next (right arrow key)" role="link"></a>'+ 2415 '</div>' 2416 ).appendTo('.highslide-wrapper'); 2417 } else if(hs.prms.first && !hs.prms.last){ 2418 $('<div class="nav-arrows">'+ 2419 '<a href="#" class="next-item" onclick="return hs.next(this)" title="Next (right arrow key)" role="link"></a>'+ 2420 '</div>' 2421 ).appendTo('.highslide-wrapper'); 2422 } else { 2423 $('<div class="nav-arrows">'+ 2424 '<a href="#" class="prev-item" onclick="return hs.previous(this)" title="Previous (left arrow key)" role="link"></a>'+ 2425 '</div>' 2426 ).appendTo('.highslide-wrapper'); 2427 } 2428 } 2429 2430 this.addTabbable(false); 2431 2432 $("body").on('keydown', function(e) { 2433 this.tabbable(e,hs.tabbables); 2434 }.bind(this)); 2435 2436 $('.gallery-item--spacer').on('keyup',function(e){ 2437 2438 if(e.keyCode === 13 || e.keyCode === 32 ){ 2439 e.preventDefault(); 2440 $(this).find('a').trigger("click"); 2441 }else{ 2442 return false;
2443 } 2444 }); 2445 2446 // var firstInput = inputs.first(); 2447 // var lastInput = $thumbImages.last(); 2448 2449 // /*set focus on first input*/ 2450 // firstInput.focus(); 2451 2452 // /*redirect last tab to first input*/ 2453 // lastInput.on('keydown', function (e) { 2454 // if ((e.which === 9 && !e.shiftKey)) { 2455 // e.preventDefault(); 2456 // firstInput.focus(); 2457 // } 2458 // }); 2459 2460 // /*redirect first shift+tab to last input*/ 2461 // firstInput.on('keydown', function (e) { 2462 // if ((e.which === 9 && e.shiftKey)) { 2463 // e.preventDefault(); 2464 // lastInput.focus(); 2465 // } 2466 // }); 2467}, 2468 2469prepareNextOutline : function() { 2470 var key = this.key; 2471 var outlineType = this.outlineType; 2472 new hs.Outline(outlineType, 2473 function () { try { hs.expanders[key].preloadNext(); } catch (e) {} }); 2474}, 2475 2476 2477preloadNext : function() { 2478 var next = this.getAdjacentAnchor(1); 2479 if (next && next.onclick.toString().match(/hs\.expand/)) 2480 var img = hs.createElement('img', { src: hs.getSrc(next) }); 2481}, 2482 2483 2484getAdjacentAnchor : function(op) { 2485 var current = this.getAnchorIndex(), as = hs.anchors.groups[this.slideshowGroup || 'none']; 2486 if (as && !as[current + op] && this.slideshow && this.slideshow.repeat) { 2487 if (op == 1) return as[0]; 2488 else if (op == -1) return as[as.length-1]; 2489 } 2490 return (as && as[current + op]) || null; 2491}, 2492 2493getAnchorIndex : function() { 2494 var arr = hs.getAnchors().groups[this.slideshowGroup || 'none']; 2495 if (arr) for (var i = 0; i < arr.length; i++) { 2496 if (arr[i].getAttribute('id') == this.a.getAttribute('id')) return i; 2497 } 2498 return null; 2499}, 2500 2501 2502getNumber : function() { 2503 if (this[this.numberPosition]) { 2504 var arr = hs.anchors.groups[this.slideshowGroup || 'none']; 2505 if (arr) { 2506 var s = hs.lang.number.replace('%1', this.getAnchorIndex() + 1).replace('%2', arr.length); 2507 this[this.numberPosition].innerHTML = 2508 '<div class="highslide-number">'+ s +'</div>'+ this[this.numberPosition].innerHTML; 2509 } 2510 } 2511}, 2512initSlideshow : function() { 2513 if (!this.last) { 2514 for (var i = 0; i < hs.slideshows.length; i++) { 2515 var ss = hs.slideshows[i], sg = ss.slideshowGroup; 2516 if (typeof sg == 'undefined' || sg === null || sg === this.slideshowGroup) 2517 this.slideshow = new hs.Slideshow(this.key, ss); 2518 } 2519 } else { 2520 this.slideshow = this.last.slideshow; 2521 } 2522 var ss = this.slideshow; 2523 if (!ss) return; 2524 var key = ss.expKey = this.key; 2525 2526 ss.checkFirstAndLast(); 2527 ss.disable('full-expand'); 2528 if (ss.controls) { 2529 this.createOverlay(hs.extend(ss.overlayOptions || {}, { 2530 overlayId: ss.controls, 2531 hsId: 'controls', 2532 zIndex: 5 2533 })); 2534 } 2535 if (ss.thumbstrip) ss.thumbstrip.add(this); 2536 if (!this.last && this.autoplay) ss.play(true); 2537 if (ss.autoplay) { 2538 ss.autoplay = setTimeout(function() { 2539 hs.next(key); 2540 }, (ss.interval || 500)); 2541 } 2542}, 2543 2544cancelLoading : function() { 2545 hs.discardElement (this.wrapper); 2546 hs.expanders[this.key] = null; 2547 if (hs.upcoming == this.a) hs.upcoming = null; 2548 hs.undim(this.key); 2549 if (this.loading) hs.loading.style.left = '-9999px'; 2550 hs.fireEvent(this, 'onHideLoading'); 2551}, 2552 2553writeCredits : function () { 2554 if (this.credits) return; 2555 this.credits = hs.createElement('a', { 2556 href: hs.creditsHref, 2557 target: hs.creditsTarget, 2558 className: 'highslide-credits', 2559 innerHTML: hs.lang.creditsText, 2560 title: hs.lang.creditsTitle 2561 }); 2562 this.createOverlay({ 2563 overlayId: this.credits, 2564 position: this.creditsPosition || 'top left', 2565 hsId: 'credits' 2566 }); 2567}, 2568 2569getInline : function(types, addOverlay) { 2570 for (var i = 0; i < types.length; i++) { 2571 var type = types[i], s = null; 2572 if (type == 'caption' && !hs.fireEvent(this, 'onBeforeGetCaption')) return; 2573 else if (type == 'heading' && !hs.fireEvent(this, 'onBeforeGetHeading')) return; 2574 if (!this[type +'Id'] && this.thumbsUserSetId) 2575 this[type +'Id'] = type +'-for-'+ this.thumbsUserSetId; 2576 if (this[type +'Id']) this[type] = hs.getNode(this[type +'Id']); 2577 if (!this[type] && !this[type +'Text'] && this[type +'Eval']) try { 2578 s = eval(this[type +'Eval']); 2579 } catch (e) {} 2580 if (!this[type] && this[type +'Text']) { 2581 s = this[type +'Text']; 2582 } 2583 if (!this[type] && !s) { 2584 this[type] = hs.getNode(this.a['_'+ type + 'Id']); 2585 if (!this[type]) { 2586 var next = this.a.nextSibling; 2587 while (next && !hs.isHsAnchor(next)) {
2588 if ((new RegExp('highslide-'+ type)).test(next.className || null)) { 2589 if (!next.id) this.a['_'+ type + 'Id'] = next.id = 'hsId'+ hs.idCounter++; 2590 this[type] = hs.getNode(next.id); 2591 break; 2592 } 2593 next = next.nextSibling; 2594 } 2595 } 2596 } 2597 if (!this[type] && !s && this.numberPosition == type) s = '\n'; 2598 2599 if (!this[type] && s) this[type] = hs.createElement('div', 2600 { className: 'highslide-'+ type, innerHTML: s } ); 2601 2602 if (addOverlay && this[type]) { 2603 var o = { position: (type == 'heading') ? 'above' : 'below' }; 2604 for (var x in this[type+'Overlay']) o[x] = this[type+'Overlay'][x]; 2605 o.overlayId = this[type]; 2606 this.createOverlay(o); 2607 } 2608 } 2609}, 2610 2611 2612// on end move and resize 2613doShowHide : function(visibility) { 2614 if (hs.hideSelects) this.showHideElements('SELECT', visibility); 2615 if (hs.hideIframes) this.showHideElements('IFRAME', visibility); 2616 if (hs.geckoMac) this.showHideElements('*', visibility); 2617}, 2618showHideElements : function (tagName, visibility) { 2619 var els = document.getElementsByTagName(tagName); 2620 var prop = tagName == '*' ? 'overflow' : 'visibility'; 2621 for (var i = 0; i < els.length; i++) { 2622 if (prop == 'visibility' || (document.defaultView.getComputedStyle( 2623 els[i], "").getPropertyValue('overflow') == 'auto' 2624 || els[i].getAttribute('hidden-by') != null)) { 2625 var hiddenBy = els[i].getAttribute('hidden-by'); 2626 if (visibility == 'visible' && hiddenBy) { 2627 hiddenBy = hiddenBy.replace('['+ this.key +']', ''); 2628 els[i].setAttribute('hidden-by', hiddenBy); 2629 if (!hiddenBy) els[i].style[prop] = els[i].origProp; 2630 } else if (visibility == 'hidden') { // hide if behind 2631 var elPos = hs.getPosition(els[i]); 2632 elPos.w = els[i].offsetWidth; 2633 elPos.h = els[i].offsetHeight; 2634 if (!this.dimmingOpacity) { // hide all if dimming 2635 2636 var clearsX = (elPos.x + elPos.w < this.x.get('opos') 2637 || elPos.x > this.x.get('opos') + this.x.get('osize')); 2638 var clearsY = (elPos.y + elPos.h < this.y.get('opos') 2639 || elPos.y > this.y.get('opos') + this.y.get('osize')); 2640 } 2641 var wrapperKey = hs.getWrapperKey(els[i]); 2642 if (!clearsX && !clearsY && wrapperKey != this.key) { // element falls behind image 2643 if (!hiddenBy) { 2644 els[i].setAttribute('hidden-by', '['+ this.key +']'); 2645 els[i].origProp = els[i].style[prop]; 2646 els[i].style[prop] = 'hidden'; 2647 2648 } else if (hiddenBy.indexOf('['+ this.key +']') == -1) { 2649 els[i].setAttribute('hidden-by', hiddenBy + '['+ this.key +']'); 2650 } 2651 } else if ((hiddenBy == '['+ this.key +']' || hs.focusKey == wrapperKey) 2652 && wrapperKey != this.key) { // on move 2653 els[i].setAttribute('hidden-by', ''); 2654 els[i].style[prop] = els[i].origProp || ''; 2655 } else if (hiddenBy && hiddenBy.indexOf('['+ this.key +']') > -1) { 2656 els[i].setAttribute('hidden-by', hiddenBy.replace('['+ this.key +']', '')); 2657 } 2658 2659 } 2660 } 2661 } 2662}, 2663 2664focus : function() { 2665 this.wrapper.style.zIndex = hs.zIndexCounter += 2; 2666 // blur others 2667 for (var i = 0; i < hs.expanders.length; i++) { 2668 if (hs.expanders[i] && i == hs.focusKey) { 2669 var blurExp = hs.expanders[i]; 2670 blurExp.content.className += ' highslide-'+ blurExp.contentType +'-blur'; 2671 if (blurExp.isImage) { 2672 blurExp.content.style.cursor = hs.ieLt7 ? 'hand' : 'pointer'; 2673 blurExp.content.title = hs.lang.focusTitle; 2674 } 2675 hs.fireEvent(blurExp, 'onBlur'); 2676 } 2677 } 2678 2679 // focus this 2680 if (this.outline) this.outline.table.style.zIndex 2681 = this.wrapper.style.zIndex - 1; 2682 this.content.className = 'highslide-'+ this.contentType; 2683 if (this.isImage) { 2684 this.content.title = hs.lang.restoreTitle; 2685 2686 if (hs.restoreCursor) { 2687 hs.styleRestoreCursor = window.opera ? 'pointer' : 'url('+ hs.graphicsDir + hs.restoreCursor +'), pointer'; 2688 if (hs.ieLt7 && hs.uaVersion < 6) hs.styleRestoreCursor = 'hand'; 2689 this.content.style.cursor = hs.styleRestoreCursor; 2690 } 2691 } 2692 hs.focusKey = this.key; 2693 hs.addEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 2694 hs.fireEvent(this, 'onFocus'); 2695}, 2696moveTo: function(x, y) { 2697 this.x.setPos(x); 2698 this.y.setPos(y); 2699}, 2700resize : function (e) { 2701 var w, h, r = e.width / e.height; 2702 w = Math.max(e.width + e.dX, Math.min(this.minWidth, this.x.full)); 2703 if (this.isImage && Math.abs(w - this.x.full) < 12) w = this.x.full; 2704 h = this.isHtml ? e.height + e.dY : w / r; 2705 if (h < Math.min(this.minHeight, this.y.full)) { 2706 h = Math.min(this.minHeight, this.y.full); 2707 if (this.isImage) w = h * r; 2708 } 2709 this.resizeTo(w, h); 2710}, 2711resizeTo: function(w, h) { 2712 this.y.setSize(h); 2713 this.x.setSize(w); 2714 this.wrapper.style.height = this.y.get('wsize') +'px'; 2715}, 2716 2717close : function() { 2718 if (this.isClosing || !this.isExpanded) return; 2719 if (this.transitions[1] == 'crossfade' && hs.upcoming) { 2720 hs.getExpander(hs.upcoming).cancelLoading(); 2721 hs.upcoming = null; 2722 } 2723 if (!hs.fireEvent(this, 'onBeforeClose')) return; 2724 this.isClosing = true; 2725 if (this.slideshow && !hs.upcoming) this.slideshow.pause(); 2726 2727 hs.removeEventListener(document, window.opera ? 'keypress' : 'keydown', hs.keyHandler); 2728 2729 try { 2730 if (this.isHtml) this.htmlPrepareClose(); 2731 this.content.style.cursor = 'default'; 2732 this.changeSize( 2733 0, { 2734 wrapper: { 2735 width : this.x.t, 2736 height : this.y.t, 2737 left: this.x.tpos - this.x.cb + this.x.tb, 2738 top: this.y.tpos - this.y.cb + this.y.tb 2739 }, 2740 content: { 2741 left: 0, 2742 top: 0, 2743 width: this.x.t, 2744 height: this.y.t 2745 } 2746 }, hs.restoreDuration 2747 ); 2748 } catch (e) { this.afterClose(); } 2749}, 2750 2751htmlPrepareClose : function() { 2752 if (hs.geckoMac) { // bad redraws 2753 if (!hs.mask) hs.mask = hs.createElement('div', null, 2754 { position: 'absolute' }, hs.container); 2755 hs.setStyles(hs.mask, { width: this.x.size +'px', height: this.y.size +'px', 2756 left: this.x.pos +'px', top: this.y.pos +'px', display: 'block' }); 2757 } 2758 if (this.objectType == 'swf') try { hs.$(this.body.id).StopPlay(); } catch (e) {} 2759 2760 if (this.objectLoadTime == 'after' && !this.preserveContent) this.destroyObject(); 2761 if (this.scrollerDiv && this.scrollerDiv != this.scrollingContent) 2762 this.scrollerDiv.style.overflow = 'hidden'; 2763}, 2764 2765destroyObject : function () { 2766 if (hs.ie && this.iframe) 2767 try { 2768 this.iframe.contentWindow.document.body.innerHTML = ''; 2769 } catch (e) { 2770 this.iframe.src = ''; 2771 } 2772 if (this.objectType == 'swf') swfobject.removeSWF(this.body.id); 2773 this.body.innerHTML = ''; 2774}, 2775 2776sleep : function() { 2777 if (this.outline) this.outline.table.style.display = 'none'; 2778 this.releaseMask = null; 2779 this.wrapper.style.display = 'none'; 2780 this.isExpanded = false;
2781 hs.push(hs.sleeping, this); 2782}, 2783 2784awake : function() {try { 2785 2786 hs.expanders[this.key] = this; 2787 2788 if (!hs.allowMultipleInstances &&hs.focusKey != this.key) { 2789 try { hs.expanders[hs.focusKey].close(); } catch (e){} 2790 } 2791 2792 var z = hs.zIndexCounter++, stl = { display: '', zIndex: z }; 2793 hs.setStyles (this.wrapper, stl); 2794 this.isClosing = false; 2795 2796 var o = this.outline || 0; 2797 if (o) { 2798 if (!this.outlineWhileAnimating) stl.visibility = 'hidden'; 2799 hs.setStyles (o.table, stl); 2800 } 2801 if (this.slideshow) { 2802 this.initSlideshow(); 2803 } 2804 2805 this.show(); 2806} catch (e) {} 2807 2808 2809}, 2810 2811createOverlay : function (o) { 2812 var el = o.overlayId, 2813 relToVP = (o.relativeTo == 'viewport' && !/panel$/.test(o.position)); 2814 if (typeof el == 'string') el = hs.getNode(el); 2815 if (o.html) el = hs.createElement('div', { innerHTML: o.html }); 2816 if (!el || typeof el == 'string') return; 2817 if (!hs.fireEvent(this, 'onCreateOverlay', { overlay: el })) return; 2818 el.style.display = 'block'; 2819 o.hsId = o.hsId || o.overlayId; 2820 if (this.transitions[1] == 'crossfade' && this.reuseOverlay(o, el)) return; 2821 this.genOverlayBox(); 2822 var width = o.width && /^[0-9]+(px|%)$/.test(o.width) ? o.width : 'auto'; 2823 if (/^(left|right)panel$/.test(o.position) && !/^[0-9]+px$/.test(o.width)) width = '200px'; 2824 var overlay = hs.createElement( 2825 'div', { 2826 id: 'hsId'+ hs.idCounter++, 2827 hsId: o.hsId 2828 }, { 2829 position: 'absolute', 2830 visibility: 'hidden', 2831 width: width, 2832 direction: hs.lang.cssDirection || '', 2833 opacity: 0 2834 }, 2835 relToVP ? hs.viewport :this.overlayBox, 2836 true 2837 ); 2838 if (relToVP) overlay.hsKey = this.key; 2839 2840 overlay.appendChild(el); 2841 hs.extend(overlay, { 2842 opacity: 1, 2843 offsetX: 0, 2844 offsetY: 0, 2845 dur: (o.fade === 0 || o.fade === false || (o.fade == 2 && hs.ie)) ? 0 : 250 2846 }); 2847 hs.extend(overlay, o); 2848 2849 2850 if (this.gotOverlays) { 2851 this.positionOverlay(overlay); 2852 if (!overlay.hideOnMouseOut || this.mouseIsOver) 2853 hs.animate(overlay, { opacity: overlay.opacity }, overlay.dur); 2854 } 2855 hs.push(this.overlays, hs.idCounter - 1); 2856}, 2857positionOverlay : function(overlay) { 2858 var p = overlay.position || 'middle center', 2859 relToVP = (overlay.relativeTo == 'viewport'), 2860 offX = overlay.offsetX, 2861 offY = overlay.offsetY; 2862 if (relToVP) { 2863 hs.viewport.style.display = 'block'; 2864 overlay.hsKey = this.key; 2865 if (overlay.offsetWidth > overlay.parentNode.offsetWidth) 2866 overlay.style.width = '100%'; 2867 } else 2868 if (overlay.parentNode != this.overlayBox) this.overlayBox.appendChild(overlay); 2869 if (/left$/.test(p)) overlay.style.left = offX +'px'; 2870 2871 if (/center$/.test(p)) hs.setStyles (overlay, { 2872 left: '50%', 2873 marginLeft: (offX - Math.round(overlay.offsetWidth / 2)) +'px' 2874 }); 2875 2876 if (/right$/.test(p)) overlay.style.right = - offX +'px'; 2877 2878 if (/^leftpanel$/.test(p)) { 2879 hs.setStyles(overlay, { 2880 right: '100%', 2881 marginRight: this.x.cb +'px', 2882 top: - this.y.cb +'px', 2883 bottom: - this.y.cb +'px', 2884 overflow: 'auto' 2885 }); 2886 this.x.p1 = overlay.offsetWidth; 2887 2888 } else if (/^rightpanel$/.test(p)) { 2889 hs.setStyles(overlay, { 2890 left: '100%', 2891 marginLeft: this.x.cb +'px', 2892 top: - this.y.cb +'px', 2893 bottom: - this.y.cb +'px', 2894 overflow: 'auto' 2895 }); 2896 this.x.p2 = overlay.offsetWidth; 2897 } 2898 var parOff = overlay.parentNode.offsetHeight; 2899 overlay.style.height = 'auto'; 2900 if (relToVP && overlay.offsetHeight > parOff) 2901 overlay.style.height = hs.ieLt7 ? parOff +'px' : '100%'; 2902 2903 if (/^top/.test(p)) overlay.style.top = offY +'px'; 2904 if (/^middle/.test(p)) hs.setStyles (overlay, { 2905 top: '50%', 2906 marginTop: (offY - Math.round(overlay.offsetHeight / 2)) +'px' 2907 }); 2908 if (/^bottom/.test(p)) overlay.style.bottom = - offY +'px'; 2909 if (/^above$/.test(p)) { 2910 hs.setStyles(overlay, { 2911 left: (- this.x.p1 - this.x.cb) +'px', 2912 right: (- this.x.p2 - this.x.cb) +'px', 2913 bottom: '100%', 2914 marginBottom: this.y.cb +'px', 2915 width: 'auto' 2916 }); 2917 this.y.p1 = overlay.offsetHeight; 2918 2919 } else if (/^below$/.test(p)) { 2920 hs.setStyles(overlay, { 2921 position: 'relative', 2922 left: (- this.x.p1 - this.x.cb) +'px', 2923 right: (- this.x.p2 - this.x.cb) +'px', 2924 top: '100%', 2925 marginTop: this.y.cb +'px', 2926 width: 'auto' 2927 }); 2928 this.y.p2 = overlay.offsetHeight; 2929 overlay.style.position = 'absolute'; 2930 } 2931}, 2932 2933getOverlays : function() { 2934 this.getInline(['heading', 'caption'], true); 2935 this.getNumber(); 2936 if (this.caption) hs.fireEvent(this, 'onAfterGetCaption'); 2937 if (this.heading) hs.fireEvent(this, 'onAfterGetHeading'); 2938 if (this.heading && this.dragByHeading) this.heading.className += ' highsli
2938de-move'; 2939 if (hs.showCredits) this.writeCredits(); 2940 for (var i = 0; i < hs.overlays.length; i++) { 2941 var o = hs.overlays[i], tId = o.thumbnailId, sg = o.slideshowGroup; 2942 if ((!tId && !sg) || (tId && tId == this.thumbsUserSetId) 2943 || (sg && sg === this.slideshowGroup)) { 2944 if (this.isImage || (this.isHtml && o.useOnHtml)) 2945 this.createOverlay(o); 2946 } 2947 } 2948 var os = []; 2949 for (var i = 0; i < this.overlays.length; i++) { 2950 var o = hs.$('hsId'+ this.overlays[i]); 2951 if (/panel$/.test(o.position)) this.positionOverlay(o); 2952 else hs.push(os, o); 2953 } 2954 for (var i = 0; i < os.length; i++) this.positionOverlay(os[i]); 2955 this.gotOverlays = true; 2956}, 2957genOverlayBox : function() { 2958 if (!this.overlayBox) this.overlayBox = hs.createElement ( 2959 'div', { 2960 className: this.wrapperClassName 2961 }, { 2962 position : 'absolute', 2963 width: (this.x.size || (this.useBox ? this.width : null) 2964 || this.x.full) +'px', 2965 height: (this.y.size || this.y.full) +'px', 2966 visibility : 'hidden', 2967 overflow : 'hidden', 2968 zIndex : hs.ie ? 4 : 'auto' 2969 }, 2970 hs.container, 2971 true 2972 ); 2973}, 2974sizeOverlayBox : function(doWrapper, doPanels) { 2975 var overlayBox = this.overlayBox, 2976 x = this.x, 2977 y = this.y; 2978 hs.setStyles( overlayBox, { 2979 width: x.size +'px', 2980 height: y.size +'px' 2981 }); 2982 if (doWrapper || doPanels) { 2983 for (var i = 0; i < this.overlays.length; i++) { 2984 var o = hs.$('hsId'+ this.overlays[i]); 2985 var ie6 = (hs.ieLt7 || document.compatMode == 'BackCompat'); 2986 if (o && /^(above|below)$/.test(o.position)) { 2987 if (ie6) { 2988 o.style.width = (overlayBox.offsetWidth + 2 * x.cb 2989 + x.p1 + x.p2) +'px'; 2990 } 2991 y[o.position == 'above' ? 'p1' : 'p2'] = o.offsetHeight; 2992 } 2993 if (o && ie6 && /^(left|right)panel$/.test(o.position)) { 2994 o.style.height = (overlayBox.offsetHeight + 2* y.cb) +'px'; 2995 } 2996 } 2997 } 2998 if (doWrapper) { 2999 hs.setStyles(this.content, { 3000 top: y.p1 +'px' 3001 }); 3002 hs.setStyles(overlayBox, { 3003 top: (y.p1 + y.cb) +'px' 3004 }); 3005 } 3006}, 3007 3008showOverlays : function() { 3009 var b = this.overlayBox; 3010 b.className = ''; 3011 hs.setStyles(b, { 3012 top: (this.y.p1 + this.y.cb) +'px', 3013 left: (this.x.p1 + this.x.cb) +'px', 3014 overflow : 'visible' 3015 }); 3016 if (hs.safari) b.style.visibility = 'visible'; 3017 this.wrapper.appendChild (b); 3018 for (var i = 0; i < this.overlays.length; i++) { 3019 var o = hs.$('hsId'+ this.overlays[i]); 3020 o.style.zIndex = o.zIndex || 4; 3021 if (!o.hideOnMouseOut || this.mouseIsOver) { 3022 o.style.visibility = 'visible'; 3023 hs.setStyles(o, { visibility: 'visible', display: '' }); 3024 hs.animate(o, { opacity: o.opacity }, o.dur); 3025 } 3026 } 3027}, 3028 3029destroyOverlays : function() { 3030 if (!this.overlays.length) return; 3031 if (this.slideshow) { 3032 var c = this.slideshow.controls; 3033 if (c && hs.getExpander(c) == this) c.parentNode.removeChild(c); 3034 } 3035 for (var i = 0; i < this.overlays.length; i++) { 3036 var o = hs.$('hsId'+ this.overlays[i]); 3037 if (o && o.parentNode == hs.viewport && hs.getExpander(o) == this) hs.discardElement(o); 3038 } 3039 if (this.isHtml && this.preserveContent) { 3040 this.overlayBox.style.top = '-9999px'; 3041 hs.container.appendChild(this.overlayBox); 3042 } else 3043 hs.discardElement(this.overlayBox); 3044}, 3045 3046 3047 3048createFullExpand : function () { 3049 if (this.slideshow && this.slideshow.controls) { 3050 this.slideshow.enable('full-expand'); 3051 return; 3052 } 3053 this.fullExpandLabel = hs.createElement( 3054 'a', { 3055 href: 'javascript:hs.expanders['+ this.key +'].doFullExpand();', 3056 title: hs.lang.fullExpandTitle, 3057 className: 'highslide-full-expand' 3058 } 3059 ); 3060 if (!hs.fireEvent(this, 'onCreateFullExpand')) return; 3061 3062 this.createOverlay({ 3063 overlayId: this.fullExpandLabel, 3064 position: hs.fullExpandPosition, 3065 hideOnMouseOut: true, 3066 opacity: hs.fullExpandOpacity 3067 }); 3068}, 3069 3070doFullExpand : function () { 3071 try { 3072 if (!hs.fireEvent(this, 'onDoFullExpand')) return; 3073 if (this.fullExpandLabel) hs.discardElement(this.fullExpandLabel); 3074 3075 this.focus(); 3076 var xSize = this.x.size, 3077 ySize = this.y.size; 3078 this.resizeTo(this.x.full, this.y.full); 3079 3080 var xpos = this.x.pos - (this.x.size - xSize) / 2; 3081 if (xpos < hs.marginLeft) xpos = hs.marginLeft; 3082 3083 var ypos = this.y.pos - (this.y.size - ySize) / 2; 3084 if (ypos < hs.marginTop) ypos = hs.marginTop; 3085 3086 this.moveTo(xpos, ypos); 3087 this.doShowHide('hidden'); 3088 3089 } catch (e) { 3090 this.error(e); 3091 } 3092}, 3093 3094 3095afterClose : function () {
3096 this.a.className = this.a.className.replace('highslide-active-anchor', ''); 3097 3098 $('.gallery-item--spacer').unbind('keydown'); 3099 3100 this.doShowHide('visible'); 3101 3102 if (this.isHtml && this.preserveContent 3103 && this.transitions[1] != 'crossfade') { 3104 this.sleep(); 3105 } else { 3106 if (this.outline && this.outlineWhileAnimating) this.outline.destroy(); 3107 if (this.iframe && this.objectLoadTime != 'after') this.destroyObject(); 3108 hs.discardElement(this.wrapper); 3109 } 3110 if (hs.mask) hs.mask.style.display = 'none'; 3111 this.destroyOverlays(); 3112 if (!hs.viewport.childNodes.length) hs.viewport.style.display = 'none'; 3113 3114 if (this.dimmingOpacity) hs.undim(this.key); 3115 hs.fireEvent(this, 'onAfterClose'); 3116 hs.expanders[this.key] = null; 3117 hs.reOrder(); 3118 3119 3120}, 3121 3122tabbable : function(e, tabbable){ 3123 var keyCode = e.keyCode || e.which; 3124 if (keyCode == 9) { 3125 e.preventDefault(); 3126 3127 tabbable[hs.nextActive].focus(); 3128 hs.nextActive++; 3129 3130 if(hs.nextActive == tabbable.length){ 3131 hs.nextActive = 0; 3132 } 3133 } 3134}, 3135 3136addTabbable : function(check){ 3137 if(check){ 3138 hs.tabbables = []; 3139 $('.highslide-thumbstrip img').each(function(){ 3140 $(this).removeAttr('tabindex'); 3141 }); 3142 return false; 3143 } 3144 else{ 3145 hs.tabbables = []; 3146 3147 if($('.highslide-wrapper .gallery-item--highslide-link a').length){ 3148 hs.tabbables.push($('.highslide-wrapper .gallery-item--highslide-link a')); 3149 } 3150 3151 hs.tabbables.push($('.highslide-wrapper .prev-item')); 3152 hs.tabbables.push($('.highslide-wrapper .next-item')); 3153 hs.tabbables.push($('.close-modal')); 3154 hs.tabbables.push($('.highslide-wrapper .highslide-full-expand')); 3155 $('.highslide-thumbstrip img').each(function(){ 3156 $(this).attr('tabindex', 0); 3157 hs.tabbables.push($(this)); 3158 }); 3159 } 3160} 3161 3162}; 3163 3164 3165// hs.Ajax object prototype 3166hs.Ajax = function (a, content, pre) { 3167 this.a = a; 3168 this.content = content; 3169 this.pre = pre; 3170}; 3171 3172hs.Ajax.prototype = { 3173run : function () { 3174 var xhr; 3175 if (!this.src) this.src = hs.getSrc(this.a); 3176 if (this.src.match('#')) { 3177 var arr = this.src.split('#'); 3178 this.src = arr[0]; 3179 this.id = arr[1]; 3180 } 3181 if (hs.cachedGets[this.src]) { 3182 this.cachedGet = hs.cachedGets[this.src]; 3183 if (this.id) this.getElementContent(); 3184 else this.loadHTML(); 3185 return; 3186 } 3187 try { xhr = new XMLHttpRequest(); } 3188 catch (e) { 3189 try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } 3190 catch (e) { 3191 try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } 3192 catch (e) { this.onError(); } 3193 } 3194 } 3195 var pThis = this; 3196 xhr.onreadystatechange = function() { 3197 if(pThis.xhr.readyState == 4) { 3198 if (pThis.id) pThis.getElementContent(); 3199 else pThis.loadHTML(); 3200 } 3201 }; 3202 var src = this.src; 3203 this.xhr = xhr; 3204 if (hs.forceAjaxReload) 3205 src = src.replace(/$/, (/\?/.test(src) ? '&' : '?') +'dummy='+ (new Date()).getTime()); 3206 xhr.open('GET', src, true); 3207 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3208 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 3209 xhr.send(null); 3210}, 3211 3212getElementContent : function() { 3213 hs.init(); 3214 var attribs = window.opera || hs.ie6SSL ? { src: 'about:blank' } : null; 3215 3216 this.iframe = hs.createElement('iframe', attribs, 3217 { position: 'absolute', top: '-9999px' }, hs.container); 3218 3219 this.loadHTML(); 3220}, 3221 3222loadHTML : function() { 3223 var s = this.cachedGet || this.xhr.responseText, 3224 regBody; 3225 if (this.pre) hs.cachedGets[this.src] = s; 3226 if (!hs.ie || hs.uaVersion >= 5.5) { 3227 s = s.replace(new RegExp('<link[^>]*>', 'gi'), '') 3228 .replace(new RegExp('<script[^>]*>.*?</script>', 'gi'), ''); 3229 if (this.iframe) { 3230 var doc = this.iframe.contentDocument; 3231 if (!doc && this.iframe.contentWindow) doc = this.iframe.contentWindow.document; 3232 if (!doc) { // Opera 3233 var pThis = this; 3234 setTimeout(function() { pThis.loadHTML(); }, 25); 3235 return; 3236 } 3237 doc.open(); 3238 doc.write(s); 3239 doc.close(); 3240 try { s = doc.getElementById(this.id).innerHTML; } catch (e) { 3241 try { s = this.iframe.document.getElementById(this.id).innerHTML; } catch (e) {} // opera 3242 } 3243 hs.discardElement(this.iframe); 3244 } else { 3245 regBody = /(<body[^>]*>|<\/body>)/ig; 3246 if (regBody.test(s)) s = s.split(regBody)[hs.ieLt9 ? 1 : 2]; 3247 3248 } 3249 } 3250 hs.getElementByClass(this.content, 'DIV', 'highslide-body').innerHTML = s; 3251 this.onLoad(); 3252 for (var x in this) this[x] = null; 3253} 3254}; 3255 3256 3257hs.Slideshow = function (expKey, options) { 3258 if (hs.dynamicallyUpdateAnchors !== false) hs.updateAnchors(); 3259 this.expKey = expKey; 3260 for (var x in options) this[x] = options[x]; 3261 if (this.useControls) this.getControls(); 3262 if (this.thumbstrip) this.thumbstrip = hs.Thumbstrip(this); 3263}; 3264hs.Slideshow.prototype = { 3265getControls: function() { 3266 this.controls = hs.createElement('div', { innerHTML: hs.replaceLang(hs.skin.controls) }, 3267 null, hs.container); 3268 3269 var buttons = ['play', 'pause', 'previous', 'next', 'move', 'full-expand', 'close']; 3270 this.btn = {}; 3271 var pThis = this; 3272 for (var i = 0; i < buttons.length; i++) { 3273 this.btn[buttons[i]] = hs.getElementByClass(this.controls, 'li', 'highslide-'+ buttons[i]); 3274 this.enable(buttons[i]); 3275 } 3276 this.btn.pause.style.display = 'none'; 3277 //this.disable('full-expand'); 3278}, 3279checkFirstAndLast: function() { 3280 if (this.repeat || !this.controls) return; 3281 var exp = hs.expanders[this.expKey], 3282 cur = exp.getAnchorIndex(), 3283 re = /disabled$/; 3284 if (cur == 0) 3285 this.disable('previous'); 3286 else if (re.test(this.btn.previous.getElementsByTagName('a')[0].className)) 3287 this.enable('previous'); 3288 if (cur + 1 == hs.anchors.groups[exp.slideshowGroup || 'none'].length) { 3289 this.disable('next'); 3290 this.disable('play'); 3291 } else if (re.test(this.btn.next.getElementsByTagName('a')[0].className)) { 3292 this.enable('next'); 3293 this.enable('play'); 3294 } 3295},
3296enable: function(btn) { 3297 if (!this.btn) return; 3298 var sls = this, a = this.btn[btn].getElementsByTagName('a')[0], re = /disabled$/; 3299 a.onclick = function() { 3300 sls[btn](); 3301 return false; 3302 }; 3303 if (re.test(a.className)) a.className = a.className.replace(re, ''); 3304}, 3305disable: function(btn) { 3306 if (!this.btn) return; 3307 var a = this.btn[btn].getElementsByTagName('a')[0]; 3308 a.onclick = function() { return false; }; 3309 if (!/disabled$/.test(a.className)) a.className += ' disabled'; 3310}, 3311hitSpace: function() { 3312 if (this.autoplay) this.pause(); 3313 else this.play(); 3314}, 3315play: function(wait) { 3316 if (this.btn) { 3317 this.btn.play.style.display = 'none'; 3318 this.btn.pause.style.display = ''; 3319 } 3320 3321 this.autoplay = true; 3322 if (!wait) hs.next(this.expKey); 3323}, 3324pause: function() { 3325 if (this.btn) { 3326 this.btn.pause.style.display = 'none'; 3327 this.btn.play.style.display = ''; 3328 } 3329 3330 clearTimeout(this.autoplay); 3331 this.autoplay = null; 3332}, 3333previous: function() { 3334 this.pause(); 3335 hs.addTabbable(false); 3336 hs.previous(this.btn.previous); 3337}, 3338next: function() { 3339 this.pause(); 3340 hs.next(this.btn.next); 3341 hs.addTabbable(false); 3342}, 3343move: function() {}, 3344'full-expand': function() { 3345 hs.getExpander().doFullExpand(); 3346}, 3347close: function() { 3348 hs.close(this.btn.close); 3349} 3350}; 3351hs.Thumbstrip = function(slideshow) { 3352 function add (exp) { 3353 hs.extend(options || {}, { 3354 overlayId: dom, 3355 hsId: 'thumbstrip', 3356 className: 'highslide-thumbstrip-'+ mode +'-overlay ' + (options.className || '') 3357 }); 3358 if (hs.ieLt7) options.fade = 0; 3359 exp.createOverlay(options); 3360 hs.setStyles(dom.parentNode, { overflow: 'hidden' }); 3361 }; 3362 3363 function scroll (delta) { 3364 selectThumb(undefined, Math.round(delta * dom[isX ? 'offsetWidth' : 'offsetHeight'] * 0.7)); 3365 }; 3366 3367 function selectThumb (i, scrollBy) { 3368 if (i === undefined) for (var j = 0; j < group.length; j++) { 3369 if (group[j] == hs.expanders[slideshow.expKey].a) { 3370 i = j; 3371 break; 3372 } 3373 } 3374 if (i === undefined) return; 3375 var as = dom.getElementsByTagName('a'), 3376 active = as[i], 3377 cell = active.parentNode, 3378 left = isX ? 'Left' : 'Top', 3379 right = isX ? 'Right' : 'Bottom', 3380 width = isX ? 'Width' : 'Height', 3381 offsetLeft = 'offset' + left, 3382 offsetWidth = 'offset' + width, 3383 overlayWidth = div.parentNode.parentNode[offsetWidth], 3384 minTblPos = overlayWidth - table[offsetWidth], 3385 curTblPos = parseInt(table.style[isX ? 'left' : 'top']) || 0, 3386 tblPos = curTblPos, 3387 mgnRight = 20; 3388 if (scrollBy !== undefined) { 3389 tblPos = curTblPos - scrollBy; 3390 3391 if (minTblPos > 0) minTblPos = 0; 3392 if (tblPos > 0) tblPos = 0; 3393 if (tblPos < minTblPos) tblPos = minTblPos; 3394 3395 3396 } else { 3397 for (var j = 0; j < as.length; j++) as[j].className = ''; 3398 active.className = 'highslide-active-anchor'; 3399 var activeLeft = i > 0 ? as[i - 1].parentNode[offsetLeft] : cell[offsetLeft], 3400 activeRight = cell[offsetLeft] + cell[offsetWidth] + 3401 (as[i + 1] ? as[i + 1].parentNode[offsetWidth] : 0); 3402 if (activeRight > overlayWidth - curTblPos) tblPos = overlayWidth - activeRight; 3403 else if (activeLeft < -curTblPos) tblPos = -activeLeft; 3404 } 3405 var markerPos = cell[offsetLeft] + (cell[offsetWidth] - marker[offsetWidth]) / 2 + tblPos; 3406 hs.animate(table, isX ? { left: tblPos } : { top: tblPos }, null, 'easeOutQuad'); 3407 hs.animate(marker, isX ? { left: markerPos } : { top: markerPos }, null, 'easeOutQuad'); 3408 scrollUp.style.display = tblPos < 0 ? 'block' : 'none'; 3409 scrollDown.style.display = (tblPos > minTblPos) ? 'block' : 'none'; 3410 3411 }; 3412 3413 3414 // initialize 3415 var group = hs.anchors.groups[hs.expanders[slideshow.expKey].slideshowGroup || 'none'], 3416 options = slideshow.thumbstrip, 3417 mode = options.mode || 'horizontal', 3418 floatMode = (mode == 'float'), 3419 tree = floatMode ? ['div', 'ul', 'li', 'span'] : ['table', 'tbody', 'tr', 'td'], 3420 isX = (mode == 'horizontal'), 3421 dom = hs.createElement('div', { 3422 className: 'highslide-thumbstrip highslide-thumbstrip-'+ mode, 3423 innerHTML: 3424 '<div class="highslide-thumbstrip-inner">'+ 3425 '<'+ tree[0] +'><'+ tree[1] +'></'+ tree[1] +'></'+ tree[0] +'></div>'+ 3426 '<div class="highslide-scroll-up"><div></div></div>'+
3427 '<div class="highslide-scroll-down"><div></div></div>'+ 3428 '<div class="highslide-marker"><div></div></div>' 3429 }, { 3430 display: 'none' 3431 }, hs.container), 3432 domCh = dom.childNodes, 3433 div = domCh[0], 3434 scrollUp = domCh[1], 3435 scrollDown = domCh[2], 3436 marker = domCh[3], 3437 table = div.firstChild, 3438 tbody = dom.getElementsByTagName(tree[1])[0], 3439 tr; 3440 for (var i = 0; i < group.length; i++) { 3441 if (i == 0 || !isX) tr = hs.createElement(tree[2], null, null, tbody); 3442 (function(){ 3443 var a = group[i], 3444 cell = hs.createElement(tree[3], null, null, tr), 3445 pI = i; 3446 hs.createElement('a', { 3447 href: a.href, 3448 title: a.title, 3449 onclick: function() { 3450 if (/highslide-active-anchor/.test(this.className)) return false; 3451 hs.getExpander(this).focus(); 3452 return hs.transit(a); 3453 }, 3454 innerHTML: hs.stripItemFormatter ? hs.stripItemFormatter(a) : a.innerHTML.replace('style', 'data-style') 3455 }, null, cell); 3456 })(); 3457 } 3458 if (!floatMode) { 3459 scrollUp.onclick = function () { scroll(-1); }; 3460 scrollDown.onclick = function() { scroll(1); }; 3461 hs.addEventListener(tbody, document.onmousewheel !== undefined ? 3462 'mousewheel' : 'DOMMouseScroll', function(e) { 3463 var delta = 0; 3464 e = e || window.event; 3465 if (e.wheelDelta) { 3466 delta = e.wheelDelta/120; 3467 if (hs.opera) delta = -delta; 3468 } else if (e.detail) { 3469 delta = -e.detail/3; 3470 } 3471 if (delta) scroll(-delta * 0.2); 3472 if (e.preventDefault) e.preventDefault(); 3473 e.returnValue = false; 3474 }); 3475 } 3476 3477 return { 3478 add: add, 3479 selectThumb: selectThumb 3480 } 3481}; 3482hs.langDefaults = hs.lang; 3483// history 3484var HsExpander = hs.Expander; 3485if (hs.ie && window == window.top) { 3486 (function () { 3487 try { 3488 document.documentElement.doScroll('left'); 3489 } catch (e) { 3490 setTimeout(arguments.callee, 50); 3491 return; 3492 } 3493 hs.ready(); 3494 })(); 3495} 3496hs.addEventListener(document, 'DOMContentLoaded', hs.ready); 3497hs.addEventListener(window, 'load', hs.ready); 3498 3499// set handlers 3500hs.addEventListener(document, 'ready', function() {
3501 if (hs.expandCursor || hs.dimmingOpacity) { 3502 var style = hs.createElement('style', { type: 'text/css' }, null, 3503 document.getElementsByTagName('HEAD')[0]), 3504 backCompat = document.compatMode == 'BackCompat'; 3505 3506 3507 function addRule(sel, dec) { 3508 if (hs.ie && (hs.uaVersion < 9 || backCompat)) { 3509 var last = document.styleSheets[document.styleSheets.length - 1]; 3510 if (typeof(last.addRule) == "object") last.addRule(sel, dec); 3511 } else { 3512 style.appendChild(document.createTextNode(sel + " {" + dec + "}")); 3513 } 3514 } 3515 function fix(prop) { 3516 return 'expression( ( ( ignoreMe = document.documentElement.'+ prop + 3517 ' ? document.documentElement.'+ prop +' : document.body.'+ prop +' ) ) + \'px\' );'; 3518 } 3519 if (hs.expandCursor) addRule ('.highslide img', 3520 'cursor: url('+ hs.graphicsDir + hs.expandCursor +'), pointer !important;'); 3521 addRule ('.highslide-viewport-size', 3522 hs.ie && (hs.uaVersion < 7 || backCompat) ? 3523 'position: absolute; '+ 3524 'left:'+ fix('scrollLeft') + 3525 'top:'+ fix('scrollTop') + 3526 'width:'+ fix('clientWidth') + 3527 'height:'+ fix('clientHeight') : 3528 'position: fixed; width: 100%; height: 100%; left: 0; top: 0'); 3529 } 3530}); 3531hs.addEventListener(window, 'resize', function() { 3532 hs.getPageSize(); 3533 if (hs.viewport) for (var i = 0; i < hs.viewport.childNodes.length; i++) { 3534 var node = hs.viewport.childNodes[i], 3535 exp = hs.getExpander(node); 3536 exp.positionOverlay(node); 3537 if (node.hsId == 'thumbstrip') exp.slideshow.thumbstrip.selectThumb(); 3538 } 3539}); 3540hs.addEventListener(document, 'mousemove', function(e) { 3541 hs.mouse = { x: e.clientX, y: e.clientY }; 3542}); 3543hs.addEventListener(document, 'mousedown', hs.mouseClickHandler); 3544hs.addEventListener(document, 'mouseup', hs.mouseClickHandler); 3545hs.addEventListener(document, 'ready', hs.setClickEvents); 3546hs.addEventListener(window, 'load', hs.preloadImages); 3547hs.addEventListener(window, 'load', hs.preloadAjax); 3548}
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.