Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>!function(d,id){if(!d.getElementById(id)){var socyalize;socyalize=d.createElement("script");socyalize.id=id;socyalize.src="https://www.socyalize.com/js/customers/provider.js";d.body.appendChild(socyalize);}}(document,"socyalize-provider");</script>
- //
- $(document).ready(function() {
- $(".socyalize").each(function() {
- var elmt = $(this);
- if(typeof elmt.attr("data-active") == typeof undefined || elmt.attr("data-active") == "false") {
- // Vérification de l'existence de l'attribut "data-appId".
- if(typeof elmt.attr("data-appId") == typeof undefined) {
- return console.log("L'attribut data-appId=\"\" n'existe pas dans votre élément <div id=\"socyalize\" data-appId=? data-appMessage=? data-appCustom=?></div>. Veuillez vous référer à la documentation officielle (http://documentation.socyalize.com) pour compléter l'installation.");
- }
- if(typeof elmt.attr("data-appMessage") == typeof undefined) {
- return console.log("L'attribut data-appMessage=\"\" n'existe pas dans votre élément <div id=\"socyalize\" data-appId=? data-appMessage=? data-appCustom=?></div>. Veuillez vous référer à la documentation officielle (http://documentation.socyalize.com) pour compléter l'installation.");
- }
- if(typeof elmt.attr("data-appCustom") == typeof undefined) {
- return console.log("L'attribut data-appCustom=\"\" n'existe pas dans votre élément <div id=\"socyalize\" data-appId=? data-appMessage=? data-appCustom=?></div>. Veuillez vous référer à la documentation officielle (http://documentation.socyalize.com) pour compléter l'installation.");
- }
- var width = elmt.attr("data-width").trim();
- var height = elmt.attr("data-height").trim();
- if(width.indexOf("px") == "-1" && width.indexOf("%") == "-1" || width.endsWith("px") && !width.endsWith("%")) {
- width = width.replace("px", "") + "px";
- }
- if(height.indexOf("px") == "-1" && height.indexOf("%") == "-1" || height.endsWith("px") && !height.endsWith("%")) {
- height = height.replace("px", "") + "px";
- }
- // Insère l'iframe dans la page courant du site web partenaire
- if(elmt.attr("data-https") == "false") {
- elmt.append('<iframe src="http://www.socyalize.com/socializes/link/' + elmt.attr("data-appId") + '/' + btoa(elmt.attr("data-appMessage")) + '/' + btoa(elmt.attr("data-appCustom")) + '" style="width: ' + width + '; height: ' + height + '; border: none;"></iframe>');
- } else {
- elmt.append('<iframe src="https://www.socyalize.com/socializes/link/' + elmt.attr("data-appId") + '/' + btoa(elmt.attr("data-appMessage")) + '/' + btoa(elmt.attr("data-appCustom")) + '" style="width: ' + width + '; height: ' + height + '; border: none;"></iframe>');
- }
- elmt.attr("data-active", true);
- }
- });
- $("#socyalize-provider").remove();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement