Skip to content

Commit

Permalink
Added substr function back in, IE apparently doesn't like it when you…
Browse files Browse the repository at this point in the history
… use a strings like an array of chars. Other minor improvements, updated minified version, now at 1692 bytes. Minor edit of readme file.
  • Loading branch information
ryantenney committed Aug 11, 2010
1 parent 989b91f commit 7cb9104
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -37,4 +37,4 @@ One method:
### License ###

Émile is is licensed under the terms of the MIT License, see the included MIT-LICENSE file.
Émile borrows its name from <http://en.wikipedia.org/wiki/Émile_Cohl>.
Émile borrows its name from [Émile Cohl](http://en.wikipedia.org/wiki/Émile_Cohl).
20 changes: 11 additions & 9 deletions emile.js
Expand Up @@ -3,7 +3,7 @@
// emile.js (c) 2009 Thomas Fuchs
// Licensed under the terms of the MIT license.

(function(emile, container){
(function (emile, container) {

var parseEl = document.createElement('div'),
props = ['backgroundColor','borderBottomColor','borderBottomWidth','borderLeftColor','borderLeftWidth',
Expand All @@ -16,23 +16,25 @@
return (source + (target - source) * pos).toFixed(3);
}

function color(source,target,pos) {
function substr(str, pos) {
return str.substr(pos, 1);
}

function color(source, target, pos) {
var i = 2,
j, arg, tmp,
v = [], r = [];

while (j = 3, arg = arguments[i - 1], i--) { /*! lint !*/
if (arg[0] === 'r') {
if (arg[0] == 'r') {
arg = arg.match(/\d+/g);
while (j--) {
v.push(~~arg[j]);
}
} else {
if (arg.length === 4) {
arg = '#' + arg[1] + arg[1] + arg[2] + arg[2] + arg[3] + arg[3];
}
tmp = arg.length == 4 ? 0 : 1;
while (j--) {
v.push(parseInt(arg.substr(1 + j * 2, 2), 16));
v.push(parseInt(substr(arg, j * 2) + substr(arg, j * 2 + tmp), 16));
}
}
}
Expand Down Expand Up @@ -69,7 +71,7 @@
}

function worker(el, current, target, start, finish, dur, interval, easing, opts, after) {
var time = +new Date(),
var time = +new Date,
pos = time > finish ? 1 : (time - start) / dur,
prop;

Expand All @@ -89,7 +91,7 @@
}

container[emile] = function (el, style, opts, after) {
el = typeof el === 'string' ? document.getElementById(el) : el;
el = typeof el == 'string' ? document.getElementById(el) : el;
opts = opts || {};

var prop, interval,
Expand Down
2 changes: 1 addition & 1 deletion emile.min.js

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

0 comments on commit 7cb9104

Please sign in to comment.