first import
This commit is contained in:
39
sites/all/modules/page_title/page_title.js
Normal file
39
sites/all/modules/page_title/page_title.js
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
(function ($) {
|
||||
|
||||
Drupal.behaviors.pageTitleFieldsetSummaries = {
|
||||
attach: function (context) {
|
||||
$('fieldset#edit-page-title', context).drupalSetSummary(function (context) {
|
||||
var pt = $('input', context).val();
|
||||
|
||||
return pt ?
|
||||
Drupal.t('Page Title: @pt', { '@pt': pt }) :
|
||||
Drupal.t('No Page Title');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Drupal.behaviors.pageTitleCounter = {
|
||||
attach : function(context) {
|
||||
$('fieldset#edit-page-title', context).each(function() {
|
||||
function getLength(element) { return $(element).val().length; }
|
||||
|
||||
var wrapper = this;
|
||||
|
||||
var inputBox = $('input[name=page_title]', wrapper);
|
||||
|
||||
var valueBox = $('div.description', wrapper)
|
||||
.append('<br/><span class="counter">Characters Entered: <span class="value">0</span></span>')
|
||||
.find('.value')
|
||||
.text(getLength(inputBox));
|
||||
|
||||
$('input[name=page_title]', wrapper).keyup(function(e) { $(valueBox).text(getLength(inputBox)); });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
})(jQuery);
|
||||
|
||||
Reference in New Issue
Block a user