diff --git l10n_client.js l10n_client.js index ac8533a..045735f 100644 --- l10n_client.js +++ l10n_client.js @@ -86,13 +86,16 @@ Drupal.l10nClient = { // Attaches the localization editor behavior to all required fields. Drupal.behaviors.l10nClient = {} Drupal.behaviors.l10nClient.attach = function (context) { + // Cache client object + var $client = $('#l10n-client'); + // Killswitch - attach only once. - if ($('#l10n-client').is('.l10n-client-processed')) { + if ($client.is('.l10n-client-processed')) { return; } // First time - init & attach all handlers. - $('#l10n-client').addClass('l10n-client-processed'); + $client.addClass('l10n-client-processed'); switch($.cookie('Drupal_l10n_client')) { case '1': @@ -120,7 +123,7 @@ Drupal.behaviors.l10nClient.attach = function (context) { // When l10n_client window is clicked, toggle based on current state. $('#l10n-client .labels .toggle').click(function() { - if($('#l10n-client').is('.hidden')) { + if($client.is('.hidden')) { Drupal.l10nClient.toggle(1); } else { Drupal.l10nClient.toggle(0);