Youtube Support
Add support for youtube, video should be added via a div as follows: <div id="youtube_player" videoID="ID" class="youtube_player" width="640" height="480" > The video ID is the identifier of the video (e.g. Ij9EkAQzVvM)
This commit is contained in:
parent
57cc4c87f4
commit
03306ec611
|
|
@ -25,6 +25,46 @@ tarteaucitron.services.addthis = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// youtube
|
||||||
|
tarteaucitron.services.youtube = {
|
||||||
|
"key": "youtube",
|
||||||
|
"type": "social",
|
||||||
|
"name": "YouTube",
|
||||||
|
"uri": "https://www.google.fr/intl/fr/policies/privacy/",
|
||||||
|
"needConsent": true,
|
||||||
|
"js": function () {
|
||||||
|
"use strict";
|
||||||
|
tarteaucitron.fallback(['youtube_player'], function (x) {
|
||||||
|
var video_id = x.getAttribute("videoID");
|
||||||
|
if ( video_id === undefined ) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
var video_width = x.getAttribute("width");
|
||||||
|
var frame_width = 'width=';
|
||||||
|
if ( video_width !== undefined ) {
|
||||||
|
frame_width+= '"'+video_width+'" ';
|
||||||
|
} else {
|
||||||
|
frame_width+= '"" ';
|
||||||
|
}
|
||||||
|
var video_height = x.getAttribute("height");
|
||||||
|
var frame_height = 'height=';
|
||||||
|
if ( video_height !== undefined ) {
|
||||||
|
frame_height+= '"'+video_height+'" ';
|
||||||
|
} else {
|
||||||
|
frame_height+= '"" ';
|
||||||
|
}
|
||||||
|
var video_frame = '<iframe id="ytplayer" type="text/html" '+ frame_width + frame_height +'" src="http://www.youtube.com/embed/'+ video_id +' " frameborder="0"/>';
|
||||||
|
return video_frame;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
"fallback": function () {
|
||||||
|
"use strict";
|
||||||
|
var cookies = ['VISITOR_INFO1_LIVE', 'YSC', 'PREF', 'GEUP'],id = 'youtube';
|
||||||
|
tarteaucitron.cookie.purge(cookies);
|
||||||
|
tarteaucitron.fallback(['youtube_player'], tarteaucitron.engage(id));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// clicky
|
// clicky
|
||||||
tarteaucitron.services.clicky = {
|
tarteaucitron.services.clicky = {
|
||||||
"key": "clicky",
|
"key": "clicky",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue