'use strict';
/**
* Options bar component.
* @namespace optionsBar
* @memberof UCASDesignFramework
* @param {object} global - UCASDesignFramework object.
* @param {object} _u - UCASUtilities object.
*/
(function (global, _u) {
/**
* @function init
* @memberof! UCASDesignFramework.optionsBar
* @returns {Boolean} - true for success
* @example
* UCASDesignFramework.optionsBar.init()
*/
function init () {
// Initialise options bars.
var bars = document.querySelectorAll('.options-bar')
if (!bars.length) {
_u.log.info('Failed to find options bar')
return false
} else {
bars.forEach(function (bar) {
var readonlyInputs = bar.querySelectorAll('input[readonly]')
readonlyInputs.forEach(function (readonlyInput) {
global.size.resizeTextFieldToFitContent(readonlyInput)
})
})
}
return true
}
/**
* @function destroy
* @memberof! UCASDesignFramework.optionsBar
* @example
* UCASDesignFramework.optionsBar.destroy()
*/
function destroy () {
}
// Expose public methods and properties.
global.optionsBar = {
addSubscriptions: true,
init: init,
initOnLoad: true,
destroy: destroy
}
})(UCASDesignFramework, UCASUtilities)