Skip to content

Commit d984f88

Browse files
committed
Trim some fat
1 parent 38618ef commit d984f88

File tree

3 files changed

+28
-41
lines changed

3 files changed

+28
-41
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jQueryKeyframes",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"homepage": "https://github.com/jQueryKeyframes/jQuery.Keyframes",
55
"license": "MIT",
66
"private": false,

jquery.keyframes.js

Lines changed: 26 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
(function() {
2-
var $createKeyframeStyleTag, animationPlayState, playStateRunning,
3-
animationSupport = false,
2+
var animationSupport = false,
43
animationString = 'animation',
54
vendorPrefix = prefix = '',
65
domPrefixes = ['Webkit', 'Moz', 'O', 'ms', 'Khtml'];
@@ -23,10 +22,10 @@
2322
});
2423

2524

26-
$createKeyframeStyleTag = function(params) {
25+
var $createKeyframeStyleTag = function(id) {
2726
return $("<style>").attr({
2827
class: "keyframe-style",
29-
id: params.id,
28+
id: id,
3029
type: "text/css"
3130
}).appendTo("head");
3231
};
@@ -39,15 +38,14 @@
3938
return animationSupport;
4039
},
4140
generate: function(frameData) {
42-
var $elems, $frameStyle, css, frameName, property, key;
43-
frameName = frameData.name || "";
44-
css = "@" + vendorPrefix + "keyframes " + frameName + " {";
41+
var frameName = frameData.name || "";
42+
var css = "@" + vendorPrefix + "keyframes " + frameName + " {";
4543

46-
for (key in frameData) {
44+
for (var key in frameData) {
4745
if (key !== "name") {
4846
css += key + " {";
4947

50-
for (property in frameData[key]) {
48+
for (var property in frameData[key]) {
5149
css += property + ":" + frameData[key][property] + ";";
5250
}
5351

@@ -57,13 +55,13 @@
5755

5856
css = PrefixFree.prefixCSS(css + "}");
5957

60-
$frameStyle = $("style#" + frameData.name);
58+
var $frameStyle = $("style#" + frameData.name);
6159

6260
if ($frameStyle.length > 0) {
6361
$frameStyle.html(css);
6462

65-
$elems = $("*").filter(function() {
66-
this.style["" + animationString + "Name"] === frameName;
63+
var $elems = $("*").filter(function() {
64+
this.style[animationString + "Name"] === frameName;
6765
});
6866

6967
$elems.each(function() {
@@ -75,9 +73,7 @@
7573
});
7674
});
7775
} else {
78-
$createKeyframeStyleTag({
79-
id: frameName
80-
}).append(css);
76+
$createKeyframeStyleTag(frameName).append(css);
8177
}
8278
},
8379
define: function(frameData) {
@@ -87,13 +83,13 @@
8783
this.generate(frame);
8884
}
8985
} else {
90-
return this.generate(frameData);
86+
this.generate(frameData);
9187
}
9288
}
9389
};
9490

95-
animationPlayState = "animation-play-state";
96-
playStateRunning = "running";
91+
var animationPlayState = "animation-play-state";
92+
var playStateRunning = "running";
9793

9894
$.fn.resetKeyframe = function(callback) {
9995
var $el = $(this).css(vendorPrefix + animationPlayState, playStateRunning).css(vendorPrefix + "animation", "none");
@@ -104,15 +100,14 @@
104100
};
105101

106102
$.fn.pauseKeyframe = function() {
107-
var $el = $(this).css(vendorPrefix + animationPlayState, "paused");
103+
$(this).css(vendorPrefix + animationPlayState, "paused");
108104
};
109105

110106
$.fn.resumeKeyframe = function() {
111-
return $(this).css(vendorPrefix + animationPlayState, playStateRunning);
107+
$(this).css(vendorPrefix + animationPlayState, playStateRunning);
112108
};
113109

114110
$.fn.playKeyframe = function(frameOptions, callback) {
115-
var animationcss, animationkey, delay, duration, pfx, repeat;
116111

117112
if (typeof frameOptions === 'string') {
118113
var frameOptSplit = frameOptions.trim().split(' ');
@@ -138,27 +133,21 @@
138133
complete: callback
139134
}, frameOptions);
140135

141-
duration = frameOptions.duration;
142-
delay = frameOptions.delay;
143-
repeat = frameOptions.repeat;
144-
animationcss = "" + frameOptions.name + " " + duration + "ms " + frameOptions.timingFunction + " " + delay + "ms " + repeat + " " + frameOptions.direction + " " + frameOptions.fillMode;
145-
callback = frameOptions.complete;
146-
animationkey = vendorPrefix + "animation";
147-
pfx = ["webkit", "moz", "MS", "o", ""];
136+
var duration = frameOptions.duration;
137+
var delay = frameOptions.delay;
138+
var repeat = frameOptions.repeat;
139+
var animationcss = "" + frameOptions.name + " " + duration + "ms " + frameOptions.timingFunction + " " + delay + "ms " + repeat + " " + frameOptions.direction + " " + frameOptions.fillMode;
140+
var animationkey = vendorPrefix + "animation";
141+
var pfx = ["webkit", "moz", "MS", "o", ""];
148142

149143
var _prefixEvent = function(element, type, callback) {
150-
var evt, p, _results;
151-
p = 0;
152-
_results = [];
153-
while (p < pfx.length) {
154-
if (!pfx[p]) {
144+
for(var i = 0; i < pfx.length; i++){
145+
if (!pfx[i]) {
155146
type = type.toLowerCase();
156147
}
157-
evt = pfx[p] + type;
148+
var evt = pfx[i] + type;
158149
element.off(evt).on(evt, callback);
159-
_results.push(p++);
160150
}
161-
_results;
162151
};
163152

164153
this.each(function() {
@@ -172,8 +161,6 @@
172161
return this;
173162
};
174163

175-
$createKeyframeStyleTag({
176-
id: "boost-keyframe"
177-
}).append(" .boostKeyframe{" + vendorPrefix + "transform:scale3d(1,1,1);}");
164+
$createKeyframeStyleTag("boost-keyframe").append(" .boostKeyframe{" + vendorPrefix + "transform:scale3d(1,1,1);}");
178165

179166
}).call(this);

jquery.keyframes.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)