|
25 | 25 |
|
26 | 26 | // fn(opts) function to be called before scrolling occurs. |
27 | 27 | // `this` is the element(s) being scrolled |
28 | | - beforeScroll: function() {}, |
| 28 | + beforeScroll: function() {/* empty by default */}, |
29 | 29 |
|
30 | 30 | // fn(opts) function to be called after scrolling occurs. |
31 | 31 | // `this` is the triggering element |
32 | | - afterScroll: function() {}, |
| 32 | + afterScroll: function() {/* empty by default */}, |
33 | 33 |
|
34 | 34 | // easing name. jQuery comes with "swing" and "linear." For others, you'll need an easing plugin |
35 | 35 | // from jQuery UI or elsewhere |
|
108 | 108 | return scrollable; |
109 | 109 | }; |
110 | 110 |
|
111 | | - var rRelative = /^([\-\+]=)(\d+)/; |
| 111 | + var rRelative = /^([-+]=)(\d+)/; |
112 | 112 |
|
113 | 113 | $.fn.extend({ |
114 | 114 | scrollable: function(dir) { |
|
123 | 123 | }, |
124 | 124 |
|
125 | 125 | smoothScroll: function(options, extra) { |
126 | | - options = options || {}; |
| 126 | + var userOptions = options || {}; |
127 | 127 |
|
128 | | - if (options === 'options') { |
| 128 | + if (userOptions === 'options') { |
129 | 129 | if (!extra) { |
130 | 130 | return this.first().data('ssOpts'); |
131 | 131 | } |
|
138 | 138 | }); |
139 | 139 | } |
140 | 140 |
|
141 | | - var opts = $.extend({}, $.fn.smoothScroll.defaults, options); |
| 141 | + var opts = $.extend({}, $.fn.smoothScroll.defaults, userOptions); |
142 | 142 |
|
143 | 143 | var clickHandler = function(event) { |
144 | 144 | var escapeSelector = function(str) { |
|
324 | 324 |
|
325 | 325 | $.smoothScroll.version = version; |
326 | 326 | $.smoothScroll.filterPath = function(string) { |
327 | | - string = string || ''; |
328 | | - |
329 | | - return string |
330 | | - .replace(/^\//, '') |
331 | | - .replace(/(?:index|default).[a-zA-Z]{3,4}$/, '') |
332 | | - .replace(/\/$/, ''); |
| 327 | + return (string || '') |
| 328 | + .replace(/^\//, '') |
| 329 | + .replace(/(?:index|default).[a-zA-Z]{3,4}$/, '') |
| 330 | + .replace(/\/$/, ''); |
333 | 331 | }; |
334 | 332 |
|
335 | 333 | // default options |
|
0 commit comments