How to use the jquery.isFunction 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 phpmyadmin / phpmyadmin / js / src / utils / JqueryExtended.js View on Github external
$.fn.PMA_confirm = function (question, url, callbackFn, openCallback) {
    var confirmState = PMA_commonParams.get('confirm');
    if (! confirmState) {
        // user does not want to confirm
        if ($.isFunction(callbackFn)) {
            callbackFn.call(this, url);
            return true;
        }
    }
    if (PMA_messages.strDoYouReally === '') {
        return true;
    }

    /**
     * @var    button_options  Object that stores the options passed to jQueryUI
     *                          dialog
     */
    var button_options = [
        {
            text: PMA_messages.strOK,
            'class': 'submitOK',
github laraspace / laraspace / public / assets / admin / js / methods.js View on Github external
// The canvas element will use `Math.Math.floor` on a float number, so Math.floor first
    const canvasWidth = Math.floor(scaledWidth || originalWidth)
    const canvasHeight = Math.floor(scaledHeight || originalHeight)

    const canvas = $('<canvas>')[0]
    const context = canvas.getContext('2d')

    canvas.width = canvasWidth
    canvas.height = canvasHeight

    if (options.fillColor) {
      context.fillStyle = options.fillColor
      context.fillRect(0, 0, canvasWidth, canvasHeight)
    }

    if ($.isFunction(options.beforeDrawImage)) {
      options.beforeDrawImage(canvas)
    }

    // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
    const parameters = (() =&gt; {
      const source = utils.getSourceCanvas(self.$clone[0], self.image)
      const sourceWidth = source.width
      const sourceHeight = source.height
      const canvasData = self.canvas
      const params = [source]

      // Source canvas
      let srcX = data.x + ((canvasData.naturalWidth * (Math.abs(data.scaleX || 1) - 1)) / 2)
      let srcY = data.y + ((canvasData.naturalHeight * (Math.abs(data.scaleY || 1) - 1)) / 2)
      let srcWidth
      let srcHeight</canvas>
github fengyuanchen / datepicker / src / js / datepicker.js View on Github external
unbind() {
    const { $element: $this, options } = this;

    if ($.isFunction(options.show)) {
      $this.off(EVENT_SHOW, options.show);
    }

    if ($.isFunction(options.hide)) {
      $this.off(EVENT_HIDE, options.hide);
    }

    if ($.isFunction(options.pick)) {
      $this.off(EVENT_PICK, options.pick);
    }

    if (this.isInput) {
      $this.off(EVENT_KEYUP, this.keyup);
    }

    if (!this.inline) {
      if (options.trigger) {
        this.$trigger.off(EVENT_CLICK, this.toggle);
      } else if (this.isInput) {
        $this.off(EVENT_FOCUS, this.show);
      } else {
        $this.off(EVENT_CLICK, this.show);
      }
    }
github uploadcare / uploadcare-widget / src / locale.js View on Github external
const _build = function(stgs) {
  if (!currentLocale) {
    const settings = buildSettings(stgs)
    const lang = settings.locale || defaults.lang
    const translations = $.extend(
      true,
      {},
      locale.translations[lang],
      settings.localeTranslations
    )

    const pluralize = $.isFunction(settings.localePluralize)
      ? settings.localePluralize
      : locale.pluralize[lang]

    currentLocale = { lang, translations, pluralize }
  }

  return currentLocale
}
github fengyuanchen / datepicker / src / js / datepicker.js View on Github external
bind() {
    const { options, $element: $this } = this;

    if ($.isFunction(options.show)) {
      $this.on(EVENT_SHOW, options.show);
    }

    if ($.isFunction(options.hide)) {
      $this.on(EVENT_HIDE, options.hide);
    }

    if ($.isFunction(options.pick)) {
      $this.on(EVENT_PICK, options.pick);
    }

    if (this.isInput) {
      $this.on(EVENT_KEYUP, $.proxy(this.keyup, this));
    }

    if (!this.inline) {
github oroinc / platform / src / Oro / Bundle / EntityBundle / Resources / public / js / fields-loader.js View on Github external
var revert = $.proxy(function() {
                    var $entityChoice = $el.data('relatedChoice');
                    if ($entityChoice && $entityChoice.val() !== oldVal) {
                        $entityChoice.val(oldVal).change();
                    }
                    $el.val(oldVal).change();
                    if ($.isFunction(this.options.afterRevertCallback)) {
                        this.options.afterRevertCallback.call(this, $el);
                    }
                }, this);
            confirm.on('ok', load);
github thecreation / jquery-slidePanel / src / view.js View on Github external
Animate.do(this, this.getHidePosition(), () => {
      that.$panel.removeClass(that.options.classes.show);
      that._showed = false;
      that._instance = null;

      if (SlidePanel._current === that) {
        SlidePanel._current = null;
      }

      if (!SlidePanel.is('show')) {
        $('html').removeClass(`${that.options.classes.base}-html`);
      }

      if ($.isFunction(callback)) {
        callback.call(that);
      }

      SlidePanel.trigger(that, 'afterHide');
    });
  }
github thecreation / jquery-wizard / src / step.js View on Github external
setLoaderFromData() {
    const loader = this.$pane.data('loader');

    if (loader) {
      if ($.isFunction(window[loader])) {
        this.loader = window[loader];
      }
    } else {
      const url = this.$pane.data('loader-url');
      if (url) {
        this.loader = {
          url,
          settings: this.$pane.data('settings') || {}
        };
      }
    }
  }
github thx / magix-project / src / coms / dragdrop / index.js View on Github external
begin: function(node, moveCallback, endCallback) {
        DragStop();
        if (node) {
            ClearSelection();
            if (node.setCapture) {
                node.setCapture();
            }
            DragObject = {
                move: moveCallback,
                stop: endCallback,
                node: node,
                iMove: $.isFunction(moveCallback),
                iStop: $.isFunction(endCallback)
            };
            Doc.on(DragMoveEvent, DragMove)
                .on(DragEndEvent, DragStop)
                .on(DragPreventEvent, DragPrevent);
            Win.on('blur', DragStop);
            $(node).on('losecapture', DragStop);
        }
    },
    fromPoint: function(x, y) {