How to use the jquery.extend function in jquery

To help you get started, we’ve selected a few jquery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openworm / org.geppetto.frontend / src / main / webapp / js / widgets / form / Form.js View on Github external
setData: function (state, options, dataset) {
                // If no options specify by user, use default options
                if (options != null) {
                    $.extend(this.options, options);
                }
            	form.setValue(state);
            	return this;
            },
github duckduckgo / duckduckgo-privacy-extension / shared / js / ui / base / model.es6.js View on Github external
function BaseModel (attrs) {
  // attributes are applied directly
  // onto the instance:
  $.extend(this, attrs)

  // register model with `store` of
  // global notifications
  // (after checking `modelName` property)
  if (!this.modelName || typeof this.modelName !== 'string') {
    throw new Error('cannot init model without `modelName` property')
  } else {
    this.store = store
    this.store.register(this.modelName)
  }
}
github CenterForOpenScience / osf.io / website / static / js / notificationsTreebeard.js View on Github external
function ProjectNotifications(data) {

    //  Treebeard version
    var tbOptions = $.extend({}, projectSettingsTreebeardBase.defaults, {
        divID: 'grid',
        filesData: data,
        naturalScrollLimit : 0,
        onload : function () {
            var tb = this;
            expandOnLoad.call(tb);
        },
        resolveRows: function notificationResolveRows(item){
            var columns = [];
            var iconcss = '';
            // check if should not get icon
            if(item.children.length < 1 ){
                iconcss = 'tb-no-icon';
            }
            if (item.data.kind === 'heading') {
                if (item.data.children.length === 0) {
github oroinc / platform / src / Oro / Bundle / SegmentBundle / Resources / public / js / app / components / segment-component.js View on Github external
// common extra options for all choice inputs
            this.options.fieldChoiceOptions = {
                select2: {
                    formatSelectionTemplate: $(this.options.select2FieldChoiceTemplate).text()
                }
            };

            // options column's filed choice input
            if (!this.options.columnFieldChoiceOptions) {
                this.options.columnFieldChoiceOptions = {};
            }
            _.defaults(this.options.columnFieldChoiceOptions, this.options.fieldChoiceOptions);

            // options for segment choice
            this.options.segmentChoiceOptions = {};
            $.extend(true, this.options.segmentChoiceOptions, this.options.fieldChoiceOptions, {
                select2: {
                    formatSelectionTemplate: $(this.options.select2SegmentChoiceTemplate).text()
                }
            });
        },
github Shopify / theme-scripts / packages / theme-sections / sections.js View on Github external
extend(extension) {
    const init = extension.init;
    this.extensions.push(extension);

    $.extend(this, omit(extension, "init"));

    if ($.isFunction(init)) {
      init.apply(this);
    }
  }
};
github thecreation / jquery-asPieProgress / dist / jquery-asPieProgress.es.js View on Github external
constructor(element, options) {
    this.element = element;
    this.$element = $(element);

    this.options = $.extend(true, {}, DEFAULTS, options, this.$element.data());
    this.namespace = this.options.namespace;

    this.classes = this.options.classes;
    this.easing = EASING[this.options.easing] || EASING.ease;
    this.$element.addClass(this.classes.element);

    this.min = this.$element.attr('aria-valuemin');
    this.max = this.$element.attr('aria-valuemax');
    this.min = this.min ? parseInt(this.min, 10) : this.options.min;
    this.max = this.max ? parseInt(this.max, 10) : this.options.max;
    this.first = this.$element.attr('aria-valuenow');
    this.first = this.first ? parseInt(this.first, 10) : (this.options.first ? this.options.first : this.min);
    this.now = this.first;
    this.goal = this.options.goal;

    this._frameId = null;
github oroinc / platform / src / Oro / Bundle / DataGridBundle / Resources / public / js / grid-views-builder.js View on Github external
_.each(['columns', 'sorter'], function(attr) {
                    if (_.isEmpty(item[attr])) {
                        $.extend(true, item, _.pick(initialState, attr));
                    }
                });
            });
github 2600hz / monster-ui / apps / voip / submodules / users / users.js View on Github external
template.on('click', '.detail-numbers .list-assigned-items .remove-number', function() {
				var $this = $(this),
					userName = $this.parents('.grid-row').find('.grid-cell.name').text(),
					dataNumbers = $.extend(true, [], extensionsToSave),
					userId = $this.parents('.grid-row').data('id'),
					row = $this.parents('.item-row');

				row.slideUp(function() {
					row.remove();

					if ( !template.find('.list-assigned-items .item-row').is(':visible') ) {
						template.find('.list-assigned-items .empty-row').slideDown();
					}

					template.find('.item-row').each(function(idx, elem) {
						dataNumbers.push($(elem).data('id'));
					});

					self.usersUpdateCallflowNumbers(userId, (currentCallflow || {}).id, dataNumbers, function(callflowData) {
						toastr.success(monster.template(self, '!' + toastrMessages.numbersUpdated, { name: userName }));
github itsjavi / bootstrap-colorpicker / src / js / extensions / Palette.js View on Github external
constructor(colorpicker, options = {}) {
    super(colorpicker, $.extend(true, {}, defaults, options));

    if ((!Array.isArray(this.options.colors)) && (typeof this.options.colors !== 'object')) {
      this.options.colors = null;
    }
  }
github Esri / storymap-crowdsource / src / app / store / reducers / items / app / App.babel.js View on Github external
export const item = function (state = defaultItem, action) {
  switch (action.type) {
    case UPDATE_ITEM_APP_ITEM:
      return $.extend(true,{},state,action.parameters);
    case UPDATE_ITEM_APP_ITEM_TITLE:
      return $.extend(true,{},state,{title: action.title});
    case UPDATE_ITEM_APP_ITEM_SUBTITLE:
      return $.extend(true,{},state,{snippet: action.subtitle});
    case UPDATE_LAYOUT_ID:
      let index = state.typeKeywords.length;

      state.typeKeywords.forEach((current,i) => {
        if (current.match('layout-')) {
          index = i;
        }
      });

      const typeKeywords = [
        ...state.typeKeywords.slice(0, index),
        'layout-' + action.id,
        ...state.typeKeywords.slice(index + 1)
      ];

      return $.extend(true,{},state,{typeKeywords});