Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.04 KB | None | 0 0
  1. <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>
  2.  
  3. //
  4.  
  5. $(document).ready(function() {
  6. $(".socyalize").each(function() {
  7.  
  8. var elmt = $(this);
  9.  
  10. if(typeof elmt.attr("data-active") == typeof undefined || elmt.attr("data-active") == "false") {
  11. // Vérification de l'existence de l'attribut "data-appId".
  12. if(typeof elmt.attr("data-appId") == typeof undefined) {
  13. 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.");
  14. }
  15.  
  16. if(typeof elmt.attr("data-appMessage") == typeof undefined) {
  17. 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.");
  18. }
  19.  
  20. if(typeof elmt.attr("data-appCustom") == typeof undefined) {
  21. 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.");
  22. }
  23.  
  24. var width = elmt.attr("data-width").trim();
  25. var height = elmt.attr("data-height").trim();
  26.  
  27. if(width.indexOf("px") == "-1" && width.indexOf("%") == "-1" || width.endsWith("px") && !width.endsWith("%")) {
  28. width = width.replace("px", "") + "px";
  29. }
  30.  
  31. if(height.indexOf("px") == "-1" && height.indexOf("%") == "-1" || height.endsWith("px") && !height.endsWith("%")) {
  32. height = height.replace("px", "") + "px";
  33. }
  34.  
  35. // Insère l'iframe dans la page courant du site web partenaire
  36. if(elmt.attr("data-https") == "false") {
  37. 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>');
  38. } else {
  39. 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>');
  40. }
  41.  
  42. elmt.attr("data-active", true);
  43. }
  44. });
  45.  
  46. $("#socyalize-provider").remove();
  47.  
  48. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement