WP YouTube Lyte - Version 1.3.3

Version Description

  • fix for playlist shortcode as reported by pete777
  • fix for mobile orientation-change bug described by Kevinlikes
  • fix for better html-validation as requested by Kevinlikes
  • tested and confirmed working with WordPress 3.7
  • added "Do not Donate"-link
Download this release

Release Info

Developer futtta
Plugin Icon 128x128 WP YouTube Lyte
Version 1.3.3
Comparing to
See all releases

Code changes from version 1.3.2 to 1.3.3

external/do_not_donate_smallest.png ADDED
Binary file
lyte/lyte-min.js CHANGED
@@ -1 +1 @@
1
- (function(e){var t=document;var n="http";if(bU.indexOf("https")!=-1){n+="s"}e.te=function(){if(!r){var r=1;var i=navigator.userAgent.match(/(iphone|ipad|ipod|android)/i);lts=e.getElementsByClassName("lyMe","div");for(var s=0,o=lts.length;s<o;s+=1){p=lts[s];vid=p.id.substring(4);if(i===null){cN=p.className.replace(/lyMe/,"lyte")+" lP";p.className=cN;sprite=bU+"lytesprite.png";e.addCss(".lyte .ctrl, .lyte .Rctrl, .lyte .Lctrl, .lyte .play { background-image: url("+sprite+"); }");if(cN.indexOf("audio")===-1){bgId="lyte_"+vid;thumb=t.getElementById(bgId).getAttribute("data-src");if(thumb!==""){bgCss="#"+bgId+" { background-image: url("+thumb+"); }";e.addCss(bgCss)}else{scr=t.createElement("script");scr.src=n+"://gdata.youtube.com/feeds/api/playlists/"+vid+"?v=2&alt=json-in-script&callback=ly.parsePL&fields=id,entry";scr.type="text/javascript";t.getElementsByTagName("head")[0].appendChild(scr)}}p.onclick=e.play}else{e.play(p.id)}}}var r=""};e.parsePL=function(t){thumb=t.feed.entry[0].media$group.media$thumbnail[1].url;if(n=="https"&&thumb.indexOf("https"==-1)){thumb=thumb.replace("http://","https://")}t_id=t.feed.id.$t.match(/:playlist:(PL[a-zA-Z0-9_]+)/);id="lyte_"+t_id[1];bgCss="#"+id+" { background-image: url("+thumb+"); }";e.addCss(bgCss)};e.getQ=function(e){qsa="";if(rqs=e.className.match(/qsa_(.*)\s/,"$1"))qsa=rqs[1].replace(/\\([\&\=\?])/g,"$1");return qsa};e.play=function(r){if(typeof r==="string"){tH=t.getElementById(r);aP=0}else{tH=this;tH.onclick="";aP=1}vid=tH.id.substring(4);hidef=0;if(tH.className.indexOf("hidef")!==-1){hidef="1&vq=hd720"}if(tH.className.indexOf("playlist")===-1){eU=n+"://www.youtube.com/embed/"+vid+"?"}else{eU=n+"://www.youtube.com/embed/videoseries?list="+vid+"&"}qsa=e.getQ(tH);if(tH.className.indexOf("audio")!==-1&&aP==1){qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;"}else if(tH.className.indexOf("audio")!==-1&&aP==0){tH.parentNode.style.height="";tH.style.height="";aHgh=tH.clientHeight;aSt="height:"+aHgh+"px !important;"}else{aHgh=tH.clientHeight;aSt=""}tH.innerHTML='<iframe id="iF_'+vid+'" width="'+tH.clientWidth+'px" height="'+aHgh+'px" src="'+eU+"autoplay="+aP+"&controls=1&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."};e.getElementsByClassName=function(e,n,r){if(t.getElementsByClassName){getElementsByClassName=function(e,n,r){r=r||t;var i=r.getElementsByClassName(e),s=n?new RegExp("\\b"+n+"\\b","i"):null,o=[],u;for(var a=0,f=i.length;a<f;a+=1){u=i[a];if(!s||s.test(u.nodeName)){o.push(u)}}return o}}else if(t.evaluate){getElementsByClassName=function(e,n,r){n=n||"*";r=r||t;var i=e.split(" "),s="",o="http://www.w3.org/1999/xhtml",u=t.documentElement.namespaceURI===o?o:null,a=[],f,l;for(var c=0,h=i.length;c<h;c+=1){s+="[contains(concat(' ', @class, ' '), ' "+i[c]+" ')]"}try{f=t.evaluate(".//"+n+s,r,u,0,null)}catch(p){f=t.evaluate(".//"+n+s,r,null,0,null)}while(l=f.iterateNext()){a.push(l)}return a}}else{getElementsByClassName=function(e,n,r){n=n||"*";r=r||t;var i=e.split(" "),s=[],o=n==="*"&&r.all?r.all:r.getElementsByTagName(n),u,a=[],f;for(var l=0,c=i.length;l<c;l+=1){s.push(new RegExp("(^|\\s)"+i[l]+"(\\s|$)"))}for(var h=0,p=o.length;h<p;h+=1){u=o[h];f=false;for(var v=0,m=s.length;v<m;v+=1){f=s[v].test(u.className);if(!f){break}}if(f){a.push(u)}}return a}}return getElementsByClassName(e,n,r)};e.addCss=function(e){var n=t.createElement("style");n.type="text/css";if(n.styleSheet){n.styleSheet.cssText=e}else{n.appendChild(document.createTextNode(e))}t.getElementsByTagName("head")[0].appendChild(n)}})(window.ly=window.ly||{});(function(){var e=window;var t=document;if(e.addEventListener){e.addEventListener("load",ly.te,false);t.addEventListener("DomContentLoaded",function(){setTimeout("ly.te()",750)},false)}else{e.onload=ly.te;setTimeout("ly.te()",1e3)}})()
1
+ (function(e){var t=document;var n="http";if(bU.indexOf("https")!=-1){n+="s"}e.te=function(){if(!r){var r=1;var i=navigator.userAgent.match(/(iphone|ipad|ipod|android)/i);lts=e.getElementsByClassName("lyMe","div");for(var s=0,o=lts.length;s<o;s+=1){p=lts[s];vid=p.id.substring(4);if(i===null){cN=p.className.replace(/lyMe/,"lyte")+" lP";p.className=cN;sprite=bU+"lytesprite.png";e.addCss(".lyte .ctrl, .lyte .Rctrl, .lyte .Lctrl, .lyte .play { background-image: url("+sprite+"); }");if(cN.indexOf("audio")===-1){bgId="lyte_"+vid;thumb=t.getElementById(bgId).getAttribute("data-src");if(thumb!==""){bgCss="#"+bgId+" { background-image: url("+thumb+"); }";e.addCss(bgCss)}else{scr=t.createElement("script");scr.src=n+"://gdata.youtube.com/feeds/api/playlists/"+vid+"?v=2&alt=json-in-script&callback=ly.parsePL&fields=id,entry";scr.type="text/javascript";t.getElementsByTagName("head")[0].appendChild(scr)}}p.onclick=e.play}else{e.play(p.id)}}}var r=""};e.parsePL=function(t){thumb=t.feed.entry[0].media$group.media$thumbnail[1].url;if(n=="https"&&thumb.indexOf("https"==-1)){thumb=thumb.replace("http://","https://")}t_id=t.feed.id.$t.match(/:playlist:(PL[a-zA-Z0-9_]+)/);id="lyte_"+t_id[1];bgCss="#"+id+" { background-image: url("+thumb+"); }";e.addCss(bgCss)};e.getQ=function(e){qsa="";if(rqs=e.className.match(/qsa_(.*)\s/,"$1"))qsa=rqs[1].replace(/\\([\&\=\?])/g,"$1");return qsa};e.play=function(r){if(typeof r==="string"){tH=t.getElementById(r);aP=0}else{tH=this;tH.onclick="";aP=1}vid=tH.id.substring(4);hidef=0;if(tH.className.indexOf("hidef")!==-1){hidef="1&vq=hd720"}if(tH.className.indexOf("playlist")===-1){eU=n+"://www.youtube.com/embed/"+vid+"?"}else{eU=n+"://www.youtube.com/embed/videoseries?list="+vid+"&"}qsa=e.getQ(tH);if(tH.className.indexOf("audio")!==-1&&aP==1){qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;"}else if(tH.className.indexOf("audio")!==-1&&aP==0){tH.parentNode.style.height="";tH.style.height="";aHgh=tH.clientHeight;aSt="height:"+aHgh+"px !important;"}else{aHgh=tH.clientHeight;aSt=""}tH.innerHTML='<iframe id="iF_'+vid+'" width="'+tH.clientWidth+'px" height="'+aHgh+'px" src="'+eU+"autoplay="+aP+"&controls=1&wmode=opaque&rel=0&egm=0&iv_load_policy=3&hd="+hidef+qsa+'" frameborder="0" style="'+aSt+'" allowfullscreen></iframe>';if(aP==0){window.addEventListener("orientationchange",function(){ly.te();},false)};if(typeof tH.firstChild.getAttribute("kabl")=="string")tH.innerHTML="Please check Karma Blocker's config."};e.getElementsByClassName=function(e,n,r){if(t.getElementsByClassName){getElementsByClassName=function(e,n,r){r=r||t;var i=r.getElementsByClassName(e),s=n?new RegExp("\\b"+n+"\\b","i"):null,o=[],u;for(var a=0,f=i.length;a<f;a+=1){u=i[a];if(!s||s.test(u.nodeName)){o.push(u)}}return o}}else if(t.evaluate){getElementsByClassName=function(e,n,r){n=n||"*";r=r||t;var i=e.split(" "),s="",o="http://www.w3.org/1999/xhtml",u=t.documentElement.namespaceURI===o?o:null,a=[],f,l;for(var c=0,h=i.length;c<h;c+=1){s+="[contains(concat(' ', @class, ' '), ' "+i[c]+" ')]"}try{f=t.evaluate(".//"+n+s,r,u,0,null)}catch(p){f=t.evaluate(".//"+n+s,r,null,0,null)}while(l=f.iterateNext()){a.push(l)}return a}}else{getElementsByClassName=function(e,n,r){n=n||"*";r=r||t;var i=e.split(" "),s=[],o=n==="*"&&r.all?r.all:r.getElementsByTagName(n),u,a=[],f;for(var l=0,c=i.length;l<c;l+=1){s.push(new RegExp("(^|\\s)"+i[l]+"(\\s|$)"))}for(var h=0,p=o.length;h<p;h+=1){u=o[h];f=false;for(var v=0,m=s.length;v<m;v+=1){f=s[v].test(u.className);if(!f){break}}if(f){a.push(u)}}return a}}return getElementsByClassName(e,n,r)};e.addCss=function(e){var n=t.createElement("style");n.type="text/css";if(n.styleSheet){n.styleSheet.cssText=e}else{n.appendChild(document.createTextNode(e))}t.getElementsByTagName("head")[0].appendChild(n)}})(window.ly=window.ly||{});(function(){var e=window;var t=document;if(e.addEventListener){e.addEventListener("load",ly.te,false);t.addEventListener("DomContentLoaded",function(){setTimeout("ly.te()",750)},false)}else{e.onload=ly.te;setTimeout("ly.te()",1e3)}})()
lyte/lyte.js CHANGED
@@ -86,19 +86,15 @@ ly.play = function(id) {
86
  aHgh=tH.clientHeight;
87
  aSt="height:"+aHgh+"px !important;";
88
  } else {
89
- aHgh=tH.clientHeight;aSt="";
 
90
  }
91
 
92
- tH.innerHTML="<iframe id=\"iF_" + vid + "\" width=\"" + tH.clientWidth + "px\" height=\"" + aHgh + "px\" src=\""+eU+"autoplay="+aP+"&amp;controls=1&amp;wmode=opaque&amp;rel=0&amp;egm=0&amp;iv_load_policy=3&amp;hd="+hidef+qsa+"\" frameborder=\"0\" style=\"" + aSt + "\" allowfullscreen></iframe>"
93
-
94
- /*
95
- ytUrl=eU+"autoplay="+aP+"&amp;wmode=opaque&amp;rel=0&amp;egm=0&amp;iv_load_policy=3&amp;hd="+hidef+qsa;
96
-
97
- lytePop=window.open(ytUrl,'name','height='+aHgh+',width='+tH.clientWidth);
98
- if (window.focus) {lytePop.focus()}
99
- */
100
 
101
  if(typeof tH.firstChild.getAttribute('kabl')=="string") tH.innerHTML="Please check Karma Blocker's config.";
 
 
102
  }
103
 
104
  ly.getElementsByClassName = function(className, tag, elm) {
86
  aHgh=tH.clientHeight;
87
  aSt="height:"+aHgh+"px !important;";
88
  } else {
89
+ aHgh=tH.clientHeight;
90
+ aSt="";
91
  }
92
 
93
+ tH.innerHTML="<iframe id=\"iF_" + vid + "\" width=\"" + tH.clientWidth*2 + "\" height=\"" + aHgh + "\" src=\""+eU+"autoplay="+aP+"&amp;controls=1&amp;wmode=opaque&amp;rel=0&amp;egm=0&amp;iv_load_policy=3&amp;hd="+hidef+qsa+"\" frameborder=\"0\" style=\"" + aSt + "\" allowfullscreen></iframe>"
 
 
 
 
 
 
 
94
 
95
  if(typeof tH.firstChild.getAttribute('kabl')=="string") tH.innerHTML="Please check Karma Blocker's config.";
96
+
97
+ if (aP==0){window.addEventListener("orientationchange", function() {ly.te();}, false);}
98
  }
99
 
100
  ly.getElementsByClassName = function(className, tag, elm) {
options.php CHANGED
@@ -167,6 +167,7 @@ function lyte_settings_page() {
167
  </select>
168
  </h3>
169
  <div id="futtta_feed"></div>
 
170
  </div>
171
  </div>
172
 
167
  </select>
168
  </h3>
169
  <div id="futtta_feed"></div>
170
+ <div style="float:right;margin:50px 15px;"><a href="http://blog.futtta.be/2013/10/21/do-not-donate-to-me/" target="_blank"><img width="100px" height="85px" src="<?php echo content_url(); ?>/plugins/wp-youtube-lyte/external/do_not_donate_smallest.png" title="<?php _e("Do not donate for this plugin!"); ?>"></a></div>
171
  </div>
172
  </div>
173
 
readme.txt CHANGED
@@ -1,9 +1,10 @@
1
  === WP YouTube Lyte ===
2
  Contributors: futtta
3
  Tags: youtube, video, lyte, lite youtube embeds, html5 video, widget, youtube audio, audio, playlist, performance, accessibility, sidebar, lazy load, responsive, microdata, videoobject
 
4
  Requires at least: 2.9
5
- Tested up to: 3.6
6
- Stable tag: 1.3.2
7
 
8
  High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
9
 
@@ -101,10 +102,17 @@ Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog
101
  = How you can help =
102
  * Tell me about bugs you think you've found and if you can't find any, [confirm it works with your version of WP on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/)
103
  * Ask me for a feature you would like to see added
104
- * [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/), even if you think it stinks ;-)
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
 
108
  = 1.3.2 =
109
  * Added playlist support in the WP YouTube Lyte widget (forget to add it really, thanks to [Ed Dingwall](http://www.sinthomedia.com/) to remind me)
110
  * Added an alternative lytesprite version, created by [Claes from PCPLAY.se](http://pcplay.se/). To switch, rename lyte/lytesprite.png to lyte/lytesprite_orig.png and then rename lyte/lytesprite_claes.png to lyte/lytesprite.png.
1
  === WP YouTube Lyte ===
2
  Contributors: futtta
3
  Tags: youtube, video, lyte, lite youtube embeds, html5 video, widget, youtube audio, audio, playlist, performance, accessibility, sidebar, lazy load, responsive, microdata, videoobject
4
+ Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
5
  Requires at least: 2.9
6
+ Tested up to: 3.7
7
+ Stable tag: 1.3.3
8
 
9
  High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
10
 
102
  = How you can help =
103
  * Tell me about bugs you think you've found and if you can't find any, [confirm it works with your version of WP on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/)
104
  * Ask me for a feature you would like to see added
105
+ * [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/)
106
 
107
  == Changelog ==
108
 
109
+ = 1.3.3 =
110
+ * fix for playlist shortcode as [reported by pete777](http://wordpress.org/support/topic/playlist-via-shortcode-broken)
111
+ * fix for mobile orientation-change bug [described by Kevinlikes](http://wordpress.org/support/topic/rotation-bug-on-iphoneipad)
112
+ * fix for better html-validation as [requested by Kevinlikes](http://wordpress.org/support/topic/validatorw3-error)
113
+ * tested and confirmed working with WordPress 3.7
114
+ * added "Do not Donate"-link
115
+
116
  = 1.3.2 =
117
  * Added playlist support in the WP YouTube Lyte widget (forget to add it really, thanks to [Ed Dingwall](http://www.sinthomedia.com/) to remind me)
118
  * Added an alternative lytesprite version, created by [Claes from PCPLAY.se](http://pcplay.se/). To switch, rename lyte/lytesprite.png to lyte/lytesprite_orig.png and then rename lyte/lytesprite_claes.png to lyte/lytesprite.png.
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.3.2
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  Domain Path: /languages
@@ -13,7 +13,7 @@ Domain Path: /languages
13
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  $debug=false;
16
- $lyte_version="1.3.2";
17
  $lyte_db_version=get_option('lyte_version','none');
18
 
19
  /** have we updated? */
@@ -97,6 +97,9 @@ function lyte_parse($the_content,$doExcerpt=false) {
97
  preg_match_all($lytes_regexp, $the_content, $matches, PREG_SET_ORDER);
98
 
99
  foreach($matches as $match) {
 
 
 
100
  /** API: filter hook to preparse fragment in a httpv-url, e.g. to force hqThumb=1 or showinfo=0 */
101
  $match[12] = apply_filters( 'lyte_match_preparse_fragment',$match[12] );
102
 
@@ -338,7 +341,7 @@ function lyte_init() {
338
  if (!empty($lyte_css)) {
339
  echo "<script type=\"text/javascript\">var bU='".$lyteSettings['path']."';style = document.createElement('style');style.type = 'text/css';rules = document.createTextNode(\"".$lyte_css."\" );if(style.styleSheet) { style.styleSheet.cssText = rules.nodeValue;} else {style.appendChild(rules);}document.getElementsByTagName('head')[0].appendChild(style);</script>";
340
  }
341
- echo "<script type=\"text/javascript\" async=true src=\"".$lyteSettings['path'].$lyteSettings['file']."\"></script>";
342
  }
343
 
344
  /** override default wp_trim_excerpt to have lyte_parse remove the httpv-links */
@@ -373,7 +376,7 @@ function shortcode_lyte($atts) {
373
  ), $atts));
374
 
375
  if ($audio) {$proto="httpa";} else {$proto="httpv";}
376
- if ($playlist) {$action="playlist?list=PL";} else {$action="watch?v=";}
377
 
378
  return lyte_parse($proto.'://www.youtube.com/'.$action.$id);
379
  }
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.3.3
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  Domain Path: /languages
13
  if ( ! defined( 'ABSPATH' ) ) exit;
14
 
15
  $debug=false;
16
+ $lyte_version="1.3.3";
17
  $lyte_db_version=get_option('lyte_version','none');
18
 
19
  /** have we updated? */
97
  preg_match_all($lytes_regexp, $the_content, $matches, PREG_SET_ORDER);
98
 
99
  foreach($matches as $match) {
100
+ /* echo "<pre>";
101
+ print_r($match);
102
+ echo "</pre>"; */
103
  /** API: filter hook to preparse fragment in a httpv-url, e.g. to force hqThumb=1 or showinfo=0 */
104
  $match[12] = apply_filters( 'lyte_match_preparse_fragment',$match[12] );
105
 
341
  if (!empty($lyte_css)) {
342
  echo "<script type=\"text/javascript\">var bU='".$lyteSettings['path']."';style = document.createElement('style');style.type = 'text/css';rules = document.createTextNode(\"".$lyte_css."\" );if(style.styleSheet) { style.styleSheet.cssText = rules.nodeValue;} else {style.appendChild(rules);}document.getElementsByTagName('head')[0].appendChild(style);</script>";
343
  }
344
+ echo "<script type=\"text/javascript\" async src=\"".$lyteSettings['path'].$lyteSettings['file']."\"></script>";
345
  }
346
 
347
  /** override default wp_trim_excerpt to have lyte_parse remove the httpv-links */
376
  ), $atts));
377
 
378
  if ($audio) {$proto="httpa";} else {$proto="httpv";}
379
+ if ($playlist) {$action="playlist?list=";} else {$action="watch?v=";}
380
 
381
  return lyte_parse($proto.'://www.youtube.com/'.$action.$id);
382
  }