scripts/menu.js
/**
 * Cut down the number of entries in an option group to a specified max limit
 * @param {Object} optGroup A jQuery encapsulated HTML tag to remove entries from
 * @param {number} maxCustomItems The maximum number of entries to allow in optGroup
 * @callback removeDatabaseEntryCallback Remove items from their respective database records as well
 */
Cut down the number of entries in an option group to a specified max limit
@param {Object} optGroup A jQuery encapsulated HTML tag to remove entries from
@param {number} maxCustomItems The maximum number of entries to allow in optGroup
@callback removeDatabaseEntryCallback Remove items from their respective database records as well
Cut down the number of entries in an option group to a specified max limit @param { Object } optGroup A jQuery encapsulated HTML tag to remove entries from @param { number } maxCustomItems The maximum number of entries to allow in optGroup @callback removeDatabaseEntryCallback Remove items from their respective database records as well
function removeOldCustomOptEntries(optGroup, maxCustomItems, removeDatabaseEntryCallback) {
	var optionCount = 0;
	optGroup.children("option").each(function() {
		optionCount++;
		if(optionCount > maxCustomItems) {
			removeDatabaseEntryCallback($(this).val());			
			$(this).remove();
		}
	});
}
function removeOldCustomOptEntries ( optGroup , maxCustomItems , removeDatabaseEntryCallback ) { var optionCount = 0 ; optGroup . children ( "option" ) . each ( function ( ) { optionCount ++ ; if ( optionCount > maxCustomItems ) { removeDatabaseEntryCallback ( $ ( this ) . val ( ) ) ; $ ( this ) . remove ( ) ; } } ) ; }
Cut down the number of entries in an option group to a specified max limit
 @param {Object} optGroup A jQuery encapsulated HTML tag to remove entries from
 @param {number} maxCustomItems The maximum number of entries to allow in optGroup
 @callback removeDatabaseEntryCallback Remove items from their respective database records as well
Cut down the number of entries in an option group to a specified max limit @param { Object } optGroup A jQuery encapsulated HTML tag to remove entries from @param { number } maxCustomItems The maximum number of entries to allow in optGroup @callback removeDatabaseEntryCallback Remove items from their respective database records as well