Skip to content
This repository was archived by the owner on Dec 27, 2021. It is now read-only.

Commit dc5ac65

Browse files
committed
1.5.2
1 parent 91418e6 commit dc5ac65

File tree

4 files changed

+45
-36
lines changed

4 files changed

+45
-36
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
jQuery Form Styler <sup>[1.5.1](http://dimox.name/jquery-form-styler/#log)</sup>
1+
jQuery Form Styler <sup>[1.5.2](http://dimox.name/jquery-form-styler/#log)</sup>
22
==================
33

44
jQuery-плагин для стилизации элементов html-форм:

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Dimox/jQueryFormStyler",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"main": "jquery.formstyler.css",
55
"description": "jQuery-плагин для стилизации элементов html-форм",
66
"license": "MIT",

jquery.formstyler.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* jQuery Form Styler v1.5.1
2+
* jQuery Form Styler v1.5.2
33
* https://github.com/Dimox/jQueryFormStyler
44
*
55
* Copyright 2012-2014 Dimox (http://dimox.name/)
66
* Released under the MIT license.
77
*
8-
* Date: 2014.05.03
8+
* Date: 2014.05.28
99
*
1010
*/
1111

@@ -126,7 +126,7 @@
126126

127127
// обновление при динамическом изменении
128128
el.on('refresh', function() {
129-
el.parent().before(el).remove();
129+
el.off().parent().before(el).remove();
130130
checkbox();
131131
});
132132

@@ -199,7 +199,7 @@
199199

200200
// обновление при динамическом изменении
201201
el.on('refresh', function() {
202-
el.parent().before(el).remove();
202+
el.off().parent().before(el).remove();
203203
radio();
204204
});
205205

@@ -232,8 +232,16 @@
232232
file.append(el);
233233
if (el.is(':disabled')) file.addClass('disabled');
234234
el.change(function() {
235-
name.text(el.val().replace(/.+[\\\/]/, ''));
236-
if (el.val() == '') {
235+
var value = el.val();
236+
if (el.is('[multiple]')) {
237+
value = '';
238+
var files = el[0].files;
239+
for (var i = 0; i < files.length; i++) {
240+
value += ( (i > 0) ? ', ' : '' ) + files[i].name;
241+
}
242+
}
243+
name.text(value.replace(/.+[\\\/]/, ''));
244+
if (value == '') {
237245
name.text(opt.filePlaceholder);
238246
file.removeClass('changed');
239247
} else {
@@ -256,7 +264,7 @@
256264

257265
// обновление при динамическом изменении
258266
el.on('refresh', function() {
259-
el.parent().before(el).remove();
267+
el.off().parent().before(el).remove();
260268
file();
261269
})
262270

@@ -551,7 +559,7 @@
551559
var liText = t.text();
552560
if (selectedText != liText) {
553561
var index = t.index();
554-
if (t.is('.option')) index -= t.prevAll('.optgroup').length;
562+
index -= t.prevAll('.optgroup').length;
555563
t.addClass('selected sel').siblings().removeClass('selected sel');
556564
option.prop('selected', false).eq(index).prop('selected', true);
557565
selectedText = liText;
@@ -793,7 +801,7 @@
793801

794802
// обновление при динамическом изменении
795803
el.on('refresh', function() {
796-
el.parent().before(el).remove();
804+
el.off().parent().before(el).remove();
797805
selectbox();
798806
});
799807

0 commit comments

Comments
 (0)