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 }); 197 198 $(".sweAccordion[class*='ui-'], .sweAccordion [class*='ui-']").attr('class', function(i, c){ 199 return c.replace(/(^|\s)ui-\S+/g, ''); 200 }); 201 202 // select content based on "rel"-attribute 203 $(".sweAccordion").each(function(){ 204 var accSel = Number($(this).attr("rel")); 205 if (!isNaN(accSel)) { 206 $(this).accordion('activate', accSel); 207 } 208 }); 209 210 211 // ===== sweTabs ====== 212 var cnt = 0; 213 $(".sweTabs").each(function(idx, oldRoot){ 214 215 // get "rel"-attribute to select tab when created 216 var tabSel = $(oldRoot).attr("rel") ? "rel='" + $(oldRoot).attr("rel") + "'" : ''; 217 218 $newRoot = $("<div class='sweTabs' " + tabSel + "></div>"); 219 $(oldRoot).after($newRoot); 220 221 // Tab-Header 222 $newTabRoot = $("<ul></ul>"); 223 $newRoot.append($newTabRoot); 224 225 var subcnt = cnt; 226 var $elm = $(oldRoot).find("tr:first").add($(oldRoot).find("tr:first").siblings("tr")).filter("tr:even"); 227 228 $elm.each(function(idx, childElm){ 229 $newTabRoot.append("<li><a href='#sweTabs-" + subcnt + "'>" + $(childElm).html() + "</a></li>"); 230 subcnt++; 231 }); 232 233 // Tab-Content 234 $newRoot.append($newTabRoot); 235 subcnt = cnt; 236 $elm.each(function(idx, childElm){ 237 $newRoot.append("<div id='sweTabs-" + subcnt + "'>" + $(childElm).next().find("td:first-child").html() + "</div>"); 238 subcnt++; 239 }); 240 241 // remove original accordion table 242 $(oldRoot).detach(); 243 244 cnt = cnt + subcnt; 245 }); 246 247 $(".sweTabs").tabs(); 248 249 $(".sweTabs[class*='ui-']").attr('class', function(i, c){ 250 return c.replace(/(^|\s)ui-\S+/g, ''); 251 }); 252 253 // select tab based on "rel"-attribute 254 $(".sweTabs").each(function(){ 255 var tabSel = Number($(this).attr("rel")); 256 if (!isNaN(tabSel)) { 257 var $tabs = $(".sweTabs").tabs(); 258 $tabs.tabs('select', tabSel); 259 } 260 }); 261 262 263 // ---===== scroll anchor links =====--- 264 $('a.scrollto[href^="#"]').on('click',function (e) { 265 e.preventDefault(); 266 var target = this.hash; 267 var offsetdiff = $(this).attr('data-offset') || 50; 268 $target = $(target); 269 270 if ($(target).length > 0) { 271 var offset = $target.offset().top - offsetdiff; 272 273 $('html, body').stop().animate({ 274 'scrollTop': offset 275 }, 900, 'swing', function () { 276 //window.location.hash = target; 277 }); 278 } 279 }); 280 281 282 // ---===== prevent links for wai/design from triggering =====--- 283 $(".dummyLink").click(function(event) { 284 event.preventDefault(); 285 }); 286 287 288 // Toggle content for Help Buttons 289 // 290 // e.g.: 291 // <span class="icon btnHelp" data-helpcontent="helpCntCaching"></span> 292 // <div id="helpCntCaching" class="helpCnt">Content text</div> 293 // 294 $("[data-helpcontent]").on("click", function(e) { 295 e.preventDefault(); 296 var $helpContent = $("#" + $(this).data("helpcontent")); 297 $helpContent.slideToggle(); 298 return false;
299 }); 300 301 302 addAjaxLink(); 303 304}); 305 306 307 308/* dynamic magnific-popup implementation - ==> IMAGE <== */ 309$(document).on('click', '.swpup-image, [data-swpup-image]', function (event) { 310 event.preventDefault(); 311 var $elm = $(this); 312 313 $.magnificPopup.open({ 314 items: { 315 src: $elm.attr("href") 316 }, 317 type:'image', 318 removalDelay: 500, //delay removal by X to allow out-animation 319 image: { 320 titleSrc: function(item) { 321 return $elm.attr('data-swpup-title') + '<small>' + $elm.attr("data-swpup-description") + '</small>'; 322 } 323 }, 324 callbacks: { 325 beforeOpen: function() { 326 // just a hack that adds mfp-anim class to markup 327 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 328 var theme = $elm.data("swpup-theme"); 329 330 if (theme) { 331 this.st.mainClass = theme; 332 } else { 333 this.st.mainClass = "mfp-zoom-in"; 334 } 335 } 336 }, 337 closeOnContentClick: true, 338 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 339 }); 340 341}); 342 343 344/* dynamic magnific-popup implementation - ==> GALLERY <== */ 345$(document).on('click', '.swpup-image-gallery a', function (event) { 346 347 event.preventDefault(); 348 var $elm = $(this); 349 var $elmGallery = $(this).closest(".swpup-image-gallery"); 350 351 $elmGallery.magnificPopup({ 352 type:'image', 353 delegate: '[data-swpup-item]', // child items selector, by clicking on it popup will open 354 removalDelay: 500, //delay removal by X to allow out-animation 355 gallery: { 356 enabled: true, 357 navigateByImgClick: true, 358 preload: [0,1] // Will preload 0 - before current, and 1 after the current image 359 }, 360 image: { 361 titleSrc: function(item) { 362 return item.el.attr('data-swpup-title') + '<small>' + item.el.attr("data-swpup-description") + '</small>'; 363 } 364 }, 365 callbacks: { 366 beforeOpen: function() { 367 // just a hack that adds mfp-anim class to markup 368 this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim'); 369 370 var el = this.st.el; 371 var theme = el.data("swpup-theme"); 372 373 if (theme) { 374 this.st.mainClass = theme; 375 } else { 376 this.st.mainClass = "mfp-zoom-in"; 377 } 378 } 379 }, 380 closeOnContentClick: true, 381 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 382 }); 383 384 $elm.click(); 385 386}); 387 388 389/* dynamic magnific-popup implementation - ==> INLINE <== */ 390$(document).on('click', '.swpup-inline', function (event) { 391 392 event.preventDefault(); 393 var $elm = $(this); 394 395 $.magnificPopup.open({ 396 items: { 397 src: $elm.attr("href"), 398 type:'inline' 399 }, 400 401 removalDelay: 500, //delay removal by X to allow out-animation 402 callbacks: { 403 beforeOpen: function() { 404 var theme = $elm.data("swpup-theme"); 405 406 if (theme) { 407 this.st.mainClass = theme; 408 } else { 409 this.st.mainClass = "mfp-zoom-in"; 410 } 411 } 412 }, 413 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 414 }); 415 416}); 417 418 419/* dynamic magnific-popup implementation - ==> FRAME <== */ 420$(document).on('click', '.swpup-iframe', function (event) { 421 422 event.preventDefault(); 423 var $elm = $(this); 424 425 $.magnificPopup.open({ 426 items: { 427 src: $elm.attr("href") 428 }, 429 type:'iframe', 430 removalDelay: 500, //delay removal by X to allow out-animation 431 preloader: false, 432 fixedContentPos: false, 433 callbacks: { 434 beforeOpen: function(el) { 435 var theme = $elm.data("swpup-theme"); 436 437 if (theme) { 438 this.st.mainClass = theme; 439 } else { 440 this.st.mainClass = "mfp-zoom-in"; 441 } 442 } 443 }, 444 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 445 }); 446 447}); 448 449 450/* dynamic magnific-popup implementation - ==> VIDEO / MAPS <== */ 451$(document).on('click', '.swpup-youtube, .swpup-vimeo, .swpup-gmap', function (event) { 452 453 event.preventDefault(); 454 var $elm = $(this); 455 456 $.magnificPopup.open({ 457 items: { 458 src: $elm.attr("href") 459 }, 460 type:'iframe', 461 removalDelay: 500, //delay removal by X to allow out-animation 462 preloader: false,
463 fixedContentPos: false, 464 callbacks: { 465 beforeOpen: function(el) { 466 var theme = $elm.data("swpup-theme"); 467 468 if (theme) { 469 this.st.mainClass = theme; 470 } else { 471 this.st.mainClass = "mfp-zoom-in"; 472 } 473 } 474 }, 475 midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source. 476 }); 477 478}); 479 480 481 482 483// ---===== AJAX-LINK: quick ajax =====--- 484// get all a links within the data-swajax object and load it into the attribute value 485// only ids are allowed | only a tags will be processed | no scripts within the loaded url will be executed 486// 487// <div data-swajax="inpage_nav_{|$row.id|}" data-swajax-keephistory="y"> <a href="myurl.html">AJAX-Link</a> </div> 488function addAjaxLink () { 489 490 $("[data-swajax]").each(function(){ 491 var $ajaxobj = $(this); 492 var targetItem = $ajaxobj.data('swajax'); 493 var $targetElement = $("#" + targetItem); 494 var keepHistory = $ajaxobj.data('swajax-keephistory'); 495 496 $ajaxobj.find("a").each(function(){ 497 var itemurl = $(this).attr('href'); 498 499 $(this).click(function(e){ 500 e.preventDefault(); 501 swScrollTo("#" + targetItem, -150); 502 $targetElement.fadeTo("slow", 0.3); 503 504 $targetElement.load(itemurl + " #" + targetItem, function(response, status, xhr) { 505 506 if (status == "success") { 507 if (keepHistory && keepHistory.toLowerCase() == "y") { 508 window.history.pushState({}, '', itemurl); 509 } 510 $targetElement.children(':first').unwrap(); 511 addAjaxLink(); 512 } else if (status == "error") { 513 document.location.href = itemurl; 514 } 515 516 }); 517 518 }); 519 520 }); 521 522 }); 523 524} 525 526 527/** 528 * can be called everywhere to explicitly set the Siteswift Do-Not-Track Cookie 529 * @param enable 530 */ 531function handleSWDoNotTrack(enable) { 532 if (enable == true) { 533 var exdate=new Date(); 534 exdate.setDate(exdate.getDate() + 365); 535 document.cookie='swdonottrack=1; expires='+exdate.toUTCString()+';'; 536 } else { 537 document.cookie='swdonottrack=;expires=Thu, 01-Jan-70 00:00:01 GMT;'; 538 } 539 return false; 540} 541 542function swSlideLink(url, target) { 543 if (target == "_blank") { 544 window.open(url, "swlink"); 545 } else { 546 document.location.href=url; 547 } 548} 549 550function swSubmitForm(searchId, searchEmptyVal, searchAlert, searchFormId) { 551 var searchVal = searchId.val(); 552 var searchValClean = searchVal.replace(/ /g,''); 553 554 if (searchVal == searchEmptyVal || searchVal == "" || searchValClean == "") { 555 alert(searchAlert); 556 return false; 557 } else { 558 var formToSumit = document.getElementById(searchFormId); 559 formToSumit.submit(); 560 } 561} 562 563function swScrollTo(target,offsetpos) { 564 var $target = $(target); 565 var targetoffset = (offsetpos === undefined) ? -50 : offsetpos; 566 567 if ($target.length > 0) { 568 var offset = $target.offset().top + targetoffset; 569 $('html, body').stop().animate({ 570 'scrollTop': offset 571 }, 900, 'swing'); 572 } 573} 574 575$.fn.toggleClick=function(){ 576 var functions=arguments, iteration=0 577 return this.click(function(){ 578 functions[iteration].apply(this,arguments) 579 iteration= (iteration+1) %functions.length 580 }) 581} 582 583// ====== content aware form width: start ====== 584function dynamic_form_resize() { 585 var $dynForm = $("form.responsive"); 586 587 if ($dynForm.parent().width() < 420) { 588 $dynForm.addClass("labelTop fluid"); 589 } else { 590 $dynForm.removeClass("labelTop fluid"); 591 } 592} 593 594$(document).ready(dynamic_form_resize); 595$(window).resize(dynamic_form_resize); 596// ====== 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.