1// source --> https://www.die-weberei.de/wp-content/plugins/wp-livestream/public/js/wp-livestream-public.js?ver=1.9.2 2function createCookie(name, value, minutes) { 3 if (minutes) { 4 var date = new Date(); 5 date.setTime(date.getTime() + minutes * 60 * 1000); 6 var expires = "; expires=" + date.toGMTString(); 7 } else { 8 var expires = ""; 9 } 10 document.cookie = name + "=" + value + expires + "; path=/"; 11} 12 13function getCookie(c_name) { 14 var c_value = document.cookie, 15 c_start = c_value.indexOf(" " + c_name + "="); 16 if (c_start == -1) c_start = c_value.indexOf(c_name + "="); 17 if (c_start == -1) { 18 c_value = null; 19 } else { 20 c_start = c_value.indexOf("=", c_start) + 1; 21 var c_end = c_value.indexOf(";", c_start); 22 if (c_end == -1) { 23 c_end = c_value.length; 24 } 25 c_value = unescape(c_value.substring(c_start, c_end)); 26 } 27 return c_value; 28} 29 30(function ($) { 31 "use strict"; 32 // YouTube has disabled live chat on mobile devices, so hide it if the user agent reports a mobile device 33 $(document).ready(function () { 34 /* YouTube has completely disabled chat for now, so save this for later 35 if ( 36 /Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test( 37 navigator.userAgent 38 ) 39 ) { 40 $(".wp-block-embed-youtube-chat").hide(); 41 } 42 */ 43 44 // Only run if notifications are enabled. 45 if (wpls.notification_enable) { 46 wpls_check(); 47 } 48 function wpls_check() { 49 // REST API - Notification - Step #4 - Call our REST API and show/hide the notification based on the response 50 $.ajax({ 51 method: "GET", 52 url: wpls.restURL + "wplivestream/v1/notification", 53 data: { 54 post: wpls.postID, //pass the post ID to our notification endpoint 55 }, 56 beforeSend: function (xhr) { 57 // Here we set a header 'X-WP-Nonce' with the nonce as opposed to the nonce in the data object with admin-ajax 58 xhr.setRequestHeader("X-WP-Nonce", wpls.restNonce); 59 }, 60 success: function (response) { 61 //console.log("here it is:" + response + "end"); 62 var wpls_cookie_dismiss = getCookie("wpls-notification"); 63 64 if ( 65 response !== "" && 66 jQuery("figure.wpls").length === 0 &&
67 !wpls_cookie_dismiss 68 ) { 69 if (jQuery("#wpls-notification").length === 0) { 70 // code to run if it isn't there 71 jQuery("#wpls-notification-wrapper").html(response); 72 } else { 73 // code to run if it is there 74 jQuery("#wpls-notification").show(); 75 } 76 } else { 77 // hide the notification 78 jQuery("#wpls-notification").hide(); 79 } 80 }, 81 fail: function (response) { 82 console.log(response); 83 }, 84 }).then(function () { 85 // Get user defined frequency interval 86 var optionFrequency = wpls.frequency; 87 if ( 88 typeof optionFrequency === "undefined" || 89 optionFrequency === null || 90 optionFrequency === "" 91 ) { 92 var frequency = 60000; // default to 1 minute (60000 ms) 93 } else { 94 var frequency = parseInt(optionFrequency) * 1000; // format user input as milliseconds 95 } 96 // on completion, restart 97 setTimeout(wpls_check, frequency); // function refers to itself 98 }); 99 } 100 101 // Don't show live notification for 10 minutes if the user has clicked the X on the notification 102 $("#wpls-notification-wrapper").on( 103 "click", 104 "#wpls-hide-notification", 105 function () { 106 createCookie("wpls-notification", "dismissed", 10); 107 } 108 ); 109 }); 110})(jQuery);
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.