Skip to content

Fix JSHint warnings #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/image-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
canvas.height = img.height;
ctx.drawImage(img,0,0);
original = ctx.getImageData(0, 0, canvas.width, canvas.height);
}
};
img.src = event.target.result;
}
};
reader.readAsDataURL(e.target.files[0]);
}

Expand All @@ -27,11 +27,11 @@
var buttons = document.querySelectorAll('button');
for (var i = 0; i < buttons.length; i++) {
if (buttons[i].hasAttribute('disabled')) {
buttons[i].removeAttribute('disabled')
buttons[i].removeAttribute('disabled');
} else {
buttons[i].setAttribute('disabled', null);
}
};
}
}

function manipulateImage(type) {
Expand All @@ -57,7 +57,7 @@
}
toggleButtonsAbledness();
return ctx.putImageData(imageData, 0, 0);
};
}

function revertImage() {
return ctx.putImageData(original, 0, 0);
Expand All @@ -78,4 +78,4 @@
document.querySelector('#revert').onclick = function() {
revertImage();
};
})();
})();
12 changes: 6 additions & 6 deletions scripts/imageManips.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Image manipulation logic from github.com/jwill/psychic-lana

function manipulate(type, r, g, b, a) {

var func = function() {};

function makePixelInverted(r, g, b, a) {
r = 255 - r;
g = 255 - g;
b = 255 - b;
return [r, g, b, a];
};
}

function makePixelChroma(r, g, b, a) {
var max;
Expand All @@ -19,7 +19,7 @@ function manipulate(type, r, g, b, a) {
} else {
return [r, g, b, a];
}
};
}

function makePixelGreyScale(r, g, b, a) {
var y;
Expand All @@ -28,7 +28,7 @@ function manipulate(type, r, g, b, a) {
g = y;
b = y;
return [r, g, b, a];
};
}

function makePixelVibrant(r, g, b, a) {
var amt, avg, bs, gs, mx, rs;
Expand All @@ -39,7 +39,7 @@ function manipulate(type, r, g, b, a) {
gs = g + (amt * (mx - g));
bs = b + (amt * (mx - b));
return [rs, gs, bs, a];
};
}

switch (type) {
case "invert":
Expand All @@ -60,4 +60,4 @@ function manipulate(type, r, g, b, a) {
}

return func(r, g, b, a);
}
}
10 changes: 5 additions & 5 deletions scripts/time-animator.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"Thursday",
"Friday",
"Saturday"
]
];

var months = [
"January",
Expand All @@ -50,7 +50,7 @@
"October",
"November",
"December"
]
];

var now = new Date(Date.now());

Expand All @@ -75,7 +75,7 @@

var dateString = days[day] + ", " + date + " " + months[month] + " " + parseInt(1900 + year);
var timeString = hours + ":" + mins + ":" + secs + ":" + ms;

// calc the time diff between frames, starting with the second frame
if (lastTime > 0) {
frameTimeDiff = now - lastTime;
Expand Down Expand Up @@ -112,5 +112,5 @@
// save the data about this frame for future comparison
lastTime = now;
lastDiff = frameTimeDiff;
};
})();
}
})();
7 changes: 3 additions & 4 deletions scripts/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ this.onmessage = function(e) {
imageData.data[i * 4 + 3] = pixel[3];
}
postMessage(imageData);
} catch (e) {
} catch (ex) {
function ManipulationException(message) {
this.name = "ManipulationException";
this.message = message;
};
}
throw new ManipulationException('Image manipulation error');
postMessage(undefined);
}
}
};