jquery-selectbox 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +43 -0
- data/Rakefile +2 -0
- data/jquery-selectbox.gemspec +17 -0
- data/lib/jquery-selectbox.rb +8 -0
- data/lib/jquery-selectbox/version.rb +5 -0
- data/vendor/assets/images/select-icons.png +0 -0
- data/vendor/assets/javascripts/jquery.selectbox.js +430 -0
- data/vendor/assets/stylesheets/jquery.selectbox.css.erb +105 -0
- metadata +57 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Alif Rachmawadi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# Jquery Selectbox
|
2
|
+
|
3
|
+
Custom select box replacement inspired by jQuery UI source.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'jquery-selectbox'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install jquery-selectbox
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
`application.js`
|
22
|
+
//= require jquery.selectbox
|
23
|
+
|
24
|
+
`application.css`
|
25
|
+
*= require jquery.selectbox
|
26
|
+
|
27
|
+
or
|
28
|
+
|
29
|
+
`application.css.scss`
|
30
|
+
|
31
|
+
@import "jquery.selectbox";
|
32
|
+
|
33
|
+
## Credit
|
34
|
+
|
35
|
+
See options and configuration on [jquery.selectbox project site](http://www.bulgaria-web-developers.com/projects/javascript/selectbox/).
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/jquery-selectbox/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Alif Rachmawadi"]
|
6
|
+
gem.email = ["subosito@gmail.com"]
|
7
|
+
gem.description = %q{Custom select box replacement inspired by jQuery UI source}
|
8
|
+
gem.summary = %q{jQuery Selectbox plugin. Custom select box replacement inspired by jQuery UI source. Require jQuery 1.4.x or higher}
|
9
|
+
gem.homepage = "https://github.com/subosito/jquery-selectbox"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "jquery-selectbox"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Jquery::Selectbox::VERSION
|
17
|
+
end
|
Binary file
|
@@ -0,0 +1,430 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Selectbox plugin 0.1.3
|
3
|
+
*
|
4
|
+
* Copyright 2011, Dimitar Ivanov (http://www.bulgaria-web-developers.com/projects/javascript/selectbox/)
|
5
|
+
* Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
|
6
|
+
*
|
7
|
+
* Date: Wed Jul 29 23:20:57 2011 +0200
|
8
|
+
*/
|
9
|
+
(function ($, undefined) {
|
10
|
+
var PROP_NAME = 'selectbox',
|
11
|
+
FALSE = false,
|
12
|
+
TRUE = true;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Selectbox manager.
|
16
|
+
* Use the singleton instance of this class, $.selectbox, to interact with the select box.
|
17
|
+
* Settings for (groups of) select boxes are maintained in an instance object,
|
18
|
+
* allowing multiple different settings on the same page
|
19
|
+
*/
|
20
|
+
function Selectbox() {
|
21
|
+
this._state = [];
|
22
|
+
this._defaults = { // Global defaults for all the select box instances
|
23
|
+
classHolder: "sbHolder",
|
24
|
+
classHolderDisabled: "sbHolderDisabled",
|
25
|
+
classSelector: "sbSelector",
|
26
|
+
classOptions: "sbOptions",
|
27
|
+
classGroup: "sbGroup",
|
28
|
+
classSub: "sbSub",
|
29
|
+
classDisabled: "sbDisabled",
|
30
|
+
classToggleOpen: "sbToggleOpen",
|
31
|
+
classToggle: "sbToggle",
|
32
|
+
speed: 200,
|
33
|
+
effect: "slide", // "slide" or "fade"
|
34
|
+
onChange: null, //Define a callback function when the selectbox is changed
|
35
|
+
onOpen: null, //Define a callback function when the selectbox is open
|
36
|
+
onClose: null //Define a callback function when the selectbox is closed
|
37
|
+
};
|
38
|
+
}
|
39
|
+
|
40
|
+
$.extend(Selectbox.prototype, {
|
41
|
+
/**
|
42
|
+
* Is the first field in a jQuery collection open as a selectbox
|
43
|
+
*
|
44
|
+
* @param {Object} target
|
45
|
+
* @return {Boolean}
|
46
|
+
*/
|
47
|
+
_isOpenSelectbox: function (target) {
|
48
|
+
if (!target) {
|
49
|
+
return FALSE;
|
50
|
+
}
|
51
|
+
var inst = this._getInst(target);
|
52
|
+
return inst.isOpen;
|
53
|
+
},
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Is the first field in a jQuery collection disabled as a selectbox
|
57
|
+
*
|
58
|
+
* @param {HTMLElement} target
|
59
|
+
* @return {Boolean}
|
60
|
+
*/
|
61
|
+
_isDisabledSelectbox: function (target) {
|
62
|
+
if (!target) {
|
63
|
+
return FALSE;
|
64
|
+
}
|
65
|
+
var inst = this._getInst(target);
|
66
|
+
return inst.isDisabled;
|
67
|
+
},
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Attach the select box to a jQuery selection.
|
71
|
+
*
|
72
|
+
* @param {HTMLElement} target
|
73
|
+
* @param {Object} settings
|
74
|
+
*/
|
75
|
+
_attachSelectbox: function (target, settings) {
|
76
|
+
if (this._getInst(target)) {
|
77
|
+
return FALSE;
|
78
|
+
}
|
79
|
+
var $target = $(target),
|
80
|
+
self = this,
|
81
|
+
inst = self._newInst($target),
|
82
|
+
sbHolder, sbSelector, sbToggle, sbOptions,
|
83
|
+
s = FALSE, optGroup = $target.find("optgroup"), opts = $target.find("option"), olen = opts.length;
|
84
|
+
|
85
|
+
$target.attr("sb", inst.uid);
|
86
|
+
|
87
|
+
$.extend(inst.settings, self._defaults, settings);
|
88
|
+
self._state[inst.uid] = FALSE;
|
89
|
+
$target.hide();
|
90
|
+
|
91
|
+
function closeOthers() {
|
92
|
+
var key, uid = this.attr("id").split("_")[1];
|
93
|
+
for (key in self._state) {
|
94
|
+
if (key !== uid) {
|
95
|
+
if (self._state.hasOwnProperty(key)) {
|
96
|
+
if ($(":input[sb='" + key + "']")[0]) {
|
97
|
+
self._closeSelectbox($(":input[sb='" + key + "']")[0]);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
sbHolder = $("<div>", {
|
105
|
+
"id": "sbHolder_" + inst.uid,
|
106
|
+
"class": inst.settings.classHolder
|
107
|
+
});
|
108
|
+
|
109
|
+
sbSelector = $("<a>", {
|
110
|
+
"id": "sbSelector_" + inst.uid,
|
111
|
+
"href": "#",
|
112
|
+
"class": inst.settings.classSelector,
|
113
|
+
"click": function (e) {
|
114
|
+
e.preventDefault();
|
115
|
+
closeOthers.apply($(this), []);
|
116
|
+
var uid = $(this).attr("id").split("_")[1];
|
117
|
+
if (self._state[uid]) {
|
118
|
+
self._closeSelectbox(target);
|
119
|
+
} else {
|
120
|
+
self._openSelectbox(target);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
});
|
124
|
+
|
125
|
+
sbToggle = $("<a>", {
|
126
|
+
"id": "sbToggle_" + inst.uid,
|
127
|
+
"href": "#",
|
128
|
+
"class": inst.settings.classToggle,
|
129
|
+
"click": function (e) {
|
130
|
+
e.preventDefault();
|
131
|
+
closeOthers.apply($(this), []);
|
132
|
+
var uid = $(this).attr("id").split("_")[1];
|
133
|
+
if (self._state[uid]) {
|
134
|
+
self._closeSelectbox(target);
|
135
|
+
} else {
|
136
|
+
self._openSelectbox(target);
|
137
|
+
}
|
138
|
+
}
|
139
|
+
});
|
140
|
+
sbToggle.appendTo(sbHolder);
|
141
|
+
|
142
|
+
sbOptions = $("<ul>", {
|
143
|
+
"id": "sbOptions_" + inst.uid,
|
144
|
+
"class": inst.settings.classOptions,
|
145
|
+
"css": {
|
146
|
+
"display": "none"
|
147
|
+
}
|
148
|
+
});
|
149
|
+
|
150
|
+
$target.children().each(function(i) {
|
151
|
+
var that = $(this), li, config = {};
|
152
|
+
if (that.is("option")) {
|
153
|
+
getOptions(that);
|
154
|
+
} else if (that.is("optgroup")) {
|
155
|
+
li = $("<li>");
|
156
|
+
$("<span>", {
|
157
|
+
"text": that.attr("label")
|
158
|
+
}).addClass(inst.settings.classGroup).appendTo(li);
|
159
|
+
li.appendTo(sbOptions);
|
160
|
+
if (that.is(":disabled")) {
|
161
|
+
config.disabled = true;
|
162
|
+
}
|
163
|
+
config.sub = true;
|
164
|
+
getOptions(that.find("option"), config);
|
165
|
+
}
|
166
|
+
});
|
167
|
+
|
168
|
+
function getOptions () {
|
169
|
+
var sub = arguments[1] && arguments[1].sub ? true : false,
|
170
|
+
disabled = arguments[1] && arguments[1].disabled ? true : false;
|
171
|
+
arguments[0].each(function (i) {
|
172
|
+
var that = $(this),
|
173
|
+
li = $("<li>"),
|
174
|
+
child;
|
175
|
+
if (that.is(":selected")) {
|
176
|
+
sbSelector.text(that.text());
|
177
|
+
s = TRUE;
|
178
|
+
}
|
179
|
+
if (i === olen - 1) {
|
180
|
+
li.addClass("last");
|
181
|
+
}
|
182
|
+
if (!that.is(":disabled") && !disabled) {
|
183
|
+
child = $("<a>", {
|
184
|
+
"href": "#" + that.val(),
|
185
|
+
"rel": that.val(),
|
186
|
+
"text": that.text(),
|
187
|
+
"click": function (e) {
|
188
|
+
e.preventDefault();
|
189
|
+
var t = sbToggle,
|
190
|
+
uid = t.attr("id").split("_")[1];
|
191
|
+
self._changeSelectbox(target, $(this).attr("rel"), $(this).text());
|
192
|
+
self._closeSelectbox(target);
|
193
|
+
}
|
194
|
+
});
|
195
|
+
if (sub) {
|
196
|
+
child.addClass(inst.settings.classSub);
|
197
|
+
}
|
198
|
+
child.appendTo(li);
|
199
|
+
} else {
|
200
|
+
child = $("<span>", {
|
201
|
+
"text": that.text()
|
202
|
+
}).addClass(inst.settings.classDisabled);
|
203
|
+
if (sub) {
|
204
|
+
child.addClass(inst.settings.classSub);
|
205
|
+
}
|
206
|
+
child.appendTo(li);
|
207
|
+
}
|
208
|
+
li.appendTo(sbOptions);
|
209
|
+
});
|
210
|
+
}
|
211
|
+
|
212
|
+
if (!s) {
|
213
|
+
sbSelector.text(opts.first().text());
|
214
|
+
}
|
215
|
+
|
216
|
+
$.data(target, PROP_NAME, inst);
|
217
|
+
|
218
|
+
sbSelector.appendTo(sbHolder);
|
219
|
+
sbOptions.appendTo(sbHolder);
|
220
|
+
sbHolder.insertAfter($target);
|
221
|
+
},
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Remove the selectbox functionality completely. This will return the element back to its pre-init state.
|
225
|
+
*
|
226
|
+
* @param {HTMLElement} target
|
227
|
+
*/
|
228
|
+
_detachSelectbox: function (target) {
|
229
|
+
var inst = this._getInst(target);
|
230
|
+
if (!inst) {
|
231
|
+
return FALSE;
|
232
|
+
}
|
233
|
+
$("#sbHolder_" + inst.uid).remove();
|
234
|
+
$.data(target, PROP_NAME, null);
|
235
|
+
$(target).show();
|
236
|
+
},
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Change selected attribute of the selectbox.
|
240
|
+
*
|
241
|
+
* @param {HTMLElement} target
|
242
|
+
* @param {String} value
|
243
|
+
* @param {String} text
|
244
|
+
*/
|
245
|
+
_changeSelectbox: function (target, value, text) {
|
246
|
+
var inst = this._getInst(target),
|
247
|
+
onChange = this._get(inst, 'onChange');
|
248
|
+
$("#sbSelector_" + inst.uid).text(text);
|
249
|
+
$(target).find("option[value='" + value + "']").attr("selected", TRUE);
|
250
|
+
if (onChange) {
|
251
|
+
onChange.apply((inst.input ? inst.input[0] : null), [value, inst]);
|
252
|
+
} else if (inst.input) {
|
253
|
+
inst.input.trigger('change');
|
254
|
+
}
|
255
|
+
},
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Enable the selectbox.
|
259
|
+
*
|
260
|
+
* @param {HTMLElement} target
|
261
|
+
*/
|
262
|
+
_enableSelectbox: function (target) {
|
263
|
+
var inst = this._getInst(target);
|
264
|
+
if (!inst || !inst.isDisabled) {
|
265
|
+
return FALSE;
|
266
|
+
}
|
267
|
+
$("#sbHolder_" + inst.uid).removeClass(inst.settings.classHolderDisabled);
|
268
|
+
inst.isDisabled = FALSE;
|
269
|
+
$.data(target, PROP_NAME, inst);
|
270
|
+
},
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Disable the selectbox.
|
274
|
+
*
|
275
|
+
* @param {HTMLElement} target
|
276
|
+
*/
|
277
|
+
_disableSelectbox: function (target) {
|
278
|
+
var inst = this._getInst(target);
|
279
|
+
if (!inst || inst.isDisabled) {
|
280
|
+
return FALSE;
|
281
|
+
}
|
282
|
+
$("#sbHolder_" + inst.uid).addClass(inst.settings.classHolderDisabled);
|
283
|
+
inst.isDisabled = TRUE;
|
284
|
+
$.data(target, PROP_NAME, inst);
|
285
|
+
},
|
286
|
+
|
287
|
+
/**
|
288
|
+
* Get or set any selectbox option. If no value is specified, will act as a getter.
|
289
|
+
*
|
290
|
+
* @param {HTMLElement} target
|
291
|
+
* @param {String} name
|
292
|
+
* @param {Object} value
|
293
|
+
*/
|
294
|
+
_optionSelectbox: function (target, name, value) {
|
295
|
+
var inst = this._getInst(target);
|
296
|
+
if (!inst) {
|
297
|
+
return FALSE;
|
298
|
+
}
|
299
|
+
//TODO check name
|
300
|
+
inst[name] = value;
|
301
|
+
$.data(target, PROP_NAME, inst);
|
302
|
+
},
|
303
|
+
|
304
|
+
/**
|
305
|
+
* Call up attached selectbox
|
306
|
+
*
|
307
|
+
* @param {HTMLElement} target
|
308
|
+
*/
|
309
|
+
_openSelectbox: function (target) {
|
310
|
+
var inst = this._getInst(target);
|
311
|
+
//if (!inst || this._state[inst.uid] || inst.isDisabled) {
|
312
|
+
if (!inst || inst.isOpen || inst.isDisabled) {
|
313
|
+
return;
|
314
|
+
}
|
315
|
+
var el = $("#sbOptions_" + inst.uid),
|
316
|
+
viewportHeight = parseInt($(window).height(), 10),
|
317
|
+
offset = $("#sbHolder_" + inst.uid).offset(),
|
318
|
+
scrollTop = $(window).scrollTop(),
|
319
|
+
height = el.prev().height(),
|
320
|
+
diff = viewportHeight - (offset.top - scrollTop) - height / 2,
|
321
|
+
onOpen = this._get(inst, 'onOpen');
|
322
|
+
el.css({
|
323
|
+
"top": height + "px",
|
324
|
+
"maxHeight": (diff - height) + "px"
|
325
|
+
});
|
326
|
+
inst.settings.effect === "fade" ? el.fadeIn(inst.settings.speed) : el.slideDown(inst.settings.speed);
|
327
|
+
$("#sbToggle_" + inst.uid).addClass(inst.settings.classToggleOpen);
|
328
|
+
this._state[inst.uid] = TRUE;
|
329
|
+
inst.isOpen = TRUE;
|
330
|
+
if (onOpen) {
|
331
|
+
onOpen.apply((inst.input ? inst.input[0] : null), [inst]);
|
332
|
+
}
|
333
|
+
$.data(target, PROP_NAME, inst);
|
334
|
+
},
|
335
|
+
|
336
|
+
/**
|
337
|
+
* Close opened selectbox
|
338
|
+
*
|
339
|
+
* @param {HTMLElement} target
|
340
|
+
*/
|
341
|
+
_closeSelectbox: function (target) {
|
342
|
+
var inst = this._getInst(target);
|
343
|
+
//if (!inst || !this._state[inst.uid]) {
|
344
|
+
if (!inst || !inst.isOpen) {
|
345
|
+
return;
|
346
|
+
}
|
347
|
+
var onClose = this._get(inst, 'onClose');
|
348
|
+
inst.settings.effect === "fade" ? $("#sbOptions_" + inst.uid).fadeOut(inst.settings.speed) : $("#sbOptions_" + inst.uid).slideUp(inst.settings.speed);
|
349
|
+
$("#sbToggle_" + inst.uid).removeClass(inst.settings.classToggleOpen);
|
350
|
+
this._state[inst.uid] = FALSE;
|
351
|
+
inst.isOpen = FALSE;
|
352
|
+
if (onClose) {
|
353
|
+
onClose.apply((inst.input ? inst.input[0] : null), [inst]);
|
354
|
+
}
|
355
|
+
$.data(target, PROP_NAME, inst);
|
356
|
+
},
|
357
|
+
|
358
|
+
/**
|
359
|
+
* Create a new instance object
|
360
|
+
*
|
361
|
+
* @param {HTMLElement} target
|
362
|
+
* @return {Object}
|
363
|
+
*/
|
364
|
+
_newInst: function(target) {
|
365
|
+
var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1');
|
366
|
+
return {
|
367
|
+
id: id,
|
368
|
+
input: target,
|
369
|
+
uid: Math.floor(Math.random() * 99999999),
|
370
|
+
isOpen: FALSE,
|
371
|
+
isDisabled: FALSE,
|
372
|
+
settings: {}
|
373
|
+
};
|
374
|
+
},
|
375
|
+
|
376
|
+
/**
|
377
|
+
* Retrieve the instance data for the target control.
|
378
|
+
*
|
379
|
+
* @param {HTMLElement} target
|
380
|
+
* @return {Object} - the associated instance data
|
381
|
+
* @throws error if a jQuery problem getting data
|
382
|
+
*/
|
383
|
+
_getInst: function(target) {
|
384
|
+
try {
|
385
|
+
return $.data(target, PROP_NAME);
|
386
|
+
}
|
387
|
+
catch (err) {
|
388
|
+
throw 'Missing instance data for this selectbox';
|
389
|
+
}
|
390
|
+
},
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Get a setting value, defaulting if necessary
|
394
|
+
*
|
395
|
+
* @param {Object} inst
|
396
|
+
* @param {String} name
|
397
|
+
* @return {Mixed}
|
398
|
+
*/
|
399
|
+
_get: function(inst, name) {
|
400
|
+
return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name];
|
401
|
+
}
|
402
|
+
});
|
403
|
+
|
404
|
+
/**
|
405
|
+
* Invoke the selectbox functionality.
|
406
|
+
*
|
407
|
+
* @param {Object|String} options
|
408
|
+
* @return {Object}
|
409
|
+
*/
|
410
|
+
$.fn.selectbox = function (options) {
|
411
|
+
|
412
|
+
var otherArgs = Array.prototype.slice.call(arguments, 1);
|
413
|
+
if (typeof options == 'string' && options == 'isDisabled') {
|
414
|
+
return $.selectbox['_' + options + 'Selectbox'].apply($.selectbox, [this[0]].concat(otherArgs));
|
415
|
+
}
|
416
|
+
|
417
|
+
if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') {
|
418
|
+
return $.selectbox['_' + options + 'Selectbox'].apply($.selectbox, [this[0]].concat(otherArgs));
|
419
|
+
}
|
420
|
+
|
421
|
+
return this.each(function() {
|
422
|
+
typeof options == 'string' ?
|
423
|
+
$.selectbox['_' + options + 'Selectbox'].apply($.selectbox, [this].concat(otherArgs)) :
|
424
|
+
$.selectbox._attachSelectbox(this, options);
|
425
|
+
});
|
426
|
+
};
|
427
|
+
|
428
|
+
$.selectbox = new Selectbox(); // singleton instance
|
429
|
+
$.selectbox.version = "0.1.3";
|
430
|
+
})(jQuery);
|
@@ -0,0 +1,105 @@
|
|
1
|
+
@CHARSET "UTF-8";
|
2
|
+
.sbHolder{
|
3
|
+
background-color: #2d2d2d;
|
4
|
+
border: solid 1px #515151;
|
5
|
+
font-family: Arial, sans-serif;
|
6
|
+
font-size: 12px;
|
7
|
+
font-weight: normal;
|
8
|
+
height: 30px;
|
9
|
+
position: relative;
|
10
|
+
width: 200px;
|
11
|
+
}
|
12
|
+
.sbSelector{
|
13
|
+
display: block;
|
14
|
+
height: 30px;
|
15
|
+
left: 0;
|
16
|
+
line-height: 30px;
|
17
|
+
outline: none;
|
18
|
+
overflow: hidden;
|
19
|
+
position: absolute;
|
20
|
+
text-indent: 10px;
|
21
|
+
top: 0;
|
22
|
+
width: 170px;
|
23
|
+
}
|
24
|
+
.sbSelector:link, .sbSelector:visited, .sbSelector:hover{
|
25
|
+
color: #EBB52D;
|
26
|
+
outline: none;
|
27
|
+
text-decoration: none;
|
28
|
+
}
|
29
|
+
.sbToggle{
|
30
|
+
background: url(<%= asset_path("select-icons.png") %>) 0 -116px no-repeat;
|
31
|
+
display: block;
|
32
|
+
height: 30px;
|
33
|
+
outline: none;
|
34
|
+
position: absolute;
|
35
|
+
right: 0;
|
36
|
+
top: 0;
|
37
|
+
width: 30px;
|
38
|
+
}
|
39
|
+
.sbToggle:hover{
|
40
|
+
background: url(<%= asset_path("select-icons.png") %>) 0 -167px no-repeat;
|
41
|
+
}
|
42
|
+
.sbToggleOpen{
|
43
|
+
background: url(<%= asset_path("select-icons.png") %>) 0 -16px no-repeat;
|
44
|
+
}
|
45
|
+
.sbToggleOpen:hover{
|
46
|
+
background: url(<%= asset_path("select-icons.png") %>) 0 -66px no-repeat;
|
47
|
+
}
|
48
|
+
.sbHolderDisabled{
|
49
|
+
background-color: #3C3C3C;
|
50
|
+
border: solid 1px #515151;
|
51
|
+
}
|
52
|
+
.sbHolderDisabled .sbHolder{
|
53
|
+
|
54
|
+
}
|
55
|
+
.sbHolderDisabled .sbToggle{
|
56
|
+
|
57
|
+
}
|
58
|
+
.sbOptions{
|
59
|
+
background-color: #212121;
|
60
|
+
border: solid 1px #515151;
|
61
|
+
list-style: none;
|
62
|
+
left: -1px;
|
63
|
+
margin: 0;
|
64
|
+
padding: 0;
|
65
|
+
position: absolute;
|
66
|
+
top: 30px;
|
67
|
+
width: 200px;
|
68
|
+
z-index: 1;
|
69
|
+
overflow-y: auto;
|
70
|
+
}
|
71
|
+
.sbOptions li{
|
72
|
+
padding: 0 7px;
|
73
|
+
}
|
74
|
+
.sbOptions a{
|
75
|
+
border-bottom: dotted 1px #515151;
|
76
|
+
display: block;
|
77
|
+
outline: none;
|
78
|
+
padding: 7px 0 7px 3px;
|
79
|
+
}
|
80
|
+
.sbOptions a:link, .sbOptions a:visited{
|
81
|
+
color: #ddd;
|
82
|
+
text-decoration: none;
|
83
|
+
}
|
84
|
+
.sbOptions a:hover{
|
85
|
+
color: #EBB52D;
|
86
|
+
}
|
87
|
+
.sbOptions li.last a{
|
88
|
+
border-bottom: none;
|
89
|
+
}
|
90
|
+
.sbOptions .sbDisabled{
|
91
|
+
border-bottom: dotted 1px #515151;
|
92
|
+
color: #999;
|
93
|
+
display: block;
|
94
|
+
padding: 7px 0 7px 3px;
|
95
|
+
}
|
96
|
+
.sbOptions .sbGroup{
|
97
|
+
border-bottom: dotted 1px #515151;
|
98
|
+
color: #EBB52D;
|
99
|
+
display: block;
|
100
|
+
font-weight: bold;
|
101
|
+
padding: 7px 0 7px 3px;
|
102
|
+
}
|
103
|
+
.sbOptions .sbSub{
|
104
|
+
padding-left: 17px;
|
105
|
+
}
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-selectbox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alif Rachmawadi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-25 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Custom select box replacement inspired by jQuery UI source
|
15
|
+
email:
|
16
|
+
- subosito@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- jquery-selectbox.gemspec
|
27
|
+
- lib/jquery-selectbox.rb
|
28
|
+
- lib/jquery-selectbox/version.rb
|
29
|
+
- vendor/assets/images/select-icons.png
|
30
|
+
- vendor/assets/javascripts/jquery.selectbox.js
|
31
|
+
- vendor/assets/stylesheets/jquery.selectbox.css.erb
|
32
|
+
homepage: https://github.com/subosito/jquery-selectbox
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.11
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: jQuery Selectbox plugin. Custom select box replacement inspired by jQuery
|
56
|
+
UI source. Require jQuery 1.4.x or higher
|
57
|
+
test_files: []
|