Ansolley

Plugin - Embed Vimeo Videos

Jun 28th, 2019
1,918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.11 KB | None | 0 0
  1. /**
  2.  * Embedded Vimeo Videos:
  3.  *  - Replaces Vimeo links with embedded videos
  4.  *
  5.  * @author dapil
  6.  * @version 1.0
  7.  * @last-edit 31. 1. 2016 22:44
  8.  */
  9.  
  10. BBLog.handle("add.plugin",
  11. {
  12.     id: "dapil-vimeo",
  13.     name: "Embedded Vimeo Videos",
  14.  
  15.     init: function (instance)
  16.     {
  17.         instance.AddVimeoEmbeds(instance);
  18.     },
  19.  
  20.     domchange: function (instance)
  21.     {
  22.         instance.AddVimeoEmbeds(instance);
  23.     },
  24.  
  25.     AddVimeoEmbeds: function (instance)
  26.     {
  27.         var iframe_html = '<div class="bblog-vimeo"><iframe src="//player.vimeo.com/video/{id}" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="width: 620px; height: 349px"></iframe></div>';
  28.         $("#profile-presentation, div.platoon-presentation-padder, div.forum-threadview-post-text, .box.presentation .box-content").each(function(){
  29.             $(this).find("a[href*='vimeo.com/']").each(function () {
  30.                 var id = this.href.split("/").slice(-1)[0].split("?")[0];
  31.                 if (id) { $(this).replaceWith(iframe_html.replace(/{id}/ig, id)); }
  32.             });
  33.         });
  34.     },
  35. });
Add Comment
Please, Sign In to add comment