code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
findChildData = function findChildData( targetParent, rootData ) {
var isRootOfTree = $.isEmptyObject( targetParent );
if ( isRootOfTree ) {
return rootData;
}
if ( rootData === undefined ) {
return false;
}
for ( var i = 0; i < rootData.length; i++ ) {
var potentialMatch = rootData[ i ];
if ( potentialMatch.attr && targetParent.attr && potentialMatch.attr.id === targetParent.attr.id ) {
return potentialMatch.children;
} else if ( potentialMatch.children ) {
var foundChild = findChildData( targetParent, potentialMatch.children );
if ( foundChild ) {
return foundChild;
}
}
}
return false;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
findChildData
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
isShiftHeld = function isShiftHeld( e ) {
return e.shiftKey === true;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
isShiftHeld
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
isKey = function isKey( keyCode ) {
return function compareKeycodes( e ) {
return e.keyCode === keyCode;
};
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
isKey
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
cleanInput = function cleanInput( questionableMarkup ) {
// check for encoding and decode
while ( ENCODED_REGEX.test( questionableMarkup ) ) {
questionableMarkup = $( '<i>' ).html( questionableMarkup ).text();
}
// string completely decoded now encode it
return $( '<i>' ).text( questionableMarkup ).html();
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
cleanInput
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
Wizard = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.wizard.defaults, options );
this.options.disablePreviousStep = ( this.$element.attr( 'data-restrict' ) === 'previous' ) ? true : this.options.disablePreviousStep;
this.currentStep = this.options.selectedItem.step;
this.numSteps = this.$element.find( '.steps li' ).length;
this.$prevBtn = this.$element.find( 'button.btn-prev' );
this.$nextBtn = this.$element.find( 'button.btn-next' );
var kids = this.$nextBtn.children().detach();
this.nextText = $.trim( this.$nextBtn.text() );
this.$nextBtn.append( kids );
var steps = this.$element.children( '.steps-container' );
// maintains backwards compatibility with < 3.8, will be removed in the future
if ( steps.length === 0 ) {
steps = this.$element;
this.$element.addClass( 'no-steps-container' );
if ( window && window.console && window.console.warn ) {
window.console.warn( 'please update your wizard markup to include ".steps-container" as seen in http://getfuelux.com/javascript.html#wizard-usage-markup' );
}
}
steps = steps.find( '.steps' );
// handle events
this.$prevBtn.on( 'click.fu.wizard', $.proxy( this.previous, this ) );
this.$nextBtn.on( 'click.fu.wizard', $.proxy( this.next, this ) );
steps.on( 'click.fu.wizard', 'li.complete', $.proxy( this.stepclicked, this ) );
this.selectedItem( this.options.selectedItem );
if ( this.options.disablePreviousStep ) {
this.$prevBtn.attr( 'disabled', true );
this.$element.find( '.steps' ).addClass( 'previous-disabled' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Wizard
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
InfiniteScroll = function( element, options ) {
this.$element = $( element );
this.$element.addClass( 'infinitescroll' );
this.options = $.extend( {}, $.fn.infinitescroll.defaults, options );
this.curScrollTop = this.$element.scrollTop();
this.curPercentage = this.getPercentage();
this.fetchingData = false;
this.$element.on( 'scroll.fu.infinitescroll', $.proxy( this.onScroll, this ) );
this.onScroll();
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
InfiniteScroll
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
fetch = function() {
var helpers = {
percentage: self.curPercentage,
scrollTop: self.curScrollTop
};
var $loader = $( '<div class="loader"></div>' );
load.append( $loader );
$loader.loader();
if ( self.options.dataSource ) {
self.options.dataSource( helpers, function( resp ) {
var end;
load.remove();
if ( resp.content ) {
self.$element.append( resp.content );
}
if ( resp.end ) {
end = ( resp.end !== true ) ? resp.end : undefined;
self.end( end );
}
self.fetchingData = false;
} );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
fetch
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
Pillbox = function Pillbox( element, options ) {
this.$element = $( element );
this.$moreCount = this.$element.find( '.pillbox-more-count' );
this.$pillGroup = this.$element.find( '.pill-group' );
this.$addItem = this.$element.find( '.pillbox-add-item' );
this.$addItemWrap = this.$addItem.parent();
this.$suggest = this.$element.find( '.suggest' );
this.$pillHTML = '<li class="btn btn-default pill">' +
' <span></span>' +
' <span class="glyphicon glyphicon-close">' +
' <span class="sr-only">Remove</span>' +
' </span>' +
'</li>';
this.options = $.extend( {}, $.fn.pillbox.defaults, options );
if ( this.options.readonly === -1 ) {
if ( this.$element.attr( 'data-readonly' ) !== undefined ) {
this.readonly( true );
}
} else if ( this.options.readonly ) {
this.readonly( true );
}
// EVENTS
this.acceptKeyCodes = this._generateObject( this.options.acceptKeyCodes );
// Create an object out of the key code array, so we don't have to loop through it on every key stroke
this.$element.on( 'click.fu.pillbox', '.pill-group > .pill', $.proxy( this.itemClicked, this ) );
this.$element.on( 'click.fu.pillbox', $.proxy( this.inputFocus, this ) );
this.$element.on( 'keydown.fu.pillbox', '.pillbox-add-item', $.proxy( this.inputEvent, this ) );
if ( this.options.onKeyDown ) {
this.$element.on( 'mousedown.fu.pillbox', '.suggest > li', $.proxy( this.suggestionClick, this ) );
}
if ( this.options.edit ) {
this.$element.addClass( 'pills-editable' );
this.$element.on( 'blur.fu.pillbox', '.pillbox-add-item', $.proxy( this.cancelEdit, this ) );
}
this.$element.on( 'blur.fu.pillbox', '.pillbox-add-item', $.proxy( this.inputEvent, this ) );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Pillbox
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
Repeater = function Repeater( element, options ) {
var self = this;
var $btn;
var currentView;
this.$element = $( element );
this.$canvas = this.$element.find( '.repeater-canvas' );
this.$count = this.$element.find( '.repeater-count' );
this.$end = this.$element.find( '.repeater-end' );
this.$filters = this.$element.find( '.repeater-filters' );
this.$loader = this.$element.find( '.repeater-loader' );
this.$pageSize = this.$element.find( '.repeater-itemization .selectlist' );
this.$nextBtn = this.$element.find( '.repeater-next' );
this.$pages = this.$element.find( '.repeater-pages' );
this.$prevBtn = this.$element.find( '.repeater-prev' );
this.$primaryPaging = this.$element.find( '.repeater-primaryPaging' );
this.$search = this.$element.find( '.repeater-search' ).find( '.search' );
this.$secondaryPaging = this.$element.find( '.repeater-secondaryPaging' );
this.$start = this.$element.find( '.repeater-start' );
this.$viewport = this.$element.find( '.repeater-viewport' );
this.$views = this.$element.find( '.repeater-views' );
this.currentPage = 0;
this.currentView = null;
this.isDisabled = false;
this.infiniteScrollingCallback = function noop() {};
this.infiniteScrollingCont = null;
this.infiniteScrollingEnabled = false;
this.infiniteScrollingEnd = null;
this.infiniteScrollingOptions = {};
this.lastPageInput = 0;
this.options = $.extend( {}, $.fn.repeater.defaults, options );
this.pageIncrement = 0; // store direction navigated
this.resizeTimeout = {};
this.stamp = new Date().getTime() + ( Math.floor( Math.random() * 100 ) + 1 );
this.storedDataSourceOpts = null;
this.syncingViewButtonState = false;
this.viewOptions = {};
this.viewType = null;
this.$filters.selectlist();
this.$pageSize.selectlist();
this.$primaryPaging.find( '.combobox' ).combobox();
this.$search.search( {
searchOnKeyPress: this.options.searchOnKeyPress,
allowCancel: this.options.allowCancel
} );
this.$filters.on( 'changed.fu.selectlist', function onFiltersChanged( e, value ) {
self.$element.trigger( 'filtered.fu.repeater', value );
self.render( {
clearInfinite: true,
pageIncrement: null
} );
} );
this.$nextBtn.on( 'click.fu.repeater', $.proxy( this.next, this ) );
this.$pageSize.on( 'changed.fu.selectlist', function onPageSizeChanged( e, value ) {
self.$element.trigger( 'pageSizeChanged.fu.repeater', value );
self.render( {
pageIncrement: null
} );
} );
this.$prevBtn.on( 'click.fu.repeater', $.proxy( this.previous, this ) );
this.$primaryPaging.find( '.combobox' ).on( 'changed.fu.combobox', function onPrimaryPagingChanged( evt, data ) {
self.pageInputChange( data.text, data );
} );
this.$search.on( 'searched.fu.search cleared.fu.search', function onSearched( e, value ) {
self.$element.trigger( 'searchChanged.fu.repeater', value );
self.render( {
clearInfinite: true,
pageIncrement: null
} );
} );
this.$search.on( 'canceled.fu.search', function onSearchCanceled( e, value ) {
self.$element.trigger( 'canceled.fu.repeater', value );
self.render( {
clearInfinite: true,
pageIncrement: null
} );
} );
this.$secondaryPaging.on( 'blur.fu.repeater', function onSecondaryPagingBlur() {
self.pageInputChange( self.$secondaryPaging.val() );
} );
this.$secondaryPaging.on( 'keyup', function onSecondaryPagingKeyup( e ) {
if ( e.keyCode === 13 ) {
self.pageInputChange( self.$secondaryPaging.val() );
}
} );
this.$views.find( 'input' ).on( 'change.fu.repeater', $.proxy( this.viewChanged, this ) );
$( window ).on( 'resize.fu.repeater.' + this.stamp, function onResizeRepeater() {
clearTimeout( self.resizeTimeout );
self.resizeTimeout = setTimeout( function resizeTimeout() {
self.resize();
self.$element.trigger( 'resized.fu.repeater' );
}, 75 );
} );
this.$loader.loader();
this.$loader.loader( 'pause' );
if ( this.options.defaultView !== -1 ) {
currentView = this.options.defaultView;
} else {
$btn = this.$views.find( 'label.active input' );
currentView = ( $btn.length > 0 ) ? $btn.val() : 'list';
}
this.setViewOptions( currentView );
this.initViewTypes( function initViewTypes() {
self.resize();
self.$element.trigger( 'resized.fu.repeater' );
self.render( {
changeView: currentView
} );
} );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Repeater
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
logWarn = function logWarn( msg ) {
if ( window.console && window.console.warn ) {
window.console.warn( msg );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
logWarn
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
scan = function scan( cont ) {
var keep = [];
cont.children().each( function eachContainerChild() {
var item = $( this );
var pres = item.attr( 'data-preserve' );
if ( pres === 'deep' ) {
item.detach();
keep.push( item );
} else if ( pres === 'shallow' ) {
scan( item );
item.detach();
keep.push( item );
}
} );
cont.empty();
cont.append( keep );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
scan
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
addItem = function addItem( $parent, response ) {
var action;
if ( response ) {
action = ( response.action ) ? response.action : 'append';
if ( action !== 'none' && response.item !== undefined ) {
var $container = ( response.container !== undefined ) ? $( response.container ) : $parent;
$container[ action ]( response.item );
}
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
addItem
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
callNextInit = function callNextInit( currentViewType, viewTypes, callback ) {
var nextViewType = currentViewType + 1;
if ( nextViewType < viewTypes.length ) {
initViewType.call( this, nextViewType, viewTypes, callback );
} else {
callback();
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
callNextInit
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
initViewType = function initViewType( currentViewtype, viewTypes, callback ) {
if ( viewTypes[ currentViewtype ].initialize ) {
viewTypes[ currentViewtype ].initialize.call( this, {}, function afterInitialize() {
callNextInit.call( this, currentViewtype, viewTypes, callback );
} );
} else {
callNextInit.call( this, currentViewtype, viewTypes, callback );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
initViewType
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
afterRender = function afterRender( state ) {
var data = state.data || {};
if ( this.infiniteScrollingEnabled ) {
if ( state.viewChanged || state.options.clearInfinite ) {
this.initInfiniteScrolling();
}
this.infiniteScrollPaging( data, state.options );
}
this.$loader.hide().loader( 'pause' );
this.enable();
this.$search.trigger( 'rendered.fu.repeater', {
data: data,
options: state.dataOptions,
renderOptions: state.options
} );
this.$element.trigger( 'rendered.fu.repeater', {
data: data,
options: state.dataOptions,
renderOptions: state.options
} );
// for maintaining support of 'loaded' event
this.$element.trigger( 'loaded.fu.repeater', state.dataOptions );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
afterRender
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
doRender = function doRender( state ) {
var data = state.data || {};
if ( this.infiniteScrollingEnabled ) {
// pass empty object because data handled in infiniteScrollPaging method
this.infiniteScrollingCallback( {} );
} else {
this.itemization( data );
this.pagination( data );
}
var self = this;
this.renderItems(
state.viewTypeObj,
data,
function callAfterRender( d ) {
state.data = d;
afterRender.call( self, state );
}
);
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
doRender
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
checkIfItemMatchesValue = function checkIfItemMatchesValue( rowIndex ) {
$item = $( this );
data = $item.data( 'item_data' ) || {};
if ( data[ items[ i ].property ] === items[ i ].value ) {
selectItem( $item, items[ i ].selected, rowIndex );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
checkIfItemMatchesValue
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
selectItem = function selectItem( $itm, slct, index ) {
var $frozenCols;
var select = ( slct !== undefined ) ? slct : true;
if ( select ) {
if ( !force && selectable !== 'multi' ) {
self.list_clearSelectedItems();
}
if ( !$itm.hasClass( 'selected' ) ) {
$itm.addClass( 'selected' );
if ( self.viewOptions.list_frozenColumns || self.viewOptions.list_selectable === 'multi' ) {
$frozenCols = self.$element.find( '.frozen-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' );
$frozenCols.addClass( 'selected' );
$frozenCols.find( '.repeater-select-checkbox' ).addClass( 'checked' );
}
if ( self.viewOptions.list_actions ) {
self.$element.find( '.actions-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' ).addClass( 'selected' );
}
$itm.find( 'td:first' ).prepend( '<div class="repeater-list-check"><span class="glyphicon glyphicon-ok"></span></div>' );
}
} else {
if ( self.viewOptions.list_frozenColumns ) {
$frozenCols = self.$element.find( '.frozen-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' );
$frozenCols.addClass( 'selected' );
$frozenCols.find( '.repeater-select-checkbox' ).removeClass( 'checked' );
}
if ( self.viewOptions.list_actions ) {
self.$element.find( '.actions-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' ).removeClass( 'selected' );
}
$itm.find( '.repeater-list-check' ).remove();
$itm.removeClass( 'selected' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
selectItem
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
function revertCheckbox( $checkbox ) {
self.list_revertingCheckbox = true;
$checkbox.checkbox( 'toggle' );
delete self.list_revertingCheckbox;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
revertCheckbox
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
areDifferentColumns = function areDifferentColumns( oldCols, newCols ) {
if ( !newCols ) {
return false;
}
if ( !oldCols || ( newCols.length !== oldCols.length ) ) {
return true;
}
for ( var i = 0, newColsL = newCols.length; i < newColsL; i++ ) {
if ( !oldCols[ i ] ) {
return true;
}
for ( var j in newCols[ i ] ) {
if ( newCols[ i ].hasOwnProperty( j ) && oldCols[ i ][ j ] !== newCols[ i ][ j ] ) {
return true;
}
}
}
return false;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
areDifferentColumns
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
renderColumn = function renderColumn( $row, rows, rowIndex, columns, columnIndex ) {
var className = columns[ columnIndex ].className;
var content = rows[ rowIndex ][ columns[ columnIndex ].property ];
var $col = $( '<td></td>' );
var width = columns[ columnIndex ]._auto_width;
var property = columns[ columnIndex ].property;
if ( this.viewOptions.list_actions !== false && property === '@_ACTIONS_@' ) {
content = '<div class="repeater-list-actions-placeholder" style="width: ' + this.list_actions_width + 'px"></div>';
}
content = ( content !== undefined ) ? content : '';
$col.addClass( ( ( className !== undefined ) ? className : '' ) ).append( content );
if ( width !== undefined ) {
$col.outerWidth( width );
}
$row.append( $col );
if ( this.viewOptions.list_selectable === 'multi' && columns[ columnIndex ].property === '@_CHECKBOX_@' ) {
var checkBoxMarkup = '<label data-row="' + rowIndex + '" class="checkbox-custom checkbox-inline body-checkbox repeater-select-checkbox">' +
'<input class="sr-only" type="checkbox"></label>';
$col.html( checkBoxMarkup );
}
return $col;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderColumn
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
renderHeader = function renderHeader( $tr, columns, index ) {
var chevDown = 'glyphicon-chevron-down';
var chevron = '.glyphicon.rlc:first';
var chevUp = 'glyphicon-chevron-up';
var $div = $( '<div class="repeater-list-heading"><span class="glyphicon rlc"></span></div>' );
var checkAllID = ( this.$element.attr( 'id' ) + '_' || '' ) + 'checkall';
var checkBoxMarkup = '<div class="repeater-list-heading header-checkbox">' +
'<label id="' + checkAllID + '" class="checkbox-custom checkbox-inline">' +
'<input class="sr-only" type="checkbox" value="">' +
'<span class="checkbox-label"> </span>' +
'</label>' +
'</div>';
var $header = $( '<th></th>' );
var self = this;
var $both;
var className;
var sortable;
var $span;
var $spans;
$div.data( 'fu_item_index', index );
$div.prepend( columns[ index ].label );
$header.html( $div.html() ).find( '[id]' ).removeAttr( 'id' );
if ( columns[ index ].property !== '@_CHECKBOX_@' ) {
$header.append( $div );
} else {
$header.append( checkBoxMarkup );
}
$both = $header.add( $div );
$span = $div.find( chevron );
$spans = $span.add( $header.find( chevron ) );
if ( this.viewOptions.list_actions && columns[ index ].property === '@_ACTIONS_@' ) {
var width = this.list_actions_width;
$header.css( 'width', width );
$div.css( 'width', width );
}
className = columns[ index ].className;
if ( className !== undefined ) {
$both.addClass( className );
}
sortable = columns[ index ].sortable;
if ( sortable ) {
$both.addClass( 'sortable' );
$div.on( 'click.fu.repeaterList', function onClickRepeaterList() {
if ( !self.isDisabled ) {
self.list_sortProperty = ( typeof sortable === 'string' ) ? sortable : columns[ index ].property;
if ( $div.hasClass( 'sorted' ) ) {
if ( $span.hasClass( chevUp ) ) {
$spans.removeClass( chevUp ).addClass( chevDown );
self.list_sortDirection = 'desc';
} else if ( !self.viewOptions.list_sortClearing ) {
$spans.removeClass( chevDown ).addClass( chevUp );
self.list_sortDirection = 'asc';
} else {
$both.removeClass( 'sorted' );
$spans.removeClass( chevDown );
self.list_sortDirection = null;
self.list_sortProperty = null;
}
} else {
$tr.find( 'th, .repeater-list-heading' ).removeClass( 'sorted' );
$spans.removeClass( chevDown ).addClass( chevUp );
self.list_sortDirection = 'asc';
$both.addClass( 'sorted' );
}
self.render( {
clearInfinite: true,
pageIncrement: null
} );
}
} );
}
if ( columns[ index ].sortDirection === 'asc' || columns[ index ].sortDirection === 'desc' ) {
$tr.find( 'th, .repeater-list-heading' ).removeClass( 'sorted' );
$both.addClass( 'sortable sorted' );
if ( columns[ index ].sortDirection === 'asc' ) {
$spans.addClass( chevUp );
this.list_sortDirection = 'asc';
} else {
$spans.addClass( chevDown );
this.list_sortDirection = 'desc';
}
this.list_sortProperty = ( typeof sortable === 'string' ) ? sortable : columns[ index ].property;
}
$tr.append( $header );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderHeader
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
onClickRowRepeaterList = function onClickRowRepeaterList( repeater ) {
var isMulti = repeater.viewOptions.list_selectable === 'multi';
var isActions = repeater.viewOptions.list_actions;
var $repeater = repeater.$element;
if ( !repeater.isDisabled ) {
var $item = $( this );
var index = $( this ).index() + 1;
var $frozenRow = $repeater.find( '.frozen-column-wrapper tr:nth-child(' + index + ')' );
var $actionsRow = $repeater.find( '.actions-column-wrapper tr:nth-child(' + index + ')' );
var $checkBox = $repeater.find( '.frozen-column-wrapper tr:nth-child(' + index + ') .checkbox-inline' );
if ( $item.is( '.selected' ) ) {
$item.removeClass( 'selected' );
if ( isMulti ) {
$checkBox.click();
$frozenRow.removeClass( 'selected' );
if ( isActions ) {
$actionsRow.removeClass( 'selected' );
}
} else {
$item.find( '.repeater-list-check' ).remove();
}
$repeater.trigger( 'deselected.fu.repeaterList', $item );
} else {
if ( !isMulti ) {
repeater.$canvas.find( '.repeater-list-check' ).remove();
repeater.$canvas.find( '.repeater-list tbody tr.selected' ).each( function deslectRow() {
$( this ).removeClass( 'selected' );
$repeater.trigger( 'deselected.fu.repeaterList', $( this ) );
} );
$item.find( 'td:first' ).prepend( '<div class="repeater-list-check"><span class="glyphicon glyphicon-ok"></span></div>' );
$item.addClass( 'selected' );
$frozenRow.addClass( 'selected' );
} else {
$checkBox.click();
$item.addClass( 'selected' );
$frozenRow.addClass( 'selected' );
if ( isActions ) {
$actionsRow.addClass( 'selected' );
}
}
$repeater.trigger( 'selected.fu.repeaterList', $item );
}
toggleActionsHeaderButton.call( repeater );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
onClickRowRepeaterList
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
renderRow = function renderRow( $tbody, rows, index ) {
var $row = $( '<tr></tr>' );
if ( this.viewOptions.list_selectable ) {
$row.data( 'item_data', rows[ index ] );
if ( this.viewOptions.list_selectable !== 'action' ) {
$row.addClass( 'selectable' );
$row.attr( 'tabindex', 0 ); // allow items to be tabbed to / focused on
var repeater = this;
$row.on( 'click.fu.repeaterList', function callOnClickRowRepeaterList() {
onClickRowRepeaterList.call( this, repeater );
} );
// allow selection via enter key
$row.keyup( function onRowKeyup( e ) {
if ( e.keyCode === 13 ) {
// triggering a standard click event to be caught by the row click handler above
$row.trigger( 'click.fu.repeaterList' );
}
} );
}
}
if ( this.viewOptions.list_actions && !this.viewOptions.list_selectable ) {
$row.data( 'item_data', rows[ index ] );
}
var columns = [];
for ( var i = 0, length = this.list_columns.length; i < length; i++ ) {
columns.push( renderColumn.call( this, $row, rows, index, this.list_columns, i ) );
}
$tbody.append( $row );
if ( this.viewOptions.list_columnRendered ) {
for ( var columnIndex = 0, colLength = columns.length; columnIndex < colLength; columnIndex++ ) {
if ( !( this.list_columns[ columnIndex ].property === '@_CHECKBOX_@' || this.list_columns[ columnIndex ].property === '@_ACTIONS_@' ) ) {
this.viewOptions.list_columnRendered( {
container: $row,
columnAttr: this.list_columns[ columnIndex ].property,
item: columns[ columnIndex ],
rowData: rows[ index ]
}, function noop() {} );
}
}
}
if ( this.viewOptions.list_rowRendered ) {
this.viewOptions.list_rowRendered( {
container: $tbody,
item: $row,
rowData: rows[ index ]
}, function noop() {} );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderRow
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
renderTbody = function renderTbody( $table, data ) {
var $tbody = $table.find( 'tbody' );
var $empty;
if ( $tbody.length < 1 ) {
$tbody = $( '<tbody data-container="true"></tbody>' );
$table.append( $tbody );
}
if ( typeof data.error === 'string' && data.error.length > 0 ) {
$empty = $( '<tr class="empty text-danger"><td colspan="' + this.list_columns.length + '"></td></tr>' );
$empty.find( 'td' ).append( data.error );
$tbody.append( $empty );
} else if ( data.items && data.items.length < 1 ) {
$empty = $( '<tr class="empty"><td colspan="' + this.list_columns.length + '"></td></tr>' );
$empty.find( 'td' ).append( this.viewOptions.list_noItemsHTML );
$tbody.append( $empty );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderTbody
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
renderThead = function renderThead( $table, data ) {
var columns = data.columns || [];
var $thead = $table.find( 'thead' );
var i;
var length;
var $tr;
if ( this.list_firstRender || areDifferentColumns( this.list_columns, columns ) || $thead.length === 0 ) {
$thead.remove();
// list_noItems is set in `before` method
if ( this.viewOptions.list_selectable === 'multi' && !this.list_noItems ) {
var checkboxColumn = {
label: 'c',
property: '@_CHECKBOX_@',
sortable: false
};
columns.splice( 0, 0, checkboxColumn );
}
this.list_columns = columns;
this.list_firstRender = false;
this.$loader.removeClass( 'noHeader' );
// keep action column header even when empty, you'll need it later....
if ( this.viewOptions.list_actions ) {
var actionsColumn = {
label: this.viewOptions.list_actions.label || '<span class="actions-hidden">a</span>',
property: '@_ACTIONS_@',
sortable: false,
width: this.list_actions_width
};
columns.push( actionsColumn );
}
$thead = $( '<thead data-preserve="deep"><tr></tr></thead>' );
$tr = $thead.find( 'tr' );
for ( i = 0, length = columns.length; i < length; i++ ) {
renderHeader.call( this, $tr, columns, i );
}
$table.prepend( $thead );
if ( this.viewOptions.list_selectable === 'multi' && !this.list_noItems ) {
// after checkbox column is created need to get width of checkbox column from
// its css class
var checkboxWidth = this.$element.find( '.repeater-list-wrapper .header-checkbox' ).outerWidth();
var selectColumn = $.grep( columns, function grepColumn( column ) {
return column.property === '@_CHECKBOX_@';
} )[ 0 ];
selectColumn.width = checkboxWidth;
}
sizeColumns.call( this, $tr );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderThead
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
sizeColumns = function sizeColumns( $tr ) {
var automaticallyGeneratedWidths = [];
var self = this;
var i;
var length;
var newWidth;
var widthTaken;
if ( this.viewOptions.list_columnSizing ) {
i = 0;
widthTaken = 0;
$tr.find( 'th' ).each( function eachTH() {
var $th = $( this );
var width;
if ( self.list_columns[ i ].width !== undefined ) {
width = self.list_columns[ i ].width;
$th.outerWidth( width );
widthTaken += $th.outerWidth();
self.list_columns[ i ]._auto_width = width;
} else {
var outerWidth = $th.find( '.repeater-list-heading' ).outerWidth();
automaticallyGeneratedWidths.push( {
col: $th,
index: i,
minWidth: outerWidth
} );
}
i++;
} );
length = automaticallyGeneratedWidths.length;
if ( length > 0 ) {
var canvasWidth = this.$canvas.find( '.repeater-list-wrapper' ).outerWidth();
newWidth = Math.floor( ( canvasWidth - widthTaken ) / length );
for ( i = 0; i < length; i++ ) {
if ( automaticallyGeneratedWidths[ i ].minWidth > newWidth ) {
newWidth = automaticallyGeneratedWidths[ i ].minWidth;
}
automaticallyGeneratedWidths[ i ].col.outerWidth( newWidth );
this.list_columns[ automaticallyGeneratedWidths[ i ].index ]._auto_width = newWidth;
}
}
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
sizeColumns
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
specialBrowserClass = function specialBrowserClass() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf( 'MSIE ' );
var firefox = ua.indexOf( 'Firefox' );
if ( msie > 0 ) {
return 'ie-' + parseInt( ua.substring( msie + 5, ua.indexOf( '.', msie ) ), 10 );
} else if ( firefox > 0 ) {
return 'firefox';
}
return '';
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
specialBrowserClass
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
toggleActionsHeaderButton = function toggleActionsHeaderButton() {
var selectedSelector = '.repeater-list-wrapper > table .selected';
var $actionsColumn = this.$element.find( '.table-actions' );
var $selected;
if ( this.viewOptions.list_selectable === 'action' ) {
selectedSelector = '.repeater-list-wrapper > table tr';
}
$selected = this.$canvas.find( selectedSelector );
if ( $selected.length > 0 ) {
$actionsColumn.find( 'thead .btn' ).removeAttr( 'disabled' );
} else {
$actionsColumn.find( 'thead .btn' ).attr( 'disabled', 'disabled' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
toggleActionsHeaderButton
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
function compareItemIndex() {
if ( n === items[ i ].index ) {
$item = $( this );
return false;
} else {
n++;
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
compareItemIndex
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
function compareItemSelector() {
$item = $( this );
if ( $item.is( items[ i ].selector ) ) {
selectItem( $item, items[ i ].selected );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
compareItemSelector
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
function selectItem( $itm, select ) {
select = ( select !== undefined ) ? select : true;
if ( select ) {
if ( !force && selectable !== 'multi' ) {
self.thumbnail_clearSelectedItems();
}
$itm.addClass( 'selected' );
} else {
$itm.removeClass( 'selected' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
selectItem
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
function fillTemplate( itemData, template ) {
var invalid = false;
function replace() {
var end, start, val;
start = template.indexOf( '{{' );
end = template.indexOf( '}}', start + 2 );
if ( start > -1 && end > -1 ) {
val = $.trim( template.substring( start + 2, end ) );
val = ( itemData[ val ] !== undefined ) ? itemData[ val ] : '';
template = template.substring( 0, start ) + val + template.substring( end + 2 );
} else {
invalid = true;
}
}
while ( !invalid && template.search( '{{' ) >= 0 ) {
replace( template );
}
return template;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
fillTemplate
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
function replace() {
var end, start, val;
start = template.indexOf( '{{' );
end = template.indexOf( '}}', start + 2 );
if ( start > -1 && end > -1 ) {
val = $.trim( template.substring( start + 2, end ) );
val = ( itemData[ val ] !== undefined ) ? itemData[ val ] : '';
template = template.substring( 0, start ) + val + template.substring( end + 2 );
} else {
invalid = true;
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
replace
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
Scheduler = function Scheduler( element, options ) {
var self = this;
this.$element = $( element );
this.options = $.extend( {}, $.fn.scheduler.defaults, options );
// cache elements
this.$startDate = this.$element.find( '.start-datetime .start-date' );
this.$startTime = this.$element.find( '.start-datetime .start-time' );
this.$timeZone = this.$element.find( '.timezone-container .timezone' );
this.$repeatIntervalPanel = this.$element.find( '.repeat-every-panel' );
this.$repeatIntervalSelect = this.$element.find( '.repeat-options' );
this.$repeatIntervalSpinbox = this.$element.find( '.repeat-every' );
this.$repeatIntervalTxt = this.$element.find( '.repeat-every-text' );
this.$end = this.$element.find( '.repeat-end' );
this.$endSelect = this.$end.find( '.end-options' );
this.$endAfter = this.$end.find( '.end-after' );
this.$endDate = this.$end.find( '.end-on-date' );
// panels
this.$recurrencePanels = this.$element.find( '.repeat-panel' );
this.$repeatIntervalSelect.selectlist();
//initialize sub-controls
this.$element.find( '.selectlist' ).selectlist();
this.$startDate.datepicker( this.options.startDateOptions );
var startDateResponse = ( typeof this.options.startDateChanged === "function" ) ? this.options.startDateChanged : this._guessEndDate;
this.$startDate.on( 'change changed.fu.datepicker dateClicked.fu.datepicker', $.proxy( startDateResponse, this ) );
this.$startTime.combobox();
// init start time
if ( this.$startTime.find( 'input' ).val() === '' ) {
this.$startTime.combobox( 'selectByIndex', 0 );
}
// every 0 days/hours doesn't make sense, change if not set
if ( this.$repeatIntervalSpinbox.find( 'input' ).val() === '0' ) {
this.$repeatIntervalSpinbox.spinbox( {
'value': 1,
'min': 1,
'limitToStep': true
} );
} else {
this.$repeatIntervalSpinbox.spinbox( {
'min': 1,
'limitToStep': true
} );
}
this.$endAfter.spinbox( {
'value': 1,
'min': 1,
'limitToStep': true
} );
this.$endDate.datepicker( this.options.endDateOptions );
this.$element.find( '.radio-custom' ).radio();
// bind events: 'change' is a Bootstrap JS fired event
this.$repeatIntervalSelect.on( 'changed.fu.selectlist', $.proxy( this.repeatIntervalSelectChanged, this ) );
this.$endSelect.on( 'changed.fu.selectlist', $.proxy( this.endSelectChanged, this ) );
this.$element.find( '.repeat-days-of-the-week .btn-group .btn' ).on( 'change.fu.scheduler', function( e, data ) {
self.changed( e, data, true );
} );
this.$element.find( '.combobox' ).on( 'changed.fu.combobox', $.proxy( this.changed, this ) );
this.$element.find( '.datepicker' ).on( 'changed.fu.datepicker', $.proxy( this.changed, this ) );
this.$element.find( '.datepicker' ).on( 'dateClicked.fu.datepicker', $.proxy( this.changed, this ) );
this.$element.find( '.selectlist' ).on( 'changed.fu.selectlist', $.proxy( this.changed, this ) );
this.$element.find( '.spinbox' ).on( 'changed.fu.spinbox', $.proxy( this.changed, this ) );
this.$element.find( '.repeat-monthly .radio-custom, .repeat-yearly .radio-custom' ).on( 'change.fu.scheduler', $.proxy( this.changed, this ) );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Scheduler
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
_getFormattedDate = function _getFormattedDate( dateObj, dash ) {
var fdate = '';
var item;
fdate += dateObj.getFullYear();
fdate += dash;
item = dateObj.getMonth() + 1; //because 0 indexing makes sense when dealing with months /sarcasm
fdate += ( item < 10 ) ? '0' + item : item;
fdate += dash;
item = dateObj.getDate();
fdate += ( item < 10 ) ? '0' + item : item;
return fdate;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_getFormattedDate
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
_incrementDate = function _incrementDate( start, end, interval, increment ) {
return new Date( start.getTime() + ( INTERVALS[ interval ] * increment ) );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_incrementDate
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
function z( n ) {
return ( n < 10 ? '0' : '' ) + n;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
z
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
Picker = function Picker( element, options ) {
var self = this;
this.$element = $( element );
this.options = $.extend( {}, $.fn.picker.defaults, options );
this.$accept = this.$element.find( '.picker-accept' );
this.$cancel = this.$element.find( '.picker-cancel' );
this.$trigger = this.$element.find( '.picker-trigger' );
this.$footer = this.$element.find( '.picker-footer' );
this.$header = this.$element.find( '.picker-header' );
this.$popup = this.$element.find( '.picker-popup' );
this.$body = this.$element.find( '.picker-body' );
this.clickStamp = '_';
this.isInput = this.$trigger.is( 'input' );
this.$trigger.on( 'keydown.fu.picker', $.proxy( this.keyComplete, this ) );
this.$trigger.on( 'focus.fu.picker', $.proxy( function inputFocus( e ) {
if ( typeof e === "undefined" || $( e.target ).is( 'input[type=text]' ) ) {
$.proxy( this.show(), this );
}
}, this ) );
this.$trigger.on( 'click.fu.picker', $.proxy( function triggerClick( e ) {
if ( !$( e.target ).is( 'input[type=text]' ) ) {
$.proxy( this.toggle(), this );
} else {
$.proxy( this.show(), this );
}
}, this ) );
this.$accept.on( 'click.fu.picker', $.proxy( this.complete, this, 'accepted' ) );
this.$cancel.on( 'click.fu.picker', function( e ) {
e.preventDefault();
self.complete( 'cancelled' );
} );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Picker
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
_isOffscreen = function _isOffscreen( picker ) {
var windowHeight = Math.max( document.documentElement.clientHeight, window.innerHeight || 0 );
var scrollTop = $( document ).scrollTop();
var popupTop = picker.$popup.offset();
var popupBottom = popupTop.top + picker.$popup.outerHeight( true );
//if the bottom of the popup goes off the page, but the top does not, dropup.
if ( popupBottom > windowHeight + scrollTop || popupTop.top < scrollTop ) {
return true;
} else { //otherwise, prefer showing the top of the popup only vs the bottom
return false;
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_isOffscreen
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
_display = function _display( picker ) {
picker.$popup.css( 'visibility', 'hidden' );
_showBelow( picker );
//if part of the popup is offscreen try to show it above
if ( _isOffscreen( picker ) ) {
_showAbove( picker );
//if part of the popup is still offscreen, prefer cutting off the bottom
if ( _isOffscreen( picker ) ) {
_showBelow( picker );
}
}
picker.$popup.css( 'visibility', 'visible' );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_display
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
_showAbove = function _showAbove( picker ) {
picker.$popup.css( 'top', -picker.$popup.outerHeight( true ) + 'px' );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_showAbove
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
_showBelow = function _showBelow( picker ) {
picker.$popup.css( 'top', picker.$trigger.outerHeight( true ) + 'px' );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_showBelow
|
javascript
|
ExactTarget/fuelux
|
dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/dist/js/fuelux.js
|
BSD-3-Clause
|
logError = function logError( error ) {
if ( window && window.console && window.console.error ) {
window.console.error( error );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
logError
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Radio = function Radio( element, options ) {
this.options = $.extend( {}, $.fn.radio.defaults, options );
if ( element.tagName.toLowerCase() !== 'label' ) {
logError( 'Radio must be initialized on the `label` that wraps the `input` element. See https://github.com/ExactTarget/fuelux/blob/master/reference/markup/radio.html for example of proper markup. Call `.radio()` on the `<label>` not the `<input>`' );
return;
}
// cache elements
this.$label = $( element );
this.$radio = this.$label.find( 'input[type="radio"]' );
this.groupName = this.$radio.attr( 'name' ); // don't cache group itself since items can be added programmatically
if ( !this.options.ignoreVisibilityCheck && this.$radio.css( 'visibility' ).match( /hidden|collapse/ ) ) {
logError( 'For accessibility reasons, in order for tab and space to function on radio, `visibility` must not be set to `hidden` or `collapse`. See https://github.com/ExactTarget/fuelux/pull/1996 for more details.' );
}
// determine if a toggle container is specified
var containerSelector = this.$radio.attr( 'data-toggle' );
this.$toggleContainer = $( containerSelector );
// handle internal events
this.$radio.on( 'change', $.proxy( this.itemchecked, this ) );
// set default state
this.setInitialState();
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Radio
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Search = function( element, options ) {
this.$element = $( element );
this.$repeater = $( element ).closest( '.repeater' );
this.options = $.extend( {}, $.fn.search.defaults, options );
if ( this.$element.attr( 'data-searchOnKeyPress' ) === 'true' ) {
this.options.searchOnKeyPress = true;
}
this.$button = this.$element.find( 'button' );
this.$input = this.$element.find( 'input' );
this.$icon = this.$element.find( '.glyphicon, .fuelux-icon' );
this.$button.on( 'click.fu.search', $.proxy( this.buttonclicked, this ) );
this.$input.on( 'keyup.fu.search', $.proxy( this.keypress, this ) );
if ( this.$repeater.length > 0 ) {
this.$repeater.on( 'rendered.fu.repeater', $.proxy( this.clearPending, this ) );
}
this.activeSearch = '';
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Search
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Selectlist = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.selectlist.defaults, options );
this.$button = this.$element.find( '.btn.dropdown-toggle' );
this.$hiddenField = this.$element.find( '.hidden-field' );
this.$label = this.$element.find( '.selected-label' );
this.$dropdownMenu = this.$element.find( '.dropdown-menu' );
this.$element.on( 'click.fu.selectlist', '.dropdown-menu a', $.proxy( this.itemClicked, this ) );
this.setDefaultSelection();
if ( options.resize === 'auto' || this.$element.attr( 'data-resize' ) === 'auto' ) {
this.resize();
}
// if selectlist is empty or is one item, disable it
var items = this.$dropdownMenu.children( 'li' );
if ( items.length === 0 ) {
this.disable();
this.doSelect( $( this.options.emptyLabelHTML ) );
}
// support jumping focus to first letter in dropdown when key is pressed
this.$element.on( 'shown.bs.dropdown', function() {
var $this = $( this );
// attach key listener when dropdown is shown
$( document ).on( 'keypress.fu.selectlist', function( e ) {
// get the key that was pressed
var key = String.fromCharCode( e.which );
// look the items to find the first item with the first character match and set focus
$this.find( "li" ).each( function( idx, item ) {
if ( $( item ).text().charAt( 0 ).toLowerCase() === key ) {
$( item ).children( 'a' ).focus();
return false;
}
} );
} );
} );
// unbind key event when dropdown is hidden
this.$element.on( 'hide.bs.dropdown', function() {
$( document ).off( 'keypress.fu.selectlist' );
} );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Selectlist
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Spinbox = function Spinbox( element, options ) {
this.$element = $( element );
this.$element.find( '.btn' ).on( 'click', function( e ) {
//keep spinbox from submitting if they forgot to say type="button" on their spinner buttons
e.preventDefault();
} );
this.options = $.extend( {}, $.fn.spinbox.defaults, options );
this.options.step = this.$element.data( 'step' ) || this.options.step;
if ( this.options.value < this.options.min ) {
this.options.value = this.options.min;
} else if ( this.options.max < this.options.value ) {
this.options.value = this.options.max;
}
this.$input = this.$element.find( '.spinbox-input' );
this.$input.on( 'focusout.fu.spinbox', this.$input, $.proxy( this.change, this ) );
this.$element.on( 'keydown.fu.spinbox', this.$input, $.proxy( this.keydown, this ) );
this.$element.on( 'keyup.fu.spinbox', this.$input, $.proxy( this.keyup, this ) );
if ( this.options.hold ) {
this.$element.on( 'mousedown.fu.spinbox', '.spinbox-up', $.proxy( function() {
this.startSpin( true );
}, this ) );
this.$element.on( 'mouseup.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy( this.stopSpin, this ) );
this.$element.on( 'mouseout.fu.spinbox', '.spinbox-up, .spinbox-down', $.proxy( this.stopSpin, this ) );
this.$element.on( 'mousedown.fu.spinbox', '.spinbox-down', $.proxy( function() {
this.startSpin( false );
}, this ) );
} else {
this.$element.on( 'click.fu.spinbox', '.spinbox-up', $.proxy( function() {
this.step( true );
}, this ) );
this.$element.on( 'click.fu.spinbox', '.spinbox-down', $.proxy( function() {
this.step( false );
}, this ) );
}
this.switches = {
count: 1,
enabled: true
};
if ( this.options.speed === 'medium' ) {
this.switches.speed = 300;
} else if ( this.options.speed === 'fast' ) {
this.switches.speed = 100;
} else {
this.switches.speed = 500;
}
this.options.defaultUnit = _isUnitLegal( this.options.defaultUnit, this.options.units ) ? this.options.defaultUnit : '';
this.unit = this.options.defaultUnit;
this.lastValue = this.options.value;
this.render();
if ( this.options.disabled ) {
this.disable();
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Spinbox
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
_limitToStep = function _limitToStep( number, step ) {
return Math.round( number / step ) * step;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_limitToStep
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
_isUnitLegal = function _isUnitLegal( unit, validUnits ) {
var legalUnit = false;
var suspectUnit = unit.toLowerCase();
$.each( validUnits, function( i, validUnit ) {
validUnit = validUnit.toLowerCase();
if ( suspectUnit === validUnit ) {
legalUnit = true;
return false; //break out of the loop
}
} );
return legalUnit;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_isUnitLegal
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
_applyLimits = function _applyLimits( value ) {
// if unreadable
if ( isNaN( parseFloat( value ) ) ) {
return value;
}
// if not within range return the limit
if ( value > this.options.max ) {
if ( this.options.cycle ) {
value = this.options.min;
} else {
value = this.options.max;
}
} else if ( value < this.options.min ) {
if ( this.options.cycle ) {
value = this.options.max;
} else {
value = this.options.min;
}
}
if ( this.options.limitToStep && this.options.step ) {
value = _limitToStep( value, this.options.step );
//force round direction so that it stays within bounds
if ( value > this.options.max ) {
value = value - this.options.step;
} else if ( value < this.options.min ) {
value = value + this.options.step;
}
}
return value;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
_applyLimits
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Tree = function Tree( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.tree.defaults, options );
this.$element.attr( 'tabindex', '0' );
if ( this.options.itemSelect ) {
this.$element.on( 'click.fu.tree', '.tree-item', $.proxy( function callSelect( ev ) {
this.selectItem( ev.currentTarget );
}, this ) );
}
this.$element.on( 'click.fu.tree', '.tree-branch-name', $.proxy( function callToggle( ev ) {
this.toggleFolder( ev.currentTarget );
}, this ) );
this.$element.on( 'click.fu.tree', '.tree-overflow', $.proxy( function callPopulate( ev ) {
this.populate( $( ev.currentTarget ) );
}, this ) );
// folderSelect default is true
if ( this.options.folderSelect ) {
this.$element.addClass( 'tree-folder-select' );
this.$element.off( 'click.fu.tree', '.tree-branch-name' );
this.$element.on( 'click.fu.tree', '.icon-caret', $.proxy( function callToggle( ev ) {
this.toggleFolder( $( ev.currentTarget ).parent() );
}, this ) );
this.$element.on( 'click.fu.tree', '.tree-branch-name', $.proxy( function callSelect( ev ) {
this.selectFolder( $( ev.currentTarget ) );
}, this ) );
}
this.$element.on( 'focus', function setFocusOnTab() {
var $tree = $( this );
focusIn( $tree, $tree );
} );
this.$element.on( 'keydown', function processKeypress( e ) {
return navigateTree( $( this ), e );
} );
this.render();
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Tree
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
disclosedCompleted = function disclosedCompleted() {
$tree.trigger( 'disclosedFolder.fu.tree', $branch.data() );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
disclosedCompleted
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
closedReported = function closedReported( event, closed ) {
reportedClosed.push( closed );
// jQuery deprecated hide in 3.0. Use hidden instead. Leaving hide here to support previous markup
if ( self.$element.find( ".tree-branch.tree-open:not('.hidden, .hide')" ).length === 0 ) {
self.$element.trigger( 'closedAll.fu.tree', {
tree: self.$element,
reportedClosed: reportedClosed
} );
self.$element.off( 'loaded.fu.tree', self.$element, closedReported );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
closedReported
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
openReported = function openReported( event, opened ) {
reportedOpened.push( opened );
if ( reportedOpened.length === $openableFolders.length ) {
self.$element.trigger( 'disclosedVisible.fu.tree', {
tree: self.$element,
reportedOpened: reportedOpened
} );
/*
* Unbind the `openReported` event. `discloseAll` may be running and we want to reset this
* method for the next iteration.
*/
self.$element.off( 'loaded.fu.tree', self.$element, openReported );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
openReported
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
fixFocusability = function fixFocusability( $tree, $branch ) {
/*
When tree initializes on page, the `<ul>` element should have tabindex=0 and all sub-elements should have
tabindex=-1. When focus leaves the tree, whatever the last focused on element was will keep the tabindex=0. The
tree itself will have a tabindex=-1. The reason for this is that if you are inside of the tree and press
shift+tab, it will try and focus on the tree you are already in, which will cause focus to shift immediately
back to the element you are already focused on. That will make it seem like the event is getting "Swallowed up"
by an aggressive event listener trap.
For this reason, only one element in the entire tree, including the tree itself, should ever have tabindex=0.
If somewhere down the line problems are being caused by this, the only further potential improvement I can
envision at this time is listening for the tree to lose focus and reseting the tabindexes of all children to -1
and setting the tabindex of the tree itself back to 0. This seems overly complicated with no benefit that I can
imagine at this time, so instead I am leaving the last focused element with the tabindex of 0, even upon blur of
the tree.
One benefit to leaving the last focused element in a tree with a tabindex=0 is that if you accidentally tab out
of the tree and then want to tab back in, you will be placed exactly where you left off instead of at the
beginning of the tree.
*/
$tree.attr( 'tabindex', -1 );
$tree.find( 'li' ).attr( 'tabindex', -1 );
if ( $branch && $branch.length > 0 ) {
$branch.attr( 'tabindex', 0 ); // if tabindex is not set to 0 (or greater), node is not able to receive focus
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
fixFocusability
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
focusIn = function focusIn( $tree, $branch ) {
var $focusCandidate = $branch.find( '.tree-selected:first' );
// if no node is selected, set focus to first visible node
if ( $focusCandidate.length <= 0 ) {
$focusCandidate = $branch.find( 'li:not(".hidden"):first' );
}
setFocus( $tree, $focusCandidate );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
focusIn
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
setFocus = function setFocus( $tree, $branch ) {
fixFocusability( $tree, $branch );
$tree.attr( 'aria-activedescendant', $branch.attr( 'id' ) );
$branch.focus();
$tree.trigger( 'setFocus.fu.tree', $branch );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
setFocus
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
navigateTree = function navigateTree( $tree, e ) {
if ( e.isDefaultPrevented() || e.isPropagationStopped() ) {
return false;
}
var targetNode = e.originalEvent.target;
var $targetNode = $( targetNode );
var isOpen = $targetNode.hasClass( 'tree-open' );
var handled = false;
// because es5 lacks promises and fuelux has no polyfil (and I'm not adding one just for this change)
// I am faking up promises here through callbacks and listeners. Done will be fired immediately at the end of
// the navigateTree method if there is no (fake) promise, but will be fired by an event listener that will
// be triggered by another function if necessary. This way when done runs, and fires keyboardNavigated.fu.tree
// anything listening for that event can be sure that everything tied to that event is actually completed.
var fireDoneImmediately = true;
var done = function done() {
$tree.trigger( 'keyboardNavigated.fu.tree', e, $targetNode );
};
switch ( e.which ) {
case 13: // enter
case 32: // space
// activates a node, i.e., performs its default action.
// For parent nodes, one possible default action is to open or close the node.
// In single-select trees where selection does not follow focus, the default action is typically to select the focused node.
var foldersSelectable = $tree.hasClass( 'tree-folder-select' );
var isFolder = $targetNode.hasClass( 'tree-branch' );
var isItem = $targetNode.hasClass( 'tree-item' );
// var isOverflow = $targetNode.hasClass('tree-overflow');
fireDoneImmediately = false;
if ( isFolder ) {
if ( foldersSelectable ) {
$tree.one( 'selected.fu.tree deselected.fu.tree', done );
$tree.tree( 'selectFolder', $targetNode.find( '.tree-branch-header' )[ 0 ] );
} else {
$tree.one( 'loaded.fu.tree closed.fu.tree', done );
$tree.tree( 'toggleFolder', $targetNode.find( '.tree-branch-header' )[ 0 ] );
}
} else if ( isItem ) {
$tree.one( 'selected.fu.tree', done );
$tree.tree( 'selectItem', $targetNode );
} else {
// should be isOverflow... Try and click on it either way.
$prev = $( $targetNode.prevAll().not( '.hidden' )[ 0 ] );
$targetNode.click();
$tree.one( 'loaded.fu.tree', function selectFirstNewlyLoadedNode() {
$next = $( $prev.nextAll().not( '.hidden' )[ 0 ] );
setFocus( $tree, $next );
done();
} );
}
handled = true;
break;
case 35: // end
// Set focus to the last node in the tree that is focusable without opening a node.
setFocus( $tree, $tree.find( 'li:not(".hidden"):last' ) );
handled = true;
break;
case 36: // home
// set focus to the first node in the tree without opening or closing a node.
setFocus( $tree, $tree.find( 'li:not(".hidden"):first' ) );
handled = true;
break;
case 37: // left
if ( isOpen ) {
fireDoneImmediately = false;
$tree.one( 'closed.fu.tree', done );
$tree.tree( 'closeFolder', targetNode );
} else {
setFocus( $tree, $( $targetNode.parents( 'li' )[ 0 ] ) );
}
handled = true;
break;
case 38: // up
// move focus to previous sibling
var $prev = [];
// move to previous li not hidden
$prev = $( $targetNode.prevAll().not( '.hidden' )[ 0 ] );
// if the previous li is open, and has children, move selection to its last child so selection
// appears to move to the next "thing" up
if ( $prev.hasClass( 'tree-open' ) ) {
var $prevChildren = $prev.find( 'li:not(".hidden"):last' );
if ( $prevChildren.length > 0 ) {
$prev = $( $prevChildren[ 0 ] );
}
}
// if nothing has been selected, we are presumably at the top of an open li, select the immediate parent
if ( $prev.length < 1 ) {
$prev = $( $targetNode.parents( 'li' )[ 0 ] );
}
setFocus( $tree, $prev );
handled = true;
break;
case 39: // right
if ( isOpen ) {
focusIn( $tree, $targetNode );
} else {
fireDoneImmediately = false;
$tree.one( 'disclosed.fu.tree', done );
$tree.tree( 'discloseFolder', targetNode );
}
handled = true;
break;
case 40: // down
// move focus to next selectable tree node
var $next = $( $targetNode.find( 'li:not(".hidden"):first' )[ 0 ] );
if ( !isOpen || $next.length <= 0 ) {
$next = $( $targetNode.nextAll().not( '.hidden' )[ 0 ] );
}
if ( $next.length < 1 ) {
$next = $( $( $targetNode.parents( 'li' )[ 0 ] ).nextAll().not( '.hidden' )[ 0 ] );
}
setFocus( $tree, $next );
handled = true;
break;
default:
// console.log(e.which);
return true; // exit this handler for other keys
}
// if we didn't handle the event, allow propagation to continue so something else might.
if ( handled ) {
e.preventDefault();
e.stopPropagation();
if ( fireDoneImmediately ) {
done();
}
}
return true;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
navigateTree
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
done = function done() {
$tree.trigger( 'keyboardNavigated.fu.tree', e, $targetNode );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
done
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
ariaSelect = function ariaSelect( $element ) {
$element.attr( 'aria-selected', true );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
ariaSelect
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
ariaDeselect = function ariaDeselect( $element ) {
$element.attr( 'aria-selected', false );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
ariaDeselect
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function styleNodeSelected( $element, $icon ) {
$element.addClass( 'tree-selected' );
if ( $element.data( 'type' ) === 'item' && $icon.hasClass( 'fueluxicon-bullet' ) ) {
$icon.removeClass( 'fueluxicon-bullet' ).addClass( 'glyphicon-ok' ); // make checkmark
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
styleNodeSelected
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function styleNodeDeselected( $element, $icon ) {
$element.removeClass( 'tree-selected' );
if ( $element.data( 'type' ) === 'item' && $icon.hasClass( 'glyphicon-ok' ) ) {
$icon.removeClass( 'glyphicon-ok' ).addClass( 'fueluxicon-bullet' ); // make bullet
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
styleNodeDeselected
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function multiSelectSyncNodes( self, clicked, selected ) {
// search for currently selected and add to selected data list if needed
$.each( selected.$elements, function findCurrentlySelected( index, element ) {
var $element = $( element );
if ( $element[ 0 ] !== clicked.$element[ 0 ] ) {
selected.dataForEvent.push( $( $element ).data() );
}
} );
if ( clicked.$element.hasClass( 'tree-selected' ) ) {
styleNodeDeselected( clicked.$element, clicked.$icon );
// set event data
selected.eventType = 'deselected';
} else {
styleNodeSelected( clicked.$element, clicked.$icon );
// set event data
selected.eventType = 'selected';
selected.dataForEvent.push( clicked.elementData );
}
return selected;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
multiSelectSyncNodes
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function singleSelectSyncNodes( self, clicked, selected ) {
// element is not currently selected
if ( selected.$elements[ 0 ] !== clicked.$element[ 0 ] ) {
self.deselectAll( self.$element );
styleNodeSelected( clicked.$element, clicked.$icon );
// set event data
selected.eventType = 'selected';
selected.dataForEvent = [ clicked.elementData ];
} else {
styleNodeDeselected( clicked.$element, clicked.$icon );
// set event data
selected.eventType = 'deselected';
selected.dataForEvent = [];
}
return selected;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
singleSelectSyncNodes
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
findChildData = function findChildData( targetParent, rootData ) {
var isRootOfTree = $.isEmptyObject( targetParent );
if ( isRootOfTree ) {
return rootData;
}
if ( rootData === undefined ) {
return false;
}
for ( var i = 0; i < rootData.length; i++ ) {
var potentialMatch = rootData[ i ];
if ( potentialMatch.attr && targetParent.attr && potentialMatch.attr.id === targetParent.attr.id ) {
return potentialMatch.children;
} else if ( potentialMatch.children ) {
var foundChild = findChildData( targetParent, potentialMatch.children );
if ( foundChild ) {
return foundChild;
}
}
}
return false;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
findChildData
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
isShiftHeld = function isShiftHeld( e ) {
return e.shiftKey === true;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
isShiftHeld
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
isKey = function isKey( keyCode ) {
return function compareKeycodes( e ) {
return e.keyCode === keyCode;
};
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
isKey
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
cleanInput = function cleanInput( questionableMarkup ) {
// check for encoding and decode
while ( ENCODED_REGEX.test( questionableMarkup ) ) {
questionableMarkup = $( '<i>' ).html( questionableMarkup ).text();
}
// string completely decoded now encode it
return $( '<i>' ).text( questionableMarkup ).html();
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
cleanInput
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Wizard = function( element, options ) {
this.$element = $( element );
this.options = $.extend( {}, $.fn.wizard.defaults, options );
this.options.disablePreviousStep = ( this.$element.attr( 'data-restrict' ) === 'previous' ) ? true : this.options.disablePreviousStep;
this.currentStep = this.options.selectedItem.step;
this.numSteps = this.$element.find( '.steps li' ).length;
this.$prevBtn = this.$element.find( 'button.btn-prev' );
this.$nextBtn = this.$element.find( 'button.btn-next' );
var kids = this.$nextBtn.children().detach();
this.nextText = $.trim( this.$nextBtn.text() );
this.$nextBtn.append( kids );
var steps = this.$element.children( '.steps-container' );
// maintains backwards compatibility with < 3.8, will be removed in the future
if ( steps.length === 0 ) {
steps = this.$element;
this.$element.addClass( 'no-steps-container' );
if ( window && window.console && window.console.warn ) {
window.console.warn( 'please update your wizard markup to include ".steps-container" as seen in http://getfuelux.com/javascript.html#wizard-usage-markup' );
}
}
steps = steps.find( '.steps' );
// handle events
this.$prevBtn.on( 'click.fu.wizard', $.proxy( this.previous, this ) );
this.$nextBtn.on( 'click.fu.wizard', $.proxy( this.next, this ) );
steps.on( 'click.fu.wizard', 'li.complete', $.proxy( this.stepclicked, this ) );
this.selectedItem( this.options.selectedItem );
if ( this.options.disablePreviousStep ) {
this.$prevBtn.attr( 'disabled', true );
this.$element.find( '.steps' ).addClass( 'previous-disabled' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Wizard
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
InfiniteScroll = function( element, options ) {
this.$element = $( element );
this.$element.addClass( 'infinitescroll' );
this.options = $.extend( {}, $.fn.infinitescroll.defaults, options );
this.curScrollTop = this.$element.scrollTop();
this.curPercentage = this.getPercentage();
this.fetchingData = false;
this.$element.on( 'scroll.fu.infinitescroll', $.proxy( this.onScroll, this ) );
this.onScroll();
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
InfiniteScroll
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
fetch = function() {
var helpers = {
percentage: self.curPercentage,
scrollTop: self.curScrollTop
};
var $loader = $( '<div class="loader"></div>' );
load.append( $loader );
$loader.loader();
if ( self.options.dataSource ) {
self.options.dataSource( helpers, function( resp ) {
var end;
load.remove();
if ( resp.content ) {
self.$element.append( resp.content );
}
if ( resp.end ) {
end = ( resp.end !== true ) ? resp.end : undefined;
self.end( end );
}
self.fetchingData = false;
} );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
fetch
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Pillbox = function Pillbox( element, options ) {
this.$element = $( element );
this.$moreCount = this.$element.find( '.pillbox-more-count' );
this.$pillGroup = this.$element.find( '.pill-group' );
this.$addItem = this.$element.find( '.pillbox-add-item' );
this.$addItemWrap = this.$addItem.parent();
this.$suggest = this.$element.find( '.suggest' );
this.$pillHTML = '<li class="btn btn-default pill">' +
' <span></span>' +
' <span class="glyphicon glyphicon-close">' +
' <span class="sr-only">Remove</span>' +
' </span>' +
'</li>';
this.options = $.extend( {}, $.fn.pillbox.defaults, options );
if ( this.options.readonly === -1 ) {
if ( this.$element.attr( 'data-readonly' ) !== undefined ) {
this.readonly( true );
}
} else if ( this.options.readonly ) {
this.readonly( true );
}
// EVENTS
this.acceptKeyCodes = this._generateObject( this.options.acceptKeyCodes );
// Create an object out of the key code array, so we don't have to loop through it on every key stroke
this.$element.on( 'click.fu.pillbox', '.pill-group > .pill', $.proxy( this.itemClicked, this ) );
this.$element.on( 'click.fu.pillbox', $.proxy( this.inputFocus, this ) );
this.$element.on( 'keydown.fu.pillbox', '.pillbox-add-item', $.proxy( this.inputEvent, this ) );
if ( this.options.onKeyDown ) {
this.$element.on( 'mousedown.fu.pillbox', '.suggest > li', $.proxy( this.suggestionClick, this ) );
}
if ( this.options.edit ) {
this.$element.addClass( 'pills-editable' );
this.$element.on( 'blur.fu.pillbox', '.pillbox-add-item', $.proxy( this.cancelEdit, this ) );
}
this.$element.on( 'blur.fu.pillbox', '.pillbox-add-item', $.proxy( this.inputEvent, this ) );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Pillbox
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Repeater = function Repeater( element, options ) {
var self = this;
var $btn;
var currentView;
this.$element = $( element );
this.$canvas = this.$element.find( '.repeater-canvas' );
this.$count = this.$element.find( '.repeater-count' );
this.$end = this.$element.find( '.repeater-end' );
this.$filters = this.$element.find( '.repeater-filters' );
this.$loader = this.$element.find( '.repeater-loader' );
this.$pageSize = this.$element.find( '.repeater-itemization .selectlist' );
this.$nextBtn = this.$element.find( '.repeater-next' );
this.$pages = this.$element.find( '.repeater-pages' );
this.$prevBtn = this.$element.find( '.repeater-prev' );
this.$primaryPaging = this.$element.find( '.repeater-primaryPaging' );
this.$search = this.$element.find( '.repeater-search' ).find( '.search' );
this.$secondaryPaging = this.$element.find( '.repeater-secondaryPaging' );
this.$start = this.$element.find( '.repeater-start' );
this.$viewport = this.$element.find( '.repeater-viewport' );
this.$views = this.$element.find( '.repeater-views' );
this.currentPage = 0;
this.currentView = null;
this.isDisabled = false;
this.infiniteScrollingCallback = function noop() {};
this.infiniteScrollingCont = null;
this.infiniteScrollingEnabled = false;
this.infiniteScrollingEnd = null;
this.infiniteScrollingOptions = {};
this.lastPageInput = 0;
this.options = $.extend( {}, $.fn.repeater.defaults, options );
this.pageIncrement = 0; // store direction navigated
this.resizeTimeout = {};
this.stamp = new Date().getTime() + ( Math.floor( Math.random() * 100 ) + 1 );
this.storedDataSourceOpts = null;
this.syncingViewButtonState = false;
this.viewOptions = {};
this.viewType = null;
this.$filters.selectlist();
this.$pageSize.selectlist();
this.$primaryPaging.find( '.combobox' ).combobox();
this.$search.search( {
searchOnKeyPress: this.options.searchOnKeyPress,
allowCancel: this.options.allowCancel
} );
this.$filters.on( 'changed.fu.selectlist', function onFiltersChanged( e, value ) {
self.$element.trigger( 'filtered.fu.repeater', value );
self.render( {
clearInfinite: true,
pageIncrement: null
} );
} );
this.$nextBtn.on( 'click.fu.repeater', $.proxy( this.next, this ) );
this.$pageSize.on( 'changed.fu.selectlist', function onPageSizeChanged( e, value ) {
self.$element.trigger( 'pageSizeChanged.fu.repeater', value );
self.render( {
pageIncrement: null
} );
} );
this.$prevBtn.on( 'click.fu.repeater', $.proxy( this.previous, this ) );
this.$primaryPaging.find( '.combobox' ).on( 'changed.fu.combobox', function onPrimaryPagingChanged( evt, data ) {
self.pageInputChange( data.text, data );
} );
this.$search.on( 'searched.fu.search cleared.fu.search', function onSearched( e, value ) {
self.$element.trigger( 'searchChanged.fu.repeater', value );
self.render( {
clearInfinite: true,
pageIncrement: null
} );
} );
this.$search.on( 'canceled.fu.search', function onSearchCanceled( e, value ) {
self.$element.trigger( 'canceled.fu.repeater', value );
self.render( {
clearInfinite: true,
pageIncrement: null
} );
} );
this.$secondaryPaging.on( 'blur.fu.repeater', function onSecondaryPagingBlur() {
self.pageInputChange( self.$secondaryPaging.val() );
} );
this.$secondaryPaging.on( 'keyup', function onSecondaryPagingKeyup( e ) {
if ( e.keyCode === 13 ) {
self.pageInputChange( self.$secondaryPaging.val() );
}
} );
this.$views.find( 'input' ).on( 'change.fu.repeater', $.proxy( this.viewChanged, this ) );
$( window ).on( 'resize.fu.repeater.' + this.stamp, function onResizeRepeater() {
clearTimeout( self.resizeTimeout );
self.resizeTimeout = setTimeout( function resizeTimeout() {
self.resize();
self.$element.trigger( 'resized.fu.repeater' );
}, 75 );
} );
this.$loader.loader();
this.$loader.loader( 'pause' );
if ( this.options.defaultView !== -1 ) {
currentView = this.options.defaultView;
} else {
$btn = this.$views.find( 'label.active input' );
currentView = ( $btn.length > 0 ) ? $btn.val() : 'list';
}
this.setViewOptions( currentView );
this.initViewTypes( function initViewTypes() {
self.resize();
self.$element.trigger( 'resized.fu.repeater' );
self.render( {
changeView: currentView
} );
} );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
Repeater
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
logWarn = function logWarn( msg ) {
if ( window.console && window.console.warn ) {
window.console.warn( msg );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
logWarn
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
scan = function scan( cont ) {
var keep = [];
cont.children().each( function eachContainerChild() {
var item = $( this );
var pres = item.attr( 'data-preserve' );
if ( pres === 'deep' ) {
item.detach();
keep.push( item );
} else if ( pres === 'shallow' ) {
scan( item );
item.detach();
keep.push( item );
}
} );
cont.empty();
cont.append( keep );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
scan
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
addItem = function addItem( $parent, response ) {
var action;
if ( response ) {
action = ( response.action ) ? response.action : 'append';
if ( action !== 'none' && response.item !== undefined ) {
var $container = ( response.container !== undefined ) ? $( response.container ) : $parent;
$container[ action ]( response.item );
}
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
addItem
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
callNextInit = function callNextInit( currentViewType, viewTypes, callback ) {
var nextViewType = currentViewType + 1;
if ( nextViewType < viewTypes.length ) {
initViewType.call( this, nextViewType, viewTypes, callback );
} else {
callback();
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
callNextInit
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
initViewType = function initViewType( currentViewtype, viewTypes, callback ) {
if ( viewTypes[ currentViewtype ].initialize ) {
viewTypes[ currentViewtype ].initialize.call( this, {}, function afterInitialize() {
callNextInit.call( this, currentViewtype, viewTypes, callback );
} );
} else {
callNextInit.call( this, currentViewtype, viewTypes, callback );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
initViewType
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
afterRender = function afterRender( state ) {
var data = state.data || {};
if ( this.infiniteScrollingEnabled ) {
if ( state.viewChanged || state.options.clearInfinite ) {
this.initInfiniteScrolling();
}
this.infiniteScrollPaging( data, state.options );
}
this.$loader.hide().loader( 'pause' );
this.enable();
this.$search.trigger( 'rendered.fu.repeater', {
data: data,
options: state.dataOptions,
renderOptions: state.options
} );
this.$element.trigger( 'rendered.fu.repeater', {
data: data,
options: state.dataOptions,
renderOptions: state.options
} );
// for maintaining support of 'loaded' event
this.$element.trigger( 'loaded.fu.repeater', state.dataOptions );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
afterRender
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
doRender = function doRender( state ) {
var data = state.data || {};
if ( this.infiniteScrollingEnabled ) {
// pass empty object because data handled in infiniteScrollPaging method
this.infiniteScrollingCallback( {} );
} else {
this.itemization( data );
this.pagination( data );
}
var self = this;
this.renderItems(
state.viewTypeObj,
data,
function callAfterRender( d ) {
state.data = d;
afterRender.call( self, state );
}
);
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
doRender
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
checkIfItemMatchesValue = function checkIfItemMatchesValue( rowIndex ) {
$item = $( this );
data = $item.data( 'item_data' ) || {};
if ( data[ items[ i ].property ] === items[ i ].value ) {
selectItem( $item, items[ i ].selected, rowIndex );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
checkIfItemMatchesValue
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
selectItem = function selectItem( $itm, slct, index ) {
var $frozenCols;
var select = ( slct !== undefined ) ? slct : true;
if ( select ) {
if ( !force && selectable !== 'multi' ) {
self.list_clearSelectedItems();
}
if ( !$itm.hasClass( 'selected' ) ) {
$itm.addClass( 'selected' );
if ( self.viewOptions.list_frozenColumns || self.viewOptions.list_selectable === 'multi' ) {
$frozenCols = self.$element.find( '.frozen-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' );
$frozenCols.addClass( 'selected' );
$frozenCols.find( '.repeater-select-checkbox' ).addClass( 'checked' );
}
if ( self.viewOptions.list_actions ) {
self.$element.find( '.actions-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' ).addClass( 'selected' );
}
$itm.find( 'td:first' ).prepend( '<div class="repeater-list-check"><span class="glyphicon glyphicon-ok"></span></div>' );
}
} else {
if ( self.viewOptions.list_frozenColumns ) {
$frozenCols = self.$element.find( '.frozen-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' );
$frozenCols.addClass( 'selected' );
$frozenCols.find( '.repeater-select-checkbox' ).removeClass( 'checked' );
}
if ( self.viewOptions.list_actions ) {
self.$element.find( '.actions-column-wrapper tr:nth-child(' + ( index + 1 ) + ')' ).removeClass( 'selected' );
}
$itm.find( '.repeater-list-check' ).remove();
$itm.removeClass( 'selected' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
selectItem
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function revertCheckbox( $checkbox ) {
self.list_revertingCheckbox = true;
$checkbox.checkbox( 'toggle' );
delete self.list_revertingCheckbox;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
revertCheckbox
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
areDifferentColumns = function areDifferentColumns( oldCols, newCols ) {
if ( !newCols ) {
return false;
}
if ( !oldCols || ( newCols.length !== oldCols.length ) ) {
return true;
}
for ( var i = 0, newColsL = newCols.length; i < newColsL; i++ ) {
if ( !oldCols[ i ] ) {
return true;
}
for ( var j in newCols[ i ] ) {
if ( newCols[ i ].hasOwnProperty( j ) && oldCols[ i ][ j ] !== newCols[ i ][ j ] ) {
return true;
}
}
}
return false;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
areDifferentColumns
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
renderColumn = function renderColumn( $row, rows, rowIndex, columns, columnIndex ) {
var className = columns[ columnIndex ].className;
var content = rows[ rowIndex ][ columns[ columnIndex ].property ];
var $col = $( '<td></td>' );
var width = columns[ columnIndex ]._auto_width;
var property = columns[ columnIndex ].property;
if ( this.viewOptions.list_actions !== false && property === '@_ACTIONS_@' ) {
content = '<div class="repeater-list-actions-placeholder" style="width: ' + this.list_actions_width + 'px"></div>';
}
content = ( content !== undefined ) ? content : '';
$col.addClass( ( ( className !== undefined ) ? className : '' ) ).append( content );
if ( width !== undefined ) {
$col.outerWidth( width );
}
$row.append( $col );
if ( this.viewOptions.list_selectable === 'multi' && columns[ columnIndex ].property === '@_CHECKBOX_@' ) {
var checkBoxMarkup = '<label data-row="' + rowIndex + '" class="checkbox-custom checkbox-inline body-checkbox repeater-select-checkbox">' +
'<input class="sr-only" type="checkbox"></label>';
$col.html( checkBoxMarkup );
}
return $col;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderColumn
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
renderHeader = function renderHeader( $tr, columns, index ) {
var chevDown = 'glyphicon-chevron-down';
var chevron = '.glyphicon.rlc:first';
var chevUp = 'glyphicon-chevron-up';
var $div = $( '<div class="repeater-list-heading"><span class="glyphicon rlc"></span></div>' );
var checkAllID = ( this.$element.attr( 'id' ) + '_' || '' ) + 'checkall';
var checkBoxMarkup = '<div class="repeater-list-heading header-checkbox">' +
'<label id="' + checkAllID + '" class="checkbox-custom checkbox-inline">' +
'<input class="sr-only" type="checkbox" value="">' +
'<span class="checkbox-label"> </span>' +
'</label>' +
'</div>';
var $header = $( '<th></th>' );
var self = this;
var $both;
var className;
var sortable;
var $span;
var $spans;
$div.data( 'fu_item_index', index );
$div.prepend( columns[ index ].label );
$header.html( $div.html() ).find( '[id]' ).removeAttr( 'id' );
if ( columns[ index ].property !== '@_CHECKBOX_@' ) {
$header.append( $div );
} else {
$header.append( checkBoxMarkup );
}
$both = $header.add( $div );
$span = $div.find( chevron );
$spans = $span.add( $header.find( chevron ) );
if ( this.viewOptions.list_actions && columns[ index ].property === '@_ACTIONS_@' ) {
var width = this.list_actions_width;
$header.css( 'width', width );
$div.css( 'width', width );
}
className = columns[ index ].className;
if ( className !== undefined ) {
$both.addClass( className );
}
sortable = columns[ index ].sortable;
if ( sortable ) {
$both.addClass( 'sortable' );
$div.on( 'click.fu.repeaterList', function onClickRepeaterList() {
if ( !self.isDisabled ) {
self.list_sortProperty = ( typeof sortable === 'string' ) ? sortable : columns[ index ].property;
if ( $div.hasClass( 'sorted' ) ) {
if ( $span.hasClass( chevUp ) ) {
$spans.removeClass( chevUp ).addClass( chevDown );
self.list_sortDirection = 'desc';
} else if ( !self.viewOptions.list_sortClearing ) {
$spans.removeClass( chevDown ).addClass( chevUp );
self.list_sortDirection = 'asc';
} else {
$both.removeClass( 'sorted' );
$spans.removeClass( chevDown );
self.list_sortDirection = null;
self.list_sortProperty = null;
}
} else {
$tr.find( 'th, .repeater-list-heading' ).removeClass( 'sorted' );
$spans.removeClass( chevDown ).addClass( chevUp );
self.list_sortDirection = 'asc';
$both.addClass( 'sorted' );
}
self.render( {
clearInfinite: true,
pageIncrement: null
} );
}
} );
}
if ( columns[ index ].sortDirection === 'asc' || columns[ index ].sortDirection === 'desc' ) {
$tr.find( 'th, .repeater-list-heading' ).removeClass( 'sorted' );
$both.addClass( 'sortable sorted' );
if ( columns[ index ].sortDirection === 'asc' ) {
$spans.addClass( chevUp );
this.list_sortDirection = 'asc';
} else {
$spans.addClass( chevDown );
this.list_sortDirection = 'desc';
}
this.list_sortProperty = ( typeof sortable === 'string' ) ? sortable : columns[ index ].property;
}
$tr.append( $header );
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderHeader
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
onClickRowRepeaterList = function onClickRowRepeaterList( repeater ) {
var isMulti = repeater.viewOptions.list_selectable === 'multi';
var isActions = repeater.viewOptions.list_actions;
var $repeater = repeater.$element;
if ( !repeater.isDisabled ) {
var $item = $( this );
var index = $( this ).index() + 1;
var $frozenRow = $repeater.find( '.frozen-column-wrapper tr:nth-child(' + index + ')' );
var $actionsRow = $repeater.find( '.actions-column-wrapper tr:nth-child(' + index + ')' );
var $checkBox = $repeater.find( '.frozen-column-wrapper tr:nth-child(' + index + ') .checkbox-inline' );
if ( $item.is( '.selected' ) ) {
$item.removeClass( 'selected' );
if ( isMulti ) {
$checkBox.click();
$frozenRow.removeClass( 'selected' );
if ( isActions ) {
$actionsRow.removeClass( 'selected' );
}
} else {
$item.find( '.repeater-list-check' ).remove();
}
$repeater.trigger( 'deselected.fu.repeaterList', $item );
} else {
if ( !isMulti ) {
repeater.$canvas.find( '.repeater-list-check' ).remove();
repeater.$canvas.find( '.repeater-list tbody tr.selected' ).each( function deslectRow() {
$( this ).removeClass( 'selected' );
$repeater.trigger( 'deselected.fu.repeaterList', $( this ) );
} );
$item.find( 'td:first' ).prepend( '<div class="repeater-list-check"><span class="glyphicon glyphicon-ok"></span></div>' );
$item.addClass( 'selected' );
$frozenRow.addClass( 'selected' );
} else {
$checkBox.click();
$item.addClass( 'selected' );
$frozenRow.addClass( 'selected' );
if ( isActions ) {
$actionsRow.addClass( 'selected' );
}
}
$repeater.trigger( 'selected.fu.repeaterList', $item );
}
toggleActionsHeaderButton.call( repeater );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
onClickRowRepeaterList
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
renderRow = function renderRow( $tbody, rows, index ) {
var $row = $( '<tr></tr>' );
if ( this.viewOptions.list_selectable ) {
$row.data( 'item_data', rows[ index ] );
if ( this.viewOptions.list_selectable !== 'action' ) {
$row.addClass( 'selectable' );
$row.attr( 'tabindex', 0 ); // allow items to be tabbed to / focused on
var repeater = this;
$row.on( 'click.fu.repeaterList', function callOnClickRowRepeaterList() {
onClickRowRepeaterList.call( this, repeater );
} );
// allow selection via enter key
$row.keyup( function onRowKeyup( e ) {
if ( e.keyCode === 13 ) {
// triggering a standard click event to be caught by the row click handler above
$row.trigger( 'click.fu.repeaterList' );
}
} );
}
}
if ( this.viewOptions.list_actions && !this.viewOptions.list_selectable ) {
$row.data( 'item_data', rows[ index ] );
}
var columns = [];
for ( var i = 0, length = this.list_columns.length; i < length; i++ ) {
columns.push( renderColumn.call( this, $row, rows, index, this.list_columns, i ) );
}
$tbody.append( $row );
if ( this.viewOptions.list_columnRendered ) {
for ( var columnIndex = 0, colLength = columns.length; columnIndex < colLength; columnIndex++ ) {
if ( !( this.list_columns[ columnIndex ].property === '@_CHECKBOX_@' || this.list_columns[ columnIndex ].property === '@_ACTIONS_@' ) ) {
this.viewOptions.list_columnRendered( {
container: $row,
columnAttr: this.list_columns[ columnIndex ].property,
item: columns[ columnIndex ],
rowData: rows[ index ]
}, function noop() {} );
}
}
}
if ( this.viewOptions.list_rowRendered ) {
this.viewOptions.list_rowRendered( {
container: $tbody,
item: $row,
rowData: rows[ index ]
}, function noop() {} );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderRow
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
renderTbody = function renderTbody( $table, data ) {
var $tbody = $table.find( 'tbody' );
var $empty;
if ( $tbody.length < 1 ) {
$tbody = $( '<tbody data-container="true"></tbody>' );
$table.append( $tbody );
}
if ( typeof data.error === 'string' && data.error.length > 0 ) {
$empty = $( '<tr class="empty text-danger"><td colspan="' + this.list_columns.length + '"></td></tr>' );
$empty.find( 'td' ).append( data.error );
$tbody.append( $empty );
} else if ( data.items && data.items.length < 1 ) {
$empty = $( '<tr class="empty"><td colspan="' + this.list_columns.length + '"></td></tr>' );
$empty.find( 'td' ).append( this.viewOptions.list_noItemsHTML );
$tbody.append( $empty );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderTbody
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
renderThead = function renderThead( $table, data ) {
var columns = data.columns || [];
var $thead = $table.find( 'thead' );
var i;
var length;
var $tr;
if ( this.list_firstRender || areDifferentColumns( this.list_columns, columns ) || $thead.length === 0 ) {
$thead.remove();
// list_noItems is set in `before` method
if ( this.viewOptions.list_selectable === 'multi' && !this.list_noItems ) {
var checkboxColumn = {
label: 'c',
property: '@_CHECKBOX_@',
sortable: false
};
columns.splice( 0, 0, checkboxColumn );
}
this.list_columns = columns;
this.list_firstRender = false;
this.$loader.removeClass( 'noHeader' );
// keep action column header even when empty, you'll need it later....
if ( this.viewOptions.list_actions ) {
var actionsColumn = {
label: this.viewOptions.list_actions.label || '<span class="actions-hidden">a</span>',
property: '@_ACTIONS_@',
sortable: false,
width: this.list_actions_width
};
columns.push( actionsColumn );
}
$thead = $( '<thead data-preserve="deep"><tr></tr></thead>' );
$tr = $thead.find( 'tr' );
for ( i = 0, length = columns.length; i < length; i++ ) {
renderHeader.call( this, $tr, columns, i );
}
$table.prepend( $thead );
if ( this.viewOptions.list_selectable === 'multi' && !this.list_noItems ) {
// after checkbox column is created need to get width of checkbox column from
// its css class
var checkboxWidth = this.$element.find( '.repeater-list-wrapper .header-checkbox' ).outerWidth();
var selectColumn = $.grep( columns, function grepColumn( column ) {
return column.property === '@_CHECKBOX_@';
} )[ 0 ];
selectColumn.width = checkboxWidth;
}
sizeColumns.call( this, $tr );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
renderThead
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
sizeColumns = function sizeColumns( $tr ) {
var automaticallyGeneratedWidths = [];
var self = this;
var i;
var length;
var newWidth;
var widthTaken;
if ( this.viewOptions.list_columnSizing ) {
i = 0;
widthTaken = 0;
$tr.find( 'th' ).each( function eachTH() {
var $th = $( this );
var width;
if ( self.list_columns[ i ].width !== undefined ) {
width = self.list_columns[ i ].width;
$th.outerWidth( width );
widthTaken += $th.outerWidth();
self.list_columns[ i ]._auto_width = width;
} else {
var outerWidth = $th.find( '.repeater-list-heading' ).outerWidth();
automaticallyGeneratedWidths.push( {
col: $th,
index: i,
minWidth: outerWidth
} );
}
i++;
} );
length = automaticallyGeneratedWidths.length;
if ( length > 0 ) {
var canvasWidth = this.$canvas.find( '.repeater-list-wrapper' ).outerWidth();
newWidth = Math.floor( ( canvasWidth - widthTaken ) / length );
for ( i = 0; i < length; i++ ) {
if ( automaticallyGeneratedWidths[ i ].minWidth > newWidth ) {
newWidth = automaticallyGeneratedWidths[ i ].minWidth;
}
automaticallyGeneratedWidths[ i ].col.outerWidth( newWidth );
this.list_columns[ automaticallyGeneratedWidths[ i ].index ]._auto_width = newWidth;
}
}
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
sizeColumns
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
specialBrowserClass = function specialBrowserClass() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf( 'MSIE ' );
var firefox = ua.indexOf( 'Firefox' );
if ( msie > 0 ) {
return 'ie-' + parseInt( ua.substring( msie + 5, ua.indexOf( '.', msie ) ), 10 );
} else if ( firefox > 0 ) {
return 'firefox';
}
return '';
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
specialBrowserClass
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
toggleActionsHeaderButton = function toggleActionsHeaderButton() {
var selectedSelector = '.repeater-list-wrapper > table .selected';
var $actionsColumn = this.$element.find( '.table-actions' );
var $selected;
if ( this.viewOptions.list_selectable === 'action' ) {
selectedSelector = '.repeater-list-wrapper > table tr';
}
$selected = this.$canvas.find( selectedSelector );
if ( $selected.length > 0 ) {
$actionsColumn.find( 'thead .btn' ).removeAttr( 'disabled' );
} else {
$actionsColumn.find( 'thead .btn' ).attr( 'disabled', 'disabled' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
toggleActionsHeaderButton
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function compareItemIndex() {
if ( n === items[ i ].index ) {
$item = $( this );
return false;
} else {
n++;
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
compareItemIndex
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function compareItemSelector() {
$item = $( this );
if ( $item.is( items[ i ].selector ) ) {
selectItem( $item, items[ i ].selected );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
compareItemSelector
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function selectItem( $itm, select ) {
select = ( select !== undefined ) ? select : true;
if ( select ) {
if ( !force && selectable !== 'multi' ) {
self.thumbnail_clearSelectedItems();
}
$itm.addClass( 'selected' );
} else {
$itm.removeClass( 'selected' );
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
selectItem
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function fillTemplate( itemData, template ) {
var invalid = false;
function replace() {
var end, start, val;
start = template.indexOf( '{{' );
end = template.indexOf( '}}', start + 2 );
if ( start > -1 && end > -1 ) {
val = $.trim( template.substring( start + 2, end ) );
val = ( itemData[ val ] !== undefined ) ? itemData[ val ] : '';
template = template.substring( 0, start ) + val + template.substring( end + 2 );
} else {
invalid = true;
}
}
while ( !invalid && template.search( '{{' ) >= 0 ) {
replace( template );
}
return template;
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
fillTemplate
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
function replace() {
var end, start, val;
start = template.indexOf( '{{' );
end = template.indexOf( '}}', start + 2 );
if ( start > -1 && end > -1 ) {
val = $.trim( template.substring( start + 2, end ) );
val = ( itemData[ val ] !== undefined ) ? itemData[ val ] : '';
template = template.substring( 0, start ) + val + template.substring( end + 2 );
} else {
invalid = true;
}
}
|
setValue() sets the Placard triggering DOM element's display value
@param {String} the value to be displayed
@param {Boolean} If you want to explicitly suppress the application
of ellipsis, pass `true`. This would typically only be
done from internal functions (like `applyEllipsis`)
that want to avoid circular logic. Otherwise, the
value of the option applyEllipsis will be used.
@return {Object} jQuery object representing the DOM element whose
value was set
|
replace
|
javascript
|
ExactTarget/fuelux
|
reference/dist/js/fuelux.js
|
https://github.com/ExactTarget/fuelux/blob/master/reference/dist/js/fuelux.js
|
BSD-3-Clause
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.