Plugin Directory

Changeset 3027450


Ignore:
Timestamp:
01/26/2024 05:18:15 PM (2 years ago)
Author:
RAD_
Message:

v1.4.0

Location:
simple-lazy-load-videos/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • simple-lazy-load-videos/trunk/assets/css/main.full.css

    r2996110 r3027450  
    33 */
    44/* ==|== primary styles =====================================================
    5   Authors: Valerii Bohdanov
    6   ========================================================================== */
     5    Authors: Valerii Bohdanov
     6    ========================================================================== */
    77/**
    88 * Project only code
  • simple-lazy-load-videos/trunk/assets/js/scripts.js

    r2874846 r3027450  
    1 "use strict";!function(){function stop_all_video(){const videos=document.querySelectorAll(".sllv-video.-state_started");videos.length>0&&videos.forEach((video=>{video.querySelector(".sllv-video__iframe").remove(),video.classList.remove("-state_started")}))}!function(){const videos=document.querySelectorAll(".sllv-video");videos.length>0&&videos.forEach((video=>{!function(video){const link=video.querySelector(".sllv-video__link"),provider=video.getAttribute("data-provider"),id=video.getAttribute("data-video");video.addEventListener("click",(()=>{const iframe=function(provider,id){const iframe=document.createElement("iframe");return iframe.setAttribute("allowfullscreen",""),iframe.setAttribute("allow","autoplay"),iframe.setAttribute("src",function(provider,id){let url="";"youtube"==provider?url="https://www.youtube.com/embed/"+id+"?rel=0&showinfo=0&autoplay=1":"vimeo"==provider&&(url="https://player.vimeo.com/video/"+id+"?autoplay=1");return url}(provider,id)),iframe.classList.add("sllv-video__iframe"),iframe}(provider,id);stop_all_video(),function(){const html_media=document.querySelectorAll("video, audio");html_media.length>0&&html_media.forEach((media=>{media.pause()}))}(),video.appendChild(iframe),video.classList.add("-state_started")})),link.removeAttribute("href"),video.classList.add("-state_enabled")}(video)}))}(),document.querySelectorAll("video, audio").forEach((media=>{media.addEventListener("play",(()=>{stop_all_video()}))}))}();
     1"use strict";!function(){function find_videos(){const videos=document.querySelectorAll(".sllv-video");videos.length>0&&videos.forEach((video=>{video.classList.contains("-state_enabled")||function(video){const link=video.querySelector(".sllv-video__link"),provider=video.getAttribute("data-provider"),id=video.getAttribute("data-video");video.addEventListener("click",(()=>{const iframe=function(provider,id){const iframe=document.createElement("iframe");return iframe.setAttribute("allowfullscreen",""),iframe.setAttribute("allow","autoplay"),iframe.setAttribute("src",function(provider,id){let url="";"youtube"==provider?url="https://www.youtube.com/embed/"+id+"?rel=0&showinfo=0&autoplay=1":"vimeo"==provider&&(url="https://player.vimeo.com/video/"+id+"?autoplay=1");return url}(provider,id)),iframe.classList.add("sllv-video__iframe"),iframe}(provider,id);stop_all_video(),function(){const html_media=document.querySelectorAll("video, audio");html_media.length>0&&html_media.forEach((media=>{media.pause()}))}(),video.appendChild(iframe),video.classList.add("-state_started")})),link.removeAttribute("href"),video.classList.add("-state_enabled")}(video)}))}function stop_all_video(){const videos=document.querySelectorAll(".sllv-video.-state_started");videos.length>0&&videos.forEach((video=>{video.querySelector(".sllv-video__iframe").remove(),video.classList.remove("-state_started")}))}find_videos(),document.querySelectorAll("video, audio").forEach((media=>{media.addEventListener("play",(()=>{stop_all_video()}))})),jQuery(document).ajaxComplete((function(event,request,settings){setTimeout((function(){find_videos()}),500)}))}();
  • simple-lazy-load-videos/trunk/includes/class-plugin.php

    r2996110 r3027450  
    5858            add_filter( 'embed_oembed_html', array( $this, 'change_oembed_html' ), 10, 4 );
    5959
     60            // Change video oEmbed HTML for BuddyPress.
     61            add_filter( 'bp_embed_oembed_html', array( $this, 'bp_change_oembed_html' ), 10, 4 );
     62
    6063            // Add shortcodes.
    6164            add_shortcode( 'sllv_video', array( $this, 'shortcode' ) );
     
    159162                ) );
    160163
    161                 // replace default HTML by custom if exist.
     164                // Replace default HTML by custom if exist.
    162165                if ( $html ) {
    163166                    $cache = $html;
    164167                }
     168            }
     169
     170            return $cache;
     171        }
     172
     173
     174        /**
     175         * Change video oEmbed HTML for BuddyPress.
     176         *
     177         * @since 1.4.0
     178         *
     179         * @param  string $cache   Cached HTML markup for embed.
     180         * @param  string $url     The URL being embedded.
     181         * @param  array  $attr    Parsed shortcode attributes.
     182         * @param  array  $rawattr Unparased shortcode attributes.
     183         * @return string          The returned oEmbed HTML.
     184         */
     185        public function bp_change_oembed_html( $cache, $url, $attr, $rawattr ) {
     186            $template = new \SLLV\Template();
     187
     188            // Get oEmbed HTML from URL.
     189            $html = $template->get_html_from_url( array(
     190                'url' => $url,
     191            ) );
     192
     193            // Replace default HTML by custom if exist.
     194            if ( $html ) {
     195                $cache = $html;
    165196            }
    166197
  • simple-lazy-load-videos/trunk/readme.txt

    r2996110 r3027450  
    44Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=V5Q9SBB54LMDC&source=url
    55Requires at least: 4.9
    6 Tested up to: 6.4.1
     6Tested up to: 6.4.2
    77Requires PHP: 5.6
    8 Stable tag: 1.3.0
     8Stable tag: 1.4.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4141
    4242== Changelog ==
     43= 1.4.0 =
     44* Add BuddyPress support
     45* Tested up to WordPress 6.4.2
     46
    4347= 1.3.0 =
    4448* Remove styles from admin_enqueue_scripts
  • simple-lazy-load-videos/trunk/simple-lazy-load-videos.php

    r2996110 r3027450  
    44 * Plugin URI:        https://github.com/radkill/simple-lazy-load-videos
    55 * Description:       Simple Lazy Load for embedded video from Youtube and Vimeo.
    6  * Version:           1.3.0
     6 * Version:           1.4.0
    77 * Requires at least: 4.9
    88 * Requires PHP:      5.6
Note: See TracChangeset for help on using the changeset viewer.