Skip to content
This repository has been archived by the owner on Jan 5, 2018. It is now read-only.

Commit

Permalink
Update plugin js
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekmehta committed Aug 13, 2015
1 parent ad6ac6c commit 92b2576
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions js/plugins/drupalurl/plugin.js
Expand Up @@ -210,28 +210,6 @@
return 'url-embed-' + generateEmbedId.counter++;
}

/**
* Attaches or detaches behaviors, except the ones we do not want.
*
* @param {string} action
* Either 'attach' or 'detach'.
* @param context
* The context argument for Drupal.attachBehaviors()/detachBehaviors().
* @param settings
* The settings argument for Drupal.attachBehaviors()/detachBehaviors().
*/
function runEmbedBehaviors(action, context, settings) {
// Do not run the excluded behaviors.
var stashed = {};
$.each(Drupal.urlEmbed.excludedBehaviors, function (i, behavior) {
stashed[behavior] = Drupal.behaviors[behavior];
delete Drupal.behaviors[behavior];
});
// Run the remaining behaviors.
(action == 'attach' ? Drupal.attachBehaviors : Drupal.detachBehaviors)(context, settings);
// Put the stashed behaviors back in.
$.extend(Drupal.behaviors, stashed);
}

/**
* Ajax 'url_embed_insert' command: insert the rendered URL.
Expand All @@ -244,7 +222,6 @@
var $target = ajax.element;
// No need to detach behaviors here, the widget is created fresh each time.
$target.html(response.html);
runEmbedBehaviors('attach', $target.get(0), response.settings || ajax.settings);
};


Expand Down

0 comments on commit 92b2576

Please sign in to comment.