Sha256: e4ee816c3205b3c8115bcf7bd21cdf7b98e9dfbd1a52810d67c7879b3a1d2957

Contents?: true

Size: 1.16 KB

Versions: 22

Compression:

Stored size: 1.16 KB

Contents

// Expose plugin as an AMD module if AMD loader is present:
(function (factory) {
  'use strict';

  if (typeof define === 'function' && define.amd) {
    define(['jquery', 'veil'], factory);
  } else {
    factory(jQuery, Veil);
  }

}(function ($, Veil) {
  'use strict';

  $.Veil = Veil;

  // Create chainable jQuery plugin:
  $.fn.veil = function (optionsOrFnName, args) {
    var dataKey = 'veil';

    // If function invoked without argument return
    // instance of the first matched element
    if (arguments.length === 0 && this.first().data(dataKey)) {
      return this.first().data(dataKey);
    }

    return this.each(function () {
      var inputElement  = $(this),
          instance      = inputElement.data(dataKey);

      if (typeof optionsOrFnName === 'string') {
        if (instance && typeof instance[optionsOrFnName] === 'function') {
          instance[optionsOrFnName](args);
        }

      } else {
        // If instance already exists, destroy it:
        if (instance && instance.dispose) {
          instance.dispose();
        }

        instance = new Veil(optionsOrFnName);
        inputElement.data(dataKey, instance);
      }
    });
  };
}));

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kea-rails-1.0.9 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha14 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha13 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha12 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha11 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha10 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha9 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha8 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha7 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha6 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha5 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha4 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha3 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha2 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-1.0.8 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-2.0.0.pre.alpha1 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-1.0.7 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-1.0.6 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-1.0.5 vendor/assets/components/veiljs/veil-jquery.js
kea-rails-1.0.4 vendor/assets/components/veiljs/veil-jquery.js