8000 optimising a bit · Dream-git/unslider@382e9c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 382e9c9

Browse files
author
Visual Idiot
committed
optimising a bit
1 parent 094dc42 commit 382e9c9

File tree

3 files changed

+23
-26
lines changed

3 files changed

+23
-26
lines changed

config.codekit

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"CodeKitInfo": "This is a CodeKit 2.x project configuration file. It is designed to sync project settings across multiple machines. MODIFYING THE CONTENTS OF THIS FILE IS A POOR LIFE DECISION. If you do so, you will likely cause CodeKit to crash. This file is not useful unless accompanied by the project that created it in CodeKit 2. This file is not backwards-compatible with CodeKit 1.x. For more information, see: http:\/\/incident57.com\/codekit",
3-
"creatorBuild": "19076",
3+
"creatorBuild": "19099",
44
"files": {
55
"\/bower.json": {
66
"fileType": 524288,
@@ -277,10 +277,18 @@
277277
"active": 0,
278278
"flagValue": -1
279279
},
280+
"no_nested_string_interpolation": {
281+
"active": 1,
282+
"flagValue": -1
283+
},
280284
"no_plusplus": {
281285
"active": 0,
282286
"flagValue": -1
283287
},
288+
"no_private_function_fat_arrows": {
289+
"active": 1,
290+
"flagValue": -1
291+
},
284292
"no_stand_alone_at": {
285293
"active": 1,
286294
"flagValue": -1
@@ -289,6 +297,10 @@
289297
"active": 1,
290298
"flagValue": -1
291299
},
300+
"no_this": {
301+
"active": 0,
302+
"flagValue": -1
303+
},
292304
"no_throwing_strings": {
293305
"active": 1,
294306
"flagValue": -1

dist/js/unslider-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.

src/js/unslider.js

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
// Either set true/false, or an object with the HTML
6060
// elements for each arrow like below:
6161
arrows: {
62-
prev: '<a class="' + self._ + '-arrow prev"></a>',
63-
next: '<a class="' + self._ + '-arrow next"></a>'
62+
prev: '<a class="' + self._ + '-arrow prev">Prev</a>',
63+
next: '<a class="' + self._ + '-arrow next">Next</a>'
6464
},
6565

6666
// How should Unslider animate?
@@ -135,7 +135,7 @@
135135
});
136136

137137
// Add swipe support
138-
if(typeof jQuery.event.special.swipe !== undefined && self.options.swipe) {
138+
if(jQuery.event.special.swipe && self.options.swipe) {
139139
self.initSwipe();
140140
}
141141

@@ -380,10 +380,10 @@
380380
self.current = Math.min(Math.max(0, to), self.total - 1);
381381

382382
if(self.options.nav) {
383-
self.$nav.find('[data-slide="' + self.current + '"]')._toggleActive(self.options.activeClass);
383+
self.$nav.find('[data-slide="' + self.current + '"]')._active(self.options.activeClass);
384384
}
385385

386-
self.$slides.eq(self.current)._toggleActive(self.options.activeClass);
386+
self.$slides.eq(self.current)._active(self.options.activeClass);
387387

388388
return self;
389389
};
@@ -571,7 +571,7 @@
571571
// They're both just helpful types of shorthand for
572572
// anything that might take too long to write out or
573573
// something that might be used more than once.
574-
$.fn._toggleActive = function(className) {
574+
$.fn._active = function(className) {
575575
return this.addClass(className).siblings().removeClass(className);
576576
};
577577

@@ -587,15 +587,8 @@
587587
};
588588

589589
$.fn._move = function() {
590-
var type = 'animate';
591-
592590
this.stop(true, true);
593-
594-
if($.fn.velocity) {
595-
type = 'velocity';
596-
}
597-
598-
return $.fn[type].apply(this 67F4 , arguments);
591+
return $.fn[$.fn.velocity ? 'velocity' : 'animate'].apply(this, arguments);
599592
};
600593

601594
// And set up our jQuery plugin
@@ -609,18 +602,10 @@
609602
if(typeof opts === 'string' && $this.data('unslider')) {
610603
opts = opts.split(':');
611604

612-
var fn = opts[0];
613-
var call = $this.data('unslider')[fn];
605+
var call = $this.data('unslider')[opts[0]];
614606

615607
// Do we have arguments to pass to the string-function?
616-
if(opts[1]) {
617-
var args = opts[1].split(',');
618-
return $.isFunction(call) && call.apply($this, args);
619-
}
620-
621-
$.isFunction(call) && call();
622-
623-
return this;
608+
$.isFunction(call) && call.apply($this, args ? null : opts[1].split(','));
624609
}
625610

626611
return $this.data('unslider', new $.Unslider($this, opts));

0 commit comments

Comments
 (0)
0