Skip to content

Commit

Permalink
Added bower
Browse files Browse the repository at this point in the history
  • Loading branch information
bertez committed Jan 22, 2015
1 parent e2a8009 commit 6ba9f6e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ module.exports = function(grunt) {
stripBanners: true
},
dist: {
src: ['src/jquery.<%= pkg.name %>.js'],
dest: 'dist/jquery.<%= pkg.name %>.js'
src: ['src/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
},
},
uglify: {
Expand All @@ -31,7 +31,7 @@ module.exports = function(grunt) {
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/jquery.<%= pkg.name %>.min.js'
dest: 'dist/<%= pkg.name %>.min.js'
},
},
jshint: {
Expand Down
19 changes: 19 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "delegato",
"main": "dist/delegato.js",
"version": "0.2.0",
"homepage": "https://github.com/MiniPlugins/delegato",
"authors": [
"Óscar Otero <[email protected]>",
"Berto Yáñez <[email protected]>"
],
"description": "Easily add jQuery actions directly from the html",
"dependencies": {
"jquery": ">=1.8.0"
},
"keywords": [
"jquery",
"delegate"
],
"license": "MIT"
}
17 changes: 7 additions & 10 deletions dist/jquery.delegato.js → dist/delegato.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Delegato - v0.1.0 - 2015-01-22
/*! Delegato - v0.2.0 - 2015-01-22
* https://github.com/MiniPlugins/delegato
* Copyright (c) 2015 Berto Yáñez, Óscar Otero; Licensed MIT */

Expand All @@ -13,12 +13,12 @@
}(function () {

(function ($, window, document, undefined) {
var pluginName = "emissary",
var pluginName = "delegato",
defaults = {
includeJquery: false
};

function Emissary (element, options) {
function Delegato (element, options) {
this.element = element;
this.settings = $.extend({}, defaults, options);

Expand All @@ -29,7 +29,7 @@
this.init();
}

Emissary.prototype = {
Delegato.prototype = {
init: function () {
var availableActions = this.actions;
var actionPattern = this.pattern;
Expand Down Expand Up @@ -62,8 +62,7 @@
throw new Error('Invalid selector');
}


if(availableActions[command]) {
if($.isFunction(availableActions[command])) {
availableActions[command].apply($(selector), args);
} else if (includeJquery && $.isFunction($(selector)[command])) {
$(selector)[command].apply($(selector), args);
Expand All @@ -73,9 +72,7 @@
}
});


e.preventDefault();

});
},
register: function(name, func) {
Expand All @@ -92,7 +89,7 @@
if ((options === undefined) || (typeof options === 'object')) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Emissary(this, options));
$.data(this, "plugin_" + pluginName, new Delegato(this, options));
}
});
}
Expand All @@ -103,7 +100,7 @@
this.each(function () {
var instance = $.data(this, 'plugin_' + pluginName);

if ((instance instanceof Emissary) && (typeof instance[options] === 'function')) {
if ((instance instanceof Delegato) && (typeof instance[options] === 'function')) {
returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
}

Expand Down
5 changes: 5 additions & 0 deletions dist/delegato.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions dist/jquery.delegato.min.js

This file was deleted.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "delegato",
"title": "Delegato",
"description": "Easily add jquery actions directly from the html",
"version": "0.1.0",
"description": "Easily add jQuery actions directly from the html",
"version": "0.2.0",
"homepage": "https://github.com/MiniPlugins/delegato",
"author": [{
"name": "Berto Yáñez",
Expand All @@ -13,7 +13,10 @@
"email": "[email protected]"
}
],
"contributors": [
"contributors": [{
"name": "Carlos Morales",
"email": "[email protected]"
}
],
"repository": {
"type": "git",
Expand All @@ -30,7 +33,7 @@
"node": ">= 0.8.0"
},
"dependencies": {
"jquery": "*"
"jquery": ">=1.8.0"
},
"devDependencies": {
"grunt-contrib-jshint": "~0.10.0",
Expand Down
15 changes: 6 additions & 9 deletions src/jquery.delegato.js → src/delegato.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
}(function () {

(function ($, window, document, undefined) {
var pluginName = "emissary",
var pluginName = "delegato",
defaults = {
includeJquery: false
};

function Emissary (element, options) {
function Delegato (element, options) {
this.element = element;
this.settings = $.extend({}, defaults, options);

Expand All @@ -33,7 +33,7 @@
this.init();
}

Emissary.prototype = {
Delegato.prototype = {
init: function () {
var availableActions = this.actions;
var actionPattern = this.pattern;
Expand Down Expand Up @@ -66,8 +66,7 @@
throw new Error('Invalid selector');
}


if(availableActions[command]) {
if($.isFunction(availableActions[command])) {
availableActions[command].apply($(selector), args);
} else if (includeJquery && $.isFunction($(selector)[command])) {
$(selector)[command].apply($(selector), args);
Expand All @@ -77,9 +76,7 @@
}
});


e.preventDefault();

});
},
register: function(name, func) {
Expand All @@ -96,7 +93,7 @@
if ((options === undefined) || (typeof options === 'object')) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Emissary(this, options));
$.data(this, "plugin_" + pluginName, new Delegato(this, options));
}
});
}
Expand All @@ -107,7 +104,7 @@
this.each(function () {
var instance = $.data(this, 'plugin_' + pluginName);

if ((instance instanceof Emissary) && (typeof instance[options] === 'function')) {
if ((instance instanceof Delegato) && (typeof instance[options] === 'function')) {
returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
}

Expand Down

0 comments on commit 6ba9f6e

Please sign in to comment.