Version Description
- added new versions of images, fitting the player width (no more ugly rescaling)
- moved a lot of css from javascript to a css-file which gets loaded on-the-fly
Download this release
Release Info
Developer | futtta |
Plugin | WP YouTube Lyte |
Version | 0.5.1 |
Comparing to | |
See all releases |
Code changes from version 0.5.0 to 0.5.1
- lyte/controls-425.png +0 -0
- lyte/controls-480.png +0 -0
- lyte/controls-560.png +0 -0
- lyte/controls-640.png +0 -0
- lyte/controls-853.png +0 -0
- lyte/controls-newtube-425.png +0 -0
- lyte/controls-newtube-480.png +0 -0
- lyte/controls-newtube-560.png +0 -0
- lyte/controls-newtube-640.png +0 -0
- lyte/controls-newtube-853.png +0 -0
- lyte/controls-newtube.png +0 -0
- lyte/controls.png +0 -0
- lyte/lyte-min.js +1 -1
- lyte/lyte-newtube-min.js +1 -1
- lyte/lyte.css +1 -0
- options.php +1 -1
- player_sizes.inc.php +2 -2
- readme.txt +7 -6
- wp-youtube-lyte.php +3 -3
lyte/controls-425.png
ADDED
Binary file
|
lyte/controls-480.png
ADDED
Binary file
|
lyte/controls-560.png
ADDED
Binary file
|
lyte/controls-640.png
ADDED
Binary file
|
lyte/controls-853.png
ADDED
Binary file
|
lyte/controls-newtube-425.png
ADDED
Binary file
|
lyte/controls-newtube-480.png
ADDED
Binary file
|
lyte/controls-newtube-560.png
ADDED
Binary file
|
lyte/controls-newtube-640.png
ADDED
Binary file
|
lyte/controls-newtube-853.png
ADDED
Binary file
|
lyte/controls-newtube.png
DELETED
Binary file
|
lyte/controls.png
DELETED
Binary file
|
lyte/lyte-min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
if
|
1 |
+
var doc=document;var cI='lytecss';if(!doc.getElementById(cI)){var lk=doc.createElement('link');lk.id=cI;lk.rel='stylesheet';lk.type='text/css';lk.href=bU+'lyte.css';doc.getElementsByTagName('head')[0].appendChild(lk);}function lyte(){lytes=getElementsByClassName("lyte");for(var i=0;i<lytes.length;i++){lyte_id=lytes[i].id;p=doc.getElementById(lyte_id);jsonUrl="http://gdata.youtube.com/feeds/api/videos/"+lyte_id+"?fields=id,title&alt=json-in-script&callback=parseMe";loadScript(jsonUrl);pl=doc.createElement('div');p.appendChild(pl);p.onclick=nolyte;setStyle(p,'margin:5px 0px;width:'+pW+'px;height:'+pH+'px;background-color:#000;');pl.id="lyte_"+lyte_id;setStyle(pl,'cursor:pointer;text-align:center;overflow:hidden;height:'+pH+'px;width:'+pW+'px;position:relative;margin:0px;');pl.innerHTML="<img src=\""+bU+"play.png\" alt=\"Click to play this video\" style=\"margin-top:"+((pH/2)-30)+"px;opacity:0.8;\" onmouseover=\"this.style.opacity=1;\" onmouseout=\"this.style.opacity=0.8;\"/><img src=\""+bU+"controls-"+pW+".png\" width=\"100%\" alt=\"\" class=\"ctrl\" style=\"max-width:"+pW+"px;\"/>";if(pH>385){vA="center"}else{vA="top"};pl.style.background="#000 url(http://img.youtube.com/vi/"+lyte_id+"/0.jpg) no-repeat center "+vA}}function nolyte(){this.onclick="";this.innerHTML="<embed src=\"http://www.youtube-nocookie.com/v/"+this.id+"&autoplay=1&rel=0&egm=0&fs=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" id=\"lyte_"+this.id+"\" wmode=\"transparent\" width=\""+pW+"\" height=\""+pH+"\" allowscriptaccess=\"always\"></embed>"}function parseMe(r){title=r.entry.title.$t;idu=r.entry.id.$t;p=doc.getElementById("lyte_"+idu.substring((idu.length-11)));c=doc.createElement('div');c.className="tC";p.appendChild(c);setStyle(c,"margin:-"+((pH/2)+15)+"px 5px;");t=doc.createElement('div');t.className="tT";c.appendChild(t);t.innerHTML=title;}function setStyle(e,s){if(typeof e.setAttribute==="function")e.setAttribute('style',s);else if(typeof e.style.setAttribute==="object")e.style.setAttribute('cssText',s)}function loadScript(url){scr=doc.createElement('script');scr.src=url;scr.type='text/javascript';doc.getElementsByTagName('head')[0].appendChild(scr)}var getElementsByClassName=function(className,tag,elm){if(doc.getElementsByClassName){getElementsByClassName=function(className,tag,elm){elm=elm||doc;var elements=elm.getElementsByClassName(className),nodeName=(tag)?new RegExp("\\b"+tag+"\\b","i"):null,returnElements=[],current;for(var i=0,il=elements.length;i<il;i+=1){current=elements[i];if(!nodeName||nodeName.test(current.nodeName)){returnElements.push(current)}}return returnElements}}else if(doc.evaluate){getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||doc;var classes=className.split(" "),classesToCheck="",xhtmlNamespace="http://www.w3.org/1999/xhtml",namespaceResolver=(doc.documentElement.namespaceURI===xhtmlNamespace)?xhtmlNamespace:null,returnElements=[],elements,node;for(var j=0,jl=classes.length;j<jl;j+=1){classesToCheck+="[contains(concat(' ', @class, ' '), ' "+classes[j]+" ')]"}try{elements=doc.evaluate(".//"+tag+classesToCheck,elm,namespaceResolver,0,null)}catch(e){elements=doc.evaluate(".//"+tag+classesToCheck,elm,null,0,null)}while((node=elements.iterateNext())){returnElements.push(node)}return returnElements}}else{getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||doc;var classes=className.split(" "),classesToCheck=[],elements=(tag==="*"&&elm.all)?elm.all:elm.getElementsByTagName(tag),current,returnElements=[],match;for(var k=0,kl=classes.length;k<kl;k+=1){classesToCheck.push(new RegExp("(^|\\s)"+classes[k]+"(\\s|$)"))}for(var l=0,ll=elements.length;l<ll;l+=1){current=elements[l];match=false;for(var m=0,ml=classesToCheck.length;m<ml;m+=1){match=classesToCheck[m].test(current.className);if(!match){break}}if(match){returnElements.push(current)}}return returnElements}}return getElementsByClassName(className,tag,elm)};lyte();
|
lyte/lyte-newtube-min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
var doc=document;var cI='lytecss';if(!doc.getElementById(cI)){lk=doc.createElement('link');lk.id=cI;lk.rel='stylesheet';lk.type='text/css';lk.href=bU+'lyte.css';doc.getElementsByTagName('head')[0].appendChild(lk);}function lyte(){lytes=getElementsByClassName("lyte");for(var i=0;i<lytes.length;i++){lyte_id=lytes[i].id;p=doc.getElementById(lyte_id);jsonUrl="http://gdata.youtube.com/feeds/api/videos/"+lyte_id+"?fields=id,title&alt=json-in-script&callback=parseMe";loadScript(jsonUrl);pl=doc.createElement('div');p.appendChild(pl);p.onclick=nolyte;setStyle(p,'margin:5px 0px;width:'+pW+'px;height:'+pH+'px;background-color:#000;');pl.id="lyte_"+lyte_id;setStyle(pl,'cursor:pointer;text-align:center;overflow:hidden;height:'+pH+'px;width:'+pW+'px;position:relative;margin:0px;');pl.innerHTML="<img src=\""+bU+"play.png\" alt=\"Click to play this video\" style=\"margin-top:"+((pH/2)-30)+"px;opacity:0.8;\" onmouseover=\"this.style.opacity=1;\" onmouseout=\"this.style.opacity=0.8;\"/><img src=\""+bU+"controls-newtube-"+pW+".png\" width=\"100%\" class=\"ctrl\" alt=\"\" style=\"max-width:"+pW+"px;\"/>";if(pH>385){vA="center"}else{vA="top"};pl.style.background="#000 url(http://img.youtube.com/vi/"+lyte_id+"/0.jpg) no-repeat center "+vA}}function nolyte(){this.onclick="";this.innerHTML="<iframe class=\"youtube-player\" type=\"text/html\" width=\""+pW+"\" height=\""+pH+"\" src=\"http://www.youtube.com/embed/"+this.id+"?autoplay=1\" frameborder=\"0\"></iframe>"}function parseMe(r){title=r.entry.title.$t;idu=r.entry.id.$t;p=doc.getElementById("lyte_"+idu.substring((idu.length-11)));c=doc.createElement('div');c.className="tC";p.appendChild(c);setStyle(c,"margin:-"+((pH/2)+15)+"px 5px;");t=doc.createElement('div');t.className="tT";c.appendChild(t);t.innerHTML=title;}function setStyle(e,s){if(typeof e.setAttribute==="function")e.setAttribute('style',s);else if(typeof e.style.setAttribute==="object")e.style.setAttribute('cssText',s)}function loadScript(url){scr=doc.createElement('script');scr.src=url;scr.type='text/javascript';doc.getElementsByTagName('head')[0].appendChild(scr)}var getElementsByClassName=function(className,tag,elm){if(doc.getElementsByClassName){getElementsByClassName=function(className,tag,elm){elm=elm||doc;var elements=elm.getElementsByClassName(className),nodeName=(tag)?new RegExp("\\b"+tag+"\\b","i"):null,returnElements=[],current;for(var i=0,il=elements.length;i<il;i+=1){current=elements[i];if(!nodeName||nodeName.test(current.nodeName)){returnElements.push(current)}}return returnElements}}else if(doc.evaluate){getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||doc;var classes=className.split(" "),classesToCheck="",xhtmlNamespace="http://www.w3.org/1999/xhtml",namespaceResolver=(doc.documentElement.namespaceURI===xhtmlNamespace)?xhtmlNamespace:null,returnElements=[],elements,node;for(var j=0,jl=classes.length;j<jl;j+=1){classesToCheck+="[contains(concat(' ', @class, ' '), ' "+classes[j]+" ')]"}try{elements=doc.evaluate(".//"+tag+classesToCheck,elm,namespaceResolver,0,null)}catch(e){elements=doc.evaluate(".//"+tag+classesToCheck,elm,null,0,null)}while((node=elements.iterateNext())){returnElements.push(node)}return returnElements}}else{getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||doc;var classes=className.split(" "),classesToCheck=[],elements=(tag==="*"&&elm.all)?elm.all:elm.getElementsByTagName(tag),current,returnElements=[],match;for(var k=0,kl=classes.length;k<kl;k+=1){classesToCheck.push(new RegExp("(^|\\s)"+classes[k]+"(\\s|$)"))}for(var l=0,ll=elements.length;l<ll;l+=1){current=elements[l];match=false;for(var m=0,ml=classesToCheck.length;m<ml;m+=1){match=classesToCheck[m].test(current.className);if(!match){break}}if(match){returnElements.push(current)}}return returnElements}}return getElementsByClassName(className,tag,elm)};lyte();
|
lyte/lyte.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.lyte img {border:0px;padding:0px;spacing:0px;} .lytelinks {margin:0px 0px 10px 0px;} .tC {position:relative;padding:5px;background-color:rgba(0,0,0,0.3);-moz-border-radius:7px;-webkit-border-radius:7px;border-radius:7px;} .tT {font-weight:bold;font-size:16px;color:#ffffff;font-family:sans-serif;text-align:left;} .ctrl {position:absolute;left:0px;bottom:0px;}
|
options.php
CHANGED
@@ -52,7 +52,7 @@ function lyte_settings_page() {
|
|
52 |
</td>
|
53 |
</tr>
|
54 |
<tr valign="top">
|
55 |
-
<th scope="row">
|
56 |
<td>
|
57 |
<fieldset><legend class="screen-reader-text"><span>Show links?</span></legend>
|
58 |
<label title="Show YouTube-link"><input type="radio" name="show_links" value="1" <?php if (get_option('show_links')==="1") echo "checked" ?> /> Add YouTube-link.</label><br />
|
52 |
</td>
|
53 |
</tr>
|
54 |
<tr valign="top">
|
55 |
+
<th scope="row">Add links below the embedded videos?</th>
|
56 |
<td>
|
57 |
<fieldset><legend class="screen-reader-text"><span>Show links?</span></legend>
|
58 |
<label title="Show YouTube-link"><input type="radio" name="show_links" value="1" <?php if (get_option('show_links')==="1") echo "checked" ?> /> Add YouTube-link.</label><br />
|
player_sizes.inc.php
CHANGED
@@ -4,7 +4,7 @@ $pDefault=2;
|
|
4 |
$pSize[0][a]=true;
|
5 |
$pSize[0][w]=425;
|
6 |
$pSize[0][h]=344;
|
7 |
-
$pSize[0][t]="Smaller 3
|
8 |
|
9 |
$pSize[1][a]=true;
|
10 |
$pSize[1][w]=560;
|
@@ -24,7 +24,7 @@ $pSize[3][t]="YouTube default for 16:9-ratio video";
|
|
24 |
$pSize[4][a]=true;
|
25 |
$pSize[4][w]=640;
|
26 |
$pSize[4][h]=505;
|
27 |
-
$pSize[4][t]="Larger 3
|
28 |
|
29 |
$pSize[5][a]=true;
|
30 |
$pSize[5][w]=853;
|
4 |
$pSize[0][a]=true;
|
5 |
$pSize[0][w]=425;
|
6 |
$pSize[0][h]=344;
|
7 |
+
$pSize[0][t]="Smaller 4:3 player";
|
8 |
|
9 |
$pSize[1][a]=true;
|
10 |
$pSize[1][w]=560;
|
24 |
$pSize[4][a]=true;
|
25 |
$pSize[4][w]=640;
|
26 |
$pSize[4][h]=505;
|
27 |
+
$pSize[4][t]="Larger 4:3 player";
|
28 |
|
29 |
$pSize[5][a]=true;
|
30 |
$pSize[5][w]=853;
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: futtta
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5
|
4 |
Requires at least: 2.9
|
5 |
-
Tested up to: 3.0
|
6 |
-
Stable tag: 0.5.
|
7 |
|
8 |
"Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
|
9 |
|
@@ -29,24 +29,25 @@ Just install form your Wordpress "Plugins|Add New" screen and all will be well.
|
|
29 |
= What does "experimental html5 video support" mean? =
|
30 |
HTML5 video will not be visible for everyone (see requirements), some visitors will see the fallback Flash video instead.
|
31 |
|
32 |
-
= What are requirements to see embedded YouTube HTML5 video? =
|
33 |
-
|
34 |
* It only works in browsers that support the h264 (Safari, Chrome, IE9) or WebM (currently development versions of Chrome, Opera and Firefox) video codecs
|
35 |
* You have to be enrolled in the [YouTube html5 beta](http://www.youtube.com/html5)
|
36 |
|
37 |
= Any bugs/ issues should I know about? =
|
38 |
* The new YouTube HTML5-embed-code is a work in progress, positioning of video isn't always perfect when fallback Flash-version is used.
|
39 |
* The YouTube-thumbnail doesn't fit in the smaller-sized player, which will typically be visible when playing 16:9 videos (as YouTube adds black border on top and bottom)
|
40 |
-
* The controls (play button & bottom control) are not optimized for the different sizes, they just scale along (for now).
|
41 |
|
42 |
= What features might be added at a later stage? =
|
43 |
* Having the video title link to the YouTube-page
|
44 |
-
* Better quality controls for different sizes
|
45 |
|
46 |
= But I would like yet other features to be added! =
|
47 |
Just ask, I'll see what I can do.
|
48 |
|
49 |
== Changelog ==
|
|
|
|
|
|
|
|
|
50 |
= 0.5.0 =
|
51 |
* implemented the new [HTML5 YouTube embed code](http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html) and removed my [newTube.js-hack](http://blog.futtta.be/2010/06/16/embedding-html5-youtube-video-with-wp-youtube-lyte/) for html5-embedding
|
52 |
* player size now applies to Flash- and the new HTML5-embeds
|
2 |
Contributors: futtta
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5
|
4 |
Requires at least: 2.9
|
5 |
+
Tested up to: 3.0.1
|
6 |
+
Stable tag: 0.5.1
|
7 |
|
8 |
"Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
|
9 |
|
29 |
= What does "experimental html5 video support" mean? =
|
30 |
HTML5 video will not be visible for everyone (see requirements), some visitors will see the fallback Flash video instead.
|
31 |
|
32 |
+
= What are the requirements to see embedded YouTube HTML5 video? =
|
|
|
33 |
* It only works in browsers that support the h264 (Safari, Chrome, IE9) or WebM (currently development versions of Chrome, Opera and Firefox) video codecs
|
34 |
* You have to be enrolled in the [YouTube html5 beta](http://www.youtube.com/html5)
|
35 |
|
36 |
= Any bugs/ issues should I know about? =
|
37 |
* The new YouTube HTML5-embed-code is a work in progress, positioning of video isn't always perfect when fallback Flash-version is used.
|
38 |
* The YouTube-thumbnail doesn't fit in the smaller-sized player, which will typically be visible when playing 16:9 videos (as YouTube adds black border on top and bottom)
|
|
|
39 |
|
40 |
= What features might be added at a later stage? =
|
41 |
* Having the video title link to the YouTube-page
|
|
|
42 |
|
43 |
= But I would like yet other features to be added! =
|
44 |
Just ask, I'll see what I can do.
|
45 |
|
46 |
== Changelog ==
|
47 |
+
= 0.5.1 =
|
48 |
+
* added new versions of images, fitting the player width (no more ugly rescaling)
|
49 |
+
* moved a lot of css from javascript to a css-file which gets loaded on-the-fly
|
50 |
+
|
51 |
= 0.5.0 =
|
52 |
* implemented the new [HTML5 YouTube embed code](http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html) and removed my [newTube.js-hack](http://blog.futtta.be/2010/06/16/embedding-html5-youtube-video-with-wp-youtube-lyte/) for html5-embedding
|
53 |
* player size now applies to Flash- and the new HTML5-embeds
|
wp-youtube-lyte.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP YouTube Lyte
|
|
4 |
Plugin URI: http://blog.futtta.be/tag/lyte
|
5 |
Description: WordPress Lite YouTube Embeds (with optional HTML5 video) in posts.
|
6 |
Author: Frank (futtta) Goossens
|
7 |
-
Version: 0.5.
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
*/
|
10 |
|
@@ -44,11 +44,11 @@ function lyte_parse($the_content) {
|
|
44 |
break;
|
45 |
case "2":
|
46 |
$noscript_post="";
|
47 |
-
$lytelinks_txt="<div
|
48 |
break;
|
49 |
default:
|
50 |
$noscript_post="";
|
51 |
-
$lytelinks_txt="<div
|
52 |
}
|
53 |
$lytetemplate = "<div class=\"lyte\" id=\"".$match[3]."\" style=\"width:".$lyteSettings[2].";height:".$lyteSettings[3].";\"><noscript><a href=\"http://youtu.be/".$match[3]."\"><img src=\"http://img.youtube.com/vi/".$match[3]."/default.jpg\">".$noscript_post."</a></noscript><script>var bU='".$lyteSettings[0]."';pW='".$lyteSettings[2]."';pH='".$lyteSettings[3]."';(function(){d=document;if(!document.getElementById('lytescr')){lyte=d.createElement('script');lyte.async=true;lyte.id='lytescr';lyte.src='".$lyteSettings[0].$lyteSettings[1]."';d.getElementsByTagName('head')[0].appendChild(lyte)}})();</script></div>".$lytelinks_txt;
|
54 |
$the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $lytetemplate, $the_content, 1);
|
4 |
Plugin URI: http://blog.futtta.be/tag/lyte
|
5 |
Description: WordPress Lite YouTube Embeds (with optional HTML5 video) in posts.
|
6 |
Author: Frank (futtta) Goossens
|
7 |
+
Version: 0.5.1
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
*/
|
10 |
|
44 |
break;
|
45 |
case "2":
|
46 |
$noscript_post="";
|
47 |
+
$lytelinks_txt="<div class=\"lytelinks\">Watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a> or on <a href=\"http://icant.co.uk/easy-youtube/?http://www.youtube.com/watch?v=".$match[3]."\">Easy Youtube</a>.</div>";
|
48 |
break;
|
49 |
default:
|
50 |
$noscript_post="";
|
51 |
+
$lytelinks_txt="<div class=\"lytelinks\">Watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a>.</div>";
|
52 |
}
|
53 |
$lytetemplate = "<div class=\"lyte\" id=\"".$match[3]."\" style=\"width:".$lyteSettings[2].";height:".$lyteSettings[3].";\"><noscript><a href=\"http://youtu.be/".$match[3]."\"><img src=\"http://img.youtube.com/vi/".$match[3]."/default.jpg\">".$noscript_post."</a></noscript><script>var bU='".$lyteSettings[0]."';pW='".$lyteSettings[2]."';pH='".$lyteSettings[3]."';(function(){d=document;if(!document.getElementById('lytescr')){lyte=d.createElement('script');lyte.async=true;lyte.id='lytescr';lyte.src='".$lyteSettings[0].$lyteSettings[1]."';d.getElementsByTagName('head')[0].appendChild(lyte)}})();</script></div>".$lytelinks_txt;
|
54 |
$the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $lytetemplate, $the_content, 1);
|