PageSourceSearch

https://yottaflex.ai/wp-content/plugins/bwd-elementor-addons/assets/public/js/masking-video.js?ver=4.4.2

js yottaflex.ai collected 2026-10-05 13:22:35 UTC 9,344 bytes, 280 lines download raw bytes

1"use strict";
2(() => {
3  function BWDVideoPopUp(videoBtn) {
4    //sticky video =====
5    const stickyVideoWrapper = videoBtn.querySelector(".bwdmv-mask-video");
6
7    const body = document.querySelector("body");
8    // element creator function
9    const elemCreator = (elem = "div") => {
10      return document.createElement(elem);
11    };
12    //attribute setter
13    const attrSetter = (elem, attr, val) => {
14      return elem.setAttribute(attr, val);
15    };
16
17    // function VideoMaker(){
18    function VideoMaker() {
19      // all video attributes
20      const youtubeUrl = videoBtn.getAttribute("data-youtube-url");
21      const vimeoUrl = videoBtn.getAttribute("data-vimeo-url");
22      const selfUrl = videoBtn.getAttribute("data-self-url");
23
24      let VideoTag;
25      const allAttribute = {
26        autoplay: videoBtn.getAttribute("data-autoplay"),
27        muted: videoBtn.getAttribute("data-mute"),
28        loop: videoBtn.getAttribute("data-loop"),
29        controls: videoBtn.getAttribute("data-control"),
30        privacy: videoBtn.getAttribute("data-privacy"),
31        poster: videoBtn.getAttribute("data-poster"),
32      };
33
34      // checking here type of the url
35      if (selfUrl) {
36        VideoTag = elemCreator("video");
37        const SourceTag = elemCreator("source");
38        attrSetter(SourceTag, "src", selfUrl);
39
40        // check video type and set
41        (() => {
42          if (selfUrl.includes("ogg")) {
43            attrSetter(SourceTag, "type", "video/ogg");
44          } else if (selfUrl.includes("mp4")) {
45            attrSetter(SourceTag, "type", "video/mp4");
46          } else if (selfUrl.includes("webm")) {
47            attrSetter(SourceTag, "type", "video/webm");
48          }
49        })();
50        //  video controls check & active
51        if (allAttribute.controls === "yes") {
52          attrSetter(VideoTag, "controls", "");
53        }
54        if (allAttribute.autoplay === "yes") {
55          attrSetter(VideoTag, "autoplay", "");
56          VideoTag.muted=true;
57          VideoTag.play();
58        }
59        if (allAttribute.muted === "yes") {
60          attrSetter(VideoTag, "muted", "muted");
61        }
62        if (allAttribute.loop === "yes") {
63          attrSetter(VideoTag, "loop", "");
64        }
65        if (allAttribute.poster) {
66          attrSetter(VideoTag, "poster", allAttribute.poster);
67        }
68		attrSetter(VideoTag, "controlslist", "nodownload");
69
70        VideoTag.appendChild(SourceTag);
71      } else if (youtubeUrl) {
72        let youTubeVUrl;
73        let videoId;
74        if (youtubeUrl.includes("watch")) {
75          // watch url
76          let videoIdFirstPosition = youtubeUrl.indexOf("?v=") + 3;
77         	 videoId = youtubeUrl.substr(videoIdFirstPosition, 11);
78
79           if(allAttribute.privacy === 'yes'){
80            youTubeVUrl = `https://www.youtube-nocookie.com/embed/${videoId}`;
81           }else{
82            youTubeVUrl = `https://www.youtube.com/embed/${videoId}`;
83           }
84
85        } else if(youtubeUrl.includes("youtu.be")) {
86          // share url
87          let shareVideoUrl = youtubeUrl + "mb";
88          let videoIdFirstPosition = shareVideoUrl.indexOf("youtu.be/") + 9;
89          let videoIdLastPosition = shareVideoUrl.lastIndexOf("mb");
90          	 videoId = shareVideoUrl.substring(
91            videoIdFirstPosition,
92            videoIdLastPosition
93          );
94          if(allAttribute.privacy === 'yes'){
95            youTubeVUrl = `https://www.youtube-nocookie.com/embed/${videoId}`;
96           }else{
97            youTubeVUrl = `https://www.youtube.com/embed/${videoId}`;
98           }
99        } else if (youtubeUrl.includes("embed")) {
100          // embed url
101
102          if(allAttribute.privacy === 'yes'){
103            // embed url
104            let videoIdFirstPosition = youtubeUrl.indexOf("embed") + 6;
105              videoId = youtubeUrl.substr(videoIdFirstPosition, 11);
106              youTubeVUrl = `https://www.youtube-nocookie.com/embed/${videoId}`;
107           }else{
108            youTubeVUrl = youtubeUrl;
109           }
110        }
111
112        // create i frame tag
113        VideoTag = document.createElement("iframe");
114        //youtube  video controls check & active
115        if (allAttribute.controls === "yes") {
116          youTubeVUrl = `${youTubeVUrl}?controls=1`;
117        } else {
118          youTubeVUrl = `${youTubeVUrl}?controls=0`;
119        }
120
121        if (allAttribute.autoplay === "yes") {
122          youTubeVUrl = `${youTubeVUrl}&autoplay=1`;
123        }
124
125        if (allAttribute.muted === "yes") {
126          youTubeVUrl = `${youTubeVUrl}&mute=1`;
127        }
128        if (allAttribute.loop === "yes") {
129          youTubeVUrl = `${youTubeVUrl}&playlist=${videoId}&loop=1`;
130        }
131        // for popup video
132        VideoTag.setAttribute("src", youTubeVUrl);
133        VideoTag.setAttribute(
134          "allow",
135          "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
136        );
137      } else if (vimeoUrl) {
138        // create i frame tag
139        let setVimeoUrl;
140        VideoTag = document.createElement("iframe");
141
142        let videoIdFirstPosition;
143        if (vimeoUrl.includes("video")) {
144          videoIdFirstPosition = vimeoUrl.indexOf("video/") + 6;
145        } else {
146          videoIdFirstPosition = vimeoUrl.indexOf("com/") + 4;
147        }
148        let videoId = vimeoUrl.substr(videoIdFirstPosition, 9);
149        setVimeoUrl = `https://player.vimeo.com/video/${videoId}`;
150
151        //vimeo  video controls check & active
152        if (allAttribute.controls === "yes") {
153          setVimeoUrl = `${setVimeoUrl}?controls=1`;
154        } else {
155          setVimeoUrl = `${setVimeoUrl}?controls=0`;
156        }
157
158        if (allAttribute.autoplay === "yes") {
159          setVimeoUrl = `${setVimeoUrl}&autoplay=1`;
160        }
161
162        if (allAttribute.muted === "yes") {
163          setVimeoUrl = `${setVimeoUrl}&muted=1`;
164        }
165
166        if (allAttribute.loop === "yes") {
167          setVimeoUrl = `${setVimeoUrl}&loop=1`;
168        }
169        VideoTag.setAttribute("src", setVimeoUrl);
170      }
171
172      // if any url or video have given
173      if (selfUrl || youtubeUrl || vimeoUrl) {
174        //sticky video render
175        stickyVideoWrapper.appendChild(VideoTag);
176        // when click on sticky video
177        if (videoBtn.getAttribute("data-lightbox") === "yes") {
178          videoBtn.addEventListener("click", (e) => {
179            e.preventDefault();
180
181            VideoTag.setAttribute("class", "bwd-video-wrapper");
182            //pop up before background
183            let popUpBefore = document.createElement("div");
184            popUpBefore.setAttribute("class", "bwd-popup-before");
185            // pop up element
186            let popUpElem = document.createElement("div");
187
188            // popup body style adding
189            popUpElem.setAttribute("class", `bwd-popUpBody`);
190
191            //cross button
192            let popUpCrossUp = document.createElement("i");
193            popUpCrossUp.setAttribute(
194              "class",
195              "fa fa-times bwd-popup-cross-btn"
196            );
197
198            //all append child
199            popUpElem.appendChild(popUpCrossUp);
200            popUpElem.appendChild(VideoTag);
201            body.appendChild(popUpBefore);
202            body.appendChild(popUpElem);
203            // click on cross btn to close popup
204            popUpCrossUp.addEventListener("click", (e) => {
205              e.preventDefault();
206              body.removeChild(popUpElem);
207              body.removeChild(popUpBefore);
208            });
209            popUpBefore.addEventListener("click", (e) => {
210              e.preventDefault();
211              body.removeChild(popUpElem);
212              body.removeChild(popUpBefore);
213            });
214          });
215        }
216      }
217    }
218    VideoMaker();
219  }
220
221
222  // videoPopup plyer
223  const videoPopupPlayer = () => {
224    let allvideoPopupVideoCommon = document.querySelectorAll(
225      ".bwdmv-video-mask-wrapper"
226    );
227    for (let item of allvideoPopupVideoCommon) {
228      BWDVideoPopUp(item);
229    }
230  };
231  // editMode active or not
232  let bwdvideoPopupEditModeObserver = (getEditMode) => {
233    // elementor render observing
234    const bwdvideoPopupObserver = new MutationObserver((mutations) => {
235      mutations.map((record) => {
236        if (record.addedNodes.length) {
237          record.addedNodes.forEach((singleItem) => {
238            if (singleItem.nodeName == "DIV") {
239              if (singleItem.querySelector(".bwdmv-video-mask-wrapper")) {
240                let observedItem = singleItem.querySelector(
241                  ".bwdmv-video-mask-wrapper"
242                );
243                BWDVideoPopUp(observedItem);
244              }
245            }
246          });
247        }
248      });
249    });
250
251    bwdvideoPopupObserver.observe(getEditMode, {
252      subtree: true,
253      childList: true,
254    });
255  };
256  // edit mode checker
257  (() => {
258    let bwdMyInterValId;
259    if (
260      document.querySelector(".elementor-edit-area") ||
261      document.querySelector(".bwdmv-video-mask-wrapper")
262    ) {
263      videoPopupPlayer();
264    } else {
265      bwdMyInterValId = setInterval(() => {
266        let bwdElementorEditArea = document.querySelector(
267          ".elementor-edit-area"
268        );
269        if (bwdElementorEditArea) {
270          clearInterval(bwdMyInterValId);
271          // play ===============
272          bwdvideoPopupEditModeObserver(bwdElementorEditArea);
273        }
274      }, 300);
275    }
276  })();
277
278
279
280})();

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.