1(function ($) { 2 //IE resize bug fixed 3 if (document.windowResizeFixFired) { 4 return; 5 } 6 document.windowResizeFixFired = true; 7 8 var $window = $(window), 9 _wWidth = $window.width(), 10 _wHeight = $window.height(); 11 12 $window.bind('resize', function (e) { 13 var _nWidth = $window.width(), 14 _nHeight = $window.height(); 15 16 if (_wWidth == _nWidth && _wHeight == _nHeight) { 17 e.preventDefault(); 18 e.stopImmediatePropagation(); 19 return; 20 } 21 _wWidth = _nWidth; 22 _wHeight = _nHeight; 23 }); 24 25 $.fn.serviceMenu = function (options) { 26 var settings = $.extend( 27 { 28 urlWebchatServer: '', 29 urlWebchatJS: '', 30 userKdNr: '', 31 firstName: '', 32 lastName: '', 33 email: '', 34 loggedIn: false, 35 hoverWidth: '427px', 36 hoverContentWidth: '374px' 37 }, 38 options 39 ); 40 41 $(document).ready(function () { 42 var wipeOn = 'false', 43 $listElement = $('#side_ul li'), 44 $wipeElement = $('#wipe'), 45 $menuElement = $('#servicemenu'); 46 47 $listElement.click(function (e) { 48 if ($(this).data('type') != 'link') { 49 e.preventDefault(); 50 showDiv($(this)); 51 } 52 }); 53 $wipeElement.click(function () { 54 showDiv($(this).attr('id')); 55 wipeOn = 'true'; 56 }); 57 58 // Bind fly-in / -out effect of service menu item texts 59 $listElement.mouseenter(function () { 60 slideServiceTextIn($(this)); 61 }); 62 63 $listElement.mouseleave(function () { 64 slideServiceTextOut($(this), false); 65 }); 66 67 if ($(window).height() <= 800) { 68 $menuElement.css('top', '200px'); 69 $wipeElement.css('top', '200px'); 70 } else { 71 $menuElement.css('top', '290px'); 72 $wipeElement.css('top', '290px'); 73 } 74 75 /*show menu only if screen is wider than 1280 px*/ 76 if ($(window).width() >= 1280) { 77 $wipeElement.hide(); 78 wipeOn = 'false'; 79 $menuElement.show(); 80 $menuElement.css('right', '0px'); 81 } else if ($(window).width() < 970) { 82 $wipeElement.hide(); 83 wipeOn = 'false'; 84 $menuElement.hide(); 85 } else { 86 $wipeElement.show(); 87 wipeOn = 'true'; 88 $menuElement.show(); 89 $menuElement.css('right', '-60px'); 90 } 91 92 $(window).resize(function () { 93 if ($(window).height() <= 800) { 94 $menuElement.css('top', '200px'); 95 $wipeElement.css('top', '200px'); 96 } else { 97 $menuElement.css('top', '290px'); 98 $wipeElement.css('top', '290px'); 99 } 100 if ($(window).width() >= 1280) { 101 $wipeElement.hide(); 102 wipeOn = 'false'; 103 $menuElement.show(); 104 $menuElement.css('right', '0px'); 105 } else if ($(window).width() < 970) { 106 $wipeElement.hide(); 107 wipeOn = 'false'; 108 $menuElement.hide(); 109 } else { 110 wipeOn = 'true'; 111 $wipeElement.show(); 112 $wipeElement.css('right', '0px'); 113 $menuElement.show(); 114 $menuElement.css('right', '-60px'); 115 } 116 }); 117 118 $(document).on('click touchstart', function (e) { 119 if ($menuElement.has(e.target).length === 0) { 120 if (wipeOn == 'false') { 121 $menuElement.animate({ right: '0px' }, 500, 'easeOutQuad', function () { 122 $('.frame_container').hide(); 123 $menuElement.removeClass('openIFrame'); 124 }); 125 } 126 $listElement.each(function () { 127 $(this).removeClass('active'); 128 }); 129 if ($wipeElement.has(e.target).length === 0) { 130 $wipeElement.animate({ right: '0px' }, 500, 'easeOutQuad'); 131 132 if ($(window).width() >= 1280) { 133 $wipeElement.hide(); 134 wipeOn = 'false'; 135 $menuElement.show(); 136 } else if ($(window).width() < 970) { 137 $wipeElement.hide(); 138 wipeOn = 'false'; 139 $menuElement.hide(); 140 } else { 141 $menuElement.animate({ right: '-60px' }, 500, 'easeOutQuad', function () { 142 $('.frame_container').hide(); 143 }); 144 } 145 } 146 } 147 }); 148 149 function setIframeSrc(element) { 150 var iframe_src = jQuery('#' + element.attr('id') + 'Content iframe').attr('src'); 151 152 if (!iframe_src || iframe_src == 'undefined') { 153 var iframe = jQuery('#' + element.attr('id') + 'Content iframe'); 154 iframe_src = iframe.attr('data-target'); 155 156 if (element.attr('id') == 'contact' && settings.loggedIn == 'true') { 157 iframe_src += '?kdnr=' + settings.userKdNr + '&name=' + settings.firstName + '&surname=' + settings.lastName + '&email=' + settings.email; 158 } 159 iframe.attr('src', iframe_src); 160 } 161 } 162 163 function showDiv(element) { 164 if (element != 'wipe') { 165 var e = document.getElementById(element.attr('id')); 166 if (!e) { 167 return; 168 } 169 } 170 171 if (element == 'wipe') { 172 $(e).animate({ right: '0px' }, 500, 'easeInQuad'); 173 $wipeElement.animate({ right: '-60px' }, 500, 'easeInQuad'); 174 } else { 175 $(e).toggleClass('active'); 176 } 177 178 if ($(e).hasClass('active')) { 179 $('.frame_container').hide(); 180 var id = $(e).attr('id') + 'Content'; 181 $('#' + id).show(); 182 183 var elem = $(e).attr('id'); 184 $listElement.each(function () { 185 if ($(this).attr('id') != elem) { 186 if ($(this).hasClass('active')) { 187 $(this).removeClass('active'); 188 } 189 } 190 }); 191 if (element.data('type') == 'iframe') { 192 /*chat*/ 193 if (element.attr('id') == 'chat') { 194 element.attr('src', element.attr('data-target')); 195 $('#chaticonsubmenu').remove(); 196 197 $('#side_content').append('<div id="chaticonsubmenu" class="frame_container" ><div id="webchat"></div></div>'); 198 jQuery 199 .ajax({
200 url: settings.urlWebchatJS + '?e=3', 201 dataType: 'script', 202 cache: true 203 }) 204 .done(function () { 205 var userName = settings.firstName + ' ' + settings.lastName; 206 WebChat.Init('1401', 'shop', 'webchat', settings.urlWebchatServer, null, 'right', '20', 'DE', settings.userKdNr, userName); 207 }); 208 } else { 209 setIframeSrc(element); 210 } 211 } 212 // hide the service menu text slowly 213 $menuElement.stop(); 214 slideServiceTextOut(e, true); 215 $menuElement.animate({ right: '374px', queue: false }, 500, 'easeInQuad'); 216 $menuElement.addClass('openIFrame'); 217 } else { 218 // clicked on icon when iFrame is shown -> close iframe 219 $menuElement.stop(); 220 $menuElement.animate({ right: '0px' }, 500, 'easeOutQuad', function () { 221 $('.frame_container').hide(); 222 }); 223 $menuElement.removeClass('openIFrame'); 224 } 225 } 226 227 function slideServiceTextIn(element) { 228 // Shows the service menu item text element if it exists 229 var sidebarListElement = $('#sidebar_list'), 230 sidebarElementText = $(element).find('a').find('span'); 231 232 if (sidebarElementText && sidebarElementText.length && sidebarListElement) { 233 if (sidebarListElement.length && element && element.length) { 234 if (!sidebarListElement.find('.active').length && sidebarListElement.hasClass('activated_mouseover')) { 235 sidebarListElement.stop(); 236 $(element).stop(); 237 sidebarElementText.stop(); 238 239 // shrinking is done slow, when animate = true, so that it seems that the iframe slowly slide over the span element 240 sidebarListElement.animate({ width: settings.hoverWidth, queue: false }, 350, 'easeInQuad'); 241 $(element).animate({ width: settings.hoverWidth, queue: false }, 350, 'easeInQuad'); 242 sidebarElementText.animate({ width: settings.hoverContentWidth, queue: false }, 350, 'easeInQuad'); 243 } 244 } 245 } 246 } 247 248 function slideServiceTextOut(element, shrinkSlow) { 249 // Hides the service menu item text. At the end only the icon is displayed 250 var sidebarListElement = $('#sidebar_list'), 251 sidebarElementText = $(element).find('a').find('span'), 252 shrinkTime = 350; 253 254 if (shrinkSlow) { 255 shrinkTime = 500; 256 } 257 258 if (sidebarListElement && sidebarListElement.length && sidebarListElement.hasClass('activated_mouseover')) { 259 if (element && !$(element).hasClass('shrinkProcess')) { 260 if (shrinkSlow) { 261 $(element).addClass('shrinkProcess'); 262 } 263 264 sidebarListElement.stop(); 265 $(element).stop(); 266 sidebarElementText.stop(); 267 268 // shrinking is done slow, when animate = true, so that it seems that the iframe slowly slide over the span element 269 sidebarListElement.animate({ width: '53px', queue: false }, shrinkTime, 'easeInQuad'); 270 $(element).animate({ width: '53px', queue: false }, shrinkTime, 'easeInQuad', function () { 271 $(element).removeClass('shrinkProcess'); 272 });
273 sidebarElementText.animate({ width: '0px', queue: false }, shrinkTime, 'easeInQuad'); 274 } 275 } 276 } 277 }); 278 }; 279})(jQuery);
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.