Skip to content

Commit 4e580aa

Browse files
author
bradrobertson
committed
merge conflicts
2 parents 4d4d465 + 8059b6d commit 4e580aa

File tree

6 files changed

+173
-39
lines changed

6 files changed

+173
-39
lines changed

CHANGELOG.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
# 1.2.6
2-
### Sep 15, 2011
1+
# 1.2.7
2+
### In Progress
33

4-
- Fix animation queue when switching tabs for both slideshow and autoscroll
4+
- Fix dateinput selectors bug
55
-
66

7+
# 1.2.6
8+
### Sept 15, 2011
9+
10+
- Fixed animation queue issue when switching tabs in both autoscroll and slideshow plugins [#447](https://github.com/jquerytools/jquerytools/issues/447)
11+
- Native browser validation is now disabled in validator to avoid compatibility issues [#334](https://github.com/jquerytools/jquerytools/issues/334)
12+
- Dateinput now has `beforeChange` event and triggers `change` appropriately [#292](https://github.com/jquerytools/jquerytools/issues/292)
13+
- Tooltip fade bugfix for IE [#363](https://github.com/jquerytools/jquerytools/issues/363)
14+
- Rangeinput vertical position calculations are fixed [#463](https://github.com/jquerytools/jquerytools/issues/463)
15+
- Horizontal accordion works again with smoother animation [#327](https://github.com/jquerytools/jquerytools/issues/327)
16+
- Tabs with history plugin work once again [#261](https://github.com/jquerytools/jquerytools/issues/261)
17+
- Added size parameter back to scrollable [#58](https://github.com/jquerytools/jquerytools/issues/58)
18+
- Dateinput forward/back buttons no longer calculate the wrong date *in some cases* [#476](https://github.com/jquerytools/jquerytools/pull/476)

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ jQuery Tools is a collection of the most important user-interface components for
66
##Contributing
77

88
Please issue pull requests to the [dev branch](https://github.com/jquerytools/jquerytools/tree/dev).
9-
This is where active development takes place, we then merge changes into master for releases
9+
10+
This is where active development takes place, we then merge changes into master for releases. That will become v1.2.6.
11+
Most of the development goes to 2.0 which is currently a private repository.
12+

src/dateinput/dateinput.js

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,14 @@
282282
currMonth = date.getMonth();
283283
currDay = date.getDate();
284284

285+
e || (e = $.Event("api"));
286+
287+
// focus the input after selection (doesn't work in IE)
288+
if (e.type == "click" && !$.browser.msie) {
289+
input.focus();
290+
}
285291

286-
// beforChange
287-
e = e || $.Event("api");
292+
// beforeChange
288293
e.type = "beforeChange";
289294

290295
fire.trigger(e, [date]);
@@ -317,13 +322,13 @@
317322
if (e.ctrlKey) { return true; }
318323
var key = e.keyCode;
319324

320-
// backspace clears the value
321-
if (key == 8) {
325+
// backspace or delete clears the value
326+
if (key == 8 || key == 46) {
322327
input.val("");
323328
return self.hide(e);
324329
}
325330

326-
// esc or tab key
331+
// esc or tab key exits
327332
if (key == 27 || key == 9) { return self.hide(e); }
328333

329334
if ($(KEYS).index(key) >= 0) {
@@ -414,16 +419,16 @@
414419

415420
opened = true;
416421

417-
// month selector
418-
monthSelector.unbind("change").change(function() {
419-
self.setValue(yearSelector.val(), $(this).val());
420-
});
421-
422-
// year selector
423-
yearSelector.unbind("change").change(function() {
424-
self.setValue($(this).val(), monthSelector.val());
425-
});
426-
422+
// month selector
423+
monthSelector.unbind("change").change(function() {
424+
self.setValue(integer(yearSelector.val()), integer($(this).val()));
425+
});
426+
427+
// year selector
428+
yearSelector.unbind("change").change(function() {
429+
self.setValue(integer($(this).val()), integer(monthSelector.val()));
430+
});
431+
427432
// prev / next month
428433
pm = root.find("#" + css.prev).unbind("click").click(function(e) {
429434
if (!pm.hasClass(css.disabled)) {
@@ -664,11 +669,11 @@
664669
e.type = "onHide";
665670
fire.trigger(e);
666671

667-
$(document).unbind("click.d").unbind("keydown.d");
668-
669672
// cancelled ?
670673
if (e.isDefaultPrevented()) { return; }
671674

675+
$(document).unbind("click.d").unbind("keydown.d");
676+
672677
// do the hide
673678
root.hide();
674679
opened = false;
@@ -729,6 +734,10 @@
729734
if (!opened && $(KEYS).index(key) >= 0) {
730735
self.show(e);
731736
return e.preventDefault();
737+
738+
// clear value on backspace or delete
739+
} else if (key == 8 || key == 46) {
740+
input.val("");
732741
}
733742

734743
// allow tab

src/scrollable/scrollable.navigator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161

6262
if (hashed) {
63-
history.pushState({i: 0});
63+
history.pushState({i: 0}, '');
6464

6565
$(window).bind("popstate", function(evt) {
6666
var s = evt.originalEvent.state;
@@ -71,7 +71,7 @@
7171
function doClick(el, i, e) {
7272
api.seekTo(i);
7373
e.preventDefault();
74-
if (hashed) { history.pushState({i: i}); }
74+
if (hashed) { history.pushState({i: i}, ''); }
7575
}
7676

7777
function els() {

src/validator/validator.js

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,17 @@
9595
};
9696

9797
/* calculate error message position relative to the input */
98-
function getPosition(trigger, el, conf) {
98+
function getPosition(trigger, el, conf) {
99+
100+
// Get the first element in the selector set
101+
el = $(el).first() || el;
99102

100103
// get origin top/left position
101-
var top = trigger.offset().top,
102-
left = trigger.offset().left,
103-
pos = conf.position.split(/,?\s+/),
104-
y = pos[0],
105-
x = pos[1];
104+
var top = trigger.offset().top,
105+
left = trigger.offset().left,
106+
pos = conf.position.split(/,?\s+/),
107+
y = pos[0],
108+
x = pos[1];
106109

107110
top -= el.outerHeight() - conf.offset[0];
108111
left += trigger.outerWidth() + conf.offset[1];
@@ -256,12 +259,21 @@
256259
return p.test(el.val());
257260
});
258261

262+
v.fn(":radio", "Please select an option.", function(el) {
263+
var checked = false;
264+
var els = $("[name=" + el.attr("name") + "]").each(function(i, el) {
265+
if ($(el).is(":checked")) {
266+
checked = true;
267+
}
268+
});
269+
return (checked) ? true : false;
270+
});
259271

260272
function Validator(inputs, form, conf) {
261273

262274
// private variables
263275
var self = this,
264-
fire = form.add(self);
276+
fire = form.add(self);
265277

266278
// make sure there are input fields available
267279
inputs = inputs.not(":button, :image, :reset, :submit");
@@ -388,6 +400,17 @@
388400

389401
els = els || inputs;
390402
els = els.not(":disabled");
403+
404+
// filter duplicate elements by name
405+
var names = {};
406+
els = els.filter(function(){
407+
var name = $(this).attr("name");
408+
if (!names[name]) {
409+
names[name] = true;
410+
return $(this);
411+
}
412+
});
413+
391414
if (!els.length) { return true; }
392415

393416
e = e || $.Event();
@@ -401,7 +424,7 @@
401424
var errs = [];
402425

403426
// loop trough the inputs
404-
els.not(":radio:not(:checked)").each(function() {
427+
els.each(function() {
405428

406429
// field and it's error message container
407430
var msgs = [],
@@ -545,22 +568,27 @@
545568
});
546569
}
547570

548-
// checkboxes, selects and radios are checked separately
571+
// checkboxes and selects are checked separately
549572
inputs.filter(":checkbox, select").filter("[required]").bind("change.V", function(e) {
550573
var el = $(this);
551574
if (this.checked || (el.is("select") && $(this).val())) {
552575
effects[conf.effect][1].call(self, el, e);
553576
}
554-
});
555-
556-
var radios = inputs.filter(":radio").change(function(e) {
557-
self.checkValidity(radios, e);
577+
});
578+
579+
// get radio groups by name
580+
inputs.filter(":radio[required]").bind("change.V", function(e) {
581+
var els = $("[name=" + $(e.srcElement).attr("name") + "]");
582+
if ((els != null) && (els.length != 0)) {
583+
self.checkValidity(els, e);
584+
}
558585
});
559586

560587
// reposition tooltips when window is resized
561588
$(window).resize(function() {
562589
self.reflow();
563590
});
591+
564592
}
565593

566594

@@ -593,6 +621,4 @@
593621

594622
};
595623

596-
})(jQuery);
597-
598-
624+
})(jQuery);

test/scrollable/history.html

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
<script src="../js/jquery-1.6.2.js"></script>
3+
<script src="../../src/scrollable/scrollable.js"></script>
4+
<script src="../../src/scrollable/scrollable.navigator.js"></script>
5+
<link rel='stylesheet' href='http://flowplayer.org/tools/css/tabs-flowplayer-v2.css'>
6+
7+
<style type="text/css">
8+
/* override the root element to enable scrolling */
9+
#flowpanes {
10+
position:relative;
11+
overflow:hidden;
12+
clear:both;
13+
}
14+
15+
/* override single pane */
16+
#flowpanes div {
17+
float:left;
18+
display:block;
19+
width:670px;
20+
font-size:14px;
21+
}
22+
23+
/* our additional wrapper element for the items */
24+
#flowpanes .items {
25+
width:20000em;
26+
position:absolute;
27+
clear:both;
28+
margin:0;
29+
padding:0;
30+
}
31+
32+
#flowpanes .less, #flowpanes .less a {
33+
color:#999 !important;
34+
font-size:11px;
35+
}
36+
37+
</style>
38+
39+
<!-- tabs work as navigator for scrollable -->
40+
<ul id="flowtabs" class="navi">
41+
<li><a id="t1" href="#story">The Story</a></li>
42+
<li><a id="t2" href="#features">Features</a></li>
43+
<li><a id="t3" href="#plugins">Plugins</a></li>
44+
<li><a id="t4" href="#demos">Demos</a></li>
45+
</ul>
46+
47+
<!-- tab panes -->
48+
<div id="flowpanes">
49+
50+
<!-- wrapper for scrollable items -->
51+
<div class="items">
52+
53+
<!-- the items -->
54+
<div> [ story html ]</div>
55+
<div> [ features html ]</div>
56+
<div> [ plugins html ]</div>
57+
<div> [ demos html ]</div>
58+
59+
</div>
60+
61+
</div>
62+
63+
<script type="text/javascript">
64+
// wait until document is fully scriptable
65+
$(function() {
66+
67+
// select #flowplanes and make it scrollable. use circular and navigator plugins
68+
$("#flowpanes").scrollable({ circular: true, mousewheel: true }).navigator({
69+
70+
// select #flowtabs to be used as navigator
71+
navi: "#flowtabs",
72+
73+
// select A tags inside the navigator to work as items (not direct children)
74+
naviItem: 'a',
75+
76+
// assign "current" class name for the active A tag inside navigator
77+
activeClass: 'current',
78+
79+
// make browser's back button work
80+
history: true
81+
82+
});
83+
});
84+
</script>

0 commit comments

Comments
 (0)