summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2014-11-05 00:02:03 -0500
committerDavid Rothstein <drothstein@gmail.com>2014-11-05 00:02:03 -0500
commit2e906b8d706461f2a65b05fbe8505ccdff562c13 (patch)
treed98671be805ad658bf10613267c68316e0e18eac
parent6cf3889e1dc5aa69ee00bea969725d164c4b2b26 (diff)
downloadbrdo-2e906b8d706461f2a65b05fbe8505ccdff562c13.tar.gz
brdo-2e906b8d706461f2a65b05fbe8505ccdff562c13.tar.bz2
Issue #2282541 by Mark Carver | gge: Fixed Hide summary in text.js not working in jQuery 1.9+.
-rw-r--r--modules/field/modules/text/text.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/modules/field/modules/text/text.js b/modules/field/modules/text/text.js
index c1ab2f695..7973d5d52 100644
--- a/modules/field/modules/text/text.js
+++ b/modules/field/modules/text/text.js
@@ -23,24 +23,28 @@ Drupal.behaviors.textSummary = {
}
// Setup the edit/hide summary link.
- var $link = $('<span class="field-edit-link">(<a class="link-edit-summary" href="#">' + Drupal.t('Hide summary') + '</a>)</span>').toggle(
- function () {
+ var $link = $('<span class="field-edit-link">(<a class="link-edit-summary" href="#">' + Drupal.t('Hide summary') + '</a>)</span>');
+ var $a = $link.find('a');
+ var toggleClick = true;
+ $link.bind('click', function (e) {
+ if (toggleClick) {
$summary.hide();
- $(this).find('a').html(Drupal.t('Edit summary')).end().appendTo($fullLabel);
- return false;
- },
- function () {
+ $a.html(Drupal.t('Edit summary'));
+ $link.appendTo($fullLabel);
+ }
+ else {
$summary.show();
- $(this).find('a').html(Drupal.t('Hide summary')).end().appendTo($summaryLabel);
- return false;
+ $a.html(Drupal.t('Hide summary'));
+ $link.appendTo($summaryLabel);
}
- ).appendTo($summaryLabel);
+ e.preventDefault();
+ toggleClick = !toggleClick;
+ }).appendTo($summaryLabel);
// If no summary is set, hide the summary field.
if ($(this).find('.text-summary').val() == '') {
$link.click();
}
- return;
});
});
}