WP YouTube Lyte - Version 1.6.4

Version Description

  • updated to latest YouTube UI, again thanks to Draikin. the bottom control is now hidden by defaults, see FAQ
  • added filter lyte_do_mobile to display lyte video instead of normal youtube on mobile as well, see FAQ
  • if WP YouTube Lyte is configured to load HD video, it will also show the maxresdefault.jpg thumbnail.
  • bugfix: on some mobile browsers WP YouTybe Lyte made the page too wide
Download this release

Release Info

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

Code changes from version 1.6.3 to 1.6.4

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*2+'" height="'+aHgh+'" 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.";if(aP==0){window.addEventListener("orientationchange",function(){t.getElementById(r).width=t.getElementById(r).parentNode.clientWidth},false)}};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;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(mOs===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*2+'" height="'+aHgh+'" 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.";if(aP==0){window.addEventListener("orientationchange",function(){t.getElementById(r).width=t.getElementById(r).parentNode.clientWidth},false)}};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
@@ -7,7 +7,6 @@ if (bU.indexOf('https')!=-1) {sch+="s"}
7
  ly.te = function() {
8
  if (!rn) {
9
  var rn=1;
10
- var mOs=navigator.userAgent.match(/(iphone|ipad|ipod|android)/i);
11
  lts = ly.getElementsByClassName("lyMe", "div");
12
 
13
  for (var i = 0, lln = lts.length; i < lln; i += 1) {
7
  ly.te = function() {
8
  if (!rn) {
9
  var rn=1;
 
10
  lts = ly.getElementsByClassName("lyMe", "div");
11
 
12
  for (var i = 0, lln = lts.length; i < lln; i += 1) {
lyte/lytesprite.png CHANGED
Binary file
lyte/lytesprite_2014.png ADDED
Binary file
lyte/lytesprite_old.png DELETED
Binary file
lyte_helper.php_example CHANGED
@@ -62,13 +62,6 @@ function lyte_override_excerpt_template($content,$type) {
62
  return $content;
63
  }
64
 
65
- /** change css using lyte_css filter, e.g. to hide bottom control ui */
66
- // add_filter('lyte_css','lyte_change_css',10,1);
67
- function lyte_change_css($lyte_css) {
68
- /** you can replace the entire css here or just add some declarations overriding the default ones */
69
- return $lyte_css.=" .ctrl{display:none;}";
70
- }
71
-
72
  /** change setting from within code using lyte_settings filter */
73
  // add_filter('lyte_settings','lyte_change_settings',10,1);
74
  function lyte_change_settings($settingsArray) {
@@ -101,4 +94,20 @@ function lyte_filter_aioseop_description($description) {
101
  function lyte_my_own_thumburl($thumb) {
102
  return "http://images.vrt.be/mobile320/2014/08/05/8570f3aa-1c9e-11e4-b923-00163edf75b7.jpg";
103
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  ?>
62
  return $content;
63
  }
64
 
 
 
 
 
 
 
 
65
  /** change setting from within code using lyte_settings filter */
66
  // add_filter('lyte_settings','lyte_change_settings',10,1);
67
  function lyte_change_settings($settingsArray) {
94
  function lyte_my_own_thumburl($thumb) {
95
  return "http://images.vrt.be/mobile320/2014/08/05/8570f3aa-1c9e-11e4-b923-00163edf75b7.jpg";
96
  }
97
+
98
+ /** change lyte css, for example to load Robota fond and force bottom control visible */
99
+ // add_filter('lyte_css','fgo_lyte_change_css',10,1);
100
+ function fgo_lyte_change_css($lyte_css) {
101
+ // import robota
102
+ $lyte_css="@import url(https://fonts.googleapis.com/css?family=Roboto&subset=latin,latin-ext);".$lyte_css;
103
+ // show bottom control
104
+ $lyte_css.=" .ctrl{display:block !important;}";
105
+ return $lyte_css;
106
+ }
107
+
108
+ /** don't do lyte on mobile to avoid users having to press play twice */
109
+ // add_filter('lyte_do_mobile','no_lyte_on_mobile',10,0);
110
+ function no_lyte_on_mobile(){
111
+ return false;
112
+ }
113
  ?>
options.php CHANGED
@@ -201,6 +201,7 @@ function lyte_settings_page() {
201
  </form>
202
  </div>
203
  <div style="float:right;width:30%" id="lyte_admin_feed">
 
204
  <div style="margin:0px 15px 15px 15px;font-size:larger;"><a href="<?php echo network_admin_url(); ?>plugin-install.php?tab=search&type=author&s=futtta"><?php _e("Happy with WP YouTube Lyte? Try my other plugins!"); ?></a></div>
205
  <div style="margin-left:10px;margin-top:-5px;">
206
  <h3>
201
  </form>
202
  </div>
203
  <div style="float:right;width:30%" id="lyte_admin_feed">
204
+ <div style="margin:0px 15px 15px 15px;font-size:larger;"><?php _e("Need help? <a href='https://wordpress.org/plugins/wp-youtube-lyte/faq/' target='_blank'>Check out the FAQ</a> or post your question on <a href='http://wordpress.org/support/plugin/wp-youtube-lyte' target='_blank'>the support-forum</a>."); ?></div>
205
  <div style="margin:0px 15px 15px 15px;font-size:larger;"><a href="<?php echo network_admin_url(); ?>plugin-install.php?tab=search&type=author&s=futtta"><?php _e("Happy with WP YouTube Lyte? Try my other plugins!"); ?></a></div>
206
  <div style="margin-left:10px;margin-top:-5px;">
207
  <h3>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: youtube, video, lyte, lite youtube embeds, html5 video, widget, youtube au
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: 4.3
7
- Stable tag: 1.6.3
8
 
9
  High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
10
 
@@ -128,6 +128,16 @@ All in One SEO Pack be default generates a description which still has httpv-lin
128
  = When I click on a LYTE video, a link to YouTube opens, what's up with that? =
129
  You probably added a link around the httpv-url. No link is needed, just the httpv-url.
130
 
 
 
 
 
 
 
 
 
 
 
131
  = Any bugs/ issues should I know about? =
132
  * Although the widget is available in (very) small sizes, these do not display that great and might, in the near future, be disabled by YouTube as their Terms of Service state that the smallest available embedded player is 200X200 pixels. Use the deprecated smaller sizes at your own risk.
133
  * Having the same YouTube-video on one page can cause WP YouTube Lyte to malfunction (as the YouTube id is used as the div's id in the DOM, and DOM id's are supposed to be unique)
@@ -144,6 +154,12 @@ Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog
144
 
145
  == Changelog ==
146
 
 
 
 
 
 
 
147
  = 1.6.3 =
148
  * changed Lyte widget constructor to PHP5-style object contructor
149
  * tested & confirmed working with WordPress 4.3
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: 4.3
7
+ Stable tag: 1.6.4
8
 
9
  High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
10
 
128
  = When I click on a LYTE video, a link to YouTube opens, what's up with that? =
129
  You probably added a link around the httpv-url. No link is needed, just the httpv-url.
130
 
131
+ = My video's seem to load slower on mobile devices? =
132
+ By default WP YouTube Lyte will indeed load slower normal YouTube video's instead of Lyte ones, as Lyte video's require would require two clicks from the user to play a video (once to load the YouTube video and once to start it) because there is no autoplay-support on mobile. If you want to, you can force WP YouTube Lyte to make video's Lyte on mobile with this code (add it in your child theme's functions.php, in a seperate helper plugin or using the [code snippets plugin](https://wordpress.org/plugins/code-snippets/);
133
+
134
+ `
135
+ add_filter('lyte_do_mobile','lyte_on_mobile',10,0);
136
+ function lyte_on_mobile(){
137
+ return true;
138
+ }
139
+ `
140
+
141
  = Any bugs/ issues should I know about? =
142
  * Although the widget is available in (very) small sizes, these do not display that great and might, in the near future, be disabled by YouTube as their Terms of Service state that the smallest available embedded player is 200X200 pixels. Use the deprecated smaller sizes at your own risk.
143
  * Having the same YouTube-video on one page can cause WP YouTube Lyte to malfunction (as the YouTube id is used as the div's id in the DOM, and DOM id's are supposed to be unique)
154
 
155
  == Changelog ==
156
 
157
+ = 1.6.4 =
158
+ * updated to latest YouTube UI, again thanks to Draikin. the bottom control is now hidden by defaults, see FAQ
159
+ * added filter `lyte_do_mobile` to display lyte video instead of normal youtube on mobile as well, see FAQ
160
+ * if WP YouTube Lyte is configured to load HD video, it will also show the maxresdefault.jpg thumbnail.
161
+ * bugfix: on some mobile browsers WP YouTybe Lyte [made the page too wide](https://wordpress.org/support/topic/mobil-page-view-only-covering-14-size?replies=11#post-7328487)
162
+
163
  = 1.6.3 =
164
  * changed Lyte widget constructor to PHP5-style object contructor
165
  * tested & confirmed working with WordPress 4.3
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.6.3
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  Domain Path: /languages
@@ -122,9 +122,11 @@ function lyte_parse($the_content,$doExcerpt=false) {
122
  preg_match("/noMicroData\=([0-1]{1})/",$match[12],$microData);
123
 
124
  $thumb="normal";
125
- if (!empty($hqThumb)) {
 
 
126
  if ($hqThumb[0]==="hqThumb=1") {
127
- $thumb="highres";
128
  }
129
  }
130
 
@@ -181,7 +183,7 @@ function lyte_parse($the_content,$doExcerpt=false) {
181
 
182
  if ($match[11]!="") {
183
  $plClass=" playlist";
184
- $vid=$match[11];
185
  switch ($lyteSettings['links']) {
186
  case "0":
187
  $noscript_post="<br />".__("Watch this playlist on YouTube","wp-youtube-lyte");
@@ -190,7 +192,7 @@ function lyte_parse($the_content,$doExcerpt=false) {
190
  break;
191
  default:
192
  $noscript="";
193
- $lytelinks_txt="<div class=\"lL\" style=\"width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\">".__("Watch this playlist","wp-youtube-lyte")." <a href=\"".$lyteSettings['scheme']."://www.youtube.com/playlist?list=".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a></div>";
194
  }
195
  } else if ($match[9]!="") {
196
  $plClass="";
@@ -198,15 +200,15 @@ function lyte_parse($the_content,$doExcerpt=false) {
198
  switch ($lyteSettings['links']) {
199
  case "0":
200
  $noscript_post="<br />".__("Watch this video on YouTube","wp-youtube-lyte");
201
- $lytelinks_txt="<div class=\"lL\" style=\"width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\"></div>";
202
  break;
203
  case "2":
204
  $noscript_post="";
205
- $lytelinks_txt="<div class=\"lL\" style=\"width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$lyteSettings['scheme']."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a> ".__("or on","wp-youtube-lyte")." <a href=\"http://icant.co.uk/easy-youtube/?http://www.youtube.com/watch?v=".$vid."\">Easy Youtube</a>.</div>";
206
  break;
207
  default:
208
  $noscript_post="";
209
- $lytelinks_txt="<div class=\"lL\" style=\"width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$lyteSettings['scheme']."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
210
  }
211
 
212
  $noscript="<noscript><a href=\"".$lyteSettings['scheme']."://youtu.be/".$vid."\"><img src=\"".$lyteSettings['scheme']."://i.ytimg.com/vi/".$vid."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$NSimgHeight."\" />".$noscript_post."</a></noscript>";
@@ -275,8 +277,6 @@ function lyte_parse($the_content,$doExcerpt=false) {
275
  $thumbUrl="//i.ytimg.com/vi/".$vid."/hqdefault.jpg";
276
  }
277
  }
278
- /** API: filter hook to override thumbnail URL */
279
- $thumbUrl = apply_filters( 'lyte_match_thumburl', $thumbUrl );
280
  } else {
281
  // no useable result from youtube, fallback on video thumbnail (doesn't work on playlist)
282
  $thumbUrl = "//i.ytimg.com/vi/".$vid."/hqdefault.jpg";
@@ -285,7 +285,11 @@ function lyte_parse($the_content,$doExcerpt=false) {
285
  // same fallback
286
  $thumbUrl = "//i.ytimg.com/vi/".$vid."/hqdefault.jpg";
287
  }
288
-
 
 
 
 
289
  if ($audio===true) {
290
  $wrapper="<div class=\"lyte-wrapper-audio\" style=\"width:".$lyteSettings[2]."px;max-width:100%;overflow:hidden;height:38px;".$lyteSettings['pos']."\">";
291
  } else {
@@ -490,14 +494,21 @@ function lyte_initer() {
490
  /* actual initialization */
491
  function lyte_init() {
492
  global $lyteSettings;
493
- $lyte_css = ".lyte-wrapper-audio div, .lyte-wrapper div {margin:0px !important; overflow:hidden;} .lyte,.lyMe{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;background-color:#777;} .fourthree .lyMe, .fourthree .lyte {padding-bottom:75%;} .lidget{margin-bottom:5px;} .lidget .lyte, .widget .lyMe {padding-bottom:0!important;height:100%!important;} .lyte-wrapper-audio .lyte{height:38px!important;overflow:hidden;padding:0!important} .lyMe iframe, .lyte iframe,.lyte .pL{position:absolute;top:0;left:0;width:100%;height:100%!important;background:no-repeat scroll center #000;background-size:cover;cursor:pointer} .tC{background-color:rgba(0,0,0,0.8);left:0;position:absolute;top:0;width:100%} .tT{color:#CCC;font-family:sans-serif;font-size:12px;height:auto;text-align:left;padding:5px 10px} .tT:hover{color:#FFF;text-decoration:underline} .play{background:no-repeat scroll 0 0 transparent;width:88px;height:63px;position:absolute;left:43%;left:calc(50% - 44px);left:-webkit-calc(50% - 44px);top:38%;top:calc(50% - 31px);top:-webkit-calc(50% - 31px);} .widget .play {top:30%;top:calc(45% - 31px);top:-webkit-calc(45% - 31px);transform:scale(0.6);-webkit-transform:scale(0.6);-ms-transform:scale(0.6);} .lyte:hover .play{background-position:0 -65px;} .lyte-audio .pL{max-height:38px!important} .lyte-audio iframe{height:438px!important} .ctrl{background:repeat scroll 0 -215px transparent;width:100%;height:40px;bottom:0;left:0;position:absolute} .Lctrl{background:no-repeat scroll 0 -132px transparent;width:158px;height:40px;bottom:0;left:0;position:absolute} .Rctrl{background:no-repeat scroll -42px -174px transparent;width:117px;height:40px;bottom:0;right:0;position:absolute} .lyte-audio .play{display:none} .hidden{display:none}";
 
 
 
 
 
 
 
 
 
494
 
495
  /** API: filter hook to change css */
496
  $lyte_css = apply_filters( 'lyte_css', $lyte_css);
497
 
498
- if (!empty($lyte_css)) {
499
- 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>";
500
- }
501
  echo "<script type=\"text/javascript\" async src=\"".$lyteSettings['path'].$lyteSettings['file']."\"></script>";
502
  }
503
 
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.6.4
8
  Author URI: http://blog.futtta.be/
9
  Text Domain: wp-youtube-lyte
10
  Domain Path: /languages
122
  preg_match("/noMicroData\=([0-1]{1})/",$match[12],$microData);
123
 
124
  $thumb="normal";
125
+ if ($lyteSettings['hidef']==="1") {
126
+ $thumb="highres";
127
+ } else if (!empty($hqThumb)) {
128
  if ($hqThumb[0]==="hqThumb=1") {
129
+ $thumb="highres";
130
  }
131
  }
132
 
183
 
184
  if ($match[11]!="") {
185
  $plClass=" playlist";
186
+ $vid=$match[11];
187
  switch ($lyteSettings['links']) {
188
  case "0":
189
  $noscript_post="<br />".__("Watch this playlist on YouTube","wp-youtube-lyte");
192
  break;
193
  default:
194
  $noscript="";
195
+ $lytelinks_txt="<div class=\"lL\" style=\"max-width:100%;width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\">".__("Watch this playlist","wp-youtube-lyte")." <a href=\"".$lyteSettings['scheme']."://www.youtube.com/playlist?list=".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a></div>";
196
  }
197
  } else if ($match[9]!="") {
198
  $plClass="";
200
  switch ($lyteSettings['links']) {
201
  case "0":
202
  $noscript_post="<br />".__("Watch this video on YouTube","wp-youtube-lyte");
203
+ $lytelinks_txt="<div class=\"lL\" style=\"max-width:100%;width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\"></div>";
204
  break;
205
  case "2":
206
  $noscript_post="";
207
+ $lytelinks_txt="<div class=\"lL\" style=\"max-width:100%;width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$lyteSettings['scheme']."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a> ".__("or on","wp-youtube-lyte")." <a href=\"http://icant.co.uk/easy-youtube/?http://www.youtube.com/watch?v=".$vid."\">Easy Youtube</a>.</div>";
208
  break;
209
  default:
210
  $noscript_post="";
211
+ $lytelinks_txt="<div class=\"lL\" style=\"max-width:100%;width:".$lyteSettings[2]."px;".$lyteSettings['pos']."\">".__("Watch this video","wp-youtube-lyte")." <a href=\"".$lyteSettings['scheme']."://youtu.be/".$vid."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
212
  }
213
 
214
  $noscript="<noscript><a href=\"".$lyteSettings['scheme']."://youtu.be/".$vid."\"><img src=\"".$lyteSettings['scheme']."://i.ytimg.com/vi/".$vid."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$NSimgHeight."\" />".$noscript_post."</a></noscript>";
277
  $thumbUrl="//i.ytimg.com/vi/".$vid."/hqdefault.jpg";
278
  }
279
  }
 
 
280
  } else {
281
  // no useable result from youtube, fallback on video thumbnail (doesn't work on playlist)
282
  $thumbUrl = "//i.ytimg.com/vi/".$vid."/hqdefault.jpg";
285
  // same fallback
286
  $thumbUrl = "//i.ytimg.com/vi/".$vid."/hqdefault.jpg";
287
  }
288
+
289
+ /** API: filter hook to override thumbnail URL */
290
+ $thumbUrl = apply_filters( 'lyte_match_thumburl', $thumbUrl );
291
+
292
+
293
  if ($audio===true) {
294
  $wrapper="<div class=\"lyte-wrapper-audio\" style=\"width:".$lyteSettings[2]."px;max-width:100%;overflow:hidden;height:38px;".$lyteSettings['pos']."\">";
295
  } else {
494
  /* actual initialization */
495
  function lyte_init() {
496
  global $lyteSettings;
497
+ $lyte_css = ".lyte-wrapper-audio div, .lyte-wrapper div {margin:0px; overflow:hidden;} .lyte,.lyMe{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;background-color:#777;} .fourthree .lyMe, .fourthree .lyte {padding-bottom:75%;} .lidget{margin-bottom:5px;} .lidget .lyte, .widget .lyMe {padding-bottom:0!important;height:100%!important;} .lyte-wrapper-audio .lyte{height:38px!important;overflow:hidden;padding:0!important} .lyMe iframe, .lyte iframe,.lyte .pL{position:absolute !important;top:0;left:0;width:100%;height:100%!important;background:no-repeat scroll center #000;background-size:cover;cursor:pointer} .tC{left:0;position:absolute;top:0;width:100%} .tC{background-image:linear-gradient(to bottom,rgba(0,0,0,0.6),rgba(0,0,0,0))} .tT{color:#FFF;font-family:Roboto,sans-serif;font-size:16px;height:auto;text-align:left;padding:5px 10px 50px 10px} .play{background:no-repeat scroll 0 0 transparent;width:88px;height:63px;position:absolute;left:43%;left:calc(50% - 44px);left:-webkit-calc(50% - 44px);top:38%;top:calc(50% - 31px);top:-webkit-calc(50% - 31px);} .widget .play {top:30%;top:calc(45% - 31px);top:-webkit-calc(45% - 31px);transform:scale(0.6);-webkit-transform:scale(0.6);-ms-transform:scale(0.6);} .lyte:hover .play{background-position:0 -65px;} .lyte-audio .pL{max-height:38px!important} .lyte-audio iframe{height:438px!important} .ctrl{background:repeat scroll 0 -220px rgba(0,0,0,0.3);width:100%;height:40px;bottom:0px;left:0;position:absolute;} .lyte-wrapper .ctrl{display:none}.Lctrl{background:no-repeat scroll 0 -137px transparent;width:158px;height:40px;bottom:0;left:0;position:absolute} .Rctrl{background:no-repeat scroll -42px -179px transparent;width:117px;height:40px;bottom:0;right:0;position:absolute;padding-right:10px;}.lyte-audio .play{display:none}.lyte-audio .ctrl{background-color:rgba(0,0,0,1)}.hidden{display:none}";
498
+
499
+ // by default show lyte vid on mobile (requiring user clicking play two times)
500
+ // but can be overruled by this filter
501
+ $mobLyte = apply_filters( 'lyte_do_mobile', false );
502
+ if ($mobLyte) {
503
+ $mobJS = "var mOs=null;";
504
+ } else {
505
+ $mobJS = "var mOs=navigator.userAgent.match(/(iphone|ipad|ipod|android)/i);";
506
+ }
507
 
508
  /** API: filter hook to change css */
509
  $lyte_css = apply_filters( 'lyte_css', $lyte_css);
510
 
511
+ echo "<script type=\"text/javascript\">var bU='".$lyteSettings['path']."';".$mobJS."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>";
 
 
512
  echo "<script type=\"text/javascript\" async src=\"".$lyteSettings['path'].$lyteSettings['file']."\"></script>";
513
  }
514