]> mj.ucw.cz Git - gallery.git/blob - gal/highslide/custom.js
Bugfix
[gallery.git] / gal / highslide / custom.js
1 /*
2  *      Site-specific configuration settings for Highslide JS
3  */
4
5 hs.showCredits = true;
6 hs.creditsPosition = 'top right';
7 hs.outlineType = 'rounded-black';
8 hs.fadeInOut = false;
9 hs.align = 'center';
10 hs.useBox = true;
11 hs.width = 1080;
12 hs.height = 840;
13 // hs.allowMultipleInstances = false;
14 hs.captionEval = 'this.thumb.title';
15 hs.captionOverlay = { position: "top" };
16 hs.expandDuration = 100;
17 hs.restoreDuration = 100;
18 hs.dimmingDuration = 100;
19 hs.dimmingOpacity = 0.8;
20 hs.transitionDuration = 100;
21 hs.thumbnailId = 'thumb1';
22 hs.numberPosition = 'caption';
23 hs.transitions = ['expand', 'crossfade'];
24
25 hs.addSlideshow({
26         interval: 5000,
27         repeat: false,
28         useControls: true,
29         fixedControls: 'fit',
30         overlayOptions: {
31                 className: 'controls-in-heading',
32                 opacity: 0.6,
33                 position: 'top center',
34                 hideOnMouseOut: true
35         },
36         thumbstrip: {
37                 mode: 'horizontal',
38                 position: 'below',
39                 relativeTo: 'expander'
40         }
41 });
42
43
44 ////////////////////////////////////////////////
45 // Dynamic change of the hash part of the URL //
46 ////////////////////////////////////////////////
47 var hashTag = '';
48 // Use hashDelimiter to "hide" name of the anchor (and to not scroll the page)
49 var hashDelimiter = '_';
50
51 hs.extend (hs.Expander.prototype, {
52         onAfterExpand: function(sender) {
53                 hashTag = this.a.id;
54                 window.location.hash = hashDelimiter + hashTag;
55         },
56
57         onBeforeClose: function(sender) {
58                 window.location.hash = '';
59         }
60 });
61
62 function showDefaultImage() {
63         var hashParts = window.location.hash.split(hashDelimiter);
64         var myThumb = document.getElementById(hashParts[1])
65         if (hashParts[1] && myThumb) myThumb.click();
66         else window.location.hash = '';
67 }
68 // If the new hash is not equal to the hash we store internally,
69 // then it must be the user hitting the "back/forward" button
70 function checkHashChange() {
71         var hashParts = window.location.hash.split(hashDelimiter);
72         if (hashParts[1] != hashTag) {
73                 hs.close();
74                 window.location.hash = '';
75         }
76 }
77
78 // Add onLoad and onHashChange functions
79 if(window.onload) {
80         var current = window.onload;
81         var newAction = function() {
82                 current();
83                 showDefaultImage();
84         };
85         window.onload = newAction;
86 } else window.onload = showDefaultImage;
87
88 if(window.onhashchange) {
89         var curronload = window.onHashChange;
90         var newAction = function() {
91                 current();
92                 checkHashChange();
93         };
94         window.onhashchange = newAction;
95 } else window.onhashchange = checkHashChange;