Commit b692bb7c authored by iStryker's avatar iStryker
Browse files

Remove jQuery 1.10 syntax and display message if download is clicked.

parent 60866358
......@@ -2,15 +2,25 @@
Drupal.behaviors.intelligenceBank = {
attach: function (context, settings) {
$(window).on("message", function(n) {
var a = JSON.parse(n.originalEvent.data);
// requires jQuery 1.10
// $(window).on('message', function(e) {
window.addEventListener("message", function(e) {
if (event.origin !== 'https://ucprod.intelligencebank.com') { return; }
var a = JSON.parse(e.data);
if ("resource_link" === a.action) {
mediaBrowser = $('#mediaBrowser');
var loadingMsg = "Loading file, please wait...</b><div class='ajax-progress'><div class='throbber'></div></div>";
var mediaBrowser = $('#mediaBrowser');
mediaBrowser.contents().find('#edit-embed-code').val(a.url);
mediaBrowser.contents().find('#ib-iframe').toggle();
mediaBrowser.contents().find('#edit-next').click();
mediaBrowser.contents().find('.form-item-embed-code').append(loadingMsg);
mediaBrowser.contents().find('#edit-next').toggle();
}
else if ("resource_download" === a.action) {
alert('Downloading is currently not supported. Please click on public link');
}
});
}, false);
}
};
}(jQuery));
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment