1/** 2 * standard scripts in HTML head -> tags_htmlhead.tpl 3 */ 4 5$(document).ready(function(){ 6 7 // ===== prettyPhoto ====== 8 $("a[rel^='prettyPhoto']").prettyPhoto({ 9 animation_speed: 'fast', /* fast/slow/normal */ 10 opacity: 0.35, /* Value between 0 and 1 */ 11 show_title: false, /* true/false */ 12 allow_resize: true, /* true/false */ 13 counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */ 14 theme: 'light_square', /* pp_default / light_rounded / dark_rounded / light_square / dark_square / facebook */ 15 overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */ 16 deeplinking: false, /* Allow prettyPhoto to update the url to enable deeplinking. */ 17 social_tools: '' /* AZP: disable social sharing */ 18 }); 19 20 // ===== magnificPopup-edit ====== 21 if ($('.magnificPopup-edit').length > 0) { 22 23 $(".magnificPopup-edit").click(function(){ 24 /* delay 2sec and create warning box */ 25 $(this).animate({opacity: 1},2000,function(){ 26 $("body").prepend('<div id="editWarningWrapper"><div class="editWarning">Bitte warten Sie, bis die Seite neu geladen wurde</div></div>'); 27 $("#editWarningWrapper").css({ 28 "top": Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px" 29 }); 30 }); 31 }); 32 33 $('.magnificPopup-edit').magnificPopup({ 34 type:'iframe', 35 removalDelay: 500, //delay removal by X to allow out-animation 36 preloader: false, 37 fixedContentPos: false, 38 callbacks: { 39 beforeOpen: function() { 40 this.st.mainClass = "mfp-zoom-in"; 41 $("body").addClass("editOverlay"); 42 }, 43 close: function() { 44 var curlUrl = document.location.href.split("?")[0].split("#")[0]; 45 document.location.href = curlUrl; 46 } 47 }, 48 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 49 }); 50 51 } 52 53 54 /* ============================================ 55 MAGNIFIC-POPUP SETTINGS 56 57 ==> IMAGE <== 58 Single image popup, needs class ".swpup-image" to initialize. 59 60 HTML markup: 61 <a href="http://placekitten.com/1500/1500" class="swpup-image" data-swpup-title="Titel" data-swpup-description="Die Beschreibung im Text...">IMAGE</a> 62 63 Attributes: 64
65 href="url" | link to popup image 66 data-mfp-src="url" | overrides href attribute - link to popup image 67 data-swpup-title="abc" | title of image 68 data-swpup-description="xyz" | small description of image 69 70 71 ==> GALLERY <== 72 Image gallery with next/prev arrows. 73 Class ".swpup-image-gallery" = container, items need "data-swpup-item" attribute. 74 75 HTML markup: 76 <div class="swpup-image-gallery"> 77 <a href="http://placekitten.com/800/600" data-swpup-item data-swpup-title="Titel 1" data-swpup-description="Die Beschreibung im Text 1...">Item 1</a> 78 <a href="http://placekitten.com/700/700" data-swpup-item data-swpup-title="Titel 2" data-swpup-description="Die Beschreibung im Text 2...">Item 2</a> 79 <a href="http://placekitten.com/750/650" data-swpup-item data-swpup-title="Titel 3" data-swpup-description="Die Beschreibung im Text 3...">Item 3</a> 80 </div> 81 82 Attributes: 83 84 href="url" | link to popup image 85 data-mfp-src="url" | overrides href attribute - link to popup
85image 86 data-swpup-item | empty attribute to mark as gallery item 87 data-swpup-title="abc" | title of image 88 data-swpup-description="xyz" | small description of image 89 90 91 ==> INLINE <== 92 Opens a hidden div. Markup: 93 94 HTML markup: 95 <a href="#test-popup" class="swpup-inline">OPEN</a> 96 <div id="test-popup" class="white-popup mfp-with-anim mfp-hide">...TEXT...</div> 97 98 Classes: 99 white-popup | theme class - see "swscripts/bower/custom/magnific-popup/magnific-popup-site.custom.css" 100 mfp-with-anim | used for animation marker 101 mfp-hide | initially hide content 102 103 104 ==> FRAME <== 105 Opens overlay with iFrame content. 106 107 HTML markup: 108 <a href="IFRAME URL" class="swpup-iframe">iFrame</a> 109 110 Classes: 111 swpup-iframe | init iframe 112 113 114 ==> VIDEO / MAPS <== 115 Opens overlay with iFrame content - optimized for video (youtube, vimeo) and maps (gmap). 116 117 HTML markup: 118 <a class="swpup-youtube" href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">YouTube video</a><br> 119 <a class="swpup-vimeo" href="https://vimeo.com/120469122">Vimeo video</a><br> 120 <a class="swpup-gmap" href="https://maps.google.com/maps?q=221B+Baker+Street,+London,+United+Kingdom&hl=en&t=v&hnear=221B+Baker+St,+London+NW1+6XE,+United+Kingdom">Google Map</a> 121 122 Classes: 123 swpup-youtube | init youtube video 124 swpup-vimeo | init vimeo video 125 swpup-gmap | init google maps 126 127 ============================================ */ 128 129 $('.swpup-inline-group').magnificPopup({ 130 delegate:'.swpup-inline-item', 131 type:'inline', 132 removalDelay: 500, //delay removal by X to allow out-animation 133 callbacks: { 134 beforeOpen: function() { 135 var el = this.st.el; 136 var theme = el.data("swpup-theme"); 137 138 if (theme) { 139 this.st.mainClass = theme; 140 } else { 141 this.st.mainClass = "mfp-zoom-in"; 142 } 143 } 144 }, 145 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 146 }); 147 148 $('.swpup-iframe-group').magnificPopup({ 149 delegate:'.swpup-iframe-item', 150 type:'iframe', 151 removalDelay: 500, //delay removal by X to allow out-animation 152 preloader: false, 153 fixedContentPos: false, 154 callbacks: { 155 beforeOpen: function() { 156 var el = this.st.el; 157 var theme = el.data("swpup-theme"); 158 159 if (theme) { 160 this.st.mainClass = theme; 161 } else { 162 this.st.mainClass = "mfp-zoom-in"; 163 } 164 } 165 }, 166 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 167 }); 168 169 170 171 // ===== sweAccordion ====== 172 var cnt = 0; 173 $(".sweAccordion").each(function(idx, oldRoot){ 174 // get "rel"-attribute to select tab when created 175 var accSel = $(oldRoot).attr("rel") ? "rel='" + $(oldRoot).attr("rel") + "'" : ''; 176 $newRoot = $("<div class='sweAccordion' " + accSel + "></div>"); 177 $(oldRoot).after($newRoot); 178 179 var subcnt = cnt; 180 var $elm = $(oldRoot).find("tr:first").add($(oldRoot).find("tr:first").siblings("tr")).filter("tr:even"); 181 182 $elm.each(function(idx, childElm){ 183 $newRoot.append("<div>" + $(childElm).html() + "</div>"); 184 $newRoot.append("<div>" + $(childElm).next().find("td").html() + "</div>"); 185 subcnt++; 186 }); 187 188 // remove original accordion table 189 $(oldRoot).detach(); 190 }); 191 192 $(".sweAccordion").accordion({ 193 autoHeight: false, 194 active: false, 195 collapsible: true, 196 create: function(event, ui) { 197 window.setTimeout(function(){ 198 try { 199 Waypoint.refreshAll(); 200 } catch (e) {} 201 }, 500); 202 }, 203 activate: function(event, ui) { 204 try { 205 Waypoint.refreshAll(); 206 } catch (e) {} 207 } 208 }); 209 210 $(".sweAccordion[class*='ui-'], .sweAccordion [class*='ui-']").attr('class', function(i, c){ 211 return c.replace(/(^|\s)ui-\S+/g, ''); 212 }); 213 214 // select content based on "rel"-attribute 215 $(".sweAccordion").each(function(){ 216 var accSel = Number($(this).attr("rel")); 217 if (!isNaN(accSel)) { 218 $(this).accordion('activate', accSel); 219 } 220 }); 221 222 223 // ===== sweTabs ====== 224 var cnt = 0; 225 $(".sweTabs").each(function(idx, oldRoot){ 226 227 // get "rel"-attribute to select tab when created 228 var tabSel = $(oldRoot).attr("rel") ? "rel='" + $(oldRoot).attr("rel") + "'" : ''; 229 230 $newRoot = $("<div class='sweTabs' " + tabSel + "></div>"); 231 $(oldRoot).after($newRoot); 232 233 // Tab-Header 234 $newTabRoot = $("<ul></ul>"); 235 $newRoot.append($newTabRoot); 236 237 var subcnt = cnt; 238 var $elm = $(oldRoot).find("tr:first").add($(oldRoot).find("tr:first").siblings("tr")).filter("tr:even"); 239 240 $elm.each(function(idx, childElm){ 241 $newTabRoot.append("<li><a href='#sweTabs-" + subcnt + "'>" + $(childElm).html() + "</a></li>"); 242 subcnt++; 243 }); 244 245 // Tab-Content 246 $newRoot.append($newTabRoot); 247 subcnt = cnt; 248 $elm.each(function(idx, childElm){ 249 $newRoot.append("<div id='sweTabs-" + subcnt + "'>" + $(childElm).next().find("td:first-child").html() + "</div>"); 250 subcnt++; 251 }); 252 253 // remove original accordion table 254 $(oldRoot).detach(); 255 256 cnt = cnt + subcnt; 257 }); 258 259 $(".sweTabs").tabs(); 260 261 $(".sweTabs[class*='ui-']").attr('class', function(i, c){ 262 return c.replace(/(^|\s)ui-\S+/g, ''); 263 }); 264 265 // select tab based on "rel"-attribute 266 $(".sweTabs").each(function(){ 267 var tabSel = Number($(this).attr("rel")); 268 if (!isNaN(tabSel)) { 269 var $tabs = $(".sweTabs").tabs(); 270 $tabs.tabs('select', tabSel); 271 } 272 }); 273 274 275 // ---===== scroll anchor links =====--- 276 $('a.scrollto[href^="#"]').on('click',function (e) { 277 e.preventDefault(); 278 var target = this.hash; 279 var offsetdiff = $(this).attr('data-offset') || 50; 280 $target = $(target); 281 282 if ($(target).length > 0) { 283 var offset = $target.offset().top - offsetdiff; 284 285 $('html, body').stop().animate({ 286 'scrollTop': offset 287 }, 900, 'swing', function () { 288 //window.location.hash = target; 289 }); 290 } 291 }); 292 293 294 // ---===== prevent links for wai/design from triggering =====--- 295 $(".dummyLink").click(function(event) { 296 event.preventDefault(); 297 }); 298 299 300 // Toggle content for Help Buttons 301 // 302 // e.g.: 303 // <span class="icon btnHelp" data-helpcontent="helpCntCaching"></span> 304 // <div id="helpCntCaching" class="helpCnt">Content text</div> 305 // 306 $("[data-helpcontent]").on("click", function(e) { 307 e.preventDefault(); 308 var $helpContent = $("#" + $(this).data("helpcontent")); 309 $helpContent.slideToggle(); 310 return false;
311 }); 312 313 314 addAjaxLink(); 315 316}); 317 318 319 320/* dynamic magnific-popup implementation - ==> IMAGE <== */ 321$(document).on('click', '.swpup-image, [data-swpup-image]', function (event) { 322 event.preventDefault(); 323 var $elm = $(this); 324 325 $.magnificPopup.open({ 326 items: { 327 src: $elm.attr("href") 328 }, 329 type:'image', 330 removalDelay: 500, //delay removal by X to allow out-animation 331 image: { 332 titleSrc: function(item) { 333 return $elm.attr('data-swpup-title') + '<small>' + $elm.attr("data-swpup-description") + '</small>'; 334 } 335 }, 336 callbacks: { 337 beforeOpen: function() { 338 // just a hack that adds mfp-anim class to markup 339 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 340 var theme = $elm.data("swpup-theme"); 341 342 if (theme) { 343 this.st.mainClass = theme; 344 } else { 345 this.st.mainClass = "mfp-zoom-in"; 346 } 347 } 348 }, 349 closeOnContentClick: true, 350 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 351 }); 352 353}); 354 355 356/* dynamic magnific-popup implementation - ==> GALLERY <== */ 357$(document).on('click', '.swpup-image-gallery a', function (event) { 358 359 event.preventDefault(); 360 var $elm = $(this); 361 var $elmGallery = $(this).closest(".swpup-image-gallery"); 362 363 $elmGallery.magnificPopup({ 364 type:'image', 365 delegate: '[data-swpup-item]', // child items selector, by clicking on it popup will open 366 removalDelay: 500, //delay removal by X to allow out-animation 367 gallery: { 368 enabled: true, 369 navigateByImgClick: true, 370 preload: [0,1] // Will preload 0 - before current, and 1 after the current image 371 }, 372 image: { 373 titleSrc: function(item) { 374 return item.el.attr('data-swpup-title') + '<small>' + item.el.attr("data-swpup-description") + '</small>'; 375 } 376 }, 377 callbacks: { 378 beforeOpen: function() { 379 // just a hack that adds mfp-anim class to markup 380 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 381 382 var el = this.st.el; 383 var theme = el.data("swpup-theme"); 384 385 if (theme) { 386 this.st.mainClass = theme; 387 } else { 388 this.st.mainClass = "mfp-zoom-in"; 389 } 390 } 391 }, 392 closeOnContentClick: true, 393 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 394 }); 395 396 $elm.click(); 397 398}); 399 400 401/* dynamic magnific-popup implementation - ==> INLINE <== */ 402$(document).on('click', '.swpup-inline', function (event) { 403 404 event.preventDefault(); 405 var $elm = $(this); 406 407 $.magnificPopup.open({ 408 items: { 409 src: $elm.attr("href"), 410 type:'inline' 411 }, 412 413 removalDelay: 500, //delay removal by X to allow out-animation 414 callbacks: { 415 beforeOpen: function() { 416 var theme = $elm.data("swpup-theme"); 417 418 if (theme) { 419 this.st.mainClass = theme; 420 } else { 421 this.st.mainClass = "mfp-zoom-in"; 422 } 423 } 424 }, 425 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 426 }); 427 428}); 429 430 431/* dynamic magnific-popup implementation - ==> FRAME <== */ 432$(document).on('click', '.swpup-iframe', function (event) { 433 434 event.preventDefault(); 435 var $elm = $(this); 436 437 $.magnificPopup.open({ 438 items: { 439 src: $elm.attr("href") 440 }, 441 type:'iframe', 442 removalDelay: 500, //delay removal by X to allow out-animation 443 preloader: false, 444 fixedContentPos: false, 445 callbacks: { 446 beforeOpen: function(el) { 447 var theme = $elm.data("swpup-theme"); 448 449 if (theme) { 450 this.st.mainClass = theme; 451 } else { 452 this.st.mainClass = "mfp-zoom-in"; 453 } 454 } 455 }, 456 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 457 }); 458 459}); 460 461 462/* dynamic magnific-popup implementation - ==> VIDEO / MAPS <== */ 463$(document).on('click', '.swpup-youtube, .swpup-vimeo, .swpup-gmap', function (event) { 464 465 event.preventDefault(); 466 var $elm = $(this); 467 468 $.magnificPopup.open({ 469 items: { 470 src: $elm.attr("href") 471 }, 472 type:'iframe', 473 removalDelay: 500, //delay removal by X to allow out-animation 474 preloader: false,
475 fixedContentPos: false, 476 callbacks: { 477 beforeOpen: function(el) { 478 var theme = $elm.data("swpup-theme"); 479 480 if (theme) { 481 this.st.mainClass = theme; 482 } else { 483 this.st.mainClass = "mfp-zoom-in"; 484 } 485 } 486 }, 487 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 488 }); 489 490}); 491 492 493 494 495// ---===== AJAX-LINK: quick ajax =====--- 496// get all a links within the data-swajax object and load it into the attribute value 497// only ids are allowed | only a tags will be processed | no scripts within the loaded url will be executed 498// 499// <div data-swajax="inpage_nav_{|$row.id|}" data-swajax-keephistory="y"> <a href="myurl.html">AJAX-Link</a> </div> 500function addAjaxLink () { 501 502 $("[data-swajax]").each(function(){ 503 var $ajaxobj = $(this); 504 var targetItem = $ajaxobj.data('swajax'); 505 var $targetElement = $("#" + targetItem); 506 var keepHistory = $ajaxobj.data('swajax-keephistory'); 507 508 $ajaxobj.find("a").each(function(){ 509 var itemurl = $(this).attr('href'); 510 511 $(this).click(function(e){ 512 e.preventDefault(); 513 swScrollTo("#" + targetItem, -150); 514 $targetElement.fadeTo("slow", 0.3); 515 516 $targetElement.load(itemurl + " #" + targetItem, function(response, status, xhr) { 517 518 if (status == "success") { 519 if (keepHistory && keepHistory.toLowerCase() == "y") { 520 window.history.pushState({}, '', itemurl); 521 } 522 $targetElement.children(':first').unwrap(); 523 addAjaxLink(); 524 } else if (status == "error") { 525 document.location.href = itemurl; 526 } 527 528 }); 529 530 }); 531 532 }); 533 534 }); 535 536} 537 538 539/** 540 * can be called everywhere to explicitly set the Siteswift Do-Not-Track Cookie 541 * @param enable 542 */ 543function handleSWDoNotTrack(enable) { 544 if (enable == true) { 545 var exdate=new Date(); 546 exdate.setDate(exdate.getDate() + 365); 547 document.cookie='swdonottrack=1; expires='+exdate.toUTCString()+';'; 548 } else { 549 document.cookie='swdonottrack=;expires=Thu, 01-Jan-70 00:00:01 GMT;'; 550 } 551 return false; 552} 553 554function swSlideLink(url, target) { 555 if (target == "_blank") { 556 window.open(url, "swlink"); 557 } else { 558 document.location.href=url; 559 } 560} 561 562function swSubmitForm(searchId, searchEmptyVal, searchAlert, searchFormId) { 563 var searchVal = searchId.val(); 564 var searchValClean = searchVal.replace(/ /g,''); 565 566 if (searchVal == searchEmptyVal || searchVal == "" || searchValClean == "") { 567 alert(searchAlert); 568 return false; 569 } else { 570 var formToSumit = document.getElementById(searchFormId); 571 formToSumit.submit(); 572 } 573} 574 575function swScrollTo(target,offsetpos) { 576 var $target = $(target); 577 var targetoffset = (offsetpos === undefined) ? -50 : offsetpos; 578 579 if ($target.length > 0) { 580 var offset = $target.offset().top + targetoffset; 581 $('html, body').stop().animate({ 582 'scrollTop': offset 583 }, 900, 'swing'); 584 } 585} 586 587$.fn.toggleClick=function(){ 588 var functions=arguments, iteration=0 589 return this.click(function(){ 590 functions[iteration].apply(this,arguments) 591 iteration= (iteration+1) %functions.length 592 }) 593} 594 595// ====== content aware form width: start ====== 596function dynamic_form_resize() { 597 var $dynForm = $("form.responsive"); 598 599 if ($dynForm.parent().width() < 480) { 600 $dynForm.addClass("labelTop fluid"); 601 } else { 602 $dynForm.removeClass("labelTop fluid"); 603 } 604} 605 606$(document).ready(dynamic_form_resize); 607$(window).resize(dynamic_form_resize); 608// ====== content aware form width: end ======
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.