Version Description
- privacy enhancement: load thumbnails from the cookie-less i.ytimg.com instead of from the cookie-riddled youtube.com (but there are some caveats, see FAQ)
- bugfix: the fullscreen-button did not always appear when playing a video, added the "allowfullscreen" attribute to the iframe (as in the most recent youtube embed code)
- still waiting for the big leap forwards (responsive LYTE and custom sizes) I'm afraid
Download this release
Release Info
Developer | futtta |
Plugin | WP YouTube Lyte |
Version | 1.1.9 |
Comparing to | |
See all releases |
Code changes from version 1.1.8 to 1.1.9
- lyte/lyte-min.js +1 -1
- lyte/lyte.js +2 -2
- readme.txt +8 -1
- wp-youtube-lyte.php +4 -4
lyte/lyte-min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(a){function e(a){qsa="";if(rqs=a.className.match(/qsa_(.*)\s/,"$1"))qsa=rqs[1].replace(/\\([\&\=\?])/g,"$1");return qsa}function f(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 g(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function h(a){scr=d.createElement("script");scr.src=a;scr.type="text/javascript";d.getElementsByTagName("head")[0].appendChild(scr)}function i(a,b,c){if(d.getElementsByClassName){i=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){i=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{i=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 i(a,b,c)}d=document;var b="http";if(bU.indexOf("https")!=-1){b+="s"}a.te=function(){if(!c){var c=1;var f=navigator.userAgent.match(/(iphone|ipad|ipod)/i);lts=i("lyMe","div");for(var j=0,k=lts.length;j<k;j+=1){p=lts[j];vid=p.id.substring(4);cN=p.className.replace(/lyMe/,"lyte")+" lP";p.className=cN;pl=d.createElement("div");pl.id="lyte_"+vid;pl.className="pL";if(f===null){p.onclick=a.play;pW=p.style.width.match(/\d+/g)[0];pH=p.style.height.match(/\d+/g)[0];bgA="-60px";if(cN.indexOf("widget")!==-1||pW/pH<1.7)bgA="-10px";qsa=e(p);cImg='<img src="'+bU+"controls-"+pW+'.png" height="40px" width="'+pW+'px" class="ctrl" alt=""/>';pImg='<img src="'+bU+'play.png" width="83px" height="55px" alt="Click to play" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/>';ytA="://gdata.youtube.com/feeds/api/";if(cN.indexOf("audio")!==-1){g(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML=cImg}else if(cN.indexOf("playlist")!==-1){g(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML=pImg+cImg;joU=b+ytA+"playlists/"+vid+"?v=2&alt=json-in-script&callback=ly.prsPL&fields=id,title,entry";h(joU)}else{g(pl,"height:"+pH+"px;width:"+pW+"px;background:url('"+b+"://
|
1 |
+
(function(a){function e(a){qsa="";if(rqs=a.className.match(/qsa_(.*)\s/,"$1"))qsa=rqs[1].replace(/\\([\&\=\?])/g,"$1");return qsa}function f(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 g(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function h(a){scr=d.createElement("script");scr.src=a;scr.type="text/javascript";d.getElementsByTagName("head")[0].appendChild(scr)}function i(a,b,c){if(d.getElementsByClassName){i=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){i=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{i=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 i(a,b,c)}d=document;var b="http";if(bU.indexOf("https")!=-1){b+="s"}a.te=function(){if(!c){var c=1;var f=navigator.userAgent.match(/(iphone|ipad|ipod)/i);lts=i("lyMe","div");for(var j=0,k=lts.length;j<k;j+=1){p=lts[j];vid=p.id.substring(4);cN=p.className.replace(/lyMe/,"lyte")+" lP";p.className=cN;pl=d.createElement("div");pl.id="lyte_"+vid;pl.className="pL";if(f===null){p.onclick=a.play;pW=p.style.width.match(/\d+/g)[0];pH=p.style.height.match(/\d+/g)[0];bgA="-60px";if(cN.indexOf("widget")!==-1||pW/pH<1.7)bgA="-10px";qsa=e(p);cImg='<img src="'+bU+"controls-"+pW+'.png" height="40px" width="'+pW+'px" class="ctrl" alt=""/>';pImg='<img src="'+bU+'play.png" width="83px" height="55px" alt="Click to play" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/>';ytA="://gdata.youtube.com/feeds/api/";if(cN.indexOf("audio")!==-1){g(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML=cImg}else if(cN.indexOf("playlist")!==-1){g(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML=pImg+cImg;joU=b+ytA+"playlists/"+vid+"?v=2&alt=json-in-script&callback=ly.prsPL&fields=id,title,entry";h(joU)}else{g(pl,"height:"+pH+"px;width:"+pW+"px;background:url('"+b+"://i.ytimg.com/vi/"+vid+"/0.jpg') no-repeat scroll center "+bgA+" rgb(0, 0, 0);background-size:cover;");pl.innerHTML=pImg+cImg;if(cN.indexOf("widget")===-1&&qsa.indexOf("showinfo=0")===-1){joU=b+ytA+"videos/"+vid+"?fields=id,title&alt=json-in-script&callback=ly.prsV";h(joU)}}p.appendChild(pl)}else{a.play(p.id)}}}var c=""};a.play=function(a){if(typeof a==="string"){tH=d.getElementById(a);aP=0}else{tH=this;tH.onclick="";aP=1}vid=tH.id.substring(4);hidef=0;if(tH.className.indexOf("hidef")!==-1){hidef=1}if(tH.className.indexOf("playlist")===-1){eU=b+"://www.youtube.com/embed/"+vid+"?"}else{eU=b+"://www.youtube.com/embed/videoseries?list="+vid+"&"}qsa=e(tH);if(tH.className.indexOf("audio")!==-1){qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;"}else{aHgh=tH.clientHeight;aSt=""}tH.innerHTML='<iframe id="iF_'+vid+'" width="'+tH.clientWidth+'px" height="'+aHgh+'px" src="'+eU+"autoplay="+aP+"&wmode=opaque&rel=0&egm=0&iv_load_policy=3&hd="+hidef+qsa+'" frameborder="0" style="'+aSt+'" allowfullscreen></iframe>';if(typeof tH.firstChild.getAttribute("kabl")=="string")tH.innerHTML="Please check Karma Blocker's config."};a.prsV=function(a){tI=a.entry.title.$t;idu=a.entry.id.$t;id="lyte_"+idu.substring(idu.length-11);f(id,tI)};a.prsPL=function(a){thumb=a.feed.entry[0].media$group.media$thumbnail[1].url;idu=a.feed.id.$t;id="lyte_"+idu.match(/PL[a-zA-Z0-9\-\_]*/)[0];title="Playlist: "+a.feed.title.$t;pl=d.getElementById(id);pH=pl.style.height;pW=pl.style.width;if(b=="https"&&thumb.indexOf("https"==-1)){thumb=thumb.replace("http://","https://")}g(pl,"height:"+pH+";width:"+pW+";background:url('"+thumb+"') no-repeat scroll center -50px rgb(0, 0, 0); background-size:cover;");f(id,title)};})(window.ly=window.ly||{});(function(){var a=window;var b=document;if(a.addEventListener){a.addEventListener("load",ly.te,false);b.addEventListener("DomContentLoaded",function(){setTimeout("ly.te()",750)},false)}else{a.onload=ly.te;setTimeout("ly.te()",1e3)}})()
|
lyte/lyte.js
CHANGED
@@ -41,7 +41,7 @@ ly.te = function() {
|
|
41 |
joU = sch+ytA+"playlists/"+ vid +"?v=2&alt=json-in-script&callback=ly.prsPL&fields=id,title,entry";
|
42 |
loadSC(joU);
|
43 |
} else {
|
44 |
-
setST(pl, "height:" + pH + "px;width:" + pW + "px;background:url('" + sch + "://
|
45 |
pl.innerHTML = pImg+cImg;
|
46 |
if ((cN.indexOf('widget') === -1) && (qsa.indexOf('showinfo=0') === -1)) {
|
47 |
joU = sch+ytA+"videos/" + vid + "?fields=id,title&alt=json-in-script&callback=ly.prsV";
|
@@ -87,7 +87,7 @@ ly.play = function(id) {
|
|
87 |
|
88 |
if (tH.className.indexOf("audio") !== -1) { qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;" } else { aHgh=tH.clientHeight;aSt=""; }
|
89 |
|
90 |
-
tH.innerHTML="<iframe id=\"iF_" + vid + "\" width=\"" + tH.clientWidth + "px\" height=\"" + aHgh + "px\" src=\""+eU+"autoplay="+aP+"&wmode=opaque&rel=0&egm=0&iv_load_policy=3&hd="+hidef+qsa+"\" frameborder=\"0\" style=\"" + aSt + "\"></iframe>"
|
91 |
|
92 |
if(typeof tH.firstChild.getAttribute('kabl')=="string") tH.innerHTML="Please check Karma Blocker's config.";
|
93 |
}
|
41 |
joU = sch+ytA+"playlists/"+ vid +"?v=2&alt=json-in-script&callback=ly.prsPL&fields=id,title,entry";
|
42 |
loadSC(joU);
|
43 |
} else {
|
44 |
+
setST(pl, "height:" + pH + "px;width:" + pW + "px;background:url('" + sch + "://i.ytimg.com/vi/" + vid + "/0.jpg') no-repeat scroll center " + bgA + " rgb(0, 0, 0);background-size:cover;");
|
45 |
pl.innerHTML = pImg+cImg;
|
46 |
if ((cN.indexOf('widget') === -1) && (qsa.indexOf('showinfo=0') === -1)) {
|
47 |
joU = sch+ytA+"videos/" + vid + "?fields=id,title&alt=json-in-script&callback=ly.prsV";
|
87 |
|
88 |
if (tH.className.indexOf("audio") !== -1) { qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;" } else { aHgh=tH.clientHeight;aSt=""; }
|
89 |
|
90 |
+
tH.innerHTML="<iframe id=\"iF_" + vid + "\" width=\"" + tH.clientWidth + "px\" height=\"" + aHgh + "px\" src=\""+eU+"autoplay="+aP+"&wmode=opaque&rel=0&egm=0&iv_load_policy=3&hd="+hidef+qsa+"\" frameborder=\"0\" style=\"" + aSt + "\" allowfullscreen></iframe>"
|
91 |
|
92 |
if(typeof tH.firstChild.getAttribute('kabl')=="string") tH.innerHTML="Please check Karma Blocker's config.";
|
93 |
}
|
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.4.2
|
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 |
|
@@ -49,6 +49,8 @@ When playing, HTML5 video will not be visible for everyone (see requirements). I
|
|
49 |
= Does WP YouTube Lyte protect my visitor's privacy? =
|
50 |
As opposed to some of the [most important](http://blog.futtta.be/2010/12/15/wordpress-com-stats-trojan-horse-for-quantcast-tracking/) [plugins](http://blog.futtta.be/2010/01/22/add-to-any-removed-from-here/) there is no 3rd party tracking code in WP YouTube Lyte, but YouTube off course does see visitor requests coming in (see also the youtube-nocookie.com remark in Bugs/Issues below).
|
51 |
|
|
|
|
|
52 |
= Can I use WP YouTube Lyte for a custom field? =
|
53 |
As tested and confirmed by [rumultik.ru's Dimitri](http://rumultik.ru) (thanks for that man!), this indeed does work. Just pass the httpv url of such a field to lyte_parse like this:
|
54 |
`if(function_exists('lyte_parse')) { echo lyte_parse($video); }`
|
@@ -76,6 +78,11 @@ Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
79 |
= 1.1.8 =
|
80 |
* bugfix: [playlists API changed: playlists can now have ID's of more than 16 chars and always should be prepended with PL](http://apiblog.youtube.com/2012/08/playlists-now-with-more-pl.html), which broke playlist rendering. Hat tip for the guys over at [dubtechnoblog.com](http://www.dubtechnoblog.com) for reporting!
|
81 |
* bugfix: further work on excerpts to make sure http(v|a) links in manual excerpts get replaced by a lyte player.
|
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.4.2
|
6 |
+
Stable tag: 1.1.9
|
7 |
|
8 |
High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
|
9 |
|
49 |
= Does WP YouTube Lyte protect my visitor's privacy? =
|
50 |
As opposed to some of the [most important](http://blog.futtta.be/2010/12/15/wordpress-com-stats-trojan-horse-for-quantcast-tracking/) [plugins](http://blog.futtta.be/2010/01/22/add-to-any-removed-from-here/) there is no 3rd party tracking code in WP YouTube Lyte, but YouTube off course does see visitor requests coming in (see also the youtube-nocookie.com remark in Bugs/Issues below).
|
51 |
|
52 |
+
If you want to stop YouTube from setting cookies, add the "&showinfo=0" parameter to your httpv-url. This will prevent the call to the Youtube API, which is used to fetch the title of the video, and stop YouTube-cookies from being set when the LYTE-player is loaded. This however does not work for playlists (the API-call is needed to be able to present something meaningful). You should also take into account that any user actually playing the video, will always receive YouTube-cookies ([as is the case with youtube-nocokie embeds as well](http://support.google.com/youtube/bin/answer.py?hl=en&answer=171780&expand=PrivacyEnhancedMode#privacy)).
|
53 |
+
|
54 |
= Can I use WP YouTube Lyte for a custom field? =
|
55 |
As tested and confirmed by [rumultik.ru's Dimitri](http://rumultik.ru) (thanks for that man!), this indeed does work. Just pass the httpv url of such a field to lyte_parse like this:
|
56 |
`if(function_exists('lyte_parse')) { echo lyte_parse($video); }`
|
78 |
|
79 |
== Changelog ==
|
80 |
|
81 |
+
= 1.1.9 =
|
82 |
+
* privacy enhancement: load thumbnails from the cookie-less i.ytimg.com instead of from the cookie-riddled youtube.com (but there are some caveats, [see FAQ](http://wordpress.org/extend/plugins/wp-youtube-lyte/faq/))
|
83 |
+
* bugfix: the fullscreen-button did not always appear when playing a video, added the "allowfullscreen" attribute to the iframe (as in the most recent youtube embed code)
|
84 |
+
* still [waiting for the big leap forwards (responsive LYTE and custom sizes) I'm afraid](http://blog.futtta.be/2012/10/16/wp-youtube-lyte-waiting-for-the-big-leap-forwards/)
|
85 |
+
|
86 |
= 1.1.8 =
|
87 |
* bugfix: [playlists API changed: playlists can now have ID's of more than 16 chars and always should be prepended with PL](http://apiblog.youtube.com/2012/08/playlists-now-with-more-pl.html), which broke playlist rendering. Hat tip for the guys over at [dubtechnoblog.com](http://www.dubtechnoblog.com) for reporting!
|
88 |
* bugfix: further work on excerpts to make sure http(v|a) links in manual excerpts get replaced by a lyte player.
|
wp-youtube-lyte.php
CHANGED
@@ -4,7 +4,7 @@ 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
|
@@ -47,7 +47,7 @@ $lyteSettings['links']=get_option('show_links');
|
|
47 |
$lyteSettings['file']=$wyl_file."?wyl_version=".$wyl_version;
|
48 |
$lyteSettings['position']=get_option('position','0');
|
49 |
|
50 |
-
function lyte_parse($the_content,$doExcerpt=
|
51 |
global $lyteSettings;
|
52 |
|
53 |
$urlArr=parse_url($lyteSettings['path']);
|
@@ -148,7 +148,7 @@ function lyte_parse($the_content,$doExcerpt="false") {
|
|
148 |
$lytelinks_txt="<div class=\"lL\" style=\"width:".$lyteSettings[2]."px;\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$scheme."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
|
149 |
}
|
150 |
|
151 |
-
$noscript="<noscript><a href=\"".$scheme."://youtu.be/".$vid."\"><img src=\"".$scheme."://
|
152 |
}
|
153 |
|
154 |
if ($doExcerpt) {$noscript="";}
|
@@ -178,7 +178,7 @@ function lyte_init() {
|
|
178 |
}
|
179 |
|
180 |
function lyte_parse_excerpt($excerpt){
|
181 |
-
$excerpt=lyte_parse($excerpt,$doExcerpt=
|
182 |
return $excerpt;
|
183 |
}
|
184 |
|
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.9
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Text Domain: wp-youtube-lyte
|
10 |
Domain Path: /languages
|
47 |
$lyteSettings['file']=$wyl_file."?wyl_version=".$wyl_version;
|
48 |
$lyteSettings['position']=get_option('position','0');
|
49 |
|
50 |
+
function lyte_parse($the_content,$doExcerpt=false) {
|
51 |
global $lyteSettings;
|
52 |
|
53 |
$urlArr=parse_url($lyteSettings['path']);
|
148 |
$lytelinks_txt="<div class=\"lL\" style=\"width:".$lyteSettings[2]."px;\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$scheme."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
|
149 |
}
|
150 |
|
151 |
+
$noscript="<noscript><a href=\"".$scheme."://youtu.be/".$vid."\"><img src=\"".$scheme."://i.ytimg.com/vi/".$vid."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$NSimgHeight."\" />".$noscript_post."</a> ".$NSbanner."</noscript>";
|
152 |
}
|
153 |
|
154 |
if ($doExcerpt) {$noscript="";}
|
178 |
}
|
179 |
|
180 |
function lyte_parse_excerpt($excerpt){
|
181 |
+
$excerpt=lyte_parse($excerpt,$doExcerpt=true);
|
182 |
return $excerpt;
|
183 |
}
|
184 |
|