Version Description
- bugfix: added missing lyte/controls-400.png, which was needed for the new widget-size in 1.1.4
- bugfix: force margin for widget to 0 for themes that think they know better (as reported by long-time user FruityOaty)
- bugfix: workaround for iOS quirk that caused the video to only start after 2nd click (as reported by Robert of audio-times.com and Collin Maessen)
- bugfix: add sizes to images as suggested by elmll on the wordpress.org forum
- beta: shortcode (see Description for examples) as suggested by ben4d85 on the wordpress.org forum
Download this release
Release Info
Developer | futtta |
Plugin | WP YouTube Lyte |
Version | 1.1.5 |
Comparing to | |
See all releases |
Code changes from version 1.1.4 to 1.1.5
- lyte/controls-400.png +0 -0
- lyte/lyte-min.js +1 -1
- lyte/lyte.js +35 -19
- readme.txt +14 -1
- wp-youtube-lyte.php +19 -3
lyte/controls-400.png
ADDED
Binary file
|
lyte/lyte-min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(function(a){function e(a){qsa="";if(rqs=a.className.match(/qsa_(.*)\s/,"$1"))qsa=rqs[1].replace(/\\([\&\=\?])/g,"$1");return qsa}function f(a,b){p=d.getElementById(a);c=d.createElement("div");c.className="tC";t=d.createElement("div");t.className="tT";c.appendChild(t);t.innerHTML=b;p.appendChild(c)}function g(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function h(a){scr=d.createElement("script");scr.src=a;scr.type="text/javascript";d.getElementsByTagName("head")[0].appendChild(scr)}function i(a,b,c){if(d.getElementsByClassName){i=function(a,b,c){c=c||d;var e=c.getElementsByClassName(a),f=b?new RegExp("\\b"+b+"\\b","i"):null,g=[],h;for(var i=0,j=e.length;i<j;i+=1){h=e[i];if(!f||f.test(h.nodeName)){g.push(h)}}return g}}else if(d.evaluate){i=function(a,b,c){b=b||"*";c=c||d;var e=a.split(" "),f="",g="http://www.w3.org/1999/xhtml",h=d.documentElement.namespaceURI===g?g:null,i=[],j,k;for(var l=0,m=e.length;l<m;l+=1){f+="[contains(concat(' ', @class, ' '), ' "+e[l]+" ')]"}try{j=d.evaluate(".//"+b+f,c,h,0,null)}catch(n){j=d.evaluate(".//"+b+f,c,null,0,null)}while(k=j.iterateNext()){i.push(k)}return i}}else{i=function(a,b,c){b=b||"*";c=c||d;var e=a.split(" "),f=[],g=b==="*"&&c.all?c.all:c.getElementsByTagName(b),h,i=[],j;for(var k=0,l=e.length;k<l;k+=1){f.push(new RegExp("(^|\\s)"+e[k]+"(\\s|$)"))}for(var m=0,n=g.length;m<n;m+=1){h=g[m];j=false;for(var o=0,p=f.length;o<p;o+=1){j=f[o].test(h.className);if(!j){break}}if(j){i.push(h)}}return i}}return i(a,b,c)}d=document;var b="http";if(bU.indexOf("https")!=-1){b+="s"}a.te=function(){if(!c){var c=1;lts=i("lyMe","div");for(var
|
1 |
+
(function(a){function e(a){qsa="";if(rqs=a.className.match(/qsa_(.*)\s/,"$1"))qsa=rqs[1].replace(/\\([\&\=\?])/g,"$1");return qsa}function f(a,b){p=d.getElementById(a);c=d.createElement("div");c.className="tC";t=d.createElement("div");t.className="tT";c.appendChild(t);t.innerHTML=b;p.appendChild(c)}function g(a,b){if(typeof a.setAttribute==="function")a.setAttribute("style",b);else if(typeof a.style.setAttribute==="object")a.style.setAttribute("cssText",b)}function h(a){scr=d.createElement("script");scr.src=a;scr.type="text/javascript";d.getElementsByTagName("head")[0].appendChild(scr)}function i(a,b,c){if(d.getElementsByClassName){i=function(a,b,c){c=c||d;var e=c.getElementsByClassName(a),f=b?new RegExp("\\b"+b+"\\b","i"):null,g=[],h;for(var i=0,j=e.length;i<j;i+=1){h=e[i];if(!f||f.test(h.nodeName)){g.push(h)}}return g}}else if(d.evaluate){i=function(a,b,c){b=b||"*";c=c||d;var e=a.split(" "),f="",g="http://www.w3.org/1999/xhtml",h=d.documentElement.namespaceURI===g?g:null,i=[],j,k;for(var l=0,m=e.length;l<m;l+=1){f+="[contains(concat(' ', @class, ' '), ' "+e[l]+" ')]"}try{j=d.evaluate(".//"+b+f,c,h,0,null)}catch(n){j=d.evaluate(".//"+b+f,c,null,0,null)}while(k=j.iterateNext()){i.push(k)}return i}}else{i=function(a,b,c){b=b||"*";c=c||d;var e=a.split(" "),f=[],g=b==="*"&&c.all?c.all:c.getElementsByTagName(b),h,i=[],j;for(var k=0,l=e.length;k<l;k+=1){f.push(new RegExp("(^|\\s)"+e[k]+"(\\s|$)"))}for(var m=0,n=g.length;m<n;m+=1){h=g[m];j=false;for(var o=0,p=f.length;o<p;o+=1){j=f[o].test(h.className);if(!j){break}}if(j){i.push(h)}}return i}}return i(a,b,c)}d=document;var b="http";if(bU.indexOf("https")!=-1){b+="s"}a.te=function(){if(!c){var c=1;var f=navigator.userAgent.match(/(iphone|ipad|ipod)/i);lts=i("lyMe","div");for(var j=0,k=lts.length;j<k;j+=1){p=lts[j];vid=p.id.substring(4);cN=p.className.replace(/lyMe/,"lyte")+" lP";p.className=cN;pl=d.createElement("div");pl.id="lyte_"+vid;pl.className="pL";if(f===null){p.onclick=a.play;pW=p.style.width.match(/\d+/g)[0];pH=p.style.height.match(/\d+/g)[0];bgA="-60px";if(cN.indexOf("widget")!==-1||pW/pH<1.7)bgA="-10px";qsa=e(p);cImg='<img src="'+bU+"controls-"+pW+'.png" height="40px" width="'+pW+'px" class="ctrl" alt=""/>';pImg='<img src="'+bU+'play.png" width="83px" height="55px" alt="Click to play" style="margin-top:'+(pH/2-30)+'px;opacity:0.7;" onmouseover="this.style.opacity=1;" onmouseout="this.style.opacity=0.8;"/>';ytA="://gdata.youtube.com/feeds/api/";if(cN.indexOf("audio")!==-1){g(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML=cImg}else if(cN.indexOf("playlist")!==-1){g(pl,"height:"+pH+"px;width:"+pW+"px;");pl.innerHTML=pImg+cImg;joU=b+ytA+"playlists/"+vid+"?v=2&alt=json-in-script&callback=ly.prsPL&fields=id,title,entry";h(joU)}else{g(pl,"height:"+pH+"px;width:"+pW+"px;background:url('"+b+"://img.youtube.com/vi/"+vid+"/0.jpg') no-repeat scroll center "+bgA+" rgb(0, 0, 0);background-size:cover;");pl.innerHTML=pImg+cImg;if(cN.indexOf("widget")===-1&&qsa.indexOf("showinfo=0")===-1){joU=b+ytA+"videos/"+vid+"?fields=id,title&alt=json-in-script&callback=ly.prsV";h(joU)}}p.appendChild(pl)}else{a.play(p.id)}}}var c=""};a.play=function(a){if(typeof a==="string"){tH=d.getElementById(a);aP=0}else{tH=this;tH.onclick="";aP=1}vid=tH.id.substring(4);hidef=0;if(tH.className.indexOf("hidef")!==-1){hidef=1}if(tH.className.indexOf("playlist")===-1){eU=b+"://www.youtube.com/embed/"+vid+"?"}else{eU=b+"://www.youtube.com/embed/videoseries?list=PL"+vid+"&"}qsa=e(tH);if(tH.className.indexOf("audio")!==-1){qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;"}else{aHgh=tH.clientHeight;aSt=""}tH.innerHTML='<iframe id="iF_'+vid+'" width="'+tH.clientWidth+'px" height="'+aHgh+'px" src="'+eU+"autoplay="+aP+"&wmode=opaque&rel=0&egm=0&iv_load_policy=3&hd="+hidef+qsa+'" frameborder="0" style="'+aSt+'"></iframe>';if(typeof tH.firstChild.getAttribute("kabl")=="string")tH.innerHTML="Please check Karma Blocker's config."};a.prsV=function(a){tI=a.entry.title.$t;idu=a.entry.id.$t;id="lyte_"+idu.substring(idu.length-11);f(id,tI)};a.prsPL=function(a){thumb=a.feed.entry[0].media$group.media$thumbnail[1].url;idu=a.feed.id.$t;id="lyte_"+idu.substring(idu.length-16);title="Playlist: "+a.feed.title.$t;pl=d.getElementById(id);pH=pl.style.height;pW=pl.style.width;if(b=="https"&&thumb.indexOf("https"==-1)){thumb=thumb.replace("http://","https://")}g(pl,"height:"+pH+";width:"+pW+";background:url('"+thumb+"') no-repeat scroll center -50px rgb(0, 0, 0); background-size:cover;");f(id,title)};})(window.ly=window.ly||{});(function(){var a=window;var b=document;if(a.addEventListener){a.addEventListener("load",ly.te,false);b.addEventListener("DomContentLoaded",function(){setTimeout("ly.te()",750)},false)}else{a.onload=ly.te;setTimeout("ly.te()",1e3)}})()
|
lyte/lyte.js
CHANGED
@@ -7,41 +7,51 @@ if (bU.indexOf('https')!=-1) {sch+="s"}
|
|
7 |
ly.te = function() {
|
8 |
if (!rn) {
|
9 |
var rn=1;
|
|
|
10 |
lts = getElementsByClassName("lyMe", "div");
|
11 |
for (var i = 0, lln = lts.length; i < lln; i += 1) {
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
22 |
|
23 |
bgA="-60px";
|
24 |
if ((cN.indexOf('widget') !== -1)||(pW/pH<1.7)) bgA="-10px";
|
25 |
|
26 |
qsa=getQ(p);
|
27 |
|
|
|
|
|
|
|
|
|
28 |
if (cN.indexOf('audio') !== -1) {
|
29 |
setST(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
|
30 |
-
pl.innerHTML =
|
31 |
} else if (cN.indexOf('playlist') !== -1) {
|
32 |
setST(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
|
33 |
-
pl.innerHTML =
|
34 |
-
joU = sch+"
|
35 |
loadSC(joU);
|
36 |
} else {
|
37 |
setST(pl, "height:" + pH + "px;width:" + pW + "px;background:url('" + sch + "://img.youtube.com/vi/" + vid + "/0.jpg') no-repeat scroll center " + bgA + " rgb(0, 0, 0);background-size:cover;");
|
38 |
-
pl.innerHTML =
|
39 |
if ((cN.indexOf('widget') === -1) && (qsa.indexOf('showinfo=0') === -1)) {
|
40 |
-
joU = sch+"
|
41 |
loadSC(joU)
|
42 |
}
|
43 |
}
|
44 |
p.appendChild(pl);
|
|
|
|
|
|
|
45 |
}
|
46 |
}
|
47 |
var rn="";
|
@@ -53,9 +63,15 @@ function getQ(nD) {
|
|
53 |
return qsa;
|
54 |
}
|
55 |
|
56 |
-
ly.play = function() {
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
vid=tH.id.substring(4);
|
60 |
|
61 |
hidef=0;
|
@@ -71,7 +87,7 @@ ly.play = function() {
|
|
71 |
|
72 |
if (tH.className.indexOf("audio") !== -1) { qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;" } else { aHgh=tH.clientHeight;aSt=""; }
|
73 |
|
74 |
-
tH.innerHTML="<iframe id=\"iF_" + vid + "\" width=\"" + tH.clientWidth + "px\" height=\"" + aHgh + "px\" src=\""+eU+"autoplay=
|
75 |
|
76 |
if(typeof tH.firstChild.getAttribute('kabl')=="string") tH.innerHTML="Please check Karma Blocker's config.";
|
77 |
}
|
7 |
ly.te = function() {
|
8 |
if (!rn) {
|
9 |
var rn=1;
|
10 |
+
var iOs=navigator.userAgent.match(/(iphone|ipad|ipod)/i);
|
11 |
lts = getElementsByClassName("lyMe", "div");
|
12 |
for (var i = 0, lln = lts.length; i < lln; i += 1) {
|
13 |
+
p = lts[i];
|
14 |
+
vid = p.id.substring(4);
|
15 |
+
cN = p.className.replace(/lyMe/, "lyte")+ " lP";
|
16 |
+
p.className = cN;
|
17 |
+
pl = d.createElement('div');
|
18 |
+
pl.id = "lyte_" + vid;
|
19 |
+
pl.className = "pL";
|
20 |
+
|
21 |
+
if (iOs === null) {
|
22 |
+
p.onclick = ly.play;
|
23 |
+
pW = p.style.width.match(/\d+/g)[0];
|
24 |
+
pH = p.style.height.match(/\d+/g)[0];
|
25 |
|
26 |
bgA="-60px";
|
27 |
if ((cN.indexOf('widget') !== -1)||(pW/pH<1.7)) bgA="-10px";
|
28 |
|
29 |
qsa=getQ(p);
|
30 |
|
31 |
+
cImg="<img src=\"" + bU + "controls-" + pW + ".png\" height=\"40px\" width=\""+pW+"px\" class=\"ctrl\" alt=\"\"/>";
|
32 |
+
pImg="<img src=\"" + bU + "play.png\" width=\"83px\" height=\"55px\" alt=\"Click to play\" style=\"margin-top:" + ((pH / 2) - 30) + "px;opacity:0.7;\" onmouseover=\"this.style.opacity=1;\" onmouseout=\"this.style.opacity=0.8;\"/>";
|
33 |
+
ytA="://gdata.youtube.com/feeds/api/";
|
34 |
+
|
35 |
if (cN.indexOf('audio') !== -1) {
|
36 |
setST(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
|
37 |
+
pl.innerHTML = cImg;
|
38 |
} else if (cN.indexOf('playlist') !== -1) {
|
39 |
setST(pl, 'height:' + pH + 'px;width:' + pW + 'px;');
|
40 |
+
pl.innerHTML = pImg+cImg;
|
41 |
+
joU = sch+ytA+"playlists/"+ vid +"?v=2&alt=json-in-script&callback=ly.prsPL&fields=id,title,entry";
|
42 |
loadSC(joU);
|
43 |
} else {
|
44 |
setST(pl, "height:" + pH + "px;width:" + pW + "px;background:url('" + sch + "://img.youtube.com/vi/" + vid + "/0.jpg') no-repeat scroll center " + bgA + " rgb(0, 0, 0);background-size:cover;");
|
45 |
+
pl.innerHTML = pImg+cImg;
|
46 |
if ((cN.indexOf('widget') === -1) && (qsa.indexOf('showinfo=0') === -1)) {
|
47 |
+
joU = sch+ytA+"videos/" + vid + "?fields=id,title&alt=json-in-script&callback=ly.prsV";
|
48 |
loadSC(joU)
|
49 |
}
|
50 |
}
|
51 |
p.appendChild(pl);
|
52 |
+
} else {
|
53 |
+
ly.play(p.id);
|
54 |
+
}
|
55 |
}
|
56 |
}
|
57 |
var rn="";
|
63 |
return qsa;
|
64 |
}
|
65 |
|
66 |
+
ly.play = function(id) {
|
67 |
+
if (typeof id === 'string') {
|
68 |
+
tH=d.getElementById(id);
|
69 |
+
aP=0;
|
70 |
+
} else {
|
71 |
+
tH=this;
|
72 |
+
tH.onclick="";
|
73 |
+
aP=1;
|
74 |
+
}
|
75 |
vid=tH.id.substring(4);
|
76 |
|
77 |
hidef=0;
|
87 |
|
88 |
if (tH.className.indexOf("audio") !== -1) { qsa+="&autohide=0";aHgh="438";aSt="position:relative;top:-400px;" } else { aHgh=tH.clientHeight;aSt=""; }
|
89 |
|
90 |
+
tH.innerHTML="<iframe id=\"iF_" + vid + "\" width=\"" + tH.clientWidth + "px\" height=\"" + aHgh + "px\" src=\""+eU+"autoplay="+aP+"&wmode=opaque&rel=0&egm=0&iv_load_policy=3&hd="+hidef+qsa+"\" frameborder=\"0\" style=\"" + aSt + "\"></iframe>"
|
91 |
|
92 |
if(typeof tH.firstChild.getAttribute('kabl')=="string") tH.innerHTML="Please check Karma Blocker's config.";
|
93 |
}
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: futtta
|
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio, playlist, youtube playlist, hd, performance, accessibility, sidebar, lazy load
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.4
|
6 |
-
Stable tag: 1.1.
|
7 |
|
8 |
High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
|
9 |
|
@@ -20,6 +20,12 @@ Just add a YouTube-link for a video or [an entire playlist](http://blog.futtta.b
|
|
20 |
* httpv://www.youtube.com/watch?v=_SQkWbRublY#stepSize=-1 (video player, one size smaller than what's configured as default)
|
21 |
* httpv://www.youtube.com/watch?v=_SQkWbRublY?start=20&showinfo=0 (video player, start playing at 20 seconds and don't show title)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
WP YouTube Lyte has been written with optimal performance as primary goal, but has been tested for maximum browser-compatibility (iPad included) while keeping an eye on accessibility. The plugin is fully multi-language, with support for Catalan, Dutch, English, French, German, Hebrew, Romanian, Spanish and Slovene.
|
24 |
|
25 |
Feedback is welcome; see [info in the faq](http://wordpress.org/extend/plugins/wp-youtube-lyte/faq/) for bug reports/ feature requests and feel free to [rate and/or report on compatibility on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/).
|
@@ -71,6 +77,13 @@ Just tell me, I like the feedback! Use the [Contact-page on my blog](http://blog
|
|
71 |
|
72 |
== Changelog ==
|
73 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
= 1.1.4 =
|
75 |
* bugfix: audio-only youtube was broken due to changes at YouTube (thanks for reporting [Adrian](http://www.yeahlabs.ca/)!)
|
76 |
* bugfix: playlist embedding was somewhat broken (again due to changes at YouTube)
|
3 |
Tags: youtube, video, lyte, lite youtube embeds, html5 video, html5, widget, youtube audio, audio, playlist, youtube playlist, hd, performance, accessibility, sidebar, lazy load
|
4 |
Requires at least: 2.9
|
5 |
Tested up to: 3.4
|
6 |
+
Stable tag: 1.1.5
|
7 |
|
8 |
High performance YouTube video, playlist and audio-only embeds which don't slow down your blog and offer optimal accessibility.
|
9 |
|
20 |
* httpv://www.youtube.com/watch?v=_SQkWbRublY#stepSize=-1 (video player, one size smaller than what's configured as default)
|
21 |
* httpv://www.youtube.com/watch?v=_SQkWbRublY?start=20&showinfo=0 (video player, start playing at 20 seconds and don't show title)
|
22 |
|
23 |
+
Or using shortcodes (beta):
|
24 |
+
`[lyte id="_SQkWbRublY" /]`
|
25 |
+
`[lyte id="_SQkWbRublY" audio="true" /]`
|
26 |
+
`[lyte id="A486E741B25F8E00" playlist="true" /]
|
27 |
+
|
28 |
+
|
29 |
WP YouTube Lyte has been written with optimal performance as primary goal, but has been tested for maximum browser-compatibility (iPad included) while keeping an eye on accessibility. The plugin is fully multi-language, with support for Catalan, Dutch, English, French, German, Hebrew, Romanian, Spanish and Slovene.
|
30 |
|
31 |
Feedback is welcome; see [info in the faq](http://wordpress.org/extend/plugins/wp-youtube-lyte/faq/) for bug reports/ feature requests and feel free to [rate and/or report on compatibility on wordpress.org](http://wordpress.org/extend/plugins/wp-youtube-lyte/).
|
77 |
|
78 |
== Changelog ==
|
79 |
|
80 |
+
= 1.1.5 =
|
81 |
+
* bugfix: added missing lyte/controls-400.png, which was needed for the new widget-size in 1.1.4
|
82 |
+
* bugfix: force margin for widget to 0 for themes that think they know better (as reported by long-time user [FruityOaty](http://fruityoaty.com/))
|
83 |
+
* bugfix: workaround for iOS quirk that caused the video to only start after 2nd click (as reported by Robert of [audio-times.com](http://audio-times.com) and [Collin Maessen](http://www.realsceptic.com/))
|
84 |
+
* bugfix: add sizes to images as [suggested by elmll on the wordpress.org forum](http://wordpress.org/support/topic/plugin-wp-youtube-lyte-specify-img-dimensions)
|
85 |
+
* beta: shortcode (see [Description](http://wordpress.org/extend/plugins/wp-youtube-lyte/) for examples) as [suggested by ben4d85 on the wordpress.org forum](http://wordpress.org/support/topic/plugin-wp-youtube-lyte-shortcode-custom-class)
|
86 |
+
|
87 |
= 1.1.4 =
|
88 |
* bugfix: audio-only youtube was broken due to changes at YouTube (thanks for reporting [Adrian](http://www.yeahlabs.ca/)!)
|
89 |
* bugfix: playlist embedding was somewhat broken (again due to changes at YouTube)
|
wp-youtube-lyte.php
CHANGED
@@ -4,13 +4,14 @@ 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.1.
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Text Domain: wp-youtube-lyte
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
-
$wyl_version="1.1.
|
|
|
14 |
|
15 |
$plugin_dir = basename(dirname(__FILE__)).'/languages';
|
16 |
load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
|
@@ -162,15 +163,30 @@ function lyte_init() {
|
|
162 |
if ($lyteSettings['position']==="1") {
|
163 |
$pos="auto";
|
164 |
}
|
165 |
-
echo "<script type=\"text/javascript\">var bU='".$lyteSettings['path']."';style = document.createElement('style');style.type = 'text/css';rules = document.createTextNode('.lyte img {border:0px !important;padding:0px;spacing:0px;margin:0px;display:inline;background-color:transparent;} .lL {margin:5px ".$pos.";} .lP {background-color:#fff;margin:5px ".$pos.";} .pL {cursor:pointer;text-align:center;overflow:hidden;position:relative;margin:0px;} .tC {left:0;top:0;position:absolute;width:100%;background-color:rgba(0,0,0,0.6);} .tT {padding:5px 10px;font-size:16px;color:#ffffff;font-family:sans-serif;text-align:left;} .ctrl {position:absolute;left:0px;bottom:0px;}');if(style.styleSheet) { style.styleSheet.cssText = rules.nodeValue;} else {style.appendChild(rules);}document.getElementsByTagName('head')[0].appendChild(style);</script>";
|
166 |
echo "<script type=\"text/javascript\" async=true src=\"".$lyteSettings['path']."lyte-min.js?wylver=".$lyteSettings['version']."\"></script>";
|
167 |
}
|
168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
if ( is_admin() ) {
|
170 |
require_once(dirname(__FILE__).'/options.php');
|
171 |
} else {
|
172 |
add_filter('the_content', 'lyte_parse', 4);
|
173 |
add_filter('the_excerpt', 'lyte_parse', 4);
|
|
|
174 |
}
|
175 |
|
176 |
/* donottrack */
|
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.1.5
|
8 |
Author URI: http://blog.futtta.be/
|
9 |
Text Domain: wp-youtube-lyte
|
10 |
Domain Path: /languages
|
11 |
*/
|
12 |
|
13 |
+
$wyl_version="1.1.5";
|
14 |
+
#$wyl_version=rand()/1000;
|
15 |
|
16 |
$plugin_dir = basename(dirname(__FILE__)).'/languages';
|
17 |
load_plugin_textdomain( 'wp-youtube-lyte', null, $plugin_dir );
|
163 |
if ($lyteSettings['position']==="1") {
|
164 |
$pos="auto";
|
165 |
}
|
166 |
+
echo "<script type=\"text/javascript\">var bU='".$lyteSettings['path']."';style = document.createElement('style');style.type = 'text/css';rules = document.createTextNode('.lyte img {border:0px !important;padding:0px;spacing:0px;margin:0px;display:inline;background-color:transparent;max-width:100%} .lL {margin:5px ".$pos.";} .lP {background-color:#fff;margin:5px ".$pos.";} .pL {cursor:pointer;text-align:center;overflow:hidden;position:relative;margin:0px !important;} .tC {left:0;top:0;position:absolute;width:100%;background-color:rgba(0,0,0,0.6);} .tT {padding:5px 10px;font-size:16px;color:#ffffff;font-family:sans-serif;text-align:left;} .ctrl {position:absolute;left:0px;bottom:0px;}');if(style.styleSheet) { style.styleSheet.cssText = rules.nodeValue;} else {style.appendChild(rules);}document.getElementsByTagName('head')[0].appendChild(style);</script>";
|
167 |
echo "<script type=\"text/javascript\" async=true src=\"".$lyteSettings['path']."lyte-min.js?wylver=".$lyteSettings['version']."\"></script>";
|
168 |
}
|
169 |
|
170 |
+
/** YouTube shortcode */
|
171 |
+
function shortcode_lyte($atts) {
|
172 |
+
extract(shortcode_atts(array(
|
173 |
+
"id" => '',
|
174 |
+
"audio" => '',
|
175 |
+
"playlist" => '',
|
176 |
+
), $atts));
|
177 |
+
|
178 |
+
if ($audio) {$proto="httpa";} else {$proto="httpv";}
|
179 |
+
if ($playlist) {$action="playlist?list=PL";} else {$action="watch?v=";}
|
180 |
+
|
181 |
+
return lyte_parse($proto.'://www.youtube.com/'.$action.$id);
|
182 |
+
}
|
183 |
+
|
184 |
if ( is_admin() ) {
|
185 |
require_once(dirname(__FILE__).'/options.php');
|
186 |
} else {
|
187 |
add_filter('the_content', 'lyte_parse', 4);
|
188 |
add_filter('the_excerpt', 'lyte_parse', 4);
|
189 |
+
add_shortcode("lyte", "shortcode_lyte");
|
190 |
}
|
191 |
|
192 |
/* donottrack */
|