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