1if (ENV.page != 'stream') { 2 3 jQuery(document).ready(function ($) { 4 5 var initScrollPos = 0; 6 var isScreener = $('body').hasClass('page-screenings') || $('body').hasClass('page-film-detail'); 7 var doPlaytimeCheck30 = false; 8 9 function getPiwik() { 10 var result = null; 11 if (typeof Piwik !== 'undefined') { 12 result = Piwik.getTracker( 13 ("https:" == document.location.protocol ? "https" : "http") + 14 "://stat.culturebase.org/piwik.php", 15 80 16 ); 17 } 18 return result; 19 } 20 21 function getUrlParam(paramName) { 22 var searchUrl = decodeURIComponent(window.location.search.substring(1)); 23 var urlComponents = searchUrl.split('&'); 24 // array with a key and a value 25 var urlComponent; 26 var i; 27 28 for (i = 0; i < urlComponents.length; i++) { 29 urlComponent = urlComponents[i].split('='); 30 31 if (urlComponent[0] === paramName) { 32 return urlComponent[1]; 33 } 34 } 35 36 return null; 37 } 38 39 $(".copy-link-film-single").click(function (e) { 40// $('button#copy-link-film').unbind('click').on('click', function (e) { 41 $(this).find('.link-copied').css('display', 'block'); 42 $(this).find('#share-url').select(); 43 document.execCommand("copy"); 44 $(this).find('#share-url').css('display', 'block'); 45 e.stopPropagation(); 46 47 setTimeout(function () { 48 $('.link-copied').fadeOut(500); 49 }, 2000); 50 51 }); 52 53 function createFilmLayer(vjs, filmDetails, template, data, idOffer, config) { 54 var links = ""; 55 var templateData = {}; 56 57 var idProjectProfile = ENV.stream_stat_project_id; 58 var urlReferrer = window.location.href; 59 var statId = null; 60 var lastPlaytime = null; 61 var playerIdOffer = idOffer; 62 doPlaytimeCheck30 = true; 63 64 // clean up before adding a new layer 65 $('.film-layer').remove(); 66 67// if (filmDetails) { 68// $.each(filmDetails.RegiePersons, function (index, item) { 69// if (index !== 0) { 70// links += ", "; 71// } 72// links += '<a href="' + item.Link + '" class="film-layer__meta__persons__person"'; 73// links += (isScreener ? ' target="_blank"' : '') + '>'; 74// links += item.Name + '</a>'; 75// }); 76// 77// templateData = { 78// Title: filmDetails.Title, 79// RegiePersonText: filmDetails.RegiePersonsText, 80// MoreInfoLink: filmDetails.MoreInfoLink, 81// MoreInfoText: filmDetails.MoreInfoLinkText, 82// ClipDuration: filmDetails.ClipDuration, 83// FilmDuration: filmDetails.FilmDuration, 84// Links: links, 85// DocumentRoot: filmDetails.DocumentRoot 86// }; 87// } 88 89 $(Mustache.render( 90 template, 91 config 92 )).hide().appendTo('body').fadeIn(400); 93 94 $('.bg-cover-page').fadeIn(400); 95 96 97 98 // save current scroll position 99// initScrollPos = $(window).scrollTop(); 100// $('html,body').animate({ 101// scrollTop: 0 102// }, 500); 103 //centerFilmLayer(); 104 105 //$(window).resize(centerFilmLayer); 106 107// centerFilmLayer2(); 108// $(window).resize(centerFilmLayer2); 109 110 $('.film-layer').on('click', function (e) { 111 if (!($(e.target).is('.film-layer__inner') || 112 $.contains(document.querySelector('.film-layer__inner'), e.target))) { 113 $(this).fadeOut(400, function () { 114 $(this).remove(); 115 }); 116 $('.bg-cover-page').fadeOut(400, function () { 117 $(this).remove(); 118 }); 119 120 } 121 }); 122 123 $("button#copy-link-film").click(function (e) { 124// $('button#copy-link-film').unbind('click').on('click', function (e) { 125 $(this).find('.link-copied').css('display', 'block'); 126 $(this).find('#share-url').select(); 127 document.execCommand("copy"); 128 $(this).find('#share-url').css('display', 'block'); 129 e.stopPropagation(); 130 131 setTimeout(function () { 132 $('.link-copied').fadeOut(500); 133 }, 2000); 134 135 }); 136 137 $('.film-layer__video-close').on('click', function (e) { 138 e.preventDefault(); 139 e.stopPropagation(); 140 $('.film-layer').fadeOut(400, function () { 141 $(this).remove(); 142// $('html,body').animate({ 143// scrollTop: initScrollPos 144// }, 500); 145 }); 146 doPlaytimeCheck = false;
147 doPlaytimeCheck30 = false; 148 $('.bg-cover-page').fadeOut(400, function () { 149 $(this).remove(); 150 }); 151 $("body").removeClass("overflow-hidden"); 152 153 //remobe parameter after closing video layer 154 var current_url = window.location.href; 155 const urlObj = new URL(current_url); 156 urlObj.search = ''; 157 urlObj.hash = ''; 158 159 const result = urlObj.toString(); 160 window.history.replaceState(null, "", result); 161 162 return false; 163 }); 164 165 function registerPlayTime(playtime, playtimeDiff) { 166 167 console.log("statId: " + statId); 168 console.log("playtime: " + playtime); 169 console.log("playtimeDiff: " + playtimeDiff); 170 171 var statUrl = "/player/api/stream_stat"; 172 173 var body = { 174 m: "update_playtime", 175 offer_id: statId, 176 playtime: playtime, 177 playtime_diff: playtimeDiff 178 }; 179 180 $.get(statUrl, body, function () { 181// console.log("SUCCESS GET"); 182 }); 183 184 } 185 186 // player ready 187 $(vjs.contentEl()).prependTo('.film-layer__inner'); 188 189// if (typeof _paq.push === 'function') { 190// _paq.push(['MediaAnalytics::scanForMedia']); 191// } 192 193 var playButton = $('.vjs-big-play-button'); 194 195 196// $('button#copy-link-film').unbind('click').on('click', function () { 197// $('.link-copied').css('display', 'block'); 198// $('#share-url').select(); 199// document.execCommand("copy"); 200// $('#share-url').css('display', 'block'); 201// 202// setTimeout(function () { 203// $('.link-copied').fadeOut(500); 204// }, 2000); 205// 206// }); 207 208 var enablePlayButton = function () { 209 if (isScreener && data.source === null) { 210 // film not allowed, show message, close video 211 if (ENV.auth !== null) { 212 CbUx.showMessage('film_not_allowed_text', 'film_not_allowed_header'); 213 } else { 214 ENV.openLogin('film_not_allowed'); 215 } 216 $('.film-layer').fadeOut(400); 217 } else { 218 vjs.one('play', function () { 219 waitForInactivity(); 220 isVideoPlaying(); 221 if (isScreener && data.source === null) { 222 // film not allowed, show message, close video 223 if (ENV.auth !== null) { 224 CbUx.showMessage('film_not_allowed_text', 'film_not_allowed_header'); 225 } else { 226 ENV.openLogin(); 227 } 228 $('.film-layer').fadeOut(400); 229 } else { 230 $('.film-layer').addClass('film-layer--playing'); 231 var piwikTracker = getPiwik(); 232 if (piwikTracker && isScreener) { 233 piwikTracker.trackEvent(['Screenings-2018-Video', filmDetails.Title, 'Player', 'Play']); 234 } 235 } 236 237 function playtimeCheck30() { 238 if (doPlaytimeCheck30) { 239 var currentTime = vjs.currentTime(); 240 var playtimeDiff = 30; 241 if (lastPlaytime === null) { 242 playtimeDiff = currentTime; 243 } else if (currentTime >= lastPlaytime) { 244 playtimeDiff = currentTime - lastPlaytime; 245 if (playtimeDiff > 30) { 246 playtimeDiff = 30; 247 } 248 } 249 250 lastPlaytime += playtimeDiff; 251 252 registerPlayTime(currentTime, playtimeDiff); 253 254 setTimeout(function () { 255 playtimeCheck30(); 256 }, 30000); 257 } 258 } 259 setTimeout(function () { 260 playtimeCheck30(); 261 }, 30000); 262 263 function registerPlay() { 264 var body = { 265 m: 'play_start', 266 offer_id: idOffer, 267 project_profile_id: idProjectProfile, 268 url_referrer: urlReferrer 269 }; 270 271 $.get("/player/api/stream_stat", body, function (DataStatId) { 272 statId = DataStatId; 273 }); 274 } 275 276 registerPlay(); 277 }); 278 279 vjs.play(); 280 281 vjs.one('ended', function () { 282 doPlaytimeCheck = false;
283 doPlaytimeCheck30 = false; 284 285 var currentTime = vjs.currentTime(); 286 var playtimeDiff = 30; 287 if (lastPlaytime === null) { 288 playtimeDiff = currentTime; 289 } else if (currentTime >= lastPlaytime) { 290 playtimeDiff = currentTime - lastPlaytime; 291 if (playtimeDiff > 30) { 292 playtimeDiff = 30; 293 } 294 } 295 296 lastPlaytime += playtimeDiff; 297 298 registerPlayTime(currentTime, playtimeDiff); 299 300 function registerEnded() { 301 $.ajax({ 302 type: "GET", 303 url: "/player/api/stream_stat?m=play_ended&offer_id=" + statId, 304 data: data, 305 success: function () {}, 306 dataType: JSON 307 }); 308 } 309 310 registerEnded(); 311 }); 312 313 vjs.one('error', function () { 314 doPlaytimeCheck = false; 315 doPlaytimeCheck30 = false; 316 }); 317 } 318 319 320 }; 321 322 var checkRegisterLoadingState = function () { 323 console.log(REGISTER.config.authDataIsLoading); 324 if (ENV.authDataIsLoading === false) { 325 playButton.prop('disabled', ''); 326 enablePlayButton(); 327 } else { 328 setTimeout(checkRegisterLoadingState, 500); 329 } 330 }; 331 332// if (ENV.authDataIsLoading !== false) { 333// playButton.prop('disabled', 'disabled');
334// checkRegisterLoadingState(); 335// } else { 336 enablePlayButton(); 337// } 338 339 $('.film-layer__video-info-btn').on('click', function (e) { 340 $('.film-layer__title').addClass("active"); 341 $('.film-layer__meta').addClass("active"); 342 waitForInactivity(e); 343 isVideoPlaying(e); 344 }); 345 } 346 347 348 349 var scrollTopPosition = 0; 350 $(window).scroll(function () { 351 scrollTopPosition = $(this).scrollTop(); 352 }); 353 function centerFilmLayer() { 354 topPosition = scrollTopPosition + Math.round(($(window).height() - (620 + $('.film-layer-info').height())) / 2); 355// FilmLayerHeight = $('.film-layer__inner').height(); 356// console.log("FilmLayerHeight: " + FilmLayerHeight); 357// ScreenHeight = $(window).height() - 111; 358// console.log("ScreenHeight: " + ScreenHeight); 359 360 console.log(topPosition); 361 362 if (Math.round(($(window).height() < 1100))) { 363 topPosition = scrollTopPosition + $('.site-header').height(); 364 } 365 $('.film-layer__inner').css({ 366 367 top: topPosition 368 }); 369 } 370 371 function centerFilmLayer2() { 372 window_height = $(window).height(); 373 view_height = window_height - 112; 374 375 setTimeout(function () { 376 377 podcast_layer_inner_height = $(".film-layer__inner").height(); 378 offestTop = Math.round((window_height - podcast_layer_inner_height) / 2); 379 380 381 if (offestTop < 112) { 382 $('.film-layer__inner').css({ 383 'top': '112px', 384 'transform': 'translate(-50%, 0)' 385 }); 386 } else { 387 $('.film-layer__inner').css({ 388 'top': '50%', 389 'transform': 'translate(-50%, -50%)' 390 }); 391 } 392 }, 50); 393 } 394 395 var toID; 396 function waitForInactivity(e) { 397 //console.log("HAllo "); 398 var targetParent = $(".film-layer"); 399 var player = targetParent.find('.video-js'); 400// var metaContainer = targetParent.find('.film-layer__meta'); 401 if (player.hasClass("vjs-user-inactive") /** && !metaContainer.is(":hover")*/) { 402 $('.player-icon-wrapper').removeClass("active"); 403 } else { 404 $('.player-icon-wrapper').addClass("active"); 405 } 406 407 if ($(targetParent).length === 0) { 408 clearTimeout(toID); 409 } else { 410 toID = setTimeout(function () { 411 waitForInactivity(e); 412 }, 800); 413 } 414 415 416 } 417 418 function isVideoPlaying(e) { 419 var targetParent = $(".film-layer"); 420 var player = targetParent.find('.video-js'); 421 if (player.hasClass("vjs-playing") /** && !metaContainer.is(":hover")*/) { 422 423 $('.film-layer__inner').addClass("film_is_playing"); 424 } else { 425 $('.film-layer__inner').removeClass("film_is_playing"); 426 } 427 if ($(targetParent).length === 0) { 428 clearTimeout(toID); 429 } else { 430 toID = setTimeout(function () { 431 isVideoPlaying(e); 432 }, 800); 433 } 434 } 435 436 window.LayerPlayer = { 437 init: function (config) { 438 CbUx.showLoader(); 439 PLAYER.create({ 440 config: 'default', 441 id_offer: config.id_offer, 442 film: { 443 id: config.id_film, 444 type: 'film6', 445 }, 446 video: { 447 width: 1280, 448 height: 720 449 } 450 }, function (data) { 451 CbUx.hideLoader(); 452 // this refers to the PLAYER instance 453 createFilmLayer(this, config.film_details, config.template, data, config.id_offer, config); 454 }); 455 } 456 457 }; 458// $('body').on('click', '.open-stream-media-layer, .mediathek-share-link', function (e) { 459 $('body').on('click', '.open-stream-media-layer', function (e) { 460 $("body").addClass("overflow-hidden"); 461// $(".bg-cover-page , .film-layer").css("opacity", "1"); 462 e.preventDefault(); 463 464 CbUx.showLoader(); 465 var idFilm = $(this).attr('data-film-id'); 466 var idOffer = $(this).attr('data-offer-id'); 467 468 var title = $(this).attr('data-title'); 469 var subtitle = $(this).data('subtitle'); 470 var text = $(this).data('text'); 471 var detailLink = $(this).data('detail-lin'); 472 var detailLinkTarget = $(this).data('detail-lin-target'); 473 var detailName = $(this).data('detail-lin-name'); 474// var detailName = $(this).data(''); 475 var shareUrl = $(this).data('share-url'); 476 477 var mediaUrl = $(this).data('media-url'); 478 var mediaTitleTag = $(this).data('media-title-tag'); 479 var mediaAltTag = $(this).data('media-alt-tag'); 480 481 $.ajax({ 482 url: ENV.link_root + '/film.json', 483 cache: false, 484 data: { 485 m: 'get_film_details_for_layer', 486 id: idFilm, 487 // fetch unpublished films as well 488 all_films: 1, 489 is_screenings: 1 490 } 491 }) 492 .done(function (filmDetails) { 493 LayerPlayer.init({ 494 id_film: idFilm, 495 id_offer: idOffer, 496 film_details: filmDetails,
497 template: $('#offer-film-layer-template').html(), 498 Title: title, 499 Subtitle: subtitle, 500 Text: text, 501 DetailLink: detailLink, 502 DetailLinkTarget: detailLinkTarget, 503 DetailName: detailName, 504 ShareUrl: shareUrl, 505 ShareText: ml('share_film_layer'), 506 CopyTitleText: ml('copy_film_layer'), 507 CloseFilmLayer: ml('close_film_layer'), 508 LinkCopiedText: ml('link_copied_text'), 509 MediaUrl: mediaUrl, 510 MediaTitelTag: mediaTitleTag, 511 MediaAltTag: mediaAltTag, 512 }); 513 }); 514 515// setTimeout(function () { 516// $(".bg-cover-page , .film-layer").css("opacity", "1"); 517// }, 1000); 518 519 }); 520 521//open Podcast Layer RSC 250916 522 523 if (ENV.page === "programm") { 524 525 var isFirstLoding = true; 526 if (isFirstLoding === true && getUrlParam('item') !== null) { 527 528 var itemId = getUrlParam('item'); 529 530 setTimeout(function () { 531 if ($('.card-img[data-item-id="' + itemId + '"]').hasClass('open-podcast-player')) { 532 console.log('## OPEN PODCAST LAYER ##'); 533 openPodcastLayer(itemId); 534 } else { 535 $('.card-img[data-item-id="' + itemId + '"]').click(); 536 } 537 }, 1000); 538 } 539 isFirstLoding = false; 540 } 541 542 543 544 function openPodcastLayer(itemId) { 545 var card = $('.card-img[data-item-id="' + itemId + '"]'); 546 var podcastLayerTemplate = $('#podcast-layer-template').html(); 547 548 var podcastLayer = Mustache.render(podcastLayerTemplate, { 549 Title: $(card).data('title'), 550 Subtitle: $(card).data('subtitle'), 551 Text: $(card).data('text'), 552 DetailLink: $(card).data('detail-lin'), 553 DetailLinkTarget: $(card).data('detail-lin-target'), 554 DetailName: $(card).data('detail-lin-name'), 555 ShareUrl: $(card).data('share-url'), 556 Id: itemId, 557 PodcastUrl: $(card).data('podcast-url'), 558 MediaUrl: $(card).data('media-url'), 559 MediaTitelTag: $(card).data('media-title-tag'), 560 MediaAltTag: $(card).data('media-alt-tag'), 561 ShareText: ml('share_film_layer'), 562 CopyTitleText: ml('copy_podcast_layer'), 563 ClosePodcastLayer: ml('close_podcast_layer'), 564 LinkCopiedText: ml('link_copied_text'), 565 MediaUrl: $(card).data('media-url'), 566 MediaTitelTag: $(card).data('media-title-tag'), 567 MediaAltTag: $(card).data('media-alt-tag'), 568 }); 569 570 571 console.log(podcastLayer); 572 $(podcastLayer).hide().appendTo('body').fadeIn(400); 573 574 var podcastPlayer = videojs('#podcast-layer-' + itemId, {autoplay: true}); 575 576 $('.podcast-layer .podcast-layer__video-close').unbind('click').on('click', function (e) { 577 podcastPlayer.dispose(); 578 $('.podcast-layer').remove(); 579 580 $('.bg-cover-page').fadeOut(400); 581 582 $("body").removeClass("overflow-hidden"); 583 return false; 584 }); 585 586 podcastPlayer.one('play', function () { 587 doxStatisticRegisterApplicationsFileDownload($(card).data('podcast-file-id')); 588 }); 589 590 591 var copyToClipboard = function (element) { 592 593 var $temp = $("<input>"); 594 595 $("body").append($temp); 596 $temp.val($(element).text()).select(); 597 document.execCommand("copy"); 598 $temp.remove(); 599 } 600 601 602 $('button#copy-link-podcast').click(function (e) { 603 $(this).find('.link-copied').css('display', 'block'); 604 $(this).find('#share-url').select(); 605 document.execCommand("copy"); 606 $(this).find('#share-url').css('display', 'block'); 607 e.stopPropagation(); 608 609 setTimeout(function () { 610 $('.link-copied').fadeOut(500); 611 }, 2000); 612 613 }); 614 615 } 616// $('.page-programm .open-podcast-player, .page-programm .mediathek-share-link').unbind('click').on('click', function (e) { 617 $('.page-programm .open-podcast-player , .page-home .open-podcast-player').unbind('click').on('click', function (e) { 618 619 $("body").addClass("overflow-hidden"); 620 e.preventDefault(); 621 622 var podcast_ID = $(this).attr('data-item-id'); 623 openPodcastLayer(podcast_ID); 624 }); 625 626// $('body').on('click', '.open-podcast-player .mediathek-share-link', function (e) { 627// e.preventDefault(); 628// 629// CbUx.showLoader(); 630// var idPodcast = $(this).parent().attr('data-item-id'); 631// var idOffer = $(this).parent().attr('data-offer-id'); 632// var podcastLayerTemplate = $('#podcast-layer-template').html(); 633// 634// var title = $(this).parent().attr('data-title'); 635// var subtitle = $(this).parent().data('subtitle'); 636// var text = $(this).parent().data('text'); 637// var detailLink = $(this).parent().data('detail-lin'); 638// var detailLinkTarget = $(this).parent().data('detail-lin-target'); 639// var detailName = $(this).parent().data('detail-lin-name'); 640// var shareUrl = $(this).parent().data('share-url'); 641// var mediaUrl = $(this).parent().data('media-url'); 642// var podcastUrl = $(this).parent().data('data-podcast-url'); 643// 644// 645// var podcastLayer = Mustache.render(podcastLayerTemplate, { 646// Title: title, 647// Subtitle: subtitle, 648// Text: text, 649// DetailLink: detailLink, 650// DetailLinkTarget: detailLinkTarget, 651// DetailName: detailName, 652// ShareUrl: shareUrl, 653// Id: idPodcast, 654// ClosePodcastLayer: ml('close_podcast_layer'), 655// LinkCopiedText: ml('link_copied_text'), 656// CopyTitleText: ml('copy_podcast_layer'), 657// MediaUrl: mediaUrl, 658// PodcastUrl: podcastUrl 659// }); 660// 661// console.log(podcastLayer); 662// $(podcastLayer).hide().appendTo('body').fadeIn(400); 663// 664// var podcastPlayer = videojs('#podcast-layer-' + idPodcast, {autoplay: true}); 665// 666// 667// $('.podcast-layer .podcast-layer__video-close').unbind('click').on('click', function (e) {
668// podcastPlayer.dispose(); 669// $('.podcast-layer').remove(); 670// 671// $('.bg-cover-page').fadeOut(400); 672// }); 673// 674// podcastPlayer.one('play', function () { 675// doxStatisticRegisterApplicationsFileDownload($(card).data('podcast-file-id')); 676// }); 677// 678// }); 679 680// 681// 682////LGO: funktioniert. aber muss noch geprüft werden ob es überall geht auf der Home mit meheren Elementen 683// $('.page-programm .open-podcast-player').unbind('click').on('click', function () { 684// var podcast_ID = $(this).attr('data-item-id'); 685// 686// var podcastPlayerId = 'podcast-' + podcast_ID; 687// var podcastPlayer = videojs(podcastPlayerId, { 688// autoplay: false 689// }); 690// 691// console.log({1: "1", podcast_ID}); 692// 693//// var podcastFileId = $(this).data('podcast-file-id'); 694//// var bigPlayButton = $(this).find('.vjs-big-play-button'); 695//// 696//// bigPlayButton.on('click', function(){ 697//// if ($('#' + podcastPlayerId + ' .vjs-playing').length === 0) { 698//// $('#' + podcastPlayerId + ' .vjs-play-control').click(); 699//// } 700//// }); 701// 702// podcastPlayer.one('ready', function () { 703// 704// console.log('###_2'); 705// 706//// if (typeof _paq.push === 'function') { 707//// _paq.push(['MediaAnalytics::scanForMedia']); 708//// } 709// 710// setTimeout(function () { 711//// console.log('podcastPlayerContainer' + podcastPlayerContainer); 712// console.log('#' + podcastPlayerId + ' .vjs-play-control'); 713// 714// if ($('#' + podcastPlayerId + ' .vjs-playing').length === 0) { 715// $('#' + podcastPlayerId + ' .vjs-play-control').click(); 716// console.log('###_2_2'); 717// } 718// 719//// if (lastPodcastFileId !== podcastFileId) { 720//// lastPodcastFileId = podcastFileId; 721//// doxStatisticRegisterApplicationsFileDownload(podcastFileId); 722//// } 723// 724// }, 333); 725// }); 726// 727//// $('.bg-cover-page').hide(); 728// $(this).find('.podcast-player-container').show(); 729// $(this).find('.vjs-big-play-button').hide(); 730// 731//// podcastPlayer.one('play', function () { 732////
733//// console.log('Podcast play'); 734//// if (lastPodcastFileId !== podcastFileId) { 735//// lastPodcastFileId = podcastFileId; 736//// doxStatisticRegisterApplicationsFileDownload(podcastFileId); 737//// } 738//// 739//// }); 740// 741// podcastPlayer.one('pause', function () { 742// 743// console.log('Podcast paused'); 744// $('.open-podcast-player').find('.vjs-big-play-button').hide(); 745// }); 746// 747// }); 748// 749 750 751 }); 752 753}
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.