mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 16:08:24 -04:00
Remove expandCollapse.js script and refs to it
This commit is contained in:
@@ -1,58 +0,0 @@
|
|||||||
(function(Modules) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Modules.ExpandCollapse = function() {
|
|
||||||
|
|
||||||
this.start = function(component) {
|
|
||||||
|
|
||||||
this.$component = $(component);
|
|
||||||
|
|
||||||
this.$toggle = this.$component.find('.toggle')
|
|
||||||
.on(
|
|
||||||
"click",
|
|
||||||
this.change
|
|
||||||
)
|
|
||||||
.on("keydown", this.filterKeyPresses([32, 13], this.change));
|
|
||||||
|
|
||||||
if (this.getNativeHeight() < this.$component.data('max-height')) {
|
|
||||||
this.change();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
this.filterKeyPresses = (keys, callback) => function(event) {
|
|
||||||
|
|
||||||
if (keys.indexOf(event.keyCode)) return;
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
callback();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
this.getNativeHeight = function() {
|
|
||||||
|
|
||||||
var $copy = this.$component.clone().css({
|
|
||||||
'position': 'absolute',
|
|
||||||
'left': '9999px',
|
|
||||||
'width': this.$component.width(),
|
|
||||||
'font-size': this.$component.css('font-size'),
|
|
||||||
'line-height': this.$component.css('line-height')
|
|
||||||
}).addClass('expanded');
|
|
||||||
|
|
||||||
$('body').append($copy);
|
|
||||||
|
|
||||||
var nativeHeight = $copy.height();
|
|
||||||
|
|
||||||
$copy.remove();
|
|
||||||
|
|
||||||
return nativeHeight;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
this.change = () => this.toggleCollapsed() && this.$toggle.remove();
|
|
||||||
|
|
||||||
this.toggleCollapsed = () => this.$component.addClass('expanded');
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
})(window.GOVUK.Modules);
|
|
||||||
@@ -84,7 +84,6 @@ const javascripts = () => {
|
|||||||
paths.src + 'javascripts/autofocus.js',
|
paths.src + 'javascripts/autofocus.js',
|
||||||
paths.src + 'javascripts/highlightTags.js',
|
paths.src + 'javascripts/highlightTags.js',
|
||||||
paths.src + 'javascripts/fileUpload.js',
|
paths.src + 'javascripts/fileUpload.js',
|
||||||
paths.src + 'javascripts/expandCollapse.js',
|
|
||||||
paths.src + 'javascripts/radioSelect.js',
|
paths.src + 'javascripts/radioSelect.js',
|
||||||
paths.src + 'javascripts/updateContent.js',
|
paths.src + 'javascripts/updateContent.js',
|
||||||
paths.src + 'javascripts/listEntry.js',
|
paths.src + 'javascripts/listEntry.js',
|
||||||
|
|||||||
Reference in New Issue
Block a user