Yaffs site version 1.1
[yaffs-website] / web / modules / contrib / media_entity_instagram / js / instagram.js
diff --git a/web/modules/contrib/media_entity_instagram/js/instagram.js b/web/modules/contrib/media_entity_instagram/js/instagram.js
new file mode 100644 (file)
index 0000000..c674057
--- /dev/null
@@ -0,0 +1,26 @@
+/**
+ * @file
+ */
+
+(function ($, Drupal) {
+  "use strict";
+
+  Drupal.behaviors.instagramMediaEntity = {
+    attach: function (context) {
+      function _init () {
+        instgrm.Embeds.process();
+      }
+
+      //TODO: ckeditor integration still doesn't work
+      // If the instagram card is being embedded in a CKEditor's iFrame the widgets
+      // library might not have been loaded yet.
+      if (typeof instgrm == 'undefined') {
+        $.getScript('//platform.instagram.com/en_US/embeds.js', _init);
+      }
+      else {
+        _init();
+      }
+    }
+  };
+
+})(jQuery, Drupal);