jslint syntax + support both http and https protocol

This commit is contained in:
Amauri CHAMPEAUX 2015-01-08 18:07:06 +01:00
parent 75ff44aa4a
commit c950d9adc3
1 changed files with 43 additions and 40 deletions

View File

@ -25,46 +25,6 @@ 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
tarteaucitron.services.clicky = {
"key": "clicky",
@ -374,6 +334,49 @@ tarteaucitron.services.twitter = {
}
};
// 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"),
video_width = x.getAttribute("width"),
frame_width = 'width=',
video_height = x.getAttribute("height"),
frame_height = 'height=',
video_frame;
if (video_id === undefined) {
return "";
}
if (video_width !== undefined) {
frame_width += '"' + video_width + '" ';
} else {
frame_width += '"" ';
}
if (video_height !== undefined) {
frame_height += '"' + video_height + '" ';
} else {
frame_height += '"" ';
}
video_frame = '<iframe id="ytplayer" type="text/html" ' + frame_width + frame_height + '" src="//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));
}
};
// xiti
tarteaucitron.services.xiti = {
"key": "xiti",