Sha256: 9dab22a799df6498f8e50446930f9bd308c8c4518e37760505312a17ab01b609

Contents?: true

Size: 1.62 KB

Versions: 5

Compression:

Stored size: 1.62 KB

Contents

//https://gist.github.com/661855
(function($) {
  var o = $({});

  $.subscribe = function() {
    o.on.apply(o, arguments);
  };

  $.unsubscribe = function() {
    o.off.apply(o, arguments);
  };

  $.publish = function() {
    o.trigger.apply(o, arguments);
  };
}(jQuery));

//Form seriliser
$.fn.serializeObject = function()
{
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
        if (o[this.name] !== undefined) {
            if (!o[this.name].push) {
                o[this.name] = [o[this.name]];
            }
            o[this.name].push(this.value || '');
        } else {
            o[this.name] = this.value || '';
        }
    });
    return o;
};

// Map air log to console
var console = {
    log: function(msg){
        air.Introspector.Console.log(msg);
    }
};

// Capture [ctrl] key press
$.ctrl = function(key, callback, args) {
    $(document).keydown(function(e) {
        if(!args) args=[]; // IE barks when args is null
        if(e.keyCode == key.charCodeAt(0) && e.ctrlKey) {
            callback.apply(this, args);
            return false;
        }
    });
};

// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
  var rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  return this.push.apply(this, rest);
};

jQuery.fn.toggleDisabled = function () {
  return this.each(function () {
    var $this = $(this);
    if ($this.attr('disabled')) $this.removeAttr('disabled');
    else $this.attr('disabled', 'disabled');
  });
};

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scms-1.8.8 assets/blank-app-template/public/scripts/libs/jquery.fn.custom.js
scms-1.8.7 assets/blank-app-template/public/scripts/libs/jquery.fn.custom.js
scms-1.8.6 assets/blank-app-template/public/scripts/libs/jquery.fn.custom.js
scms-1.7.9 assets/blank-app-template/public/scripts/libs/jquery.fn.custom.js
scms-1.7.8 assets/blank-app-template/public/scripts/libs/jquery.fn.custom.js