1/* 2name: main.js 3URI: https://wiiw.ac.at/ 4discription: Javascript Datei; jQuery vorausgesetzt 5Version: 1.0 2013-02-11 6Author: Robert Menghini 7 8*/ 9 10/** 11 * helper functions 12 * @param mixed 13 * @return mixed 14 * 15 * @access private 16*/ 17 18// Funktion zum auslesen von URL Parametern 19function getURLParameter(sParam){ 20 21 var sPageURL = window.location.search.substring(1); 22 var sURLVariables = sPageURL.split('&'); 23 24 for (var i = 0; i < sURLVariables.length; i++){ 25 26 var sParameterName = sURLVariables[i].split('='); 27 28 if (sParameterName[0] == sParam){ 29 return sParameterName[1]; 30 }//end if 31 32 }//next 33 34}//end function 35 36 37 38 39/** 40 * 1. 41 * Funktion: E-Mail Adresse entschluesseln 42 * @param object obj 43 * @return void 44 * 45 * @access public 46*/ 47 48/*public*/function decodeEmail(obj) { 49 if(!obj.length) return; //Wenn obj auf Seite nicht vorhanden, dann Funktion verlassen 50 var replaced; 51 obj.each(function(index, element) { 52 replaced = $(this).html().replace(/\[-@-\]/g,'@'); 53 $(this).html(replaced); 54 }); 55}//end function 56 57 58/** 59 * 2. 60 * Funktion: Fancybox konfigurieren 61 * @param object obj 62 * @return void 63 * 64 * @access public 65*/ 66/*public*/function fancyBox(obj) { 67 if(!obj.length) return; //Wenn obj auf Seite nicht vorhanden, dann Funktion verlassen 68 69 obj.fancybox({ 70 openEffect : 'elastic', 71 closeEffect : 'elastic', 72 prevEffect : 'fade', 73 nextEffect : 'fade', 74 loop : false, 75 helpers : { 76 title : { 77 type: 'inside' 78 } 79 }, 80 wrapCSS: 'fancyOwn' 81 }); 82}//end function 83 84 85/** 86 * 3. 87 * Funktion: dynamisches Flyout Menu ohne css-hover und overlay 88 * @param object obj 89 * @return void 90 * 91 * @access public 92*/ 93 94/*public*/function main_menu(obj) { 95 if(!obj.length) return; //Wenn obj auf Seite nicht vorhanden, dann Funktion verlassen 96 97 // variablen deklarieren 98 var main_nav = $("ul#main_nav"); 99 100 // css-hover effekt ausschalten (nur js-hover) 101 main_nav.removeClass('use_hover'); 102 103 // sub-menue display->none und left:auto statt left:-9999px (siehe css) 104 $("ul#main_nav div.sub_menu").css({"display":"none", "left":"auto"}); 105 106 // ausrechnen der Scrollbalken breite fuer Overlay 107 var overlay = { 108 width: function() { 109 if ($.browser.msie) { 110 scrollWidth = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth); 111 offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); 112 113 return scrollWidth < offsetWidth ? $(window).width() : scrollWidth; 114 115 } else { 116 return $(document).width(); 117 }//end if 118 }//end function 119 }//obj 120 121 var overflow = $('body').css('overflow'); 122 $("body").css('overflow','hidden'); 123 var width = overlay.width() 124 $("body").css('overflow','scroll'); 125 var scroll_width = width -= overlay.width(); 126 $("body").removeAttr('style') 127 128 129 // hover main_nav -> overlay ein/aus blenden // <a>-Element fuer Overlay, da mobile-safari kein click auf div versteht! 130 main_nav.hover(function() { 131 $("body") 132 .css("margin-right",scroll_width) 133 .addClass('menu_overlay_lock') 134 .append('<a href="javascript:void(0)" class="menu_overlay" style="display: none; width: auto; height: auto;"> </a>'); 135 136 $('.menu_overlay').delay(300).fadeIn(400); 137 138 }, function() { 139 $("body") 140 .removeAttr('style') 141 .removeClass('menu_overlay_lock'); 142 143 $(".menu_overlay") 144 .stop(true, true) 145 .delay(200) 146 .fadeOut(400,function() { 147 $(this).detach(); 148 }) 149 }); 150 151 // hover Menuepunkt flayout-menue ein/ausblenden 152 obj.hover(function() { 153 $(this) 154 .find('div.sub_menu') 155 /*.stop(true, true)*/ 156 /*.delay(200)*/ 157 .slideDown(300, function() { 158 $(this).css({overflow: "visible"});//bugfix IE < 7 159 }) 160 .parent('li') 161 .children('a') 162 .addClass('active'); 163 }, function() { 164 165 $(this) 166 .find('div.sub_menu') 167 .stop(true, true) 168 /*.delay(200)*/ 169 .slideUp(300) 170 .parent('li') 171 .children('a') 172 .removeClass('active'); 173 }); 174 175 $('.menu_overlay').live('click',function() { 176 $('div.sub_menu') 177 .stop(true, true) 178 .slideUp(300) 179 .parent('li') 180 .children('a') 181 .removeClass('active'); 182 }); 183 184 185}//end function 186 187 188/** 189 * 4. 190 * Funktion: Verstecken und togglen von Zusatzinfos 191 * @param object obj 192 * @return void 193 * 194 * @access public 195*/ 196 197/*public*/function toggle_next(obj) { 198 199 // Cookies in Variablen speichern 200 var location = $.cookie('location'); 201 var status = $.cookie('status'); 202 var akt_loc = true;//Schalter 203 204 if ( location != window.location.href) { 205 $.removeCookie('status'); 206 akt_loc = false; 207 }//end if 208
209 //Wenn obj auf Seite nicht vorhanden, dann Funktion verlassen 210 if(!obj.length) return; 211 212 //.toogled_content in Variable speichern 213 var toggled = $('.toggled_content'); 214 215 //Wenn nicht cookie->status open dann verstecken und Symbol zum oeffnen; sonst anzeigen und Symbol zum schliessen 216 if(status != 'open' || !akt_loc) { 217 toggled.hide(); 218 obj.addClass('closed').append('<span class="toggle_arrow dib"> </span>'); 219 } else { 220 obj.addClass('open').append('<span class="toggle_arrow dib"> </span>'); 221 }//end if 222 223 //cookie fuer location setzen 224 $.cookie('location', window.location.href, { expires: 1 } ); 225 226 //Klickevent 227 obj.click(function() { 228 if($(this).next(toggled).is(':hidden')) { 229 $(this).removeClass('closed').addClass('open'); 230 $(this).next(toggled).slideDown("slow",function() { 231 $(this) 232 .prev('.toggle_next') 233 .children('.toggle_arrow'); 234 }); 235 $.cookie('status','open', { expires: 1 }); 236 } else { 237 $(this).next(toggled).slideUp("slow",function() { 238 $(this) 239 .prev('.toggle_next') 240 .removeClass('open') 241 .addClass('closed') 242 .children('.toggle_arrow'); 243 }); 244 $.cookie('status','closed', { expires: 1 }); 245 }//end if 246 }); 247 248}//end function 249 250/** 251 * 5. 252 * Funktion: Zur Linkziel scrollen 253 * @param object obj 254 * @return void 255 * 256 * @access public 257*/ 258 259/*public*/function scroll_to(obj) { 260 261 if(!obj.length) return; 262 263 var href; 264 var idOffset; 265 266 obj.click(function(e) { 267 e.preventDefault(); 268 href = $($(this).attr('href')); 269 270 // Zum Artikel scrollen 271 $("html,body").animate({scrollTop: href.offset().top}, "slow" ); 272 }); 273 274 275}//end function 276 277 278/** 279 * 6. 280 * Funktion: Scroll to Top 281 * @return void 282*/ 283 284function scrollToTop() { 285 286 $("#back-top").removeClass('imgGalNoJS').hide(); 287 288 var windowW = $(window).innerWidth(); 289 290 if(windowW < 1200) return; //wenn Anzeigebereich kleiner 1400 -> keine back-top anzeigen 291 292 $(window).scroll(function () { 293 294 if ($(this).scrollTop() > 400 ) { 295 if ($('#back-top').is(":hidden")) { 296 $('#back-top').fadeIn(); 297 } 298 } else { 299 if ($('#back-top').is(":visible")) { 300 $('#back-top').fadeOut(); 301 } 302 }//end if 303 }); 304 305 $('#back-top a').hover(function() { 306 $(this).stop(true, true).animate({'width': '120px'},400); 307 },function() { 308 $(this).animate({'width': '60px'},400); 309 }); 310 311 /*$('#back-top a').click(function(e) { 312 e.preventDefault(); 313 $('body,html').animate({ scrollTop: 0}, "slow","swing", function() { 314 $('#back-top a').blur(); 315 }); 316 });*/ 317}//end function 318 319 320/** 321 * 7. 322 * Funktion: Printerfriendly Version Button und neues Fenster 323 * @required function getURLParameter 324 * @ return void 325*/ 326function printVersion() { 327 var url = window.location.href.split('?')[0]; 328 var query = window.location.search; 329 var view = getURLParameter('siteview'); 330 331 // If the 'siteview' parameter is not 'print', reset it to an empty value 332 if (view !== 'print') { 333 view = ''; 334 } 335 336 query = query === '' ? '?siteview=print' : query + '&siteview=print'; 337 338 var safeUrl = url + query; 339 340 var $link = $('<a>', { 341 href: safeUrl, 342 title: "Printer friendly version" 343 }); 344 345 var $printDiv = $('<div>', { class: 'print' }).append($link); 346 347 $('#breadcrumb').append($printDiv); 348 349 $('#breadcrumb div.print a').click(function(e) { 350 e.preventDefault(); 351 352 var winPrint = window.open($(this).attr('href'), "PrintVersion", "width=800,height=600,scrollbars=yes"); 353 winPrint.focus(); 354 }); 355 356 if (view === 'print') { 357 $('body').addClass('print_version'); 358 359 var $printHeader = $('<div>', { id: 'print_header' }).append( 360 $('<div>', { class: 'print_start dib' }).append( 361 $('<a>', { href: 'javascript:window.print()', text: 'Print' }) 362 ), 363 $('<div>', { class: 'print_logo' }).append( 364 $('<img>', { 365 src: 'https://wiiw.ac.at/design/images/layout/wiiw_logo-print.jpg', 366 alt: 'Wiiw Logo', 367 width: 173, 368 height: 75 369 }) 370 ) 371 ); 372 373 $('#breadcrumb').before($printHeader); 374 375 $('div.print').remove(); 376 $('#back-top').remove(); 377 } 378} 379 380function getURLParameter(name) { 381 var param = new URLSearchParams(window.location.search).get(name); 382 return param ? param : ''; // Return the parameter or an empty string if not found 383} 384 385 386 387/** 388 * 8. 389 * Funktion: Tooltip ausgeben 390 * @return void 391*/ 392function tooltip(){ 393 394 //+++ Tooltip mit classen +++ 395 $(".tt_north-west").tipsy({gravity: 'nw', delayIn: 500, delayOut: 300, opacity: 0.9}); 396 $(".tt_north").tipsy({gravity: 'n', delayIn: 500, delayOut: 300, opacity: 0.9}); 397 $(".tt_north-east").tipsy({gravity: 'ne', delayIn: 500, delayOut: 300, opacity: 0.9}); 398 $(".tt_west").tipsy({gravity: 'w', delayIn: 500, delayOut: 300, opacity: 0.9}); 399 $(".tt_east").tipsy({gravity: 'e', delayIn: 500, delayOut: 300, opacity: 0.9}); 400 $(".tt_south-west").tipsy({gravity: 'sw', delayIn: 500, delayOut: 300, opacity: 0.9}); 401 $(".tt_south").tipsy({gravity: 's', delayIn: 500, delayOut: 300, opacity: 0.9}); 402 $(".tt_south-east").tipsy({gravity: 'se', delayIn: 500, delayOut: 300, opacity: 0.9}); 403 404 //+++ spezielle Tooltips +++ 405 406 //Logo 407 $("#header #logo").tipsy({gravity: 's', delayIn: 500, opacity: 0.9, offset: -75}); 408 409 410 //Link 411 $(".info_symbol, .info_icon").tipsy({gravity: 'w', delayIn: 500, delayOut: 300, opacity: 0.9}); 412 413 //search form 414 $("#frm_search_filter .toggle_next.closed").tipsy({gravity: 'w', delayIn: 500, delayOut: 0, opacity: 0.9, live: true}); 415 416 417 418 $("[title]").not("#header #logo, .info_symbol, .info_icon, #frm_search_filter .toggle_next").tipsy({gravity: $.fn.tipsy.autoNS, delayIn: 500, delayOut: 300, opacity: 0.9}); 419 420 421}//end function 422 423/** 424 * 9.
425 * Funktion: Slide/Toggle/Fade Effekte 426 * @return void 427*/ 428function slide_toogle_fade() { 429 430 var chk_upcoming_events = $("#chk_sub_newsletter_upcoming_events"); 431 var event_items_list = chk_upcoming_events.parent().nextAll("ul"); 432 433 if(chk_upcoming_events.is(':checked')) 434 event_items_list.hide(); 435 else 436 event_items_list.show(); 437 438 439 chk_upcoming_events.click(function() { 440 event_items_list.slideToggle(this.checekd); 441 442 }); 443 444 445 446}//end function 447 448 449// +++++++++++++++++++++++++++++++++++++ Document Ready ++++++++++++++++++++++++++++++++ 450 451$(document).ready(function(){ // warten bis das Dokument bereit ist um manipuliert zu werde 452 453 // 1. Spamschutz alle [-@-] entschluesseln 454 decodeEmail($("#container :contains('[-@-]')")); 455 456 // 2. fancybox config 457 fancyBox($("a.fancybox")); 458 459 // 3. main_menu 460 main_menu($("ul#main_nav li")); 461 462 // 4. toggle_next 463 toggle_next($(".toggle_next")); 464 465 // 5. Zur Linkziel scrollen 466 scroll_to($(".scroller")); 467 468 // 6. Scroll-Top ein, ausblenden und scrollen 469 scrollToTop(); 470 471 // 7. Printer friendly version 472 printVersion(); 473 474 // 8. Tooltip tipsy 475 tooltip(); 476 477 // 9. Slide/Toggle/Fade Effekte 478 slide_toogle_fade(); 479 480 481 482 483 484 485}); // Ende ready function()
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.