1var DynamicList = { 2 3 init: function (config) { 4 this.$el = config.container; 5 this.$itemTmpl = config.item; 6 this.$form = config.form; 7 this.url = config.url; 8 this.useMasonry = config.useMasonry; 9 this.page = 1; 10 this.lastScrollPosition = 0; 11 this.isLoading = false; 12 this.isFirstLoding = true; 13 this.urlHasParameter = config.urlHasParameter; 14 this.setupForm(); 15 this.bindForm(); 16 this.bindFormCustom(); 17 this.load(); 18 if (this.useMasonry) 19 this.initMasonry(); 20 this.infinitScollEnabled = false, 21 this.isLastPage = false 22 }, 23 24 unbindInfiniteScroll: function () { 25// $('#blog').unbind('scroll'); 26 this.lastScrollPosition = 0; 27 }, 28 29 bindInfiniteScroll: function () { 30 var self = this; 31 self.unbindInfiniteScroll(); 32 if (self.infinitScollEnabled === true) { 33 $(window).scroll(function () { 34 if (self.isLastPage === false && !$('#blog').hasClass('hide-element')) { 35 var scrollPosition = $(window).scrollTop(); 36 if (scrollPosition + $(window).height() > ($(window).height() / 100 * 90) && 37 !self.isLoading && self.lastScrollPosition < scrollPosition) { 38 self.lastScrollPosition = scrollPosition; 39 self.page += 1; 40 self.load(); 41 } 42 } 43 }); 44 } else { 45 $('#blog-load-more-button, #blog-nsh-more-button').unbind('click').on('click', function () { 46 console.log("Button pressed"); 47 self.infinitScollEnabled = true; 48 $(this).fadeOut(500); 49 self.bindInfiniteScroll(); 50 var scrollPosition = $(window).scrollTop(); 51 self.lastScrollPosition = scrollPosition; 52 self.page += 1; 53 self.load(); 54 }); 55 } 56 }, 57 58 getUrlParam: function (paramName) { 59 var searchUrl = decodeURIComponent(window.location.search.substring(1)); 60 var urlComponents = searchUrl.split('&'); 61 // array with a key and a value 62 var urlComponent; 63 var i; 64 65 for (i = 0; i < urlComponents.length; i++) { 66 urlComponent = urlComponents[i].split('='); 67 68 if (urlComponent[0] === paramName) { 69 return urlComponent[1]; 70 } 71 } 72 73 return null; 74 }, 75 76 bindForm: function () { 77 var self = this; 78 self.$form.submit(function () { 79 self.page = 1; 80 self.empty(); 81 self.load(); 82 return false; 83 }); 84 $(':input', self.$form).change(function () { 85 self.$form.submit(); 86 }); 87 }, 88 89 load: function (callback) { 90 var self = this; 91 var fields = {}; 92 93 self.$form.serializeArray().map(function (item) { 94 if (item.value !== "") 95 fields[item.name] = item.value; 96 }); 97 98 var url = window.location.pathname; 99 var urlFirstParameter = self.urlHasParameter ? '&' : '?'; 100 console.log('1'); 101 if ($('body').hasClass('page-home')) { 102 url += urlFirstParameter + 'p=' + self.page; 103 if (!$.isEmptyObject(fields)) { 104 url += '&' + $.param(fields); 105 } 106 // preserve hash 107 var hash = window.location.hash; 108 109 history.pushState( 110 '', 111 document.title, 112 url 113 ); 114 if (hash) { 115 location.hash = hash; 116 } 117 } 118 119 if ($('body').hasClass('page-mediathek') || 120 $('body').hasClass('page-mediathek-schauspiel') || 121 $('body').hasClass('page-mediathek-staatsoper') || 122 $('body').hasClass('page-mediathek-staatsballett') || 123 $('body').hasClass('page-mediathek-staatsorchester') 124 ) { 125 var newUrlParams = null; 126 if (typeof fields['query'] !== 'undefined') { 127 if (newUrlParams === null) { 128 newUrlParams = "?query=" + fields['query']; 129 } else { 130 newUrlParams += "&query=" + fields['query']; 131 } 132 } 133 var category = ''; 134 $.each($('li.category-filter.active'), function (index, item) { 135 if (index > 0) { 136 category += '_'; 137 } 138 category += $(item).data('value'); 139 }); 140 fields['tag_section'] = category; 141 console.log("CATEGORY " + category); 142 if (category !== '') { 143 console.log("CATEGORY IS NOT EMPT>"); 144 if (newUrlParams === null) { 145 newUrlParams = "?tag_section=" + category; 146 } else { 147 newUrlParams += "&tag_section=" + category; 148 } 149 } 150 151 var location = ''; 152 $.each($('li.location-filter.active'), function (index, item) { 153// $.each($('.location-selectbox :selected'), function (index, item) { 154 if (index > 0) { 155 location += '_'; 156 } 157 location += $(item).data('value'); 158 }); 159 fields['tag_format'] = location; 160 console.log("Tag Format in Dynamic List: " + location); 161 if (location !== '') { 162 if (newUrlParams === null) { 163 newUrlParams = "?tag_format=" + location; 164 } else { 165 newUrlParams += "&tag_format=" + location; 166 } 167 } 168 169 170 if (self.isFirstLoding === true && self.getUrlParam('item') !== null) { 171 fields['item'] = self.getUrlParam('item'); 172 newUrlParams = "?item=" + fields['item']; 173 } 174 175 window.history.replaceState(null, null, newUrlParams); 176 } 177 178 if (self.isLoading) 179 return; 180 181 self.isLoading = true; 182 CbUx.showLoader(); 183 $.ajax({ 184 'url': ENV.link_root + self.url, 185 'data': $.extend( 186 { 187 'p': self.page, 188 page_name: ENV.page 189 }, 190 fields 191 ) 192 }) 193 .done(function (data) { 194 $('#blog-nsh-more-button').show(); 195 self.isLastPage = false;
196 if (data.Results.length) { 197 self.render(data.Results); 198 if (self.useMasonry) 199 self.reloadMasonry(); 200 setTimeout(function () { 201 self.reloadMasonry(); 202 }, 250); 203 if (data.IsLastPage) { 204 self.isLastPage = true; 205 self.unbindInfiniteScroll(); 206 $('#blog-nsh-more-button').hide(); 207 } else { 208 self.bindInfiniteScroll(); 209 } 210 } else if (self.page === 1) { 211 // first page and no results, show not found message 212 self.notFound(); 213 if (self.useMasonry) 214 self.reloadMasonry(); 215 self.isLastPage = true; 216 self.unbindInfiniteScroll(); 217 } 218 219 self.showChangedValue(); 220 221 var lastPodcastFileId = null; 222 223 $('.open-podcast-player').unbind('click').on('click', function () { 224 var podcastPlayerContainer = $(this).find('.podcast-player'); 225 var podcastPlayerId = $(podcastPlayerContainer).attr('id'); 226 var podcastPlayer = videojs('#' + podcastPlayerId, { 227 autoplay: true 228 229 230 }); 231 232 233 var podcastFileId = $(this).data('podcast-file-id'); 234 235 podcastPlayer.one('ready', function () { 236 if (typeof _paq.push === 'function') { 237 _paq.push(['MediaAnalytics::scanForMedia']); 238 } 239 240 setTimeout(function () { 241 console.log(podcastPlayerContainer); 242 console.log('#' + podcastPlayerId + ' .vjs-play-control'); 243 244 if ($('#' + podcastPlayerId + ' .vjs-playing').length === 0) { 245 $('#' + podcastPlayerId + ' .vjs-play-control').click(); 246 } 247 }, 333); 248 249 250 }); 251 252 //fix autoplay bug in chrome 253 if ($(this).hasClass("not_running")) { 254 setTimeout(function () { 255 256 if ($('#' + podcastPlayerId + ' .vjs-playing').length === 0) { 257 $('#' + podcastPlayerId + ' .vjs-play-control').click(); 258 } 259 }, 333); 260 } 261 $(this).removeClass("not_running"); 262 263 264 $(this).find('.podcast-player-container').show(); 265 266 podcastPlayer.one('play', function () { 267 if (lastPodcastFileId !== podcastFileId) { 268 lastPodcastFileId = podcastFileId; 269 doxStatisticRegisterApplicationsFileDownload(podcastFileId); 270 } 271 }); 272 273 console.table("open podcast"); 274 275 276 277 }); 278 279 $(".copy-link-film-single").click(function (e) { 280// $('button#copy-link-film').unbind('click').on('click', function (e) { 281 $(this).find('.link-copied').css('display', 'block'); 282 $(this).find('#share-url').select(); 283 document.execCommand("copy"); 284 $(this).find('#share-url').css('display', 'block'); 285 e.stopPropagation(); 286 287 setTimeout(function () { 288 $('.link-copied').fadeOut(500); 289 }, 2000); 290 291 }); 292 293 if (typeof callback === 'function') 294 callback(data); 295 296 self.isLoading = false;
297 }) 298 .fail(CbUx.ajaxErrorEvent) 299 .always(CbUx.hideLoader); 300 }, 301 302 empty: function () { 303 var self = this; 304 self.$el.find(':not(.gutter-sizer)').remove(); 305 }, 306 307 notFound: function () { 308 var self = this; 309 self.empty(); 310 if (self.urlHasParameter) { 311 $('.blog-recommendations-title').remove(); 312 } else { 313 self.$el.append('<div class="magazine-results-status">' + ml('list_no_results') + '</div>'); 314 $('#blog-nsh-more-button').hide(); 315 } 316 }, 317 318 initMasonry: function () { 319 var self = this; 320 self.$el.imagesLoaded().always(function () { 321 self.$el.masonry({ 322 // options 323 itemSelector: '.grid-item', 324 columnWidth: 1, 325 rowHeight: '.grid-item', 326 gutter: '.gutter-sizer', 327 percentPosition: true 328 }); 329// self.$el.on('layoutComplete', function (event, items) { 330// console.log(items.length); 331// 332// $("#blog .grid-item:even").addClass("second-element"); 333// $("#blog .grid-item:odd").addClass("half-size-right"); 334// }); 335 }); 336 }, 337 338 reloadMasonry: function () { 339 var self = this; 340 self.$el.masonry('reloadItems'); 341 self.$el.imagesLoaded().always(function () { 342 self.$el.masonry('layout'); 343 }); 344 }, 345 346 getItemMarkup: function (item) { 347 if (item === null) 348 return ''; 349 350 var self = this; 351 352 var templateHtml = $(self.$itemTmpl).html(); 353// console.log(templateHtml); 354 355 return Mustache.render( 356 templateHtml, 357 $.extend( 358 item, 359 { 360 PlayButtonLabel: ml('show_film'), 361 DirectorLabel: ml('director_label'), 362 ScreenplayLabel: ml('screenplay_label'), 363 CameraLabel: ml('camera_label'), 364 ProducerLabel: ml('producer_label') 365 } 366 ) 367 ); 368 }, 369 370 showChangedValue: function () { 371 var category = ''; 372 $.each($('li.category-filter.active'), function (index, item) { 373 if (index > 0) { 374 category += ', '; 375 } 376 category += $(item).html(); 377 }); 378 $(".category-displayer").html(category); 379 380 var location = ''; 381 $.each($('li.location-filter.active'), function (index, item) { 382 if (index > 0) { 383 location += ', '; 384 } 385 location += $(item).html(); 386 }); 387 $(".location-displayer").html(location); 388 }, 389 390 render: function (items) { 391 var self = this, 392 markup = ''; 393 $.each(items, function (i, item) { 394 $(self.getItemMarkup(item)) 395 .hide() 396 .appendTo(self.$el) 397 .fadeIn(0); 398 }); 399 400 $('a.blog-detail-link.link-video').unbind('click').on('click', function (e) { 401 e.stopPropagation(); 402 e.preventDefault(); 403 var idFilm = $(this).attr('data-video-id'); 404 var scrollPosition = $(window).scrollTop(); 405// var imageFilm = $(this).attr('data-video-image'); 406// var videoContainer = $(this).parent().find('.video-player-container'); 407 function centerHomeFilmLayer() { 408 $('.film-layer__inner').css({ 409 top: Math.round(($(window).height() - $('.film-layer__inner').height()) / 2), 410 left: Math.round(($(window).width() - $('.film-layer__inner').width()) / 2) 411 }); 412 } 413 414 CbUx.showLoader(); 415 $.ajax({ 416 url: ENV.link_root + '/film.json', 417 cache: false, 418 data: { 419 id: idFilm 420 } 421 }) 422 .done(function (filmdetails) { 423 CbUx.hideLoader(); 424 PLAYER.create({ 425 config: 'default', 426 film: { 427 id: idFilm, 428 type: 'film6' 429 }, 430 video: { 431 width: 1240, 432 height: 697, 433 autoplay: false 434 } 435 }, function () { 436 var layer = 437 '<div class="film-layer">' + 438 '<div class="film-layer__inner">' + 439 '<a class="film-layer__video-close owl-film-layer
439-close icon icon-close" href="#"></a>' + 440 '</div>' + 441 '</div>'; 442 $(layer).hide().appendTo('body').fadeIn(400); 443 centerHomeFilmLayer(); 444 $('header .header-fixed-menu').hide(); 445 $('html,body').scrollTop(0); 446 $(window).resize(centerHomeFilmLayer); 447 $('.film-layer').on('click', function (e) { 448 if (!($(e.target).is('.film-layer__inner') || 449 $.contains(document.querySelector('.film-layer__inner'), e.target))) { 450 $(this).fadeOut(400, function () { 451 $(this).remove(); 452 }); 453 454 } 455 }); 456 $('.film-layer .film-layer__video-close.owl-film-layer-close').on('click', function (e) { 457 $('header .header-fixed-menu').show(); 458 $("html,body").animate({scrollTop: scrollPosition}, 300); 459 $('.film-layer').fadeOut(400, function () { 460 $(this).remove(); 461 }); 462 }); 463 // player ready 464 var vjs = this; 465 $(vjs.contentEl()).appendTo('.film-layer__inner'); 466 vjs.one('play', function () { 467 $('.film-layer').addClass('film-layer--playing'); 468 }); 469 }); 470 }); 471 return false; 472 }); 473 474 if (self.isFirstLoding === true && self.getUrlParam('item') !== null) { 475 var itemId = self.getUrlParam('item'); 476 setTimeout(function () { 477 if ($('.card-img[data-item-id="' + itemId + '"]').hasClass('open-podcast-player')) { 478 console.log('## OPEN PODCAST LAYER ##'); 479 self.openPodcastLayer(itemId); 480 481 482 483 setTimeout(function () { 484 $('.podcast-layer .vjs-play-control').click(); 485 486 }, 2000); 487 } else { 488 489 console.log('## OPEN VIDEO LAYER ##'); 490 $('.card-img[data-item-id="' + itemId + '"]').click(); 491 } 492 }, 1000); 493 } 494 self.isFirstLoding = false; 495 }, 496 497 openPodcastLayer: function (itemId) { 498 var card = $('.card-img[data-item-id="' + itemId + '"]'); 499 var podcastLayerTemplate = $('#podcast-layer-template').html(); 500 501 var podcastLayer = Mustache.render(podcastLayerTemplate, { 502 Title: $(card).data('title'), 503 Subtitle: $(card).data('subtitle'), 504 Text: $(card).data('text'), 505 DetailLink: $(card).data('detail-lin'), 506 DetailLinkTarget: $(card).data('detail-lin-target'), 507 DetailName: $(card).data('detail-lin-name'), 508 ShareUrl: $(card).data('share-url'), 509 Id: itemId, 510 PodcastUrl: $(card).data('podcast-url'), 511 MediaUrl: $(card).data('media-url'), 512 MediaTitelTag: $(card).data('media-title-tag'), 513 MediaAltTag: $(card).data('media-alt-tag'), 514 ShareText: ml('share_film_layer'), 515 CopyTitleText: ml('copy_podcast_layer'), 516 ClosePodcastLayer: ml('close_podcast_layer'), 517 LinkCopiedText: ml('link_copied_text'), 518 MediaUrl: $(card).data('media-url'), 519 MediaTitelTag: $(card).data('media-title-tag'), 520 MediaAltTag: $(card).data('media-alt-tag'), 521 }); 522 523 524 525 //centerPodcastLayer2(); 526 //$(window).resize(centerPodcastLayer2); 527 528 529 var scrollTopPosition = 0; 530 $(window).scroll(function () { 531 scrollTopPosition = $(this).scrollTop(); 532 }); 533 534 function centerPodcastLayer2() { 535 window_height = $(window).height(); 536 view_height = window_height - 112; 537 538 setTimeout(function () { 539 540 podcast_layer_inner_height = $(".podcast-layer__inner").height(); 541 offestTop = Math.round((window_height - podcast_layer_inner_height) / 2); 542 543 544 if (offestTop < 112) { 545 $('.podcast-layer__inner').css({ 546 'top': '112px', 547 'transform': 'translate(-50%, 0)' 548 }); 549 } else { 550 $('.podcast-layer__inner').css({ 551 'top': '50%', 552 'transform': 'translate(-50%, -50%)' 553 }); 554 } 555 }, 50); 556 } 557 558 559 //centerPodcastLayer(); 560 //$(window).resize(centerPodcastLayer); 561 562 563// function centerPodcastLayer() { 564// topPosition = scrollTopPosition + Math.round(($(window).height() - (620 + $('.podcast-layer-info').height())) / 2); 565// 566// if (Math.round(($(window).height() < 1050))) { 567// topPosition = scrollTopPosition + $('.site-header').height(); 568// console.log("ja"); 569// 570// } 571// $('.podcast-layer__inner').css({ 572// //top: Math.round(($(window).height() - ( $('.film-layer__inner').height() + $('.film-layer
572-info').height())) / 2), 573// top: topPosition 574// 575// }); 576// $('.podcast-layer__inner').addClass("no_transform"); 577//// console.log("window-height: " + $(window).height()); 578//// console.log( "film-layer__inner: " + $('.film-layer__inner').height() ); 579//// console.log( "film-layer-info: " + $('.film-layer-info').height() ); 580// } 581 582// console.log(podcastLayer); 583 $(podcastLayer).hide().appendTo('body').fadeIn(400); 584 585 var podcastPlayer = videojs('#podcast-layer-' + itemId, {autoplay: true}); 586 587 $('.podcast-layer .podcast-layer__video-close').unbind('click').on('click', function (e) { 588 podcastPlayer.dispose(); 589 $('.podcast-layer').remove(); 590 591 $('.bg-cover-page').fadeOut(400); 592 593 594 //remobe parameter after closing podcast/ layer 595 var current_url = window.location.href; 596 const urlObj = new URL(current_url); 597 urlObj.search = ''; 598 urlObj.hash = ''; 599 600 const result = urlObj.toString(); 601 window.history.replaceState(null, "", result); 602 603 604 }); 605 606 podcastPlayer.one('play', function () { 607 doxStatisticRegisterApplicationsFileDownload($(card).data('podcast-file-id')); 608 }); 609 610 611 var copyToClipboard = function (element) { 612 613 var $temp = $("<input>"); 614 615 $("body").append($temp); 616 $temp.val($(element).text()).select(); 617 document.execCommand("copy"); 618 $temp.remove(); 619 } 620 621 622 623 $('button#copy-link-podcast').click(function (e) { 624 $(this).find('.link-copied').css('display', 'block'); 625 $(this).find('#share-url').select(); 626 document.execCommand("copy"); 627 $(this).find('#share-url').css('display', 'block'); 628 e.stopPropagation(); 629 630 setTimeout(function () { 631 $('.link-copied').fadeOut(500); 632 }, 2000); 633 634 }); 635 } 636}; 637 638 639
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.