Skip to content

Commit 7703c4b

Browse files
author
Rohit Kalkur
committed
4.0.0
1 parent be189b9 commit 7703c4b

21 files changed

+1645
-870
lines changed

.DS_Store

6 KB
Binary file not shown.

Gruntfile.js

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,35 @@ module.exports = function(grunt) {
55
grunt.initConfig({
66
// Metadata.
77
pkg: grunt.file.readJSON('package.json'),
8+
header: {
9+
dist: {
10+
options: {
11+
text: "/*! =======================================================\n VERSION <%= pkg.version %> \n========================================================= */"
12+
},
13+
files: {
14+
'<%= pkg.gruntConfig.dist.js %>': '<%= pkg.gruntConfig.temp.js %>',
15+
'<%= pkg.gruntConfig.dist.css %>': '<%= pkg.gruntConfig.temp.css %>',
16+
'<%= pkg.gruntConfig.dist.cssMin %>': '<%= pkg.gruntConfig.temp.cssMin %>'
17+
}
18+
}
19+
},
820
// Task configuration.
921
uglify: {
22+
options: {
23+
preserveComments: 'some'
24+
},
1025
dist: {
1126
src: '<%= pkg.main %>',
12-
dest: '<%= pkg.gruntConfig.dist.js %>'
27+
dest: '<%= pkg.gruntConfig.temp.js %>'
1328
}
1429
},
1530
jshint: {
31+
ignore_warning: {
32+
options: {
33+
'-W099': true
34+
},
35+
src: '<%= pkg.main %>'
36+
},
1637
options: {
1738
curly: true,
1839
eqeqeq: true,
@@ -28,8 +49,11 @@ module.exports = function(grunt) {
2849
browser: true,
2950
globals: {
3051
$ : true,
31-
Modernizr : true
32-
}
52+
Modernizr : true,
53+
console: true,
54+
define: true
55+
},
56+
"-W099": true,
3357
},
3458
gruntfile: {
3559
src: 'Gruntfile.js'
@@ -41,6 +65,7 @@ module.exports = function(grunt) {
4165
src: '<%= pkg.gruntConfig.spec %>',
4266
options : {
4367
globals : {
68+
document: true,
4469
console: false,
4570
$: false,
4671
_: false,
@@ -69,7 +94,7 @@ module.exports = function(grunt) {
6994
src : '<%= pkg.main %>',
7095
options : {
7196
specs : '<%= pkg.gruntConfig.spec %>',
72-
vendor : ['<%= pkg.gruntConfig.js.jquery %>'],
97+
vendor : ['<%= pkg.gruntConfig.js.jquery %>', '<%= pkg.gruntConfig.js.bindPolyfill %>'],
7398
styles : ['<%= pkg.gruntConfig.css.bootstrap %>', '<%= pkg.gruntConfig.css.slider %>'],
7499
template : '<%= pkg.gruntConfig.tpl.SpecRunner %>'
75100
}
@@ -142,18 +167,19 @@ module.exports = function(grunt) {
142167
},
143168
production: {
144169
files: {
145-
'<%= pkg.gruntConfig.dist.css %>': '<%= pkg.gruntConfig.less.slider %>',
170+
'<%= pkg.gruntConfig.temp.css %>': '<%= pkg.gruntConfig.less.slider %>',
146171
}
147172
},
148173
"production-min": {
149174
options: {
150175
yuicompress: true
151176
},
152177
files: {
153-
'<%= pkg.gruntConfig.dist.cssMin %>': '<%= pkg.gruntConfig.less.slider %>'
178+
'<%= pkg.gruntConfig.temp.cssMin %>': '<%= pkg.gruntConfig.less.slider %>'
154179
}
155180
}
156-
}
181+
},
182+
clean: ["temp"]
157183
});
158184

159185

@@ -163,16 +189,21 @@ module.exports = function(grunt) {
163189
grunt.loadNpmTasks('grunt-contrib-jasmine');
164190
grunt.loadNpmTasks('grunt-contrib-watch');
165191
grunt.loadNpmTasks('grunt-contrib-connect');
192+
grunt.loadNpmTasks('grunt-contrib-clean');
193+
grunt.loadNpmTasks('grunt-contrib-less');
166194
grunt.loadNpmTasks('grunt-open');
167195
grunt.loadNpmTasks('grunt-template');
168-
grunt.loadNpmTasks('grunt-contrib-less');
196+
grunt.loadNpmTasks('grunt-header');
169197

170-
// Default task.
198+
// Create custom tasks
171199
grunt.registerTask('test', ['jshint', 'jasmine']);
172200
grunt.registerTask('build', ['less:development', 'test', 'template']);
173-
grunt.registerTask('development', ['connect', 'open:development', 'watch']);
174-
grunt.registerTask('production', ['less:production', 'less:production-min', 'test', 'uglify']);
201+
grunt.registerTask('development', ['template', 'connect', 'open:development', 'watch']);
202+
grunt.registerTask('append-header', ['header', 'clean']);
203+
grunt.registerTask('production', ['less:production', 'less:production-min', 'test', 'uglify', 'append-header']);
175204
grunt.registerTask('dev', 'development');
205+
grunt.registerTask('prod', 'production');
176206
grunt.registerTask('dist', 'production');
207+
grunt.registerTask('dist-no-tests', ['less:production', 'less:production-min', 'uglify', 'append-header']);
177208
grunt.registerTask('default', 'build');
178-
};
209+
};

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
LICENSE
22
=======
33

4-
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)
4+
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt)

README.md

Lines changed: 81 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,86 @@
11
bootstrap-slider [![Build Status](https://travis-ci.org/seiyria/bootstrap-slider.png?branch=master)](https://travis-ci.org/seiyria/bootstrap-slider)
22
================
3-
A "fork" of bootstrap-slider found on http://www.eyecon.ro/ originally by Stefan Petre.
3+
Originally began as a loose "fork" of bootstrap-slider found on http://www.eyecon.ro/ by Stefan Petre.
4+
5+
Over time, this project has diverged sigfinicantly from Stefan Petre's version and is now almost completly different.
6+
7+
__Please ensure that you are using this library instead of the Petre version before creating issues in the repository Issue tracker!!__
48

59
Installation
610
============
711
Clone the repository, then run `npm install`
812

913
Want to use bower? `bower install seiyria-bootstrap-slider`
1014

15+
Then load the plugin CSS and JavaScript into your web page, and everything should work!
16+
17+
Remember to load the plugin code after loading the Bootstrap CSS and JQuery.
18+
19+
__JQuery is optional and the plugin can operate with or without it.__
20+
21+
Look below to see an example of how to interact with the non-JQuery interface.
22+
23+
Supported Browsers
24+
========
25+
__We only support modern browsers!!! Basically, anything below IE9 is not compatible with this plugin!__
26+
1127
Examples
1228
========
1329
You can see all of our API examples [here](http://seiyria.github.io/bootstrap-slider/).
1430

15-
Using bootstrap-slider
31+
Using bootstrap-slider (with JQuery)
1632
======================
1733

1834
Create an input element and call .slider() on it:
1935

2036
```js
21-
$("input.slider").slider();
37+
// Instantiate a slider
38+
var mySlider = $("input.slider").slider();
39+
40+
// Call a method on the slider
41+
var value = mySlider.slider('getValue');
42+
43+
// For non-getter methods, you can chain together commands
44+
mySlider
45+
.slider('setValue', 5)
46+
.slider('setValue', 7);
47+
```
48+
49+
If there is already a JQuery plugin named _slider_ bound to the namespace, then this plugin will take on the alternate namespace _bootstrapSlider_.
50+
51+
```
52+
// Instantiate a slider
53+
var mySlider = $("input.slider").bootstrapSlider();
54+
55+
// Call a method on the slider
56+
var value = mySlider.bootstrapSlider('getValue');
57+
58+
// For non-getter methods, you can chain together commands
59+
mySlider
60+
.bootstrapSlider('setValue', 5)
61+
.bootstrapSlider('setValue', 7);
62+
```
63+
64+
Using bootstrap-slider (without JQuery)
65+
======================
66+
67+
Create an input element in the DOM, and then create an instance of Slider, passing it a selector string referencing the input element.
68+
69+
```js
70+
// Instantiate a slider
71+
var mySlider = new Slider("input.slider", {
72+
// initial options object
73+
});
74+
75+
// Call a method on the slider
76+
var value = mySlider.getValue();
77+
78+
// For non-getter methods, you can chain together commands
79+
mySlider
80+
.setValue(5)
81+
.setValue(7);
2282
```
83+
2384
Options
2485
=======
2586
Options can be passed either as a data (data-slider-foo) attribute, or as part of an object in the slider call. The only exception here is the formater argument - that can not be passed as a data- attribute.
@@ -42,31 +103,33 @@ Options can be passed either as a data (data-slider-foo) attribute, or as part o
42103
| handle | string | 'round' | handle shape. Accepts: 'round', 'square', 'triangle' or 'custom' |
43104
| reversed | bool | false | whether or not the slider should be reversed |
44105
| enabled | bool | true | whether or not the slider is initially enabled |
45-
| formater | function | returns the plain value | formatter callback. Return the value wanted to be displayed in the tooltip |
106+
| formatter | function | returns the plain value | formatter callback. Return the value wanted to be displayed in the tooltip |
46107
| natural_arrow_keys | bool | false | The natural order is used for the arrow keys. Arrow up select the upper slider value for vertical sliders, arrow right the righter slider value for a horizontal slider - no matter if the slider was reversed or not. By default the arrow keys are oriented by arrow up/right to the higher slider value, arrow down/left to the lower slider value. |
47108

48109
Functions
49110
=========
50-
| Function | Description |
51-
| -------- | ----------- |
52-
| .slider(options) | Initializes the slider |
53-
| .slider('getValue') | Get the current value from the slider |
54-
| .slider('setValue', newValue, [triggerSlideEvent]) | Set a new value for the slider. If optional triggerSlideEvent parameter is _true_, the 'slide' event will be triggered. |
55-
| .slider('destroy') | Properly clean up and remove the slider instance |
56-
| .slider('disable') | Disables the slider and prevents the user from changing the value |
57-
| .slider('enable') | Enables the slider |
58-
| .slider('toggle') | Toggles the slider between enabled and disabled |
59-
| .slider('isEnabled') | Returns true if enabled, false if disabled |
60-
| .slider('setAttribute', [attribute], [value]) | Updates the slider's [attributes](#options) |
61-
| .slider('getAttribute', [attribute]) | Get the slider's [attributes](#options) |
62-
| .slider('refresh') | Refreshes the current slider |
111+
__NOTE:__ Optional parameters are italisized.
112+
113+
| Function | Parameters | Description |
114+
| -------- | ----------- | ----------- |
115+
| getValue | --- | Get the current value from the slider |
116+
| setValue | newValue, _triggerSlideEvent_ | Set a new value for the slider. If optional triggerSlideEvent parameter is _true_, the 'slide' event will be triggered. |
117+
| destroy | --- | Properly clean up and remove the slider instance |
118+
| disable | ---| Disables the slider and prevents the user from changing the value |
119+
| enable | --- | Enables the slider |
120+
| toggle | --- | Toggles the slider between enabled and disabled |
121+
| isEnabled | --- |Returns true if enabled, false if disabled |
122+
| setAttribute | attribute, value | Updates the slider's [attributes](#options) |
123+
| getAttribute | attribute | Get the slider's [attributes](#options) |
124+
| refresh | --- | Refreshes the current slider |
125+
| on | eventType, callback | When the slider event _eventType_ is triggered, the callback function will be invoked |
63126

64127
Events
65128
======
66129
| Event | Description |
67130
| ----- | ----------- |
68-
| slideStart | This event fires when dragging starts |
69131
| slide | This event fires when the slider is dragged |
132+
| slideStart | This event fires when dragging starts |
70133
| slideStop | This event fires when the dragging stops |
71134
| slideEnabled | This event fires when the slider is enabled |
72135
| slideDisabled | This event fires when the slider is disabled |

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "zardo/bootstrap-slider",
2+
"name": "seiyria/bootstrap-slider",
33
"type": "library",
44
"description": "A less buggy fork of the original bootstrap slider found on http://www.eyecon.ro/ by Stefan Petre. It was forked so we could update the slider since the original wasn't under version control.",
55
"keywords": ["slider", "css", "bootstrap", "javascript"],
6-
"homepage": "https://github.com/zardo/bootstrap-slider",
6+
"homepage": "https://github.com/seiyria/bootstrap-slider",
77
"require": {},
88
"license": "Apache 2.0",
99
"authors": [

css/bootstrap-slider.css

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1-
/*!
2-
* Slider for Bootstrap
1+
/*! =========================================================
2+
* bootstrap-slider.js
33
*
4-
* Licensed under the Apache License v2.0
4+
* Maintainers:
5+
* Kyle Kemp
6+
* - Twitter: @seiyria
7+
* - Github: seiyria
8+
* Rohit Kalkur
9+
* - Twitter: @Rovolutionary
10+
* - Github: rovolution
511
*
6-
*/
12+
* =========================================================
13+
*
14+
* Licensed under the Apache License, Version 2.0 (the "License");
15+
* you may not use this file except in compliance with the License.
16+
* You may obtain a copy of the License at
17+
*
18+
* http://www.apache.org/licenses/LICENSE-2.0
19+
*
20+
* Unless required by applicable law or agreed to in writing, software
21+
* distributed under the License is distributed on an "AS IS" BASIS,
22+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23+
* See the License for the specific language governing permissions and
24+
* limitations under the License.
25+
* ========================================================= */
726
.slider {
827
display: inline-block;
928
vertical-align: middle;
@@ -80,12 +99,15 @@
8099
.slider input {
81100
display: none;
82101
}
83-
.slider .tooltip.hide {
84-
display: none;
102+
.slider .tooltip.top {
103+
margin-top: -36px;
85104
}
86105
.slider .tooltip-inner {
87106
white-space: nowrap;
88107
}
108+
.slider .hide {
109+
display: none;
110+
}
89111
.slider-track {
90112
position: absolute;
91113
cursor: pointer;

0 commit comments

Comments
 (0)