Version Description
- re-minized lyte-min.js (there's lyte.js for your reading pleasure though)
- thumbnail image in noscript-tags now inherits size of div (to keep it from messing up the layout when JS is not available, e.g. in a feedburner-feed)
- the html5 version of the audio-player now is a bit higher (was 27px, now 33px) to allow scrolling through the clip
- the html-output of the plugin now validates against xhtml 1.0 transitional (thanks for the heads-up Carolin)
- text in frontend (i.e. what your visitors see) is translated into Dutch & French, corrections and other translations are welcome
Download this release
Release Info
Developer | futtta |
Plugin | WP YouTube Lyte |
Version | 0.7.1 |
Comparing to | |
See all releases |
Code changes from version 0.7.0 to 0.7.1
- languages/wp-youtube-lyte-fr_BE.mo +0 -0
- languages/wp-youtube-lyte-fr_FR.mo +0 -0
- languages/wp-youtube-lyte-nl_BE.mo +0 -0
- languages/wp-youtube-lyte-nl_NL.mo +0 -0
- languages/wp-youtube-lyte.pot +69 -0
- lyte/lyte-min.js +16 -145
- lyte/lyte.css +1 -1
- lyte/lyte.js +145 -0
- readme.txt +11 -4
- widget.php +1 -1
- wp-youtube-lyte.php +13 -13
languages/wp-youtube-lyte-fr_BE.mo
ADDED
Binary file
|
languages/wp-youtube-lyte-fr_FR.mo
ADDED
Binary file
|
languages/wp-youtube-lyte-nl_BE.mo
ADDED
Binary file
|
languages/wp-youtube-lyte-nl_NL.mo
ADDED
Binary file
|
languages/wp-youtube-lyte.pot
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright (C) 2010 WP YouTube Lyte
|
2 |
+
# This file is distributed under the same license as the WP YouTube Lyte package.
|
3 |
+
msgid ""
|
4 |
+
msgstr ""
|
5 |
+
"Project-Id-Version: WP YouTube Lyte 0.7.1\n"
|
6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-youtube-lyte\n"
|
7 |
+
"POT-Creation-Date: 2011-04-22 10:00:18+00:00\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
|
12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
+
|
15 |
+
#: options.php:93
|
16 |
+
msgid "Save Changes"
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: wp-youtube-lyte.php:57
|
20 |
+
msgid "Watch this video on YouTube"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: wp-youtube-lyte.php:62 wp-youtube-lyte.php:66
|
24 |
+
msgid "Watch this video"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: wp-youtube-lyte.php:62 wp-youtube-lyte.php:66
|
28 |
+
msgid "on YouTube"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: wp-youtube-lyte.php:62
|
32 |
+
msgid "or on"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: widget.php:65
|
36 |
+
msgid "Title:"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: widget.php:66
|
40 |
+
msgid "Size:"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: widget.php:82
|
44 |
+
msgid "Youtube-URL:"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: widget.php:83
|
48 |
+
msgid "Text:"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#. Plugin Name of the plugin/theme
|
52 |
+
msgid "WP YouTube Lyte"
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#. Plugin URI of the plugin/theme
|
56 |
+
msgid "http://blog.futtta.be/tag/lyte"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#. Description of the plugin/theme
|
60 |
+
msgid "Lite and accessible YouTube audio and video embedding."
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#. Author of the plugin/theme
|
64 |
+
msgid "Frank Goossens (futtta)"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#. Author URI of the plugin/theme
|
68 |
+
msgid "http://blog.futtta.be/"
|
69 |
+
msgstr ""
|
lyte/lyte-min.js
CHANGED
@@ -1,145 +1,16 @@
|
|
1 |
-
var doc
|
2 |
-
var
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
p = doc.getElementById(lyte_id);
|
18 |
-
p.className += " lP";
|
19 |
-
pW = p.clientWidth;
|
20 |
-
pH = p.clientHeight;
|
21 |
-
if ((p.className.indexOf('widget') === -1) && (p.className.indexOf('audio') === -1)){
|
22 |
-
jsonUrl = "http://gdata.youtube.com/feeds/api/videos/" + lyte_id + "?fields=id,title&alt=json-in-script&callback=parseMe";
|
23 |
-
loadScript(jsonUrl)
|
24 |
-
}
|
25 |
-
pl = doc.createElement('div');
|
26 |
-
p.appendChild(pl);
|
27 |
-
p.onclick = plaYT;
|
28 |
-
pl.id = "lyte_" + lyte_id;
|
29 |
-
pl.className = "pL";
|
30 |
-
|
31 |
-
if (p.className.indexOf('audio') === -1){
|
32 |
-
setStyle(pl, 'height:' + pH + 'px;width:' + pW + 'px;background:url("http://img.youtube.com/vi/' + lyte_id + '/0.jpg") no-repeat scroll center -10px rgb(0, 0, 0);background-size:contain;');
|
33 |
-
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-" + nT + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
|
34 |
-
} else {
|
35 |
-
setStyle(pl, 'height:' + pH + 'px;width:' + pW);
|
36 |
-
pl.innerHTML = "<img src=\"" + bU + "controls-" + nT + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
|
37 |
-
}
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
function plaYT() {
|
42 |
-
this.onclick = "";
|
43 |
-
if (nT=="newtube-") {
|
44 |
-
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&probably_logged_in=false\" frameborder=\"0\"></iframe>"
|
45 |
-
} else {
|
46 |
-
this.innerHTML = "<embed src=\"http://www.youtube-nocookie.com/v/" + this.id + "&autoplay=1&rel=0&egm=0&fs=1&iv_load_policy=3&probably_logged_in=false\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" id=\"lyte_" + this.id + "\" wmode=\"transparent\" width=\"" + this.clientWidth + "\" height=\"" + this.clientHeight + "\" allowscriptaccess=\"always\"></embed>"
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
function parseMe(r) {
|
51 |
-
title = r.entry.title.$t;
|
52 |
-
idu = r.entry.id.$t;
|
53 |
-
p = doc.getElementById("lyte_" + idu.substring((idu.length - 11)));
|
54 |
-
c = doc.createElement('div');
|
55 |
-
c.className = "tC";
|
56 |
-
p.appendChild(c);
|
57 |
-
setStyle(c, "margin:-" + ((p.clientHeight / 2) + 15) + "px 5px;");
|
58 |
-
t = doc.createElement('div');
|
59 |
-
t.className = "tT";
|
60 |
-
c.appendChild(t);
|
61 |
-
t.innerHTML = title;
|
62 |
-
}
|
63 |
-
|
64 |
-
function setStyle(e, s) {
|
65 |
-
if (typeof e.setAttribute === "function") e.setAttribute('style', s);
|
66 |
-
else if (typeof e.style.setAttribute === "object") e.style.setAttribute('cssText', s)
|
67 |
-
}
|
68 |
-
|
69 |
-
function loadScript(url) {
|
70 |
-
scr = doc.createElement('script');
|
71 |
-
scr.src = url;
|
72 |
-
scr.type = 'text/javascript';
|
73 |
-
doc.getElementsByTagName('head')[0].appendChild(scr)
|
74 |
-
}
|
75 |
-
|
76 |
-
var getElementsByClassName = function (className, tag, elm) {
|
77 |
-
if (doc.getElementsByClassName) {
|
78 |
-
getElementsByClassName = function (className, tag, elm) {
|
79 |
-
elm = elm || doc;
|
80 |
-
var elements = elm.getElementsByClassName(className),
|
81 |
-
nodeName = (tag) ? new RegExp("\\b" + tag + "\\b", "i") : null,
|
82 |
-
returnElements = [],
|
83 |
-
current;
|
84 |
-
for (var i = 0, il = elements.length; i < il; i += 1) {
|
85 |
-
current = elements[i];
|
86 |
-
if (!nodeName || nodeName.test(current.nodeName)) {
|
87 |
-
returnElements.push(current)
|
88 |
-
}
|
89 |
-
}
|
90 |
-
return returnElements
|
91 |
-
}
|
92 |
-
} else if (doc.evaluate) {
|
93 |
-
getElementsByClassName = function (className, tag, elm) {
|
94 |
-
tag = tag || "*";
|
95 |
-
elm = elm || doc;
|
96 |
-
var classes = className.split(" "),
|
97 |
-
classesToCheck = "",
|
98 |
-
xhtmlNamespace = "http://www.w3.org/1999/xhtml",
|
99 |
-
namespaceResolver = (doc.documentElement.namespaceURI === xhtmlNamespace) ? xhtmlNamespace : null,
|
100 |
-
returnElements = [],
|
101 |
-
elements, node;
|
102 |
-
for (var j = 0, jl = classes.length; j < jl; j += 1) {
|
103 |
-
classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]"
|
104 |
-
}
|
105 |
-
try {
|
106 |
-
elements = doc.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null)
|
107 |
-
} catch (e) {
|
108 |
-
elements = doc.evaluate(".//" + tag + classesToCheck, elm, null, 0, null)
|
109 |
-
}
|
110 |
-
while ((node = elements.iterateNext())) {
|
111 |
-
returnElements.push(node)
|
112 |
-
}
|
113 |
-
return returnElements
|
114 |
-
}
|
115 |
-
} else {
|
116 |
-
getElementsByClassName = function (className, tag, elm) {
|
117 |
-
tag = tag || "*";
|
118 |
-
elm = elm || doc;
|
119 |
-
var classes = className.split(" "),
|
120 |
-
classesToCheck = [],
|
121 |
-
elements = (tag === "*" && elm.all) ? elm.all : elm.getElementsByTagName(tag),
|
122 |
-
current, returnElements = [],
|
123 |
-
match;
|
124 |
-
for (var k = 0, kl = classes.length; k < kl; k += 1) {
|
125 |
-
classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"))
|
126 |
-
}
|
127 |
-
for (var l = 0, ll = elements.length; l < ll; l += 1) {
|
128 |
-
current = elements[l];
|
129 |
-
match = false;
|
130 |
-
for (var m = 0, ml = classesToCheck.length; m < ml; m += 1) {
|
131 |
-
match = classesToCheck[m].test(current.className);
|
132 |
-
if (!match) {
|
133 |
-
break
|
134 |
-
}
|
135 |
-
}
|
136 |
-
if (match) {
|
137 |
-
returnElements.push(current)
|
138 |
-
}
|
139 |
-
}
|
140 |
-
return returnElements
|
141 |
-
}
|
142 |
-
}
|
143 |
-
return getElementsByClassName(className, tag, elm)
|
144 |
-
};
|
145 |
-
lyte();
|
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);}
|
2 |
+
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)&&(p.className.indexOf('audio')===-1)){jsonUrl="http://gdata.youtube.com/feeds/api/videos/"+lyte_id+"?fields=id,title&alt=json-in-script&callback=parseMe";loadScript(jsonUrl)}
|
3 |
+
pl=doc.createElement('div');p.appendChild(pl);p.onclick=plaYT;pl.id="lyte_"+lyte_id;pl.className="pL";if(p.className.indexOf('audio')===-1){setStyle(pl,'height:'+pH+'px;width:'+pW+'px;background:url("http://img.youtube.com/vi/'+lyte_id+'/0.jpg") no-repeat scroll center -10px 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-"+nT+pW+".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:"+pW+"px;\"/>";}else{setStyle(pl,'height:'+pH+'px;width:'+pW);pl.innerHTML="<img src=\""+bU+"controls-"+nT+pW+".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:"+pW+"px;\"/>";}}}
|
4 |
+
function plaYT(){this.onclick="";if(nT=="newtube-"){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&probably_logged_in=false\" frameborder=\"0\"></iframe>"}else{this.innerHTML="<embed src=\"http://www.youtube-nocookie.com/v/"+this.id+"&autoplay=1&rel=0&egm=0&fs=1&iv_load_policy=3&probably_logged_in=false\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" id=\"lyte_"+this.id+"\" wmode=\"transparent\" width=\""+this.clientWidth+"\" height=\""+this.clientHeight+"\" allowscriptaccess=\"always\"></embed>"}}
|
5 |
+
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;}
|
6 |
+
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)}
|
7 |
+
function loadScript(url){scr=doc.createElement('script');scr.src=url;scr.type='text/javascript';doc.getElementsByTagName('head')[0].appendChild(scr)}
|
8 |
+
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)}}
|
9 |
+
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]+" ')]"}
|
10 |
+
try{elements=doc.evaluate(".//"+tag+classesToCheck,elm,namespaceResolver,0,null)}catch(e){elements=doc.evaluate(".//"+tag+classesToCheck,elm,null,0,null)}
|
11 |
+
while((node=elements.iterateNext())){returnElements.push(node)}
|
12 |
+
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|$)"))}
|
13 |
+
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}}
|
14 |
+
if(match){returnElements.push(current)}}
|
15 |
+
return returnElements}}
|
16 |
+
return getElementsByClassName(className,tag,elm)};lyte();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lyte/lyte.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.lyte img {border:0px;padding:0px;spacing:0px;margin:0px;display:inline;} .lL {margin:0px 0px 10px 0px;} .lyte {margin:5px 0px;} .lP {background-color:#
|
1 |
+
.lyte img {border:0px;padding:0px;spacing:0px;margin:0px;display:inline;} .lL {margin:0px 0px 10px 0px;} .lyte {margin:5px 0px;} .lP {background-color:#fff;} .pL {cursor:pointer;text-align:center;overflow:hidden;position:relative;margin: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;}
|
lyte/lyte.js
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var doc = document;
|
2 |
+
var cI = 'lytecss';
|
3 |
+
|
4 |
+
if (!doc.getElementById(cI)) {
|
5 |
+
lk = doc.createElement('link');
|
6 |
+
lk.id = cI;
|
7 |
+
lk.rel = 'stylesheet';
|
8 |
+
lk.type = 'text/css';
|
9 |
+
lk.href = bU + 'lyte.css';
|
10 |
+
doc.getElementsByTagName('head')[0].appendChild(lk);
|
11 |
+
}
|
12 |
+
|
13 |
+
function lyte() {
|
14 |
+
lytes = getElementsByClassName("lyte", "div");
|
15 |
+
for (var i = 0; i < lytes.length; i++) {
|
16 |
+
lyte_id = lytes[i].id;
|
17 |
+
p = doc.getElementById(lyte_id);
|
18 |
+
p.className += " lP";
|
19 |
+
pW = p.clientWidth;
|
20 |
+
pH = p.clientHeight;
|
21 |
+
if ((p.className.indexOf('widget') === -1) && (p.className.indexOf('audio') === -1)){
|
22 |
+
jsonUrl = "http://gdata.youtube.com/feeds/api/videos/" + lyte_id + "?fields=id,title&alt=json-in-script&callback=parseMe";
|
23 |
+
loadScript(jsonUrl)
|
24 |
+
}
|
25 |
+
pl = doc.createElement('div');
|
26 |
+
p.appendChild(pl);
|
27 |
+
p.onclick = plaYT;
|
28 |
+
pl.id = "lyte_" + lyte_id;
|
29 |
+
pl.className = "pL";
|
30 |
+
|
31 |
+
if (p.className.indexOf('audio') === -1){
|
32 |
+
setStyle(pl, 'height:' + pH + 'px;width:' + pW + 'px;background:url("http://img.youtube.com/vi/' + lyte_id + '/0.jpg") no-repeat scroll center -10px rgb(0, 0, 0);background-size:contain;');
|
33 |
+
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-" + nT + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
|
34 |
+
} else {
|
35 |
+
setStyle(pl, 'height:' + pH + 'px;width:' + pW);
|
36 |
+
pl.innerHTML = "<img src=\"" + bU + "controls-" + nT + pW + ".png\" width=\"100%\" id=\"ctrl\" alt=\"\" style=\"max-width:" + pW + "px;\"/>";
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
function plaYT() {
|
42 |
+
this.onclick = "";
|
43 |
+
if (nT=="newtube-") {
|
44 |
+
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&probably_logged_in=false\" frameborder=\"0\"></iframe>"
|
45 |
+
} else {
|
46 |
+
this.innerHTML = "<embed src=\"http://www.youtube-nocookie.com/v/" + this.id + "&autoplay=1&rel=0&egm=0&fs=1&iv_load_policy=3&probably_logged_in=false\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" id=\"lyte_" + this.id + "\" wmode=\"transparent\" width=\"" + this.clientWidth + "\" height=\"" + this.clientHeight + "\" allowscriptaccess=\"always\"></embed>"
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
function parseMe(r) {
|
51 |
+
title = r.entry.title.$t;
|
52 |
+
idu = r.entry.id.$t;
|
53 |
+
p = doc.getElementById("lyte_" + idu.substring((idu.length - 11)));
|
54 |
+
c = doc.createElement('div');
|
55 |
+
c.className = "tC";
|
56 |
+
p.appendChild(c);
|
57 |
+
setStyle(c, "margin:-" + ((p.clientHeight / 2) + 15) + "px 5px;");
|
58 |
+
t = doc.createElement('div');
|
59 |
+
t.className = "tT";
|
60 |
+
c.appendChild(t);
|
61 |
+
t.innerHTML = title;
|
62 |
+
}
|
63 |
+
|
64 |
+
function setStyle(e, s) {
|
65 |
+
if (typeof e.setAttribute === "function") e.setAttribute('style', s);
|
66 |
+
else if (typeof e.style.setAttribute === "object") e.style.setAttribute('cssText', s)
|
67 |
+
}
|
68 |
+
|
69 |
+
function loadScript(url) {
|
70 |
+
scr = doc.createElement('script');
|
71 |
+
scr.src = url;
|
72 |
+
scr.type = 'text/javascript';
|
73 |
+
doc.getElementsByTagName('head')[0].appendChild(scr)
|
74 |
+
}
|
75 |
+
|
76 |
+
var getElementsByClassName = function (className, tag, elm) {
|
77 |
+
if (doc.getElementsByClassName) {
|
78 |
+
getElementsByClassName = function (className, tag, elm) {
|
79 |
+
elm = elm || doc;
|
80 |
+
var elements = elm.getElementsByClassName(className),
|
81 |
+
nodeName = (tag) ? new RegExp("\\b" + tag + "\\b", "i") : null,
|
82 |
+
returnElements = [],
|
83 |
+
current;
|
84 |
+
for (var i = 0, il = elements.length; i < il; i += 1) {
|
85 |
+
current = elements[i];
|
86 |
+
if (!nodeName || nodeName.test(current.nodeName)) {
|
87 |
+
returnElements.push(current)
|
88 |
+
}
|
89 |
+
}
|
90 |
+
return returnElements
|
91 |
+
}
|
92 |
+
} else if (doc.evaluate) {
|
93 |
+
getElementsByClassName = function (className, tag, elm) {
|
94 |
+
tag = tag || "*";
|
95 |
+
elm = elm || doc;
|
96 |
+
var classes = className.split(" "),
|
97 |
+
classesToCheck = "",
|
98 |
+
xhtmlNamespace = "http://www.w3.org/1999/xhtml",
|
99 |
+
namespaceResolver = (doc.documentElement.namespaceURI === xhtmlNamespace) ? xhtmlNamespace : null,
|
100 |
+
returnElements = [],
|
101 |
+
elements, node;
|
102 |
+
for (var j = 0, jl = classes.length; j < jl; j += 1) {
|
103 |
+
classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]"
|
104 |
+
}
|
105 |
+
try {
|
106 |
+
elements = doc.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null)
|
107 |
+
} catch (e) {
|
108 |
+
elements = doc.evaluate(".//" + tag + classesToCheck, elm, null, 0, null)
|
109 |
+
}
|
110 |
+
while ((node = elements.iterateNext())) {
|
111 |
+
returnElements.push(node)
|
112 |
+
}
|
113 |
+
return returnElements
|
114 |
+
}
|
115 |
+
} else {
|
116 |
+
getElementsByClassName = function (className, tag, elm) {
|
117 |
+
tag = tag || "*";
|
118 |
+
elm = elm || doc;
|
119 |
+
var classes = className.split(" "),
|
120 |
+
classesToCheck = [],
|
121 |
+
elements = (tag === "*" && elm.all) ? elm.all : elm.getElementsByTagName(tag),
|
122 |
+
current, returnElements = [],
|
123 |
+
match;
|
124 |
+
for (var k = 0, kl = classes.length; k < kl; k += 1) {
|
125 |
+
classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"))
|
126 |
+
}
|
127 |
+
for (var l = 0, ll = elements.length; l < ll; l += 1) {
|
128 |
+
current = elements[l];
|
129 |
+
match = false;
|
130 |
+
for (var m = 0, ml = classesToCheck.length; m < ml; m += 1) {
|
131 |
+
match = classesToCheck[m].test(current.className);
|
132 |
+
if (!match) {
|
133 |
+
break
|
134 |
+
}
|
135 |
+
}
|
136 |
+
if (match) {
|
137 |
+
returnElements.push(current)
|
138 |
+
}
|
139 |
+
}
|
140 |
+
return returnElements
|
141 |
+
}
|
142 |
+
}
|
143 |
+
return getElementsByClassName(className, tag, elm)
|
144 |
+
};
|
145 |
+
lyte();
|
readme.txt
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
===
|
2 |
Contributors: futtta
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.1.1
|
6 |
-
Stable tag: 0.7.
|
7 |
|
8 |
"Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
WP
|
13 |
|
14 |
WP-Youtube-lyte can be used together with [Smart Youtube](http://wordpress.org/extend/plugins/smart-youtube/ "Great plugin"). In that case WP-Youtube-lyte will take care of the default embeds (httpv), while Smart Youtube continues to parse other types (httpvh, httpvhd, httpvp, ...).
|
15 |
|
@@ -54,8 +54,15 @@ and you're good to go!
|
|
54 |
* [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/), even if you think it stinks ;-)
|
55 |
|
56 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
= 0.7.0 =
|
58 |
-
* new feature (as seen [on Pitchfork](http://pitchfork.com/ "great site for music lovers")
|
59 |
* merged lyte-min.js and lyte-newtube-min.js into one file
|
60 |
* added wmode=transparant when video is played in flash-mode
|
61 |
|
1 |
+
=== WP YouTube Lyte ===
|
2 |
Contributors: futtta
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.1.1
|
6 |
+
Stable tag: 0.7.1
|
7 |
|
8 |
"Lite YouTube Embeds" look like normal YouTube embeds but don't use Flash, thus reducing download size & page rendering time.
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
WP YouTube Lyte inserts "Lite YouTube Embeds" in your blog. These look and feel like normal embedded YouTube, but don't use Flash, thereby [reducing download size & rendering time substantially](http://blog.futtta.be/2010/08/30/the-state-of-wp-youtube-lyte/). Just add a YouTube-link with "httpv" (or "httpa" if you only want to [embed YouTube's audio](http://blog.futtta.be/2011/04/19/audio-only-youtube-embedding-with-wp-youtube-lyte-0-7/)) instead of "http" and WP YouTube Lyte will replace that link with the correct (flash-less) code. When a video is played, WP YouTube Lyte can activate [YouTube's embedded html5-player](http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html) or the older Flash-version.
|
13 |
|
14 |
WP-Youtube-lyte can be used together with [Smart Youtube](http://wordpress.org/extend/plugins/smart-youtube/ "Great plugin"). In that case WP-Youtube-lyte will take care of the default embeds (httpv), while Smart Youtube continues to parse other types (httpvh, httpvhd, httpvp, ...).
|
15 |
|
54 |
* [Rate my plugin on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/), even if you think it stinks ;-)
|
55 |
|
56 |
== Changelog ==
|
57 |
+
= 0.7.1 =
|
58 |
+
* re-minized lyte-min.js (there's lyte.js for your reading pleasure though)
|
59 |
+
* thumbnail image in noscript-tags now inherits size of div (to keep it from messing up the layout when JS is not available, e.g. in a feedburner-feed)
|
60 |
+
* the html5 version of the audio-player now is a bit higher (was 27px, now 33px) to allow scrolling through the clip
|
61 |
+
* the html-output of the plugin now validates against xhtml 1.0 transitional (thanks for the heads-up Carolin)
|
62 |
+
* text in frontend (i.e. what your visitors see) is translated into Dutch & French, [corrections and other translations are welcome](http://blog.futtta.be/contact/)
|
63 |
+
|
64 |
= 0.7.0 =
|
65 |
+
* new feature (as seen [on Pitchfork](http://pitchfork.com/ "great site for music lovers")): [audio-only YouTube embeds](http://blog.futtta.be/2011/04/19/audio-only-youtube-embedding-with-wp-youtube-lyte-0-7/) (use "httpa://" instead of "httpv://")
|
66 |
* merged lyte-min.js and lyte-newtube-min.js into one file
|
67 |
* added wmode=transparant when video is played in flash-mode
|
68 |
|
widget.php
CHANGED
@@ -29,7 +29,7 @@ class WYLWidget extends WP_Widget {
|
|
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"
|
33 |
var bU='<?php echo $lyteSettings[0];?>';var nT='<?php echo $lyteSettings[1];?>';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]."lyte-min.js";?>';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};
|
34 |
--></script></div>
|
35 |
<div><?php echo $WYLtext ?></div>
|
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" alt="" /></a></noscript><script type="text/javascript"><!--
|
33 |
var bU='<?php echo $lyteSettings[0];?>';var nT='<?php echo $lyteSettings[1];?>';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]."lyte-min.js";?>';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}};
|
34 |
--></script></div>
|
35 |
<div><?php echo $WYLtext ?></div>
|
wp-youtube-lyte.php
CHANGED
@@ -4,20 +4,20 @@ Plugin Name: WP YouTube Lyte
|
|
4 |
Plugin URI: http://blog.futtta.be/tag/lyte
|
5 |
Description: Lite and accessible YouTube audio and video embedding.
|
6 |
Author: Frank Goossens (futtta)
|
7 |
-
Version: 0.7.
|
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
|
16 |
-
|
17 |
-
$plugin_dir = basename(dirname(__FILE__));
|
18 |
-
load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
|
19 |
-
|
20 |
-
$lyteSettings[0]=$wp_lyte_plugin_url."lyte/";
|
21 |
|
22 |
if (get_option('newTube')==="1") {
|
23 |
$lyteSettings[1]="newtube-";
|
@@ -46,7 +46,7 @@ function lyte_parse($the_content) {
|
|
46 |
} else {
|
47 |
$audioClass=" audio";
|
48 |
if ($lyteSettings[1]=="newtube-"){
|
49 |
-
$divHeight=
|
50 |
} else {
|
51 |
$divHeight=25;
|
52 |
}
|
@@ -54,20 +54,20 @@ function lyte_parse($the_content) {
|
|
54 |
|
55 |
switch ($lyteSettings[4]) {
|
56 |
case "0":
|
57 |
-
$noscript_post="<br />".__("Watch on YouTube","wp-youtube-lyte");
|
58 |
$lytelinks_txt="";
|
59 |
break;
|
60 |
case "2":
|
61 |
$noscript_post="";
|
62 |
-
$lytelinks_txt="<div class=\"lL\">".__("Watch this video
|
63 |
break;
|
64 |
default:
|
65 |
$noscript_post="";
|
66 |
-
$lytelinks_txt="<div class=\"lL\">".__("Watch this video
|
67 |
}
|
68 |
|
69 |
-
$lytetemplate = "<div class=\"lyte".$audioClass."\" id=\"".$match[4]."\" style=\"width:".$lyteSettings[2]."px;height:".$divHeight."px;\"><noscript><a href=\"http://youtu.be/".$match[4]."\"><img src=\"http://img.youtube.com/vi/".$match[4]."/0.jpg\"
|
70 |
-
$the_content = preg_replace("
|
71 |
}
|
72 |
}
|
73 |
return $the_content;
|
4 |
Plugin URI: http://blog.futtta.be/tag/lyte
|
5 |
Description: Lite and accessible YouTube audio and video embedding.
|
6 |
Author: Frank Goossens (futtta)
|
7 |
+
Version: 0.7.1
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
*/
|
10 |
|
11 |
+
$plugin_dir = basename(dirname(__FILE__)).'/languages';
|
12 |
+
load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
|
13 |
+
|
14 |
+
$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__));
|
15 |
+
|
16 |
require_once(dirname(__FILE__).'/options.php');
|
17 |
require_once(dirname(__FILE__).'/player_sizes.inc.php');
|
18 |
require_once(dirname(__FILE__).'/widget.php');
|
19 |
|
20 |
+
$lyteSettings[0]=$wp_lyte_plugin_url.'lyte/';
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
if (get_option('newTube')==="1") {
|
23 |
$lyteSettings[1]="newtube-";
|
46 |
} else {
|
47 |
$audioClass=" audio";
|
48 |
if ($lyteSettings[1]=="newtube-"){
|
49 |
+
$divHeight=33;
|
50 |
} else {
|
51 |
$divHeight=25;
|
52 |
}
|
54 |
|
55 |
switch ($lyteSettings[4]) {
|
56 |
case "0":
|
57 |
+
$noscript_post="<br />".__("Watch this video on YouTube","wp-youtube-lyte");
|
58 |
$lytelinks_txt="";
|
59 |
break;
|
60 |
case "2":
|
61 |
$noscript_post="";
|
62 |
+
$lytelinks_txt="<div class=\"lL\">".__("Watch this video","wp-youtube-lyte")." <a href=\"http://youtu.be/".$match[4]."\">".__("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=".$match[4]."\">Easy Youtube</a>.</div>";
|
63 |
break;
|
64 |
default:
|
65 |
$noscript_post="";
|
66 |
+
$lytelinks_txt="<div class=\"lL\">".__("Watch this video","wp-youtube-lyte")." <a href=\"http://youtu.be/".$match[4]."\">".__("on YouTube","wp-youtube-lyte")."</a>.</div>";
|
67 |
}
|
68 |
|
69 |
+
$lytetemplate = "<div class=\"lyte".$audioClass."\" id=\"".$match[4]."\" style=\"width:".$lyteSettings[2]."px;height:".$divHeight."px;\"><noscript><a href=\"http://youtu.be/".$match[4]."\"><img src=\"http://img.youtube.com/vi/".$match[4]."/0.jpg\" alt=\"\" width=\"".$lyteSettings[2]."\" height=\"".$divHeight."\" />".$noscript_post."</a></noscript><script type=\"text/javascript\"><!-- \n var nT='".$lyteSettings[1]."';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]."lyte-min.js';h=d.getElementsByTagName('script')[0];h.parentNode.insertBefore(lytescr, h)}}; \n --></script></div>".$lytelinks_txt;
|
70 |
+
$the_content = preg_replace("/<p>http(v|a):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^\s<]*)<\/p>/", $lytetemplate, $the_content, 1);
|
71 |
}
|
72 |
}
|
73 |
return $the_content;
|