Version Description
- widget size can now be set (3 sizes available, to be specified for each widget individually)
- admin-page now contains links to most recent info (blogposts) on WP YouTube Lyte (and optionally WordPress and Web Technology in general) using the excellent jQuery-plugin zrssfeed
- bugfix: removed CDATA-wrapper from javascript as WordPress turned ]]> into ]]< which broke the html (which in turn broke syndication in planets)
Download this release
Release Info
Developer | futtta |
Plugin | WP YouTube Lyte |
Version | 0.6.1 |
Comparing to | |
See all releases |
Code changes from version 0.6.0 to 0.6.1
- external/jquery.cookie.js +89 -0
- external/jquery.cookie.min.js +3 -0
- external/jquery.zrssfeed.css +47 -0
- external/jquery.zrssfeed.min.js +11 -0
- lyte/controls-160.png +0 -0
- lyte/controls-180.png +0 -0
- lyte/controls-newtube-160.png +0 -0
- lyte/controls-newtube-180.png +0 -0
- lyte/lyte-min.js +1 -1
- lyte/lyte-newtube-min.js +1 -1
- options.php +40 -0
- player_sizes.inc.php +9 -0
- readme.txt +7 -1
- widget.php +34 -3
- wp-youtube-lyte.php +6 -6
external/jquery.cookie.js
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*jslint browser: true */ /*global jQuery: true */
|
2 |
+
|
3 |
+
/**
|
4 |
+
* jQuery Cookie plugin
|
5 |
+
*
|
6 |
+
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
|
7 |
+
* Dual licensed under the MIT and GPL licenses:
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
* http://www.gnu.org/licenses/gpl.html
|
10 |
+
*
|
11 |
+
*/
|
12 |
+
|
13 |
+
// TODO JsDoc
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Create a cookie with the given key and value and other optional parameters.
|
17 |
+
*
|
18 |
+
* @example $.cookie('the_cookie', 'the_value');
|
19 |
+
* @desc Set the value of a cookie.
|
20 |
+
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
21 |
+
* @desc Create a cookie with all available options.
|
22 |
+
* @example $.cookie('the_cookie', 'the_value');
|
23 |
+
* @desc Create a session cookie.
|
24 |
+
* @example $.cookie('the_cookie', null);
|
25 |
+
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
26 |
+
* used when the cookie was set.
|
27 |
+
*
|
28 |
+
* @param String key The key of the cookie.
|
29 |
+
* @param String value The value of the cookie.
|
30 |
+
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
31 |
+
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
32 |
+
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
33 |
+
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
34 |
+
* when the the browser exits.
|
35 |
+
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
36 |
+
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
37 |
+
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
38 |
+
* require a secure protocol (like HTTPS).
|
39 |
+
* @type undefined
|
40 |
+
*
|
41 |
+
* @name $.cookie
|
42 |
+
* @cat Plugins/Cookie
|
43 |
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
44 |
+
*/
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Get the value of a cookie with the given key.
|
48 |
+
*
|
49 |
+
* @example $.cookie('the_cookie');
|
50 |
+
* @desc Get the value of a cookie.
|
51 |
+
*
|
52 |
+
* @param String key The key of the cookie.
|
53 |
+
* @return The value of the cookie.
|
54 |
+
* @type String
|
55 |
+
*
|
56 |
+
* @name $.cookie
|
57 |
+
* @cat Plugins/Cookie
|
58 |
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
59 |
+
*/
|
60 |
+
jQuery.cookie = function (key, value, options) {
|
61 |
+
|
62 |
+
// key and value given, set cookie...
|
63 |
+
if (arguments.length > 1 && (value === null || typeof value !== "object")) {
|
64 |
+
options = jQuery.extend({}, options);
|
65 |
+
|
66 |
+
if (value === null) {
|
67 |
+
options.expires = -1;
|
68 |
+
}
|
69 |
+
|
70 |
+
if (typeof options.expires === 'number') {
|
71 |
+
var days = options.expires, t = options.expires = new Date();
|
72 |
+
t.setDate(t.getDate() + days);
|
73 |
+
}
|
74 |
+
|
75 |
+
return (document.cookie = [
|
76 |
+
encodeURIComponent(key), '=',
|
77 |
+
options.raw ? String(value) : encodeURIComponent(String(value)),
|
78 |
+
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
79 |
+
options.path ? '; path=' + options.path : '',
|
80 |
+
options.domain ? '; domain=' + options.domain : '',
|
81 |
+
options.secure ? '; secure' : ''
|
82 |
+
].join(''));
|
83 |
+
}
|
84 |
+
|
85 |
+
// key and possibly options given, get cookie...
|
86 |
+
options = value || {};
|
87 |
+
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
|
88 |
+
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
|
89 |
+
};
|
external/jquery.cookie.min.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
alert("cookie loaded");
|
2 |
+
|
3 |
+
jQuery.cookie=function(key,value,options){if(arguments.length>1&&(value===null||typeof value!=="object")){options=jQuery.extend({},options);if(value===null){options.expires=-1;}if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days);}return(document.cookie=[encodeURIComponent(key),'=',options.raw?String(value):encodeURIComponent(String(value)),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''));}options=value||{};var result,decode=options.raw?function(s){return s;}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null;};
|
external/jquery.zrssfeed.css
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
@charset "UTF-8";
|
2 |
+
/*
|
3 |
+
* Example of zRSSFeed Styling
|
4 |
+
*
|
5 |
+
* Version: 1.0.1
|
6 |
+
* (c) Copyright 2010, Zazar Ltd
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
|
10 |
+
.rssFeed
|
11 |
+
{
|
12 |
+
font-family: Arial, Helvetica, sans-serif;
|
13 |
+
font-size: 90%;
|
14 |
+
spacing: 3em 4em;
|
15 |
+
}
|
16 |
+
.rssFeed a
|
17 |
+
{
|
18 |
+
color: #444;
|
19 |
+
text-decoration: none;
|
20 |
+
}
|
21 |
+
.rssFeed a:hover
|
22 |
+
{
|
23 |
+
color: #000;
|
24 |
+
text-decoration: underline;
|
25 |
+
}
|
26 |
+
|
27 |
+
.rssHeader { padding: 0.2em 0; }
|
28 |
+
|
29 |
+
.rssBody { border: 1px solid #999; }
|
30 |
+
.rssBody ul { list-style: none; }
|
31 |
+
.rssBody ul, .rssRow, .rssRow h4, .rssRow p
|
32 |
+
{
|
33 |
+
margin: 0;
|
34 |
+
padding: 0;
|
35 |
+
}
|
36 |
+
|
37 |
+
.rssRow { padding: 0.8em; }
|
38 |
+
.rssRow h4 { font-size: 1.1em; }
|
39 |
+
.rssRow div
|
40 |
+
{
|
41 |
+
font-size: 90%;
|
42 |
+
color: #666;
|
43 |
+
margin: 0.2em 0 0.4em 0;
|
44 |
+
}
|
45 |
+
|
46 |
+
.odd { background-color: #e8e8fc; }
|
47 |
+
.even { background-color: #d4d4e8; }
|
external/jquery.zrssfeed.min.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
(function($){var current=null;$.fn.rssfeed=function(url,options){var defaults={limit:10,header:true,titletag:'h4',date:true,content:true,snippet:true,showerror:true,errormsg:'',key:null};var options=$.extend(defaults,options);return this.each(function(i,e){var $e=$(e);if(!$e.hasClass('rssFeed'))$e.addClass('rssFeed');if(url==null)return false;var api="http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;if(options.limit!=null)api+="&num="+options.limit;if(options.key!=null)api+="&key="+options.key;$.getJSON(api,function(data){if(data.responseStatus==200){_callback(e,data.responseData.feed,options);}else{if(options.showerror)
|
3 |
+
if(options.errormsg!=''){var msg=options.errormsg;}else{var msg=data.responseDetails;};$(e).html('<div class="rssError"><p>'+msg+'</p></div>');};});});};var _callback=function(e,feeds,options){if(!feeds){return false;}
|
4 |
+
var html='';var row='odd';if(options.header)
|
5 |
+
html+='<div class="rssHeader">'+'<a href="'+feeds.link+'" title="'+feeds.description+'">'+feeds.title+'</a>'+'</div>';html+='<div class="rssBody">'+'<ul>';for(var i=0;i<feeds.entries.length;i++){var entry=feeds.entries[i];var entryDate=new Date(entry.publishedDate);var pubDate=entryDate.toLocaleDateString()+' '+entryDate.toLocaleTimeString();html+='<li class="rssRow '+row+'">'+'<'+options.titletag+'><a href="'+entry.link+'" title="View this feed at '+feeds.title+'">'+entry.title+'</a></'+options.titletag+'>'
|
6 |
+
if(options.date)html+='<div>'+pubDate+'</div>'
|
7 |
+
if(options.content){if(options.snippet&&entry.contentSnippet!=''){var content=entry.contentSnippet;}else{var content=entry.content;}
|
8 |
+
html+='<p>'+content+'</p>'}
|
9 |
+
html+='</li>';if(row=='odd'){row='even';}else{row='odd';}}
|
10 |
+
html+='</ul>'+'</div>'
|
11 |
+
$(e).html(html);};})(jQuery);
|
lyte/controls-160.png
ADDED
Binary file
|
lyte/controls-180.png
ADDED
Binary file
|
lyte/controls-newtube-160.png
ADDED
Binary file
|
lyte/controls-newtube-180.png
ADDED
Binary file
|
lyte/lyte-min.js
CHANGED
@@ -1 +1 @@
|
|
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","div");for(var i=0;i<lytes.length;i++){lyte_id=lytes[i].id;p=doc.getElementById(lyte_id);p.className+=" lP";if(p.className.indexOf('widget')
|
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","div");for(var i=0;i<lytes.length;i++){lyte_id=lytes[i].id;p=doc.getElementById(lyte_id);p.className+=" lP";pW=p.clientWidth;pH=p.clientHeight;if(p.className.indexOf('widget')==-1){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,'width:'+pW+'px;height:'+pH+'px;');pl.id="lyte_"+lyte_id;pl.className="pL";setStyle(pl,'height:'+pH+'px;width:'+pW+'px;background:url("http://img.youtube.com/vi/'+lyte_id+'/0.jpg") no-repeat scroll center center rgb(0, 0, 0);background-size:contain;');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%\" alt=\"\" class=\"ctrl\" style=\"max-width:"+pW+"px;\"/>";}}function nolyte(){this.onclick="";this.innerHTML="<embed src=\"http://www.youtube-nocookie.com/v/"+this.id+"&autoplay=1&rel=0&egm=0&fs=1&iv_load_policy=3\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" id=\"lyte_"+this.id+"\" wmode=\"transparent\" width=\""+this.clientWidth+"\" height=\""+this.clientHeight+"\" 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:-"+((p.clientHeight/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 |
-
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","div");for(var i=0;i<lytes.length;i++){lyte_id=lytes[i].id;p=doc.getElementById(lyte_id);p.className+=" lP";if(p.className.indexOf('widget')
|
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","div");for(var i=0;i<lytes.length;i++){lyte_id=lytes[i].id;p=doc.getElementById(lyte_id);p.className+=" lP";pW=p.clientWidth;pH=p.clientHeight;if(p.className.indexOf('widget')===-1){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;pl.id="lyte_"+lyte_id;pl.className="pL";setStyle(pl,'height:'+pH+'px;width:'+pW+'px;background:url("http://img.youtube.com/vi/'+lyte_id+'/0.jpg") no-repeat scroll center center rgb(0, 0, 0);background-size:contain;');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-newtube-"+pW+".png\" width=\"100%\" class=\"ctrl\" alt=\"\" style=\"max-width:"+pW+"px;\"/>";}}function nolyte(){this.onclick="";this.innerHTML="<iframe class=\"youtube-player\" type=\"text/html\" width=\""+this.clientWidth+"\" height=\""+this.clientHeight+"\" src=\"http://www.youtube.com/embed/"+this.id+"?autoplay=1&rel=0&egm=0&iv_load_policy=3\" 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:-"+((p.clientHeight/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();
|
options.php
CHANGED
@@ -16,6 +16,7 @@ function lyte_settings_page() {
|
|
16 |
?>
|
17 |
<div class="wrap">
|
18 |
<h2>WP YouTube Lyte Settings</h2>
|
|
|
19 |
<p>WP-YouTube-Lyte inserts "Lite YouTube Embeds" in your blog. These look and feel like normal embedded YouTube, but don't use Flash unless clicked on, thereby <a href="http://blog.futtta.be/2010/08/30/the-state-of-wp-youtube-lyte/" target="_blank">reducing download size & rendering time substantially</a>. The HTML5-option even allows for entirely Flash-less YouTube embeds, using H264 or WebM to play the video in compatible browsers. You can find more info on the <a href="http://wordpress.org/extend/plugins/wp-youtube-lyte/" target="_blank">wordpress.org WP-YouTube-Lyte page</a>.</p>
|
20 |
<p>You can place video in your posts and pages by adding one or more http<strong>v</strong> YouTube-links to your post. These will automatically be replaced by WP-YouTube-Lyte with the correct (flash-less) code. Just replace the "http://" in the link with "httpv://", like this:
|
21 |
<blockquote>http<strong>v</strong>://www.youtube.com/watch?v=QQPSMRQnNlU</blockquote></p>
|
@@ -68,5 +69,44 @@ function lyte_settings_page() {
|
|
68 |
</p>
|
69 |
|
70 |
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
</div>
|
72 |
<?php } ?>
|
16 |
?>
|
17 |
<div class="wrap">
|
18 |
<h2>WP YouTube Lyte Settings</h2>
|
19 |
+
<div style="float:left;width:70%;">
|
20 |
<p>WP-YouTube-Lyte inserts "Lite YouTube Embeds" in your blog. These look and feel like normal embedded YouTube, but don't use Flash unless clicked on, thereby <a href="http://blog.futtta.be/2010/08/30/the-state-of-wp-youtube-lyte/" target="_blank">reducing download size & rendering time substantially</a>. The HTML5-option even allows for entirely Flash-less YouTube embeds, using H264 or WebM to play the video in compatible browsers. You can find more info on the <a href="http://wordpress.org/extend/plugins/wp-youtube-lyte/" target="_blank">wordpress.org WP-YouTube-Lyte page</a>.</p>
|
21 |
<p>You can place video in your posts and pages by adding one or more http<strong>v</strong> YouTube-links to your post. These will automatically be replaced by WP-YouTube-Lyte with the correct (flash-less) code. Just replace the "http://" in the link with "httpv://", like this:
|
22 |
<blockquote>http<strong>v</strong>://www.youtube.com/watch?v=QQPSMRQnNlU</blockquote></p>
|
69 |
</p>
|
70 |
|
71 |
</form>
|
72 |
+
</div>
|
73 |
+
<div style="float:right;width:30%" id="lyte_admin_feed">
|
74 |
+
<div style="margin-left:10px;margin-top:-5px;">
|
75 |
+
<h3>
|
76 |
+
futtta about
|
77 |
+
<select id="feed_dropdown" >
|
78 |
+
<option value="1">WP YouTube Lyte</option>
|
79 |
+
<option value="2">WordPress</option>
|
80 |
+
<option value="3">Web Technology</option>
|
81 |
+
</select>
|
82 |
+
</h3>
|
83 |
+
<div id="futtta_feed"></div>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
|
87 |
+
<?php $wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__)); ?>
|
88 |
+
<script src="<?php echo $wp_lyte_plugin_url; ?>external/jquery.zrssfeed.min.js" type="text/javascript"></script>
|
89 |
+
<link rel="stylesheet" href="<?php echo $wp_lyte_plugin_url; ?>external/jquery.zrssfeed.css" />
|
90 |
+
|
91 |
+
<script type="text/javascript">
|
92 |
+
$feed = new Array;
|
93 |
+
$feed[1]="http://feeds.feedburner.com/futtta_wp-youtube-lyte";
|
94 |
+
$feed[2]="http://feeds.feedburner.com/futtta_wordpress";
|
95 |
+
$feed[3]="http://feeds.feedburner.com/futtta_webtech";
|
96 |
+
|
97 |
+
jQuery(document).ready(function() {
|
98 |
+
show_feed(1);
|
99 |
+
jQuery("#feed_dropdown").change(function() { show_feed(jQuery("#feed_dropdown").val()) });
|
100 |
+
})
|
101 |
+
|
102 |
+
function show_feed(id) {
|
103 |
+
jQuery('#futtta_feed').rssfeed($feed[id], {
|
104 |
+
limit: 4,
|
105 |
+
date: true,
|
106 |
+
header: false
|
107 |
+
});
|
108 |
+
}
|
109 |
+
</script>
|
110 |
+
|
111 |
</div>
|
112 |
<?php } ?>
|
player_sizes.inc.php
CHANGED
@@ -30,4 +30,13 @@ $pSize[5]['a']=true;
|
|
30 |
$pSize[5]['w']=853;
|
31 |
$pSize[5]['h']=505;
|
32 |
$pSize[5]['t']="Larger 16:9 player";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
?>
|
30 |
$pSize[5]['w']=853;
|
31 |
$pSize[5]['h']=505;
|
32 |
$pSize[5]['t']="Larger 16:9 player";
|
33 |
+
|
34 |
+
// widget sizes
|
35 |
+
$wDefault=2;
|
36 |
+
$wSize[1]['h']=125;
|
37 |
+
$wSize[1]['w']=150;
|
38 |
+
$wSize[2]['h']=133;
|
39 |
+
$wSize[2]['w']=160;
|
40 |
+
$wSize[3]['h']=150;
|
41 |
+
$wSize[3]['w']=180;
|
42 |
?>
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ 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.6.
|
7 |
|
8 |
"Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
|
9 |
|
@@ -38,6 +38,7 @@ HTML5 video will not be visible for everyone (see requirements), some visitors w
|
|
38 |
= Any bugs/ issues should I know about? =
|
39 |
* The new YouTube HTML5-embed-code is a work in progress, positioning of video isn't always perfect when fallback Flash-version is used.
|
40 |
* If you're using the HTML5-version and you have a WP-YouTube-Lyte widget in your sidebar, you'll notice how the controls at the bottom overlap. This is because YouTube's new embed code doesn't scale down to small sizes too great. The normal (Flash-based) player omits most controls in this case, I would expect the HTML5-version to do this as well in a not to distant future.
|
|
|
41 |
|
42 |
= I found a bug/ I would like a feature to be added! =
|
43 |
* Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog.futtta.be/contact/), [leave a comment in a post about wp-youtube-lyte](http://blog.futtta.be/tag/wp-youtube-lyte/) or [create a new topic on the wordpress.org forum](http://wordpress.org/tags/wp-youtube-lyte?forum_id=10#postform).
|
@@ -48,6 +49,11 @@ HTML5 video will not be visible for everyone (see requirements), some visitors w
|
|
48 |
* [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/), even if you think it stinks ;-)
|
49 |
|
50 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
51 |
= 0.6.0 =
|
52 |
* There now is a WP-YouTube-Lyte widget which you can add to your sidebar (see under "Appearance"->"Widgets"), as requested by the fabulous [fruityoaty](http://fruityoaty.com/)
|
53 |
* The thumbnail is now stretched to use as much of the player as possible (thanks to css3's background-size:contain directive, which works in [all bleeding edge browsers](http://www.quirksmode.org/css/background.html#t012))
|
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.6.1
|
7 |
|
8 |
"Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
|
9 |
|
38 |
= Any bugs/ issues should I know about? =
|
39 |
* The new YouTube HTML5-embed-code is a work in progress, positioning of video isn't always perfect when fallback Flash-version is used.
|
40 |
* If you're using the HTML5-version and you have a WP-YouTube-Lyte widget in your sidebar, you'll notice how the controls at the bottom overlap. This is because YouTube's new embed code doesn't scale down to small sizes too great. The normal (Flash-based) player omits most controls in this case, I would expect the HTML5-version to do this as well in a not to distant future.
|
41 |
+
* 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)
|
42 |
|
43 |
= I found a bug/ I would like a feature to be added! =
|
44 |
* Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog.futtta.be/contact/), [leave a comment in a post about wp-youtube-lyte](http://blog.futtta.be/tag/wp-youtube-lyte/) or [create a new topic on the wordpress.org forum](http://wordpress.org/tags/wp-youtube-lyte?forum_id=10#postform).
|
49 |
* [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/), even if you think it stinks ;-)
|
50 |
|
51 |
== Changelog ==
|
52 |
+
= 0.6.1 =
|
53 |
+
* widget size can now be set (3 sizes available, to be specified for each widget individually)
|
54 |
+
* admin-page now contains links to most recent info (blogposts) on WP YouTube Lyte (and optionally WordPress and Web Technology in general) using [the excellent jQuery-plugin zrssfeed](http://www.zazar.net/developers/zrssfeed/)
|
55 |
+
* bugfix: removed CDATA-wrapper from javascript as WordPress turned ]]> into ]]< which broke the html (which in turn broke syndication in planets)
|
56 |
+
|
57 |
= 0.6.0 =
|
58 |
* There now is a WP-YouTube-Lyte widget which you can add to your sidebar (see under "Appearance"->"Widgets"), as requested by the fabulous [fruityoaty](http://fruityoaty.com/)
|
59 |
* The thumbnail is now stretched to use as much of the player as possible (thanks to css3's background-size:contain directive, which works in [all bleeding edge browsers](http://www.quirksmode.org/css/background.html#t012))
|
widget.php
CHANGED
@@ -1,13 +1,20 @@
|
|
1 |
<?php
|
|
|
|
|
2 |
class WYLWidget extends WP_Widget {
|
3 |
function WYLWidget() {
|
4 |
-
parent::WP_Widget(false, $name = 'WP
|
5 |
}
|
6 |
|
7 |
function widget($args, $instance) {
|
8 |
extract( $args );
|
|
|
9 |
$WYLtitle = apply_filters('widget_title', $instance['WYLtitle']);
|
10 |
$WYLtext = apply_filters( 'widget_text', $instance['WYLtext'], $instance );
|
|
|
|
|
|
|
|
|
11 |
parse_str(parse_url(esc_url($instance['WYLurl']),PHP_URL_QUERY),$WYLarr);
|
12 |
$WYLid=$WYLarr['v'];
|
13 |
|
@@ -22,7 +29,7 @@ class WYLWidget extends WP_Widget {
|
|
22 |
?>
|
23 |
<?php echo $before_widget; ?>
|
24 |
<?php if ( $WYLtitle ) echo $before_title . $WYLtitle . $after_title; ?>
|
25 |
-
<div class="lyte widget" id="<?php echo $WYLid; ?>" style="width
|
26 |
<div><?php echo $WYLtext ?></div>
|
27 |
<?php echo $after_widget; ?>
|
28 |
<?php
|
@@ -32,6 +39,8 @@ class WYLWidget extends WP_Widget {
|
|
32 |
$instance = $old_instance;
|
33 |
$instance['WYLtitle'] = strip_tags($new_instance['WYLtitle']);
|
34 |
$instance['WYLurl'] = strip_tags($new_instance['WYLurl']);
|
|
|
|
|
35 |
if ( current_user_can('unfiltered_html') )
|
36 |
$instance['WYLtext'] = $new_instance['WYLtext'];
|
37 |
else
|
@@ -40,12 +49,34 @@ class WYLWidget extends WP_Widget {
|
|
40 |
return $instance;
|
41 |
}
|
42 |
|
43 |
-
function form($instance) {
|
|
|
|
|
44 |
$WYLtitle = esc_attr($instance['WYLtitle']);
|
45 |
$WYLurl = esc_attr($instance['WYLurl']);
|
46 |
$WYLtext = format_to_edit($instance['WYLtext']);
|
|
|
|
|
|
|
|
|
47 |
?>
|
48 |
<p><label for="<?php echo $this->get_field_id('WYLtitle'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('WYLtitle'); ?>" name="<?php echo $this->get_field_name('WYLtitle'); ?>" type="text" value="<?php echo $WYLtitle; ?>" /></label></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
<p><label for="<?php echo $this->get_field_id('WYLurl'); ?>"><?php _e('Youtube-URL:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('WYLurl'); ?>" name="<?php echo $this->get_field_name('WYLurl'); ?>" type="text" value="<?php echo $WYLurl; ?>" /></label></p>
|
50 |
<p><label for="<?php echo $this->get_field_id('WYLtext'); ?>"><?php _e('Text:'); ?> <textarea class="widefat" id="<?php echo $this->get_field_id('WYLtext'); ?>" name="<?php echo $this->get_field_name('WYLtext'); ?>" rows="16" cols="20"><?php echo $WYLtext; ?></textarea></label></p>
|
51 |
<?php
|
1 |
<?php
|
2 |
+
require_once(dirname(__FILE__).'/player_sizes.inc.php');
|
3 |
+
|
4 |
class WYLWidget extends WP_Widget {
|
5 |
function WYLWidget() {
|
6 |
+
parent::WP_Widget(false, $name = 'WP YouTube Lyte');
|
7 |
}
|
8 |
|
9 |
function widget($args, $instance) {
|
10 |
extract( $args );
|
11 |
+
global $wSize;
|
12 |
$WYLtitle = apply_filters('widget_title', $instance['WYLtitle']);
|
13 |
$WYLtext = apply_filters( 'widget_text', $instance['WYLtext'], $instance );
|
14 |
+
|
15 |
+
$WYLsize = apply_filters( 'widget_text', $instance['WYLsize'], $instance );
|
16 |
+
if ($WYLsize=="") $WYLsize=$wDefault;
|
17 |
+
|
18 |
parse_str(parse_url(esc_url($instance['WYLurl']),PHP_URL_QUERY),$WYLarr);
|
19 |
$WYLid=$WYLarr['v'];
|
20 |
|
29 |
?>
|
30 |
<?php echo $before_widget; ?>
|
31 |
<?php if ( $WYLtitle ) echo $before_title . $WYLtitle . $after_title; ?>
|
32 |
+
<div class="lyte widget" id="<?php echo $WYLid; ?>" style="width:<?php echo $wSize[$WYLsize]['w']; ?>px;height:<?php 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"></a></noscript><script type="text/javascript"><!--\n var bU='<?php echo $lyteSettings[0];?>';var d=document;if(d.addEventListener){d.addEventListener('DOMContentLoaded', insert, false)}else{window.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='<?php echo $lyteSettings[0].$lyteSettings[1];?>';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};/n--></script></div>
|
33 |
<div><?php echo $WYLtext ?></div>
|
34 |
<?php echo $after_widget; ?>
|
35 |
<?php
|
39 |
$instance = $old_instance;
|
40 |
$instance['WYLtitle'] = strip_tags($new_instance['WYLtitle']);
|
41 |
$instance['WYLurl'] = strip_tags($new_instance['WYLurl']);
|
42 |
+
$instance['WYLsize'] = strip_tags($new_instance['WYLsize']);
|
43 |
+
|
44 |
if ( current_user_can('unfiltered_html') )
|
45 |
$instance['WYLtext'] = $new_instance['WYLtext'];
|
46 |
else
|
49 |
return $instance;
|
50 |
}
|
51 |
|
52 |
+
function form($instance) {
|
53 |
+
global $wSize, $wDefault;
|
54 |
+
|
55 |
$WYLtitle = esc_attr($instance['WYLtitle']);
|
56 |
$WYLurl = esc_attr($instance['WYLurl']);
|
57 |
$WYLtext = format_to_edit($instance['WYLtext']);
|
58 |
+
|
59 |
+
$WYLsize = esc_attr($instance['WYLsize']);
|
60 |
+
if ($WYLsize=="") $WYLsize=$wDefault;
|
61 |
+
|
62 |
?>
|
63 |
<p><label for="<?php echo $this->get_field_id('WYLtitle'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('WYLtitle'); ?>" name="<?php echo $this->get_field_name('WYLtitle'); ?>" type="text" value="<?php echo $WYLtitle; ?>" /></label></p>
|
64 |
+
<p><label for="<?php echo $this->get_field_id('WYLsize'); ?>"><?php _e('Size:'); ?>
|
65 |
+
<select class="widefat" id="<?php echo $this->get_field_id('WYLsize'); ?>" name="<?php echo $this->get_field_name('WYLsize'); ?>">
|
66 |
+
<?php
|
67 |
+
$x=1;
|
68 |
+
while ($wSize[$x]) {
|
69 |
+
if ($x==$WYLsize) {
|
70 |
+
$selected=" selected=\"true\"";
|
71 |
+
} else {
|
72 |
+
$selected="";
|
73 |
+
}
|
74 |
+
echo "<option value=\"".$x."\"".$selected.">".$wSize[$x]['w']."X".$wSize[$x]['h']."</option>";
|
75 |
+
$x++;
|
76 |
+
}
|
77 |
+
?>
|
78 |
+
</select>
|
79 |
+
</label></p>
|
80 |
<p><label for="<?php echo $this->get_field_id('WYLurl'); ?>"><?php _e('Youtube-URL:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('WYLurl'); ?>" name="<?php echo $this->get_field_name('WYLurl'); ?>" type="text" value="<?php echo $WYLurl; ?>" /></label></p>
|
81 |
<p><label for="<?php echo $this->get_field_id('WYLtext'); ?>"><?php _e('Text:'); ?> <textarea class="widefat" id="<?php echo $this->get_field_id('WYLtext'); ?>" name="<?php echo $this->get_field_name('WYLtext'); ?>" rows="16" cols="20"><?php echo $WYLtext; ?></textarea></label></p>
|
82 |
<?php
|
wp-youtube-lyte.php
CHANGED
@@ -3,14 +3,14 @@
|
|
3 |
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)
|
7 |
-
Version: 0.6.
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
*/
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
$wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
|
16 |
|
@@ -51,7 +51,7 @@ function lyte_parse($the_content) {
|
|
51 |
$noscript_post="";
|
52 |
$lytelinks_txt="<div class=\"lL\">Watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a>.</div>";
|
53 |
}
|
54 |
-
$lytetemplate = "<div class=\"lyte\" id=\"".$match[3]."\" style=\"width:".$lyteSettings[2]."px;height:".$lyteSettings[3]."px;\"><noscript><a href=\"http://youtu.be/".$match[3]."\"><img src=\"http://img.youtube.com/vi/".$match[3]."/0.jpg\">".$noscript_post."</a></noscript><script type=\"text/javascript\"
|
55 |
$the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $lytetemplate, $the_content, 1);
|
56 |
}
|
57 |
}
|
3 |
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 Goossens (futtta)
|
7 |
+
Version: 0.6.1
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
*/
|
10 |
|
11 |
+
require_once(dirname(__FILE__).'/options.php');
|
12 |
+
require_once(dirname(__FILE__).'/player_sizes.inc.php');
|
13 |
+
require_once(dirname(__FILE__).'/widget.php');
|
14 |
|
15 |
$wp_lyte_plugin_url = defined('WP_PLUGIN_URL') ? trailingslashit(WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__))) : trailingslashit(get_bloginfo('wpurl')) . PLUGINDIR . '/' . dirname(plugin_basename(__FILE__));
|
16 |
|
51 |
$noscript_post="";
|
52 |
$lytelinks_txt="<div class=\"lL\">Watch this video <a href=\"http://youtu.be/".$match[3]."\">on YouTube</a>.</div>";
|
53 |
}
|
54 |
+
$lytetemplate = "<div class=\"lyte\" id=\"".$match[3]."\" style=\"width:".$lyteSettings[2]."px;height:".$lyteSettings[3]."px;\"><noscript><a href=\"http://youtu.be/".$match[3]."\"><img src=\"http://img.youtube.com/vi/".$match[3]."/0.jpg\">".$noscript_post."</a></noscript><script type=\"text/javascript\"><!--\n var bU='".$lyteSettings[0]."';var d=document;if(d.addEventListener){d.addEventListener('DOMContentLoaded', insert, false)}else{window.onload=insert} function insert(){if(!d.getElementById('lytescr')){lytescr=d.createElement('script');lytescr.async=true;lytescr.id='lytescr';lytescr.src='".$lyteSettings[0].$lyteSettings[1]."';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};\n--></script></div>".$lytelinks_txt;
|
55 |
$the_content = preg_replace("/httpv:\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", $lytetemplate, $the_content, 1);
|
56 |
}
|
57 |
}
|