[28081] | 1 | (function() { |
---|
| 2 | var session_storage = window.sessionStorage || {}; |
---|
| 3 | |
---|
| 4 | var menubar=jQuery("#menubar"), |
---|
| 5 | menuswitcher, |
---|
| 6 | content=jQuery("#the_page > .content"), |
---|
| 7 | pcontent=jQuery("#content"), |
---|
| 8 | imageInfos=jQuery("#imageInfos"), |
---|
| 9 | infoswitcher, |
---|
| 10 | theImage=jQuery("#theImage"), |
---|
| 11 | comments=jQuery("#thePicturePage #comments"), |
---|
| 12 | comments_button, |
---|
| 13 | commentsswitcher, |
---|
| 14 | comments_add, |
---|
| 15 | comments_top_offset = 0; |
---|
| 16 | |
---|
| 17 | function hideMenu(delay) { |
---|
| 18 | menubar.hide(delay); |
---|
| 19 | menuswitcher.addClass("menuhidden").removeClass("menushown"); |
---|
| 20 | content.addClass("menuhidden").removeClass("menushown"); |
---|
| 21 | pcontent.addClass("menuhidden").removeClass("menushown"); |
---|
| 22 | session_storage['picture-menu'] = 'hidden'; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | function showMenu(delay) { |
---|
| 26 | menubar.show(delay); |
---|
| 27 | menuswitcher.addClass("menushown").removeClass("menuhidden"); |
---|
| 28 | content.addClass("menushown").removeClass("menuhidden"); |
---|
| 29 | pcontent.addClass("menushown").removeClass("menuhidden"); |
---|
| 30 | session_storage['picture-menu'] = 'visible'; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | function hideInfo(delay) { |
---|
| 34 | imageInfos.hide(delay); |
---|
| 35 | infoswitcher.addClass("infohidden").removeClass("infoshown"); |
---|
| 36 | theImage.addClass("infohidden").removeClass("infoshown"); |
---|
| 37 | session_storage['side-info'] = 'hidden'; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | function showInfo(delay) { |
---|
| 41 | imageInfos.show(delay); |
---|
| 42 | infoswitcher.addClass("infoshown").removeClass("infohidden"); |
---|
| 43 | theImage.addClass("infoshown").removeClass("infohidden"); |
---|
| 44 | session_storage['side-info'] = 'visible'; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | function commentsToggle() { |
---|
| 48 | if (comments.hasClass("commentshidden")) { |
---|
| 49 | comments.removeClass("commentshidden").addClass("commentsshown"); |
---|
| 50 | comments_button.addClass("comments_toggle_off").removeClass("comments_toggle_on");; |
---|
| 51 | session_storage['comments'] = 'visible'; |
---|
| 52 | comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); |
---|
| 53 | } |
---|
| 54 | else { |
---|
| 55 | comments.addClass("commentshidden").removeClass("commentsshown"); |
---|
| 56 | comments_button.addClass("comments_toggle_on").removeClass("comments_toggle_off");; |
---|
| 57 | session_storage['comments'] = 'hidden'; |
---|
| 58 | comments_top_offset = 0; |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | jQuery(function(){ |
---|
| 63 | // side-menu show/hide |
---|
| 64 | if (menubar.length == 1 && p_main_menu!="disabled") { |
---|
| 65 | menuswitcher=jQuery("#menuSwitcher"); |
---|
| 66 | |
---|
| 67 | menuswitcher.html('<div class="switchArrow"> </div>'); |
---|
| 68 | |
---|
| 69 | if (session_storage['picture-menu'] == undefined && p_main_menu == 'off') { |
---|
| 70 | session_storage['picture-menu'] = 'hidden'; |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | if (session_storage['picture-menu'] == 'hidden') { |
---|
| 74 | hideMenu(0); |
---|
| 75 | } |
---|
| 76 | else { |
---|
| 77 | showMenu(0); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | menuswitcher.click(function(e){ |
---|
| 81 | if (menubar.is(":hidden")) { |
---|
| 82 | showMenu(0); |
---|
| 83 | } |
---|
| 84 | else { |
---|
| 85 | hideMenu(0); |
---|
| 86 | } |
---|
| 87 | e.preventDefault(); |
---|
| 88 | }); |
---|
| 89 | } |
---|
| 90 | else if (menubar.length == 1 && p_main_menu=="disabled") { |
---|
| 91 | showMenu(0); |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | // info show/hide |
---|
| 95 | if (imageInfos.length == 1 && p_pict_descr!="disabled") { |
---|
| 96 | infoswitcher=jQuery("#infoSwitcher"); |
---|
| 97 | |
---|
| 98 | infoswitcher.html('<div class="switchArrow"> </div>'); |
---|
| 99 | |
---|
| 100 | if (session_storage['side-info'] == undefined && p_pict_descr == 'off') { |
---|
| 101 | session_storage['side-info'] = 'hidden'; |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | if (session_storage['side-info'] == 'hidden') { |
---|
| 105 | hideInfo(0); |
---|
| 106 | } |
---|
| 107 | else { |
---|
| 108 | showInfo(0); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | infoswitcher.click(function(e){ |
---|
| 112 | if (imageInfos.is(":hidden")) { |
---|
| 113 | showInfo(0); |
---|
| 114 | } |
---|
| 115 | else { |
---|
| 116 | hideInfo(0); |
---|
| 117 | } |
---|
| 118 | e.preventDefault(); |
---|
| 119 | }); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | // comments show/hide |
---|
| 123 | if (comments.length == 1 && p_pict_comment!="disabled") { |
---|
| 124 | commentsswitcher=jQuery("#commentsSwitcher"); |
---|
| 125 | comments_button=jQuery("#comments h3"); |
---|
| 126 | comments_add=jQuery('#commentAdd'); |
---|
| 127 | |
---|
| 128 | commentsswitcher.html('<div class="switchArrow"> </div>'); |
---|
| 129 | |
---|
| 130 | if (comments_button.length == 0) { |
---|
| 131 | jQuery("#addComment").before("<h3>Comments</h3>"); |
---|
| 132 | comments_button=jQuery("#comments h3"); |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | if (session_storage['comments'] == undefined && p_pict_comment == 'off') { |
---|
| 136 | session_storage['comments'] = 'hidden'; |
---|
| 137 | } |
---|
| 138 | |
---|
| 139 | if (session_storage['comments'] == 'hidden') { |
---|
| 140 | comments.addClass("commentshidden"); |
---|
| 141 | comments_button.addClass("comments_toggle comments_toggle_on"); |
---|
| 142 | } |
---|
| 143 | else { |
---|
| 144 | comments.addClass("commentsshown"); |
---|
| 145 | comments_button.addClass("comments_toggle comments_toggle_off"); |
---|
| 146 | } |
---|
| 147 | |
---|
| 148 | comments_button.click(commentsToggle); |
---|
| 149 | commentsswitcher.click(commentsToggle); |
---|
| 150 | |
---|
| 151 | jQuery(window).scroll(function (event) { |
---|
| 152 | if (comments_top_offset==0) return; |
---|
| 153 | |
---|
| 154 | var y = jQuery(this).scrollTop(); |
---|
| 155 | |
---|
| 156 | if (y >= comments_top_offset) { |
---|
| 157 | comments_add.css({ |
---|
| 158 | 'position': 'absolute', |
---|
| 159 | 'top': y-comments.offset().top+10 |
---|
| 160 | }); |
---|
| 161 | } |
---|
| 162 | else { |
---|
| 163 | comments_add.css({ |
---|
| 164 | 'position': 'static', |
---|
| 165 | 'top': 0 |
---|
| 166 | }); |
---|
| 167 | } |
---|
| 168 | }); |
---|
| 169 | |
---|
| 170 | if (comments_add.is(":visible")) { |
---|
| 171 | comments_top_offset = comments_add.offset().top - parseFloat(comments_add.css('marginTop').replace(/auto/, 0)); |
---|
| 172 | } |
---|
| 173 | } |
---|
| 174 | }); |
---|
| 175 | }()); |
---|