Version Description
- bugfix: lyte css wasn't applied as class was already removed (regression caused by "Infinite Scroll" support), lyMe now is the name of the unprocessed div and becomes lyte after processing
- performance: minimizing reflows caused by amongst others how styles are applied (kudo's to "der Tuxman" again, buy that man a beer!)
Download this release
Release Info
Developer | futtta |
Plugin | WP YouTube Lyte |
Version | 1.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.1.1
- lyte/lyte-min.js +1 -1
- lyte/lyte.js +9 -12
- readme.txt +5 -1
- widget.php +1 -1
- wp-youtube-lyte.php +3 -3
lyte/lyte-min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function loadSC(a){scr=d.createElement("script");scr.src=a;scr.type="text/javascript";d.getElementsByTagName("head")[0].appendChild(scr)}function setST(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function drawT(a,b){p=d.getElementById(a);c=d.createElement("div");c.className="tC";t=d.createElement("div");t.className="tT";c.appendChild(t);t.innerHTML=b;p.appendChild(c)}function parsePL(a){thumb=a.feed.entry[0].media$group.media$thumbnail[1].url;idu=a.feed.id.$t;id="lyte_"+idu.substring(idu.length-16);title="Playlist: "+a.feed.title.$t;pl=d.getElementById(id);pH=pl.style.height;pW=pl.style.width;if(sch=="https"&&thumb.indexOf("https"==-1)){thumb=thumb.replace("http://","https://")}setST(pl,"height:"+pH+";width:"+pW+";background:url('"+thumb+"') no-repeat scroll center -50px rgb(0, 0, 0); background-size:cover;");drawT(id,title)}function parseV(a){tI=a.entry.title.$t;idu=a.entry.id.$t;id="lyte_"+idu.substring(idu.length-11);drawT(id,tI)}function plaYT(){tH=this;tH.onclick="";vid=tH.id.substring(4);if(tH.className.indexOf("hidef")
|
1 |
+
function loadSC(a){scr=d.createElement("script");scr.src=a;scr.type="text/javascript";d.getElementsByTagName("head")[0].appendChild(scr)}function setST(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function drawT(a,b){p=d.getElementById(a);c=d.createElement("div");c.className="tC";t=d.createElement("div");t.className="tT";c.appendChild(t);t.innerHTML=b;p.appendChild(c)}function parsePL(a){thumb=a.feed.entry[0].media$group.media$thumbnail[1].url;idu=a.feed.id.$t;id="lyte_"+idu.substring(idu.length-16);title="Playlist: "+a.feed.title.$t;pl=d.getElementById(id);pH=pl.style.height;pW=pl.style.width;if(sch=="https"&&thumb.indexOf("https"==-1)){thumb=thumb.replace("http://","https://")}setST(pl,"height:"+pH+";width:"+pW+";background:url('"+thumb+"') no-repeat scroll center -50px rgb(0, 0, 0); background-size:cover;");drawT(id,title)}function parseV(a){tI=a.entry.title.$t;idu=a.entry.id.$t;id="lyte_"+idu.substring(idu.length-11);drawT(id,tI)}function plaYT(){tH=this;tH.onclick="";vid=tH.id.substring(4);hidef=0;if(tH.className.indexOf("hidef")!==-1){hidef=1}if(tH.className.indexOf("playlist")===-1){eU=sch+"://www.youtube.com/embed/"+vid}else{eU=sch+"://www.youtube.com/embed/p/"+vid}qsa=getQ(tH);if(tH.className.indexOf("audio")!==-1){qsa+="&autohide=0"}tH.innerHTML='<iframe id="iF_'+vid+'" width="'+tH.clientWidth+'" height="'+tH.clientHeight+'" src="'+eU+"?autoplay=1&wmode=opaque&rel=0&egm=0&iv_load_policy=3&hd="+hidef+qsa+'" frameborder="0"></iframe>';if(typeof tH.firstChild.getAttribute("kabl")=="string")tH.innerHTML="Please check Karma Blocker's config."}function getQ(a){qsa="";if(rqs=a.className.match(/qsa_(.*)\s/,"$1"))qsa=rqs[1].replace(/\\([\&\=\?])/g,"$1");return qsa}function lyte(){if(!a){var a=1;lts=getElementsByClassName("lyMe","div");for(var b=0,c=lts.length;b<c;b+=1){p=lts[b];vid=p.id.substring(4);cN=p.className.replace(/lyMe/,"lyte")+" lP";p.className=cN;p.onclick=plaYT;pW=p.style.width.match(/\d+/g)[0];pH=p.style.height.match(/\d+/g)[0];pl=d.createElement("div");pl.id="lyte_"+vid;pl.className="pL";bgA="-60px";if(cN.indexOf("widget")!==-1||pW/pH<1.7)bgA="-10px";qsa=getQ(p);if(cN.indexOf("audio")!==-1){setST(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML='<img src="'+bU+"controls-"+pW+'.png" class="ctrl" alt="" style="max-width:'+pW+'px;"/>'}else if(cN.indexOf("playlist")!==-1){setST(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML='<img src="'+bU+'play.png" alt="Click to play this playlist" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/><img src="'+bU+"controls-"+pW+'.png" width="100%" class="ctrl" alt="" style="max-width:'+pW+'px;"/>';joU=sch+"://gdata.youtube.com/feeds/api/playlists/"+vid+"?v=2&alt=json-in-script&callback=parsePL&fields=id,title,entry";loadSC(joU)}else{setST(pl,"height:"+pH+"px;width:"+pW+"px;background:url('"+sch+"://img.youtube.com/vi/"+vid+"/0.jpg') no-repeat scroll center "+bgA+" rgb(0, 0, 0);background-size:cover;");pl.innerHTML='<img src="'+bU+'play.png" alt="Click to play this video" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/><img src="'+bU+"controls-"+pW+'.png" width="100%" class="ctrl" alt="" style="max-width:'+pW+'px;"/>';if(cN.indexOf("widget")===-1&&qsa.indexOf("showinfo=0")===-1){joU=sch+"://gdata.youtube.com/feeds/api/videos/"+vid+"?fields=id,title&alt=json-in-script&callback=parseV";loadSC(joU)}}p.appendChild(pl)}}var a=""}var d=document;sch="http";if(bU.indexOf("https")!=-1){sch+="s"}var getElementsByClassName=function(a,b,c){if(d.getElementsByClassName){getElementsByClassName=function(a,b,c){c=c||d;var e=c.getElementsByClassName(a),f=b?new RegExp("\\b"+b+"\\b","i"):null,g=[],h;for(var i=0,j=e.length;i<j;i+=1){h=e[i];if(!f||f.test(h.nodeName)){g.push(h)}}return g}}else if(d.evaluate){getElementsByClassName=function(a,b,c){b=b||"*";c=c||d;var e=a.split(" "),f="",g="http://www.w3.org/1999/xhtml",h=d.documentElement.namespaceURI===g?g:null,i=[],j,k;for(var l=0,m=e.length;l<m;l+=1){f+="[contains(concat(' ', @class, ' '), ' "+e[l]+" ')]"}try{j=d.evaluate(".//"+b+f,c,h,0,null)}catch(n){j=d.evaluate(".//"+b+f,c,null,0,null)}while(k=j.iterateNext()){i.push(k)}return i}}else{getElementsByClassName=function(a,b,c){b=b||"*";c=c||d;var e=a.split(" "),f=[],g=b==="*"&&c.all?c.all:c.getElementsByTagName(b),h,i=[],j;for(var k=0,l=e.length;k<l;k+=1){f.push(new RegExp("(^|\\s)"+e[k]+"(\\s|$)"))}for(var m=0,n=g.length;m<n;m+=1){h=g[m];j=false;for(var o=0,p=f.length;o<p;o+=1){j=f[o].test(h.className);if(!j){break}}if(j){i.push(h)}}return i}}return getElementsByClassName(a,b,c)};lyte()
|
lyte/lyte.js
CHANGED
@@ -6,17 +6,16 @@ if (bU.indexOf('https')!=-1) {sch+="s"}
|
|
6 |
function lyte() {
|
7 |
if (!rn) {
|
8 |
var rn=1;
|
9 |
-
lts = getElementsByClassName("
|
10 |
for (var i = 0, lln = lts.length; i < lln; i += 1) {
|
11 |
p = lts[i];
|
12 |
vid = p.id.substring(4);
|
13 |
-
cN = p.className.replace(/
|
14 |
p.className=cN;
|
15 |
-
|
16 |
-
|
|
|
17 |
pl = d.createElement('div');
|
18 |
-
p.appendChild(pl);
|
19 |
-
p.onclick = plaYT;
|
20 |
pl.id = "lyte_" + vid;
|
21 |
pl.className = "pL";
|
22 |
|
@@ -26,7 +25,7 @@ function lyte() {
|
|
26 |
qsa=getQ(p);
|
27 |
|
28 |
if (cN.indexOf('audio') !== -1) {
|
29 |
-
setST(pl, 'height:' + pH + 'px;width:' + pW);
|
30 |
pl.innerHTML = "<img src=\"" + bU + "controls-" + pW + ".png\" class=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
|
31 |
} else if (cN.indexOf('playlist') !== -1) {
|
32 |
setST(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
|
@@ -41,6 +40,7 @@ function lyte() {
|
|
41 |
loadSC(joU)
|
42 |
}
|
43 |
}
|
|
|
44 |
}
|
45 |
}
|
46 |
var rn="";
|
@@ -57,11 +57,8 @@ function plaYT() {
|
|
57 |
tH.onclick = "";
|
58 |
vid=tH.id.substring(4);
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
} else {
|
63 |
-
hidef=1;
|
64 |
-
}
|
65 |
|
66 |
if (tH.className.indexOf("playlist") === -1) {
|
67 |
eU=sch+"://www.youtube.com/embed/" + vid
|
6 |
function lyte() {
|
7 |
if (!rn) {
|
8 |
var rn=1;
|
9 |
+
lts = getElementsByClassName("lyMe", "div");
|
10 |
for (var i = 0, lln = lts.length; i < lln; i += 1) {
|
11 |
p = lts[i];
|
12 |
vid = p.id.substring(4);
|
13 |
+
cN = p.className.replace(/lyMe/, "lyte")+ " lP";
|
14 |
p.className=cN;
|
15 |
+
p.onclick = plaYT;
|
16 |
+
pW = p.style.width.match(/\d+/g)[0];
|
17 |
+
pH = p.style.height.match(/\d+/g)[0];
|
18 |
pl = d.createElement('div');
|
|
|
|
|
19 |
pl.id = "lyte_" + vid;
|
20 |
pl.className = "pL";
|
21 |
|
25 |
qsa=getQ(p);
|
26 |
|
27 |
if (cN.indexOf('audio') !== -1) {
|
28 |
+
setST(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
|
29 |
pl.innerHTML = "<img src=\"" + bU + "controls-" + pW + ".png\" class=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
|
30 |
} else if (cN.indexOf('playlist') !== -1) {
|
31 |
setST(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
|
40 |
loadSC(joU)
|
41 |
}
|
42 |
}
|
43 |
+
p.appendChild(pl);
|
44 |
}
|
45 |
}
|
46 |
var rn="";
|
57 |
tH.onclick = "";
|
58 |
vid=tH.id.substring(4);
|
59 |
|
60 |
+
hidef=0;
|
61 |
+
if (tH.className.indexOf("hidef") !== -1) { hidef=1; }
|
|
|
|
|
|
|
62 |
|
63 |
if (tH.className.indexOf("playlist") === -1) {
|
64 |
eU=sch+"://www.youtube.com/embed/" + vid
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: futtta
|
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio, playlist, youtube playlist, hd, performance, accessibility, sidebar, lazy load
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.3
|
6 |
-
Stable tag: 1.1.
|
7 |
|
8 |
High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
|
9 |
|
@@ -78,6 +78,10 @@ Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog
|
|
78 |
|
79 |
== Changelog ==
|
80 |
|
|
|
|
|
|
|
|
|
81 |
= 1.1.0 =
|
82 |
* updated LYTE-player UI: larger display of preview image, changed look of title placeholder, updated controls image
|
83 |
* new: added support for "Infinite Scroll" as proposed by ["der Tuxman"](http://tuxproject.de/blog) and [Olivier](http://www.wwebsolution.com/hemisphere)
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio, playlist, youtube playlist, hd, performance, accessibility, sidebar, lazy load
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.3
|
6 |
+
Stable tag: 1.1.1
|
7 |
|
8 |
High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
|
9 |
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 1.1.1 =
|
82 |
+
* bugfix: lyte css wasn't applied as class was already removed (regression caused by "Infinite Scroll" support), lyMe now is the name of the unprocessed div and becomes lyte after processing
|
83 |
+
* performance: [minimizing reflows caused by amongst others how styles are applied](http://blog.futtta.be/2012/03/20/going-against-the-reflow/) (kudo's to ["der Tuxman"](http://tuxproject.de/blog) again, buy that man a beer!)
|
84 |
+
|
85 |
= 1.1.0 =
|
86 |
* updated LYTE-player UI: larger display of preview image, changed look of title placeholder, updated controls image
|
87 |
* new: added support for "Infinite Scroll" as proposed by ["der Tuxman"](http://tuxproject.de/blog) and [Olivier](http://www.wwebsolution.com/hemisphere)
|
widget.php
CHANGED
@@ -52,7 +52,7 @@ class WYLWidget extends WP_Widget {
|
|
52 |
|
53 |
<?php echo $before_widget; ?>
|
54 |
<?php if ( $WYLtitle ) echo $before_title . $WYLtitle . $after_title; ?>
|
55 |
-
<div class="
|
56 |
<div><?php echo $WYLtext ?></div>
|
57 |
<?php echo $after_widget; ?>
|
58 |
<?php
|
52 |
|
53 |
<?php echo $before_widget; ?>
|
54 |
<?php if ( $WYLtitle ) echo $before_title . $WYLtitle . $after_title; ?>
|
55 |
+
<div class="lyMe widget <?php echo $WYLaudio; ?> <?php echo $qsaClass; ?>" id="<?php echo $WYLid; ?>" style="width:<?php echo $wSize[$WYLsize]['w']; ?>px;height:<?php if($WYLaudio==="audio") {echo "25";} else {echo $wSize[$WYLsize]['h'];} ?>px;"><noscript><a href="http://youtu.be/<?php echo $WYLid;?>"><img src="http://img.youtube.com/vi/<?php echo $WYLid; ?>/default.jpg" alt="" /></a></noscript></div>
|
56 |
<div><?php echo $WYLtext ?></div>
|
57 |
<?php echo $after_widget; ?>
|
58 |
<?php
|
wp-youtube-lyte.php
CHANGED
@@ -4,13 +4,13 @@ Plugin Name: WP YouTube Lyte
|
|
4 |
Plugin URI: http://blog.futtta.be/wp-youtube-lyte/
|
5 |
Description: Lite and accessible YouTube audio and video embedding.
|
6 |
Author: Frank Goossens (futtta)
|
7 |
-
Version: 1.1.
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Text Domain: wp-youtube-lyte
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
-
$wyl_version="1.1.
|
14 |
|
15 |
$plugin_dir = basename(dirname(__FILE__)).'/languages';
|
16 |
load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
|
@@ -140,7 +140,7 @@ function lyte_parse($the_content) {
|
|
140 |
$noscript="<noscript><a href=\"".$scheme."://youtu.be/".$vid."\"><img src=\"".$scheme."://img.youtube.com/vi/".$vid."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$NSimgHeight."\" />".$noscript_post."</a> ".$NSbanner."</noscript>";
|
141 |
}
|
142 |
|
143 |
-
$lytetemplate = "<div class=\"
|
144 |
$the_content = preg_replace("/(<p>)?http(v|a):\/\/([a-zA-Z0-9\-\_]+\.|)(youtube|youtu)(\.com|\.be)\/(((watch(\?v\=|\/v\/)|)([a-zA-Z0-9\-\_]{11}))|(playlist\?list\=PL([a-zA-Z0-9\-\_]{16})))([^\s<]*)(<\/p>)?/", $lytetemplate, $the_content, 1);
|
145 |
}
|
146 |
lyte_initer();
|
4 |
Plugin URI: http://blog.futtta.be/wp-youtube-lyte/
|
5 |
Description: Lite and accessible YouTube audio and video embedding.
|
6 |
Author: Frank Goossens (futtta)
|
7 |
+
Version: 1.1.1
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Text Domain: wp-youtube-lyte
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
+
$wyl_version="1.1.1";
|
14 |
|
15 |
$plugin_dir = basename(dirname(__FILE__)).'/languages';
|
16 |
load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
|
140 |
$noscript="<noscript><a href=\"".$scheme."://youtu.be/".$vid."\"><img src=\"".$scheme."://img.youtube.com/vi/".$vid."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$NSimgHeight."\" />".$noscript_post."</a> ".$NSbanner."</noscript>";
|
141 |
}
|
142 |
|
143 |
+
$lytetemplate = "<div class=\"lyMe".$audioClass.$hidefClass.$plClass.$qsaClass."\" id=\"WYL_".$vid."\" style=\"width:".$lyteSettings[2]."px;height:".$divHeight."px;\">".$noscript."</div>".$lytelinks_txt;
|
144 |
$the_content = preg_replace("/(<p>)?http(v|a):\/\/([a-zA-Z0-9\-\_]+\.|)(youtube|youtu)(\.com|\.be)\/(((watch(\?v\=|\/v\/)|)([a-zA-Z0-9\-\_]{11}))|(playlist\?list\=PL([a-zA-Z0-9\-\_]{16})))([^\s<]*)(<\/p>)?/", $lytetemplate, $the_content, 1);
|
145 |
}
|
146 |
lyte_initer();
|