Skip to content

Commit

Permalink
Clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
corydorning committed May 29, 2014
1 parent f820980 commit 331cb34
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
9 changes: 6 additions & 3 deletions inverter-example.html
Expand Up @@ -9,8 +9,10 @@

<title>Invert Image Plug-in Demo</title>

<meta name="description" content="inverter is a jQuery plugin that uses the HTML5 canvas element or CSS filters to invert the colors of an image.">
<meta name="description" content="">
<meta name="author" content="Cory Dorning">

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/smoothness/jquery-ui.css" rel="stylesheet">
</head>

<body>
Expand All @@ -22,15 +24,16 @@

<p><img src="google-logo.png" alt="The Google" class="google-logo" /></p>

<button>Run Inverter!</button>
<button>Toggle Inverter!</button>
<button>jQuery Inverter!</button>
<button>Google Inverter!</button>
</div><!-- .container -->


<!-- Javascript at the bottom for faster page loading -->
<!-- load jQuery script -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script>

<!-- load invert image plugin -->
<script src="jquery-inverter.js"></script>
Expand Down
16 changes: 11 additions & 5 deletions jquery-inverter.js
Expand Up @@ -3,14 +3,20 @@
* Last modified by: Cory Dorning
* Last modified on: 09/20/2011
*
* inverter is a jQuery plugin that uses the HTML5 canvas
* element or CSS filters to invert the colors of an image.
* Invert Image is a jQuery plugin that uses canvas (or appropriate
* IE filters) to invert the colors of an image.
*
* @TODO
* =Track State
Setup method for toggling the state
*
*/

;(function($) {
$.fn.inverter = function() {
(function($) {
$.fn.inverter = function(options) {
var $images = this,

image = $images.toArray(),

invert = {
canvas: function() {
Expand All @@ -20,7 +26,7 @@
canvas.setAttribute('width', img.width);

var context = canvas.getContext('2d');
context.drawImage(img, 0, 0, img.width, img.height);
context.drawImage(img, 0, 0);

var imgData = context.getImageData(0, 0, canvas.width, canvas.height),
data = imgData.data;
Expand Down

0 comments on commit 331cb34

Please sign in to comment.