Skip to content

Commit

Permalink
Moved jQuery adapter to its own file and updated the readme accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
meltingice committed Feb 25, 2011
1 parent 71e476b commit 34bbf4d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 37 deletions.
11 changes: 9 additions & 2 deletions README.md
Expand Up @@ -71,13 +71,20 @@ Caman("#image-id", function () {
});
</pre>

<h3>jQuery Plugin</h3>
If you use jQuery already on your site, CamanJS automatically registers itself as a jQuery plugin. To use it, you can do:
<h3>JS Library Adapters</h3>
If you are already using a popular JS library on your site (such as jQuery, Mootools, ExtJS, etc), then there may be an adapter for CamanJS that integrates it with that library. Remember, CamanJS is fully standalone and isn't dependent on any library, but the option is there if you like a more tightly integrated environment.

All adapters are located in the adapters/ folder. Simply include them after you include CamanJS.

<pre>
&lt;script type="text/javascript" src="caman.full.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="adapters/jquery.js"&gt;&lt;/script&gt;

&lt;script type="text/javascript"&gt;
$("#caman-image").caman(function() {
this.brightness(10).render();
});
&lt;/script&gt;
</pre>

<h3>Saving Images</h3>
Expand Down
10 changes: 10 additions & 0 deletions adapters/jquery.js
@@ -0,0 +1,10 @@
/*
* jQuery plugin adapter for CamanJS
*/
if (window.jQuery) {
window.jQuery.fn.caman = function (callback) {
return this.each(function () {
Caman(this, callback);
});
};
}
11 changes: 0 additions & 11 deletions dist/caman.full.js
Expand Up @@ -92,17 +92,6 @@ if (!('console' in window)) {
};
}

/*
* If jQuery is present, automatically make Caman a plugin
*/
if (window.jQuery) {
window.jQuery.fn.caman = function (callback) {
return this.each(function () {
Caman(this, callback);
});
};
}

Caman.ready = false;
Caman.store = {};
Caman.renderBlocks = 4;
Expand Down
1 change: 0 additions & 1 deletion dist/caman.full.min.js

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

11 changes: 0 additions & 11 deletions dist/caman.js
Expand Up @@ -92,17 +92,6 @@ if (!('console' in window)) {
};
}

/*
* If jQuery is present, automatically make Caman a plugin
*/
if (window.jQuery) {
window.jQuery.fn.caman = function (callback) {
return this.each(function () {
Caman(this, callback);
});
};
}

Caman.ready = false;
Caman.store = {};
Caman.renderBlocks = 4;
Expand Down
1 change: 0 additions & 1 deletion dist/caman.min.js

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

11 changes: 0 additions & 11 deletions src/core.js
Expand Up @@ -92,17 +92,6 @@ if (!('console' in window)) {
};
}

/*
* If jQuery is present, automatically make Caman a plugin
*/
if (window.jQuery) {
window.jQuery.fn.caman = function (callback) {
return this.each(function () {
Caman(this, callback);
});
};
}

Caman.ready = false;
Caman.store = {};
Caman.renderBlocks = 4;
Expand Down

0 comments on commit 34bbf4d

Please sign in to comment.