PageSourceSearch

https://berkanewecan.ma/wp-content/cache/wpfc-minified/215mfngh/1y5eo.js

js berkanewecan.ma collected 2026-10-03 18:50:04 UTC 6,902 bytes, 177 lines download raw bytes

1'use strict';
2const isPyr=document.querySelector('[data-playerid]')?.getAttribute('data-playerid');
3if(!isPyr){
4var scriptUrl='https:\/\/www.youtube.com\/s\/player\/9d15588c\/www-widgetapi.vflset\/www-widgetapi.js'; try { var ttPolicy=window.trustedTypes.createPolicy("youtube-widget-api", { createScriptURL: function (x){ return x }});scriptUrl=ttPolicy.createScriptURL(scriptUrl) } catch (e){ } var YT; if(!window["YT"]) YT={ loading: 0, loaded: 0 }; var YTConfig; if(!window["YTConfig"]) YTConfig={ "host": "https://www.youtube.com" };
5if(!YT.loading){
6YT.loading=1; (function (){
7var l=[]; YT.ready=function (f){ if(YT.loaded) f(); else l.push(f) }; window.onYTReady=function (){ YT.loaded=1; var i=0; for (; i < l.length; i++)try { l[i]() } catch (e){ }}; YT.setConfig=function (c){ var k; for (k in c) if(c.hasOwnProperty(k)) YTConfig[k]=c[k] }; var a=document.createElement("script"); a.type="text/javascript"; a.id="www-widgetapi-script"; a.src=scriptUrl; a.async=true; var c=document.currentScript; if(c){
8var n=c.nonce||c.getAttribute("nonce"); if(n) a.setAttribute("nonce",
9n)
10} var b=document.getElementsByTagName("script")[0]; b.parentNode.insertBefore(a, b)
11})()
12};}
13let adsConainers=document.querySelectorAll('[data-sponsored-id]');
14let container=document.querySelector('[data-sponsored-id]');
15const player=[];
16let playerIndex=0;
17adsConainers=Array.from(adsConainers);
18const getYTVideoId=(url)=> {
19if(typeof url!=='string'){
20return false;
21}
22const regex=/(?:youtube\.com\/(?:[^\/]+\/[^\/]+\/|(?:v|e(?:mbed)?)\/|[^#]*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/;
23const match=url.match(regex);
24if(match&&match[1]){
25return match[1];
26}
27return false;
28}
29const hashParentClass=(element, className)=> {
30var parent=element.parentNode;
31while (parent&&!parent.classList?.contains(className)){
32parent=parent.parentNode;
33}
34return !!parent;
35}
36const adInitialization=(adContainer, index)=> {
37if(!adContainer){
38return;
39}
40const adAtts=JSON.parse(atob(adContainer?.getAttribute('data-sponsored-attrs')));
41const blockId=adAtts.clientId;
42const blockIdMD5=adContainer.getAttribute('data-sponsored-id');
43const adStartAfter=adAtts.adStart * 1000;
44const adContent=adAtts.adContent;
45const adVideo=adContainer.querySelector('.ep-ad');
46const adSource=adAtts.adSource;
47const adVideos=[];
48const srcUrl=adAtts.url||adAtts.embedpress_embeded_link;
49const adSkipButtonAfter=parseInt(adAtts.adSkipButtonAfter);
50addWrapperForYoutube(adContainer, srcUrl, adAtts);
51adVideos.push(adVideo);
52const adTemplate=adContainer.querySelector('.main-ad-template');
53const progressBar=adContainer.querySelector('.progress-bar');
54const skipButton=adContainer.querySelector('.skip-ad-button');
55const adRunningTime=adContainer.querySelector('.sponsored-running-time');
56var playerId;
57const adMask=adContainer;
58let playbackInitiated=false;
59if(skipButton&&adSource!=='video'){
60skipButton.style.display='inline-block';
61}
62const hashClass=hashParentClass(adContainer, 'ep-content-protection-enabled');
63if(hashClass){
64adContainer.classList.remove('sponsored-mask');
65}
66adMask?.addEventListener('click', function (){
67if(adContainer.classList.contains('sponsored-mask')){
68playerId=adContainer.querySelector('[data-playerid]')?.getAttribute('data-playerid');
69if(typeof playerInit!=='undefined'&&playerInit.length > 0){
70playerInit[playerId]?.play();
71}
72if(getYTVideoId(srcUrl)){
73player[index]?.playVideo();
74}
75if(!playbackInitiated){
76setTimeout(()=> {
77if(adSource!=='image'){
78adContainer.querySelector('.ep-embed-content-wraper').classList.add('hidden');
79}
80adTemplate?.classList.add('sponsored-running');
81if(adVideo&&adSource==='video'){
82adVideo.muted=false;
83adVideo.play();
84}}, adStartAfter);
85playbackInitiated=true;
86}
87adContainer.classList.remove('sponsored-mask');
88}});
89adVideo?.addEventListener('timeupdate', ()=> {
90const currentTime=adVideo?.currentTime;
91const videoDuration=adVideo?.duration;
92if(currentTime <=videoDuration){
93const remainingTime=Math.max(0, videoDuration - currentTime);
94adRunningTime.innerText=Math.floor(remainingTime / 60) + ':' + (Math.floor(remainingTime) % 60).toString().padStart(2, '0');
95}
96if(!isNaN(currentTime)&&!isNaN(videoDuration)){
97const progress=(currentTime / videoDuration) * 100;
98progressBar.style.width=progress + '%';
99if(currentTime >=adSkipButtonAfter){
100skipButton.style.display='inline-block';
101}}
102});
103skipButton?.addEventListener('click', ()=> {
104adTemplate.remove();
105if(typeof playerInit!=='undefined'&&playerInit.length > 0){
106playerInit[playerId]?.play();
107}
108if(getYTVideoId(srcUrl)){
109player[index]?.playVideo();
110}
111adContainer.querySelector('.ep-embed-content-wraper').classList.remove('hidden');
112});
113adVideo?.addEventListener('play', ()=> {
114if(playerInit&&playerInit?.length > 0){
115playerInit[playerId]?.stop();
116}});
117adVideo?.addEventListener('ended', ()=> {
118adTemplate.remove();
119adContainer.querySelector('.ep-embed-content-wraper').classList.remove('hidden');
120});
121playerIndex++;
122}
123const isYoutubeChannel=(srcUrl)=> {
124const youtubeChannelRegex=/^(https?:\/\/)?(www\.)?youtube\.com\/(channel|user)\/[A-Za-z0-9_-]+\/?$/;
125return youtubeChannelRegex.test(srcUrl);
126};
127const addWrapperForYoutube=(adContainer, srcUrl, adAtts)=> {
128const youtubeIframe=adContainer.querySelector(`.ose-youtube iframe`);
129if(youtubeIframe&&getYTVideoId(srcUrl)){
130const divWrapper=document.createElement('div');
131divWrapper.className='ad-youtube-video';
132youtubeIframe.setAttribute('width', adAtts.width);
133youtubeIframe.setAttribute('height', adAtts.height);
134youtubeIframe.parentNode.replaceChild(divWrapper, youtubeIframe);
135divWrapper.appendChild(youtubeIframe);
136}}
137function onYouTubeIframeAPIReady(iframe, srcUrl, adVideo, index){
138if(iframe&&getYTVideoId(srcUrl)!==null){
139player[index]=new YT.Player(iframe, {
140videoId: getYTVideoId(srcUrl),
141events: {
142'onReady': (event)=> onPlayerReady(event, adVideo),
143}});
144}}
145function onPlayerReady(event, adVideo){
146adVideo?.addEventListener('ended', function (){
147event.target.playVideo();
148});
149adVideo?.addEventListener('play', function (){
150event.target.pauseVideo();
151});
152}
153if(adsConainers.length > 0&&embedpressFrontendData.isProPluginActive){
154window.onload=function (){
155let yVideos=setInterval(()=> {
156var youtubeVideos=document.querySelectorAll('.ose-youtube');
157if(youtubeVideos.length > 0){
158clearInterval(yVideos);
159youtubeVideos.forEach((yVideo, index)=> {
160const srcUrl=yVideo.querySelector('iframe')?.getAttribute('src');
161const adVideo=yVideo.closest('.sponsored-mask')?.querySelector('.ep-ad');
162const isYTChannel=yVideo.closest('.sponsored-mask')?.querySelector('.ep-youtube-channel');
163if(adVideo&&!isYTChannel){
164onYouTubeIframeAPIReady(yVideo, srcUrl, adVideo, index);
165}});
166}}, 100);
167};
168let ytIndex=0;
169adsConainers.forEach((adContainer, epAdIndex)=> {
170adContainer.setAttribute('data-ad-index', epAdIndex);
171adInitialization(adContainer, ytIndex);
172if(getYTVideoId(adContainer.querySelector('iframe')?.getAttribute('src'))){
173ytIndex++;
174}});
175}else{
176jQuery('.sponsored-mask').removeClass('sponsored-mask');
177};

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.