Merge branch 'master' into selectmenu

This commit is contained in:
Felix Nagel 2012-11-23 13:49:12 +01:00
commit e25cdd88e7
45 changed files with 3035 additions and 1376 deletions

View File

@ -9,14 +9,11 @@
<script src="../../ui/jquery.ui.widget.js"></script> <script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.progressbar.js"></script> <script src="../../ui/jquery.ui.progressbar.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style>
.ui-progressbar .ui-progressbar-value { background-image: url(images/pbar-ani.gif); }
</style>
<script> <script>
$(function() { $(function() {
$( "#progressbar" ).progressbar({ $( "#progressbar" ).progressbar({
value: 59 value: 59
}); }).find( ".ui-progressbar-value div" ).addClass( "ui-progressbar-overlay" );
}); });
</script> </script>
</head> </head>
@ -27,10 +24,10 @@
<div class="demo-description"> <div class="demo-description">
<p> <p>
This progressbar has an animated fill by setting the This progressbar has an animated fill by setting the
<code>background-image</code> <code>ui-progressbar-overlay</code> class
on the on the
<code>.ui-progressbar-value</code> <code>.ui-progressbar-value</code>
element, using css. element's overlay div.
</p> </p>
</div> </div>
</body> </body>

View File

@ -0,0 +1,53 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Progressbar - Indeterminate Value</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.8.3.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.progressbar.js"></script>
<link rel="stylesheet" href="../demos.css">
<script>
$(function() {
$( "#progressbar" ).progressbar({
value: false
});
$( "button" ).on( "click", function( event ) {
var target = $( event.target ),
pbar = $( "#progressbar" ),
pbarValue = pbar.find( ".ui-progressbar-value" );
if ( target.is( "#numButton" ) ) {
pbar.progressbar( "option", {
value: Math.floor( Math.random() * 100 )
});
} else if ( target.is( "#colorButton" ) ) {
pbarValue.css({
"background": '#' + Math.floor( Math.random() * 16777215 ).toString( 16 )
});
} else if ( target.is( "#falseButton" ) ) {
pbar.progressbar( "option", "value", false );
}
});
});
</script>
<style>
#progressbar .ui-progressbar-value {
background-color: #CCCCCC;
}
</style>
</head>
<body>
<div id="progressbar"></div>
<button id="numButton">Random Value - Determinate</button>
<button id="falseButton">Indeterminate</button>
<button id="colorButton">Random Color</button>
<div class="demo-description">
<p>Indeterminate progress bar and switching between determinate and indeterminate styles.</p>
</div>
</body>
</html>

View File

@ -10,6 +10,7 @@
<li><a href="default.html">Default functionality</a></li> <li><a href="default.html">Default functionality</a></li>
<li><a href="animated.html">Animated</a></li> <li><a href="animated.html">Animated</a></li>
<li><a href="resize.html">Resizable progressbar</a></li> <li><a href="resize.html">Resizable progressbar</a></li>
<li><a href="indeterminate.html">Indeterminate</a></li>
</ul> </ul>
</body> </body>

View File

@ -300,8 +300,8 @@ grunt.initConfig({
}), }),
// TODO consider reenabling some of these rules // TODO consider reenabling some of these rules
rules: { rules: {
"adjoining-classes": false,
"import": false, "import": false,
"important": false,
"outline-none": false, "outline-none": false,
// especially this one // especially this one
"overqualified-elements": false, "overqualified-elements": false,

View File

@ -59,6 +59,13 @@
<input type="radio" id="radio23" name="radio" checked="checked"><label for="radio23">Choice 3</label> <input type="radio" id="radio23" name="radio" checked="checked"><label for="radio23">Choice 3</label>
</div> </div>
</form> </form>
<form>
<div id="radio3">
<input type="radio" id="radio31" name="data['Page']['parse']"><label for="radio31">Choice 1</label>
<input type="radio" id="radio32" name="data['Page']['parse']" checked="checked"><label for="radio32">Choice 2</label>
<input type="radio" id="radio33" name="data['Page']['parse']"><label for="radio33">Choice 3</label>
</div>
</form>
<input type="checkbox" id="check"><label for="check">Toggle</label> <input type="checkbox" id="check"><label for="check">Toggle</label>

View File

@ -1,8 +1,26 @@
/* /*
* button_events.js * button_events.js
*/ */
(function() { (function($) {
module("button: events"); module("button: events");
test("buttonset works with single-quote named elements (#7505)", function() {
expect( 1 );
$("#radio3").buttonset();
$("#radio33").click( function(){
ok( true, "button clicks work with single-quote named elements" );
}).click();
});
test( "when button loses focus, ensure active state is removed (#8559)", function() {
expect( 1 );
$("#button").button().keypress( function() {
$("#button").one( "blur", function() {
ok( !$("#button").is(".ui-state-active"), "button loses active state appropriately" );
}).blur();
}).focus().simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ).simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
});
})(jQuery); })(jQuery);

View File

@ -13,4 +13,40 @@ test("destroy", function() {
}); });
}); });
test( "refresh: Ensure disabled state is preserved correctly.", function() {
expect( 8 );
var element = $( "<a href='#'></a>" );
element.button({ disabled: true }).button( "refresh" );
ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" ); //See #8237
element = $( "<div></div>" );
element.button({ disabled: true }).button( "refresh" );
ok( element.button( "option", "disabled" ), "<div> buttons should remain disabled after refresh" );
element = $( "<button></button>" );
element.button( { disabled: true} ).button( "refresh" );
ok( element.button( "option", "disabled" ), "<button> should remain disabled after refresh");
element = $( "<input type='checkbox'>" );
element.button( { disabled: true} ).button( "refresh" );
ok( element.button( "option", "disabled" ), "Checkboxes should remain disabled after refresh");
element = $( "<input type='radio'>" );
element.button( { disabled: true} ).button( "refresh" );
ok( element.button( "option", "disabled" ), "Radio buttons should remain disabled after refresh");
element = $( "<button></button>" );
element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" );
ok( !element.button( "option", "disabled" ), "Changing a <button>'s disabled property should update the state after refresh."); //See #8828
element = $( "<input type='checkbox'>" );
element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" );
ok( !element.button( "option", "disabled" ), "Changing a checkbox's disabled property should update the state after refresh.");
element = $( "<input type='radio'>" );
element.button( { disabled: true} ).prop( "disabled", false ).button( "refresh" );
ok( !element.button( "option", "disabled" ), "Changing a radio button's disabled property should update the state after refresh.");
});
})(jQuery); })(jQuery);

View File

@ -72,12 +72,4 @@ test( "#7534 - Button label selector works for ids with \":\"", function() {
ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" ); ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
}); });
test( "#8237 - Anchor tags lose disabled state when refreshed", function() {
expect( 1 );
var element = $( "<a id='a8237'></a>" ).appendTo( "#qunit-fixture" );
element.button({ disabled: true }).button( "refresh" );
ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" );
});
})( jQuery ); })( jQuery );

View File

@ -6,6 +6,16 @@
module("datepicker: core"); module("datepicker: core");
test("initialization - Reinitialization after body had been emptied.", function() {
expect( 1 );
var bodyContent = $('body').children(), inp = $("#inp");
$("#inp").datepicker();
$('body').empty().append(inp);
$("#inp").datepicker();
ok( $("#"+$.datepicker._mainDivId).length===1, "Datepicker container added" );
$('body').empty().append(bodyContent); // Returning to initial state for later tests
});
test( "widget method - empty collection", function() { test( "widget method - empty collection", function() {
expect( 1 ); expect( 1 );
$( "#nonExist" ).datepicker(); // should create nothing $( "#nonExist" ).datepicker(); // should create nothing

View File

@ -132,16 +132,21 @@ test('beforeShowDay-getDate', function() {
dp = $('#ui-datepicker-div'); dp = $('#ui-datepicker-div');
inp.val('01/01/2010').datepicker('show'); inp.val('01/01/2010').datepicker('show');
// contains non-breaking space // contains non-breaking space
equal($('div.ui-datepicker-title').text(), 'January 2010', 'Initial month'); equal($('div.ui-datepicker-title').text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "<span>January&#xa0;2010</span>" ).text(), 'Initial month');
$('a.ui-datepicker-next', dp).click(); $('a.ui-datepicker-next', dp).click();
$('a.ui-datepicker-next', dp).click(); $('a.ui-datepicker-next', dp).click();
// contains non-breaking space // contains non-breaking space
equal($('div.ui-datepicker-title').text(), 'March 2010', 'After next clicks'); equal($('div.ui-datepicker-title').text(),
$( "<span>March&#xa0;2010</span>" ).text(), 'After next clicks');
inp.datepicker('hide').datepicker('show'); inp.datepicker('hide').datepicker('show');
$('a.ui-datepicker-prev', dp).click(); $('a.ui-datepicker-prev', dp).click();
$('a.ui-datepicker-prev', dp).click(); $('a.ui-datepicker-prev', dp).click();
// contains non-breaking space // contains non-breaking space
equal($('div.ui-datepicker-title').text(), 'November 2009', 'After prev clicks'); equal($('div.ui-datepicker-title').text(),
$( "<span>November&#xa0;2009</span>" ).text(), 'After prev clicks');
inp.datepicker('hide'); inp.datepicker('hide');
}); });

View File

@ -146,7 +146,10 @@ test('otherMonths', function() {
var inp = TestHelpers.datepicker.init('#inp'), var inp = TestHelpers.datepicker.init('#inp'),
pop = $('#ui-datepicker-div'); pop = $('#ui-datepicker-div');
inp.val('06/01/2009').datepicker('show'); inp.val('06/01/2009').datepicker('show');
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', equal(pop.find('tbody').text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(),
'Other months - none'); 'Other months - none');
ok(pop.find('td:last *').length === 0, 'Other months - no content'); ok(pop.find('td:last *').length === 0, 'Other months - no content');
inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show'); inp.datepicker('hide').datepicker('option', 'showOtherMonths', true).datepicker('show');
@ -158,7 +161,10 @@ test('otherMonths', function() {
'Other months - select'); 'Other months - select');
ok(pop.find('td:last a').length === 1, 'Other months - link content'); ok(pop.find('td:last a').length === 1, 'Other months - link content');
inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show'); inp.datepicker('hide').datepicker('option', 'showOtherMonths', false).datepicker('show');
equal(pop.find('tbody').text(), '\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0', equal(pop.find('tbody').text(),
// support: IE <9, jQuery <1.8
// In IE7/8 with jQuery <1.8, encoded spaces behave in strange ways
$( "<span>\u00a0123456789101112131415161718192021222324252627282930\u00a0\u00a0\u00a0\u00a0</span>" ).text(),
'Other months - none'); 'Other months - none');
ok(pop.find('td:last *').length === 0, 'Other months - no content'); ok(pop.find('td:last *').length === 0, 'Other months - no content');
}); });

View File

@ -424,8 +424,8 @@ test("title", function() {
var el = $('<div></div>').dialog(); var el = $('<div></div>').dialog();
// some browsers return a non-breaking space and some return "&nbsp;" // some browsers return a non-breaking space and some return "&nbsp;"
// so we get the text to normalize to the actual non-breaking space // so we generate a non-breaking space for comparison
equal(el.dialog('widget').find(".ui-dialog-title").text(), " ", "[default]"); equal(titleText(), $( "<span>&#160;</span>" ).html(), "[default]");
equal(el.dialog("option", "title"), "", "option not changed"); equal(el.dialog("option", "title"), "", "option not changed");
el.remove(); el.remove();

View File

@ -16,6 +16,7 @@
"ui/jquery.ui.core.js", "ui/jquery.ui.core.js",
"ui/jquery.ui.widget.js", "ui/jquery.ui.widget.js",
"ui/jquery.ui.mouse.js", "ui/jquery.ui.mouse.js",
"ui/jquery.ui.resizable.js",
"ui/jquery.ui.draggable.js" "ui/jquery.ui.draggable.js"
] ]
}); });

View File

@ -44,4 +44,33 @@ test("No options, absolute", function() {
TestHelpers.draggable.shouldMove(el); TestHelpers.draggable.shouldMove(el);
}); });
test("resizable handle with complex markup (#8756 / #8757)", function() {
expect( 2 );
$('#draggable1')
.append(
$('<div>')
.addClass("ui-resizable-handle")
.addClass("ui-resizable-w")
.append($('<div>'))
);
var handle = '.ui-resizable-w div',
target = $('#draggable1').draggable().resizable({ handles: 'all' }),
drag = function(el, dx) {
$(el)
.simulate("mouseover")
.simulate("drag", {
dx: dx || 0,
speed: 'sync'
});
};
drag(handle, -50);
equal( target.width(), 250, "compare width" );
drag(handle, 50);
equal( target.width(), 200, "compare width" );
});
})(jQuery); })(jQuery);

View File

@ -23,7 +23,7 @@ test( "change", function() {
}); });
test( "complete", function() { test( "complete", function() {
expect( 3 ); expect( 4 );
var value, var value,
changes = 0, changes = 0,
element = $( "#progressbar" ).progressbar({ element = $( "#progressbar" ).progressbar({
@ -32,12 +32,14 @@ test( "complete", function() {
deepEqual( element.progressbar( "value" ), value, "change at " + value ); deepEqual( element.progressbar( "value" ), value, "change at " + value );
}, },
complete: function() { complete: function() {
equal( changes, 2, "complete triggered after change" ); equal( changes, 3, "complete triggered after change and not on indeterminate" );
} }
}); });
value = 5; value = 5;
element.progressbar( "value", value ); element.progressbar( "value", value );
value = false;
element.progressbar( "value", value );
value = 100; value = 100;
element.progressbar( "value", value ); element.progressbar( "value", value );
}); });

View File

@ -170,4 +170,25 @@ test("handle with complex markup (#8756)", function() {
equal( target.width(), 100, "compare width" ); equal( target.width(), 100, "compare width" );
}); });
test("resizable accounts for scroll position correctly (#3815)", function() {
expect( 3 );
var position, top, left,
container = $("<div style='overflow:scroll;height:300px;width:300px;position:relative;'></div>").appendTo("#qunit-fixture"),
overflowed = $("<div style='width: 1000px; height: 1000px;'></div>").appendTo( container ),
el = $("<div style='height:100px;width:100px;position:absolute;top:10px;left:10px;'></div>").appendTo( overflowed ).resizable({ handles: 'all' }),
handle = ".ui-resizable-e";
container.scrollLeft( 100 ).scrollTop( 100 );
position = el.position();
left = el.css("left");
top = el.css("top");
TestHelpers.resizable.drag(handle, 50, 50);
deepEqual( el.position(), position, "position stays the same when resized" );
equal( el.css("left"), left, "css('left') stays the same when resized" );
equal( el.css("top"), top, "css('top') stays the same when resized" );
});
})(jQuery); })(jQuery);

View File

@ -70,7 +70,6 @@ test( "programmatic event triggers", function() {
}) })
.slider( "value", 0 ); .slider( "value", 0 );
QUnit.reset();
// Test values method // Test values method
el = $( "<div></div>" ) el = $( "<div></div>" )
.slider({ .slider({
@ -81,7 +80,6 @@ test( "programmatic event triggers", function() {
}) })
.slider( "values", [80, 90] ); .slider( "values", [80, 90] );
QUnit.reset();
// Test value option // Test value option
el = $( "<div></div>" ) el = $( "<div></div>" )
.slider({ .slider({
@ -91,7 +89,6 @@ test( "programmatic event triggers", function() {
}) })
.slider( "option", "value", 0 ); .slider( "option", "value", 0 );
QUnit.reset();
// Test values option // Test values option
el = $( "<div></div>" ) el = $( "<div></div>" )
.slider({ .slider({
@ -104,4 +101,55 @@ test( "programmatic event triggers", function() {
}); });
test( "mouse based interaction part two: when handles overlap", function() {
expect(4);
var el = $( "#slider1" )
.slider({
values: [ 0, 0, 0 ],
start: function( event, ui ) {
equal(handles.index(ui.handle), 2, "rightmost handle activated when overlapping at minimum (#3736)");
}
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(0).simulate( "drag", { dx: 10 } );
el.slider( "destroy" );
el = $( "#slider1" )
.slider({
values: [ 10, 10, 10 ],
max: 10,
start: function( event, ui ) {
equal(handles.index(ui.handle), 0, "leftmost handle activated when overlapping at maximum");
}
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(0).simulate( "drag", { dx: -10 } );
el.slider( "destroy" );
el = $( "#slider1" )
.slider({
values: [ 19, 20 ]
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(0).simulate( "drag", { dx: 10 } );
el.one("slidestart", function(event, ui) {
equal(handles.index(ui.handle), 0, "left handle activated if left was moved last");
});
handles.eq(0).simulate( "drag", { dx: 10 } );
el.slider( "destroy" );
el = $( "#slider1" )
.slider({
values: [ 19, 20 ]
}),
handles = el.find( ".ui-slider-handle" );
handles.eq(1).simulate( "drag", { dx: -10 } );
el.one("slidestart", function(event, ui) {
equal(handles.index(ui.handle), 1, "right handle activated if right was moved last (#3467)");
});
handles.eq(0).simulate( "drag", { dx: 10 } );
});
}( jQuery ) ); }( jQuery ) );

View File

@ -41,10 +41,10 @@ test("enable", function() {
equal(actual, expected, 'enable is chainable'); equal(actual, expected, 'enable is chainable');
el = $('<div></div>').slider({ disabled: true }); el = $('<div></div>').slider({ disabled: true });
ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class before enable method call'); ok(el.hasClass('ui-state-disabled'), 'slider has ui-state-disabled class before enable method call');
ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class before enable method call'); ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class before enable method call');
el.slider('enable'); el.slider('enable');
ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class after enable method call'); ok(!el.hasClass('ui-state-disabled'), 'slider does not have ui-state-disabled class after enable method call');
ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class after enable method call'); ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class after enable method call');
}); });
@ -56,10 +56,10 @@ test("disable", function() {
equal(actual, expected, 'disable is chainable'); equal(actual, expected, 'disable is chainable');
el = $('<div></div>').slider({ disabled: false }); el = $('<div></div>').slider({ disabled: false });
ok(!el.hasClass('ui-disabled'), 'slider does not have ui-disabled class before disabled method call'); ok(!el.hasClass('ui-state-disabled'), 'slider does not have ui-state-disabled class before disabled method call');
ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class before disable method call'); ok(!el.hasClass('ui-slider-disabled'), 'slider does not have ui-slider-disabled class before disable method call');
el.slider('disable'); el.slider('disable');
ok(el.hasClass('ui-disabled'), 'slider has ui-disabled class after disable method call'); ok(el.hasClass('ui-state-disabled'), 'slider has ui-state-disabled class after disable method call');
ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class after disable method call'); ok(el.hasClass('ui-slider-disabled'), 'slider has ui-slider-disabled class after disable method call');
}); });

View File

@ -6,10 +6,13 @@ var disabled = TestHelpers.tabs.disabled,
module( "tabs: methods" ); module( "tabs: methods" );
test( "destroy", function() { test( "destroy", function() {
expect( 1 ); expect( 2 );
domEqual( "#tabs1", function() { domEqual( "#tabs1", function() {
$( "#tabs1" ).tabs().tabs( "destroy" ); $( "#tabs1" ).tabs().tabs( "destroy" );
}); });
domEqual( "#tabs2", function() {
$( "#tabs2" ).tabs().tabs( "destroy" );
});
}); });
test( "enable", function() { test( "enable", function() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -8,9 +8,32 @@
* *
* http://docs.jquery.com/UI/Accordion#theming * http://docs.jquery.com/UI/Accordion#theming
*/ */
.ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; } .ui-accordion .ui-accordion-header {
.ui-accordion .ui-accordion-icons { padding-left: 2.2em; } display: block;
.ui-accordion .ui-accordion-noicons { padding-left: .7em; } cursor: pointer;
.ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; } position: relative;
.ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } margin-top: 2px;
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; } padding: .5em .5em .5em .7em;
zoom: 1;
}
.ui-accordion .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-noicons {
padding-left: .7em;
}
.ui-accordion .ui-accordion-icons .ui-accordion-icons {
padding-left: 2.2em;
}
.ui-accordion .ui-accordion-header .ui-accordion-header-icon {
position: absolute;
left: .5em;
top: 50%;
margin-top: -8px;
}
.ui-accordion .ui-accordion-content {
padding: 1em 2.2em;
border-top: 0;
overflow: auto;
zoom: 1;
}

View File

@ -8,33 +8,109 @@
* *
* http://docs.jquery.com/UI/Button#theming * http://docs.jquery.com/UI/Button#theming
*/ */
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ .ui-button {
.ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; } display: inline-block;
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ position: relative;
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ padding: 0;
.ui-button-icons-only { width: 3.4em; } margin-right: .1em;
button.ui-button-icons-only { width: 3.7em; } cursor: pointer;
text-align: center;
zoom: 1;
overflow: visible; /* removes extra width in IE */
}
.ui-button,
.ui-button:link,
.ui-button:visited,
.ui-button:hover,
.ui-button:active {
text-decoration: none;
}
/* to make room for the icon, a width needs to be set here */
.ui-button-icon-only {
width: 2.2em;
}
/* button elements seem to need a little more width */
button.ui-button-icon-only {
width: 2.4em;
}
.ui-button-icons-only {
width: 3.4em;
}
button.ui-button-icons-only {
width: 3.7em;
}
/* button text element */ /* button text element */
.ui-button .ui-button-text { display: block; line-height: 1.4; } .ui-button .ui-button-text {
.ui-button-text-only .ui-button-text { padding: .4em 1em; } display: block;
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } line-height: 1.4;
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } }
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } .ui-button-text-only .ui-button-text {
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } padding: .4em 1em;
}
.ui-button-icon-only .ui-button-text,
.ui-button-icons-only .ui-button-text {
padding: .4em;
text-indent: -9999999px;
}
.ui-button-text-icon-primary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 1em .4em 2.1em;
}
.ui-button-text-icon-secondary .ui-button-text,
.ui-button-text-icons .ui-button-text {
padding: .4em 2.1em .4em 1em;
}
.ui-button-text-icons .ui-button-text {
padding-left: 2.1em;
padding-right: 2.1em;
}
/* no icon support for input elements, provide padding by default */ /* no icon support for input elements, provide padding by default */
input.ui-button { padding: .4em 1em; } input.ui-button {
padding: .4em 1em;
}
/* button icon element(s) */ /* button icon element(s) */
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } .ui-button-icon-only .ui-icon,
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } .ui-button-text-icon-primary .ui-icon,
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } .ui-button-text-icon-secondary .ui-icon,
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } .ui-button-text-icons .ui-icon,
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } .ui-button-icons-only .ui-icon {
position: absolute;
top: 50%;
margin-top: -8px;
}
.ui-button-icon-only .ui-icon {
left: 50%;
margin-left: -8px;
}
.ui-button-text-icon-primary .ui-button-icon-primary,
.ui-button-text-icons .ui-button-icon-primary,
.ui-button-icons-only .ui-button-icon-primary {
left: .5em;
}
.ui-button-text-icon-secondary .ui-button-icon-secondary,
.ui-button-text-icons .ui-button-icon-secondary,
.ui-button-icons-only .ui-button-icon-secondary {
right: .5em;
}
.ui-button-text-icons .ui-button-icon-secondary,
.ui-button-icons-only .ui-button-icon-secondary {
right: .5em;
}
/* button sets */ /* button sets */
.ui-buttonset { margin-right: 7px; } .ui-buttonset {
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } margin-right: 7px;
}
.ui-buttonset .ui-button {
margin-left: 0;
margin-right: -.3em;
}
/* workarounds */ /* workarounds */
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ /* reset extra padding in Firefox */
button.ui-button::-moz-focus-inner {
border: 0;
padding: 0;
}

View File

@ -11,31 +11,82 @@
/* Layout helpers /* Layout helpers
----------------------------------*/ ----------------------------------*/
.ui-helper-hidden { display: none; } .ui-helper-hidden {
.ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } display: none;
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; } .ui-helper-hidden-accessible {
.ui-helper-clearfix:after { clear: both; } border: 0;
.ui-helper-clearfix { zoom: 1; } clip: rect(0 0 0 0);
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.ui-helper-reset {
margin: 0;
padding: 0;
border: 0;
outline: 0;
line-height: 1.3;
text-decoration: none;
font-size: 100%;
list-style: none;
}
.ui-helper-clearfix:before,
.ui-helper-clearfix:after {
content: "";
display: table;
}
.ui-helper-clearfix:after {
clear: both;
}
.ui-helper-clearfix {
zoom: 1;
}
.ui-helper-zfix {
width: 100%;
height: 100%;
top: 0;
left: 0;
position: absolute;
opacity: 0;
filter:Alpha(Opacity=0);
}
.ui-front { z-index: 100; } .ui-front {
z-index: 100;
}
/* Interaction Cues /* Interaction Cues
----------------------------------*/ ----------------------------------*/
.ui-state-disabled { cursor: default !important; } .ui-state-disabled {
cursor: default !important;
}
/* Icons /* Icons
----------------------------------*/ ----------------------------------*/
/* states and images */ /* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } .ui-icon {
display: block;
text-indent: -99999px;
overflow: hidden;
background-repeat: no-repeat;
}
/* Misc visuals /* Misc visuals
----------------------------------*/ ----------------------------------*/
/* Overlays */ /* Overlays */
.ui-widget-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; } .ui-widget-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

View File

@ -8,49 +8,178 @@
* *
* http://docs.jquery.com/UI/Datepicker#theming * http://docs.jquery.com/UI/Datepicker#theming
*/ */
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } .ui-datepicker {
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } width: 17em;
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } padding: .2em .2em 0;
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } display: none;
.ui-datepicker .ui-datepicker-prev { left:2px; } }
.ui-datepicker .ui-datepicker-next { right:2px; } .ui-datepicker .ui-datepicker-header {
.ui-datepicker .ui-datepicker-prev-hover { left:1px; } position: relative;
.ui-datepicker .ui-datepicker-next-hover { right:1px; } padding:.2em 0;
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } .ui-datepicker .ui-datepicker-prev,
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } .ui-datepicker .ui-datepicker-next {
.ui-datepicker select.ui-datepicker-month-year {width: 100%;} position: absolute;
top: 2px;
width: 1.8em;
height: 1.8em;
}
.ui-datepicker .ui-datepicker-prev-hover,
.ui-datepicker .ui-datepicker-next-hover {
top: 1px;
}
.ui-datepicker .ui-datepicker-prev {
left: 2px;
}
.ui-datepicker .ui-datepicker-next {
right: 2px;
}
.ui-datepicker .ui-datepicker-prev-hover {
left: 1px;
}
.ui-datepicker .ui-datepicker-next-hover {
right: 1px;
}
.ui-datepicker .ui-datepicker-prev span,
.ui-datepicker .ui-datepicker-next span {
display: block;
position: absolute;
left: 50%;
margin-left: -8px;
top: 50%;
margin-top: -8px;
}
.ui-datepicker .ui-datepicker-title {
margin: 0 2.3em;
line-height: 1.8em;
text-align: center;
}
.ui-datepicker .ui-datepicker-title select {
font-size: 1em;
margin: 1px 0;
}
.ui-datepicker select.ui-datepicker-month-year {
width: 100%;
}
.ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;} .ui-datepicker select.ui-datepicker-year {
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } width: 49%;
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } }
.ui-datepicker td { border: 0; padding: 1px; } .ui-datepicker table {
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } width: 100%;
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } font-size: .9em;
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } border-collapse: collapse;
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } margin: 0 0 .4em;
}
.ui-datepicker th {
padding: .7em .3em;
text-align: center;
font-weight: bold;
border: 0;
}
.ui-datepicker td {
border: 0;
padding: 1px;
}
.ui-datepicker td span,
.ui-datepicker td a {
display: block;
padding: .2em;
text-align: right;
text-decoration: none;
}
.ui-datepicker .ui-datepicker-buttonpane {
background-image: none;
margin: .7em 0 0 0;
padding: 0 .2em;
border-left: 0;
border-right: 0;
border-bottom: 0;
}
.ui-datepicker .ui-datepicker-buttonpane button {
float: right;
margin: .5em .2em .4em;
cursor: pointer;
padding: .2em .6em .3em .6em;
width: auto;
overflow: visible;
}
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
float: left;
}
/* with multiple calendars */ /* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; } .ui-datepicker.ui-datepicker-multi {
.ui-datepicker-multi .ui-datepicker-group { float:left; } width: auto;
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } .ui-datepicker-multi .ui-datepicker-group {
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } float: left;
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } .ui-datepicker-multi .ui-datepicker-group table {
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } width: 95%;
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } margin: 0 auto .4em;
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } }
.ui-datepicker-multi-2 .ui-datepicker-group {
width: 50%;
}
.ui-datepicker-multi-3 .ui-datepicker-group {
width: 33.3%;
}
.ui-datepicker-multi-4 .ui-datepicker-group {
width: 25%;
}
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header {
border-left-width: 0;
}
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
border-left-width: 0;
}
.ui-datepicker-multi .ui-datepicker-buttonpane {
clear: left;
}
.ui-datepicker-row-break {
clear: both;
width: 100%;
font-size: 0em;
}
/* RTL support */ /* RTL support */
.ui-datepicker-rtl { direction: rtl; } .ui-datepicker-rtl {
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } direction: rtl;
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } .ui-datepicker-rtl .ui-datepicker-prev {
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } right: 2px;
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } left: auto;
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } .ui-datepicker-rtl .ui-datepicker-next {
.ui-datepicker-rtl .ui-datepicker-group { float:right; } left: 2px;
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } right: auto;
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } }
.ui-datepicker-rtl .ui-datepicker-prev:hover {
right: 1px;
left: auto;
}
.ui-datepicker-rtl .ui-datepicker-next:hover {
left: 1px;
right: auto;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane {
clear: right;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button {
float: left;
}
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current {
float:right;
}
.ui-datepicker-rtl .ui-datepicker-group {
float: right;
}
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header {
border-right-width: 0;
border-left-width: 1px;
}
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
border-right-width: 0;
border-left-width: 1px;
}

View File

@ -8,15 +8,68 @@
* *
* http://docs.jquery.com/UI/Dialog#theming * http://docs.jquery.com/UI/Dialog#theming
*/ */
.ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; width: 300px; overflow: hidden; outline: 0; } .ui-dialog {
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } position: absolute;
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } top: 0;
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } left: 0;
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } padding: .2em;
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } width: 300px;
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } overflow: hidden;
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } outline: 0;
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } }
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } .ui-dialog .ui-dialog-titlebar {
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } padding: .4em 1em;
.ui-draggable .ui-dialog-titlebar { cursor: move; } position: relative;
}
.ui-dialog .ui-dialog-title {
float: left;
margin: .1em 16px .1em 0;
}
.ui-dialog .ui-dialog-titlebar-close {
position: absolute;
right: .3em;
top: 50%;
width: 19px;
margin: -10px 0 0 0;
padding: 1px;
height: 18px;
}
.ui-dialog .ui-dialog-titlebar-close span {
display: block;
margin: 1px;
}
.ui-dialog .ui-dialog-titlebar-close:hover,
.ui-dialog .ui-dialog-titlebar-close:focus {
padding: 0;
}
.ui-dialog .ui-dialog-content {
position: relative;
border: 0;
padding: .5em 1em;
background: none;
overflow: auto;
zoom: 1;
}
.ui-dialog .ui-dialog-buttonpane {
text-align: left;
border-width: 1px 0 0 0;
background-image: none;
margin: .5em 0 0 0;
padding: .3em 1em .5em .4em;
}
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
float: right;
}
.ui-dialog .ui-dialog-buttonpane button {
margin: .5em .4em .5em 0;
cursor: pointer;
}
.ui-dialog .ui-resizable-se {
width: 14px;
height: 14px;
right: 3px;
bottom: 3px;
}
.ui-draggable .ui-dialog-titlebar {
cursor: move;
}

View File

@ -8,23 +8,71 @@
* *
* http://docs.jquery.com/UI/Menu#theming * http://docs.jquery.com/UI/Menu#theming
*/ */
.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; } .ui-menu {
.ui-menu .ui-menu { margin-top: -3px; position: absolute; } list-style: none;
.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; } padding: 2px;
.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; } margin: 0;
.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; } display: block;
outline: none;
}
.ui-menu .ui-menu {
margin-top: -3px;
position: absolute;
}
.ui-menu .ui-menu-item {
margin: 0;
padding: 0;
zoom: 1;
width: 100%;
}
.ui-menu .ui-menu-divider {
margin: 5px -2px 5px -2px;
height: 0;
font-size: 0;
line-height: 0;
border-width: 1px 0 0 0;
}
.ui-menu .ui-menu-item a {
text-decoration: none;
display: block;
padding: 2px .4em;
line-height: 1.5;
zoom: 1;
font-weight: normal;
}
.ui-menu .ui-menu-item a.ui-state-focus, .ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; } .ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;
}
.ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; } .ui-menu .ui-state-disabled {
.ui-menu .ui-state-disabled a { cursor: default; } font-weight: normal;
margin: .4em 0 .2em;
line-height: 1.5;
}
.ui-menu .ui-state-disabled a {
cursor: default;
}
/* icon support */ /* icon support */
.ui-menu-icons { position: relative; } .ui-menu-icons {
.ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; } position: relative;
}
.ui-menu-icons .ui-menu-item a {
position: relative;
padding-left: 2em;
}
/* left-aligned */ /* left-aligned */
.ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; } .ui-menu .ui-icon {
position: absolute;
top: .2em;
left: .2em;
}
/* right-aligned */ /* right-aligned */
.ui-menu .ui-menu-icon { position: static; float: right; } .ui-menu .ui-menu-icon {
position: static;
float: right;
}

View File

@ -8,5 +8,21 @@
* *
* http://docs.jquery.com/UI/Progressbar#theming * http://docs.jquery.com/UI/Progressbar#theming
*/ */
.ui-progressbar { height:2em; text-align: left; overflow: hidden; } .ui-progressbar {
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } height: 2em;
text-align: left;
overflow: hidden;
}
.ui-progressbar .ui-progressbar-value {
margin: -1px;
height:100%;
}
.ui-progressbar .ui-progressbar-value .ui-progressbar-overlay {
background: url("images/animated-overlay.gif");
height: 100%;
filter: alpha(opacity=25);
opacity: 0.25;
}
.ui-progressbar .ui-progressbar-indeterminate {
background-image: none;
}

View File

@ -8,14 +8,71 @@
* *
* http://docs.jquery.com/UI/Resizable#theming * http://docs.jquery.com/UI/Resizable#theming
*/ */
.ui-resizable { position: relative;} .ui-resizable {
.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; } position: relative;
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } .ui-resizable-handle {
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } position: absolute;
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } font-size: 0.1px;
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } display: block;
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } .ui-resizable-disabled .ui-resizable-handle,
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } .ui-resizable-autohide .ui-resizable-handle {
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;} display: none;
}
.ui-resizable-n {
cursor: n-resize;
height: 7px;
width: 100%;
top: -5px;
left: 0;
}
.ui-resizable-s {
cursor: s-resize;
height: 7px;
width: 100%;
bottom: -5px;
left: 0;
}
.ui-resizable-e {
cursor: e-resize;
width: 7px;
right: -5px;
top: 0;
height: 100%;
}
.ui-resizable-w {
cursor: w-resize;
width: 7px;
left: -5px;
top: 0;
height: 100%;
}
.ui-resizable-se {
cursor: se-resize;
width: 12px;
height: 12px;
right: 1px;
bottom: 1px;
}
.ui-resizable-sw {
cursor: sw-resize;
width: 9px;
height: 9px;
left: -5px;
bottom: -5px;
}
.ui-resizable-nw {
cursor: nw-resize;
width: 9px;
height: 9px;
left: -5px;
top: -5px;
}
.ui-resizable-ne {
cursor: ne-resize;
width: 9px;
height: 9px;
right: -5px;
top: -5px;
}

View File

@ -8,4 +8,8 @@
* *
* http://docs.jquery.com/UI/Selectable#theming * http://docs.jquery.com/UI/Selectable#theming
*/ */
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } .ui-selectable-helper {
position: absolute;
z-index: 100;
border: 1px dotted black;
}

View File

@ -8,18 +8,66 @@
* *
* http://docs.jquery.com/UI/Slider#theming * http://docs.jquery.com/UI/Slider#theming
*/ */
.ui-slider { position: relative; text-align: left; } .ui-slider {
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } position: relative;
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } text-align: left;
}
.ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 1.2em;
height: 1.2em;
cursor: default;
}
.ui-slider .ui-slider-range {
position: absolute;
z-index: 1;
font-size: .7em;
display: block;
border: 0;
background-position: 0 0;
}
.ui-slider-horizontal { height: .8em; } /* For IE8 - See #6727 */
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } .ui-slider.ui-state-disabled .ui-slider-handle,
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } .ui-slider.ui-state-disabled .ui-slider-range {
.ui-slider-horizontal .ui-slider-range-min { left: 0; } filter: inherit;
.ui-slider-horizontal .ui-slider-range-max { right: 0; } }
.ui-slider-vertical { width: .8em; height: 100px; } .ui-slider-horizontal {
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } height: .8em;
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } }
.ui-slider-vertical .ui-slider-range-min { bottom: 0; } .ui-slider-horizontal .ui-slider-handle {
.ui-slider-vertical .ui-slider-range-max { top: 0; } top: -.3em;
margin-left: -.6em;
}
.ui-slider-horizontal .ui-slider-range {
top: 0;
height: 100%;
}
.ui-slider-horizontal .ui-slider-range-min {
left: 0;
}
.ui-slider-horizontal .ui-slider-range-max {
right: 0;
}
.ui-slider-vertical {
width: .8em;
height: 100px;
}
.ui-slider-vertical .ui-slider-handle {
left: -.3em;
margin-left: 0;
margin-bottom: -.6em;
}
.ui-slider-vertical .ui-slider-range {
left: 0;
width: 100%;
}
.ui-slider-vertical .ui-slider-range-min {
bottom: 0;
}
.ui-slider-vertical .ui-slider-range-max {
top: 0;
}

View File

@ -8,13 +8,54 @@
* *
* http://docs.jquery.com/UI/Spinner#theming * http://docs.jquery.com/UI/Spinner#theming
*/ */
.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; } .ui-spinner {
.ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; } position: relative;
.ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; } display: inline-block;
.ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */ overflow: hidden;
.ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */ padding: 0;
.ui-spinner-up { top: 0; } vertical-align: middle;
.ui-spinner-down { bottom: 0; } }
.ui-spinner-input {
border: none;
background: none;
padding: 0;
margin: .2em 0;
vertical-align: middle;
margin-left: .4em;
margin-right: 22px;
}
.ui-spinner-button {
width: 16px;
height: 50%;
font-size: .5em;
padding: 0;
margin: 0;
text-align: center;
position: absolute;
cursor: default;
display: block;
overflow: hidden;
right: 0;
}
/* more specificity required here to overide default borders */
.ui-spinner a.ui-spinner-button {
border-top: none;
border-bottom: none;
border-right: none;
}
/* vertical centre icon */
.ui-spinner .ui-icon {
position: absolute;
margin-top: -8px;
top: 50%;
left: 0;
}
.ui-spinner-up {
top: 0;
}
.ui-spinner-down {
bottom: 0;
}
/* TR overrides */ /* TR overrides */
.ui-spinner .ui-icon-triangle-1-s { .ui-spinner .ui-icon-triangle-1-s {

View File

@ -8,11 +8,46 @@
* *
* http://docs.jquery.com/UI/Tabs#theming * http://docs.jquery.com/UI/Tabs#theming
*/ */
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ .ui-tabs {
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; } padding: .2em;
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } zoom: 1;
.ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; } }
.ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; } .ui-tabs .ui-tabs-nav {
.ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ margin: 0;
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } padding: .2em .2em 0;
}
.ui-tabs .ui-tabs-nav li {
list-style: none;
float: left;
position: relative;
top: 0;
margin: 1px .2em 0 0;
border-bottom: 0;
padding: 0;
white-space: nowrap;
}
.ui-tabs .ui-tabs-nav li a {
float: left;
padding: .5em 1em;
text-decoration: none;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active {
margin-bottom: -1px;
padding-bottom: 1px;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-active a,
.ui-tabs .ui-tabs-nav li.ui-state-disabled a,
.ui-tabs .ui-tabs-nav li.ui-tabs-loading a {
cursor: text;
}
.ui-tabs .ui-tabs-nav li a, /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a {
cursor: pointer;
}
.ui-tabs .ui-tabs-panel {
display: block;
border-width: 0;
padding: 1em 1.4em;
background: none;
}

View File

@ -14,47 +14,172 @@
/* Component containers /* Component containers
----------------------------------*/ ----------------------------------*/
.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; } .ui-widget {
.ui-widget .ui-widget { font-size: 1em; } font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; } font-size: 1.1em/*{fsDefault}*/;
.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; } }
.ui-widget-content a { color: #222222/*{fcContent}*/; } .ui-widget .ui-widget {
.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; } font-size: 1em;
}
.ui-widget input,
.ui-widget select,
.ui-widget textarea,
.ui-widget button {
font-family: Verdana,Arial,sans-serif/*{ffDefault}*/;
font-size: 1em;
}
.ui-widget-content {
border: 1px solid #aaaaaa/*{borderColorContent}*/;
background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/;
color: #222222/*{fcContent}*/;
}
.ui-widget-content a {
color: #222222/*{fcContent}*/;
}
.ui-widget-header {
border: 1px solid #aaaaaa/*{borderColorHeader}*/;
background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/;
color: #222222/*{fcHeader}*/;
font-weight: bold;
}
.ui-widget-header a { color: #222222/*{fcHeader}*/; } .ui-widget-header a { color: #222222/*{fcHeader}*/; }
/* Interaction states /* Interaction states
----------------------------------*/ ----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; } .ui-state-default,
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; } .ui-widget-content .ui-state-default,
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; } .ui-widget-header .ui-state-default {
.ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121/*{fcHover}*/; text-decoration: none; } border: 1px solid #d3d3d3/*{borderColorDefault}*/;
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; } background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/;
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; } font-weight: normal/*{fwDefault}*/;
color: #555555/*{fcDefault}*/;
}
.ui-state-default a,
.ui-state-default a:link,
.ui-state-default a:visited {
color: #555555/*{fcDefault}*/;
text-decoration: none;
}
.ui-state-hover,
.ui-widget-content .ui-state-hover,
.ui-widget-header .ui-state-hover,
.ui-state-focus,
.ui-widget-content .ui-state-focus,
.ui-widget-header .ui-state-focus {
border: 1px solid #999999/*{borderColorHover}*/;
background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/;
font-weight: normal/*{fwDefault}*/;
color: #212121/*{fcHover}*/;
}
.ui-state-hover a,
.ui-state-hover a:hover,
.ui-state-hover a:link,
.ui-state-hover a:visited {
color: #212121/*{fcHover}*/;
text-decoration: none;
}
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
border: 1px solid #aaaaaa/*{borderColorActive}*/;
background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/;
font-weight: normal/*{fwDefault}*/;
color: #212121/*{fcActive}*/;
}
.ui-state-active a,
.ui-state-active a:link,
.ui-state-active a:visited {
color: #212121/*{fcActive}*/;
text-decoration: none;
}
/* Interaction Cues /* Interaction Cues
----------------------------------*/ ----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; } .ui-state-highlight,
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; } .ui-widget-content .ui-state-highlight,
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; } .ui-widget-header .ui-state-highlight {
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; } border: 1px solid #fcefa1/*{borderColorHighlight}*/;
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; } background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/;
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } color: #363636/*{fcHighlight}*/;
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } .ui-state-highlight a,
.ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */ .ui-widget-content .ui-state-highlight a,
.ui-widget-header .ui-state-highlight a {
color: #363636/*{fcHighlight}*/;
}
.ui-state-error,
.ui-widget-content .ui-state-error,
.ui-widget-header .ui-state-error {
border: 1px solid #cd0a0a/*{borderColorError}*/;
background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/;
color: #cd0a0a/*{fcError}*/;
}
.ui-state-error a,
.ui-widget-content .ui-state-error a,
.ui-widget-header .ui-state-error a {
color: #cd0a0a/*{fcError}*/;
}
.ui-state-error-text,
.ui-widget-content .ui-state-error-text,
.ui-widget-header .ui-state-error-text {
color: #cd0a0a/*{fcError}*/;
}
.ui-priority-primary,
.ui-widget-content .ui-priority-primary,
.ui-widget-header .ui-priority-primary {
font-weight: bold;
}
.ui-priority-secondary,
.ui-widget-content .ui-priority-secondary,
.ui-widget-header .ui-priority-secondary {
opacity: .7;
filter:Alpha(Opacity=70);
font-weight: normal;
}
.ui-state-disabled,
.ui-widget-content .ui-state-disabled,
.ui-widget-header .ui-state-disabled {
opacity: .35;
filter:Alpha(Opacity=35);
background-image: none;
}
.ui-state-disabled .ui-icon {
filter:Alpha(Opacity=35); /* For IE8 - See #6059 */
}
/* Icons /* Icons
----------------------------------*/ ----------------------------------*/
/* states and images */ /* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; background-position: 16px 16px; } .ui-icon {
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; } width: 16px;
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; } height: 16px;
.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; } background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/;
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; } background-position: 16px 16px;
.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; } }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; } .ui-widget-content .ui-icon {
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; } background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/;
}
.ui-widget-header .ui-icon {
background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/;
}
.ui-state-default .ui-icon {
background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/;
}
.ui-state-hover .ui-icon,
.ui-state-focus .ui-icon {
background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/;
}
.ui-state-active .ui-icon {
background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/;
}
.ui-state-highlight .ui-icon {
background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/;
}
.ui-state-error .ui-icon,
.ui-state-error-text .ui-icon {
background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/;
}
/* positioning */ /* positioning */
.ui-icon-carat-1-n { background-position: 0 0; } .ui-icon-carat-1-n { background-position: 0 0; }
@ -238,11 +363,57 @@
----------------------------------*/ ----------------------------------*/
/* Corner radius */ /* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; } .ui-corner-all,
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; } .ui-corner-top,
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; } .ui-corner-left,
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; } .ui-corner-tl {
-moz-border-radius-topleft: 4px/*{cornerRadius}*/;
-webkit-border-top-left-radius: 4px/*{cornerRadius}*/;
-khtml-border-top-left-radius: 4px/*{cornerRadius}*/;
border-top-left-radius: 4px/*{cornerRadius}*/;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-right,
.ui-corner-tr {
-moz-border-radius-topright: 4px/*{cornerRadius}*/;
-webkit-border-top-right-radius: 4px/*{cornerRadius}*/;
-khtml-border-top-right-radius: 4px/*{cornerRadius}*/;
border-top-right-radius: 4px/*{cornerRadius}*/;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-left,
.ui-corner-bl {
-moz-border-radius-bottomleft: 4px/*{cornerRadius}*/;
-webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/;
-khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/;
border-bottom-left-radius: 4px/*{cornerRadius}*/;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-right,
.ui-corner-br {
-moz-border-radius-bottomright: 4px/*{cornerRadius}*/;
-webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/;
-khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/;
border-bottom-right-radius: 4px/*{cornerRadius}*/;
}
/* Overlays */ /* Overlays */
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; } .ui-widget-overlay {
.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; } background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/;
/* no space between ".3;" and "filter" because themeRoller looks back to the first space for replacement */
opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/;
}
.ui-widget-shadow {
margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/;
padding: 8px/*{thicknessShadow}*/;
background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/;
/* no space between ".3;" and "filter" because themeRoller looks back to the first space for replacement */
opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/;
-moz-border-radius: 8px/*{cornerRadiusShadow}*/;
-khtml-border-radius: 8px/*{cornerRadiusShadow}*/;
-webkit-border-radius: 8px/*{cornerRadiusShadow}*/;
border-radius: 8px/*{cornerRadiusShadow}*/;
}

View File

@ -14,4 +14,6 @@
-webkit-box-shadow: 0 0 5px #aaa; -webkit-box-shadow: 0 0 5px #aaa;
box-shadow: 0 0 5px #aaa; box-shadow: 0 0 5px #aaa;
} }
body .ui-tooltip { border-width: 2px; } body .ui-tooltip {
border-width: 2px;
}

View File

@ -590,5 +590,4 @@ $.widget( "ui.autocomplete", $.ui.autocomplete, {
} }
}); });
}( jQuery )); }( jQuery ));

View File

@ -29,6 +29,7 @@ var lastActive, startXPos, startYPos, clickDragged,
form = radio.form, form = radio.form,
radios = $( [] ); radios = $( [] );
if ( name ) { if ( name ) {
name = name.replace( /'/g, "\\'" );
if ( form ) { if ( form ) {
radios = $( form ).find( "[name='" + name + "']" ); radios = $( form ).find( "[name='" + name + "']" );
} else { } else {
@ -192,7 +193,9 @@ $.widget( "ui.button", {
$( this ).addClass( "ui-state-active" ); $( this ).addClass( "ui-state-active" );
} }
}) })
.bind( "keyup" + this.eventNamespace, function() { // see #8559, we bind to blur here in case the button element loses
// focus between keydown and keyup, it would be left in an "active" state
.bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
$( this ).removeClass( "ui-state-active" ); $( this ).removeClass( "ui-state-active" );
}); });
@ -283,7 +286,9 @@ $.widget( "ui.button", {
}, },
refresh: function() { refresh: function() {
var isDisabled = this.element.is( ":disabled" ) || this.element.hasClass( "ui-button-disabled" ); //See #8237 & #8828
var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
if ( isDisabled !== this.options.disabled ) { if ( isDisabled !== this.options.disabled ) {
this._setOption( "disabled", isDisabled ); this._setOption( "disabled", isDisabled );
} }

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,6 @@
*/ */
(function( $, undefined ) { (function( $, undefined ) {
/*jshint onevar: false, curly: false, eqeqeq: false, laxbreak: true, shadow: true, funcscope: true */
$.widget("ui.draggable", $.ui.mouse, { $.widget("ui.draggable", $.ui.mouse, {
version: "@VERSION", version: "@VERSION",
widgetEventPrefix: "drag", widgetEventPrefix: "drag",
@ -47,11 +46,15 @@ $.widget("ui.draggable", $.ui.mouse, {
}, },
_create: function() { _create: function() {
if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) if (this.options.helper === 'original' && !(/^(?:r|a|f)/).test(this.element.css("position"))) {
this.element[0].style.position = 'relative'; this.element[0].style.position = 'relative';
}
(this.options.addClasses && this.element.addClass("ui-draggable")); if (this.options.addClasses){
(this.options.disabled && this.element.addClass("ui-draggable-disabled")); this.element.addClass("ui-draggable");
}
if (this.options.disabled){
this.element.addClass("ui-draggable-disabled");
}
this._mouseInit(); this._mouseInit();
@ -67,13 +70,15 @@ $.widget("ui.draggable", $.ui.mouse, {
var o = this.options; var o = this.options;
// among others, prevent a drag on a resizable-handle // among others, prevent a drag on a resizable-handle
if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle')) if (this.helper || o.disabled || $(event.target).closest('.ui-resizable-handle').length > 0) {
return false; return false;
}
//Quit if we're not on a valid handle //Quit if we're not on a valid handle
this.handle = this._getHandle(event); this.handle = this._getHandle(event);
if (!this.handle) if (!this.handle) {
return false; return false;
}
$(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() { $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
$('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>') $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
@ -102,8 +107,9 @@ $.widget("ui.draggable", $.ui.mouse, {
this._cacheHelperProportions(); this._cacheHelperProportions();
//If ddmanager is used for droppables, set the global draggable //If ddmanager is used for droppables, set the global draggable
if($.ui.ddmanager) if($.ui.ddmanager) {
$.ui.ddmanager.current = this; $.ui.ddmanager.current = this;
}
/* /*
* - Position generation - * - Position generation -
@ -142,8 +148,9 @@ $.widget("ui.draggable", $.ui.mouse, {
(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt)); (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
//Set a containment if given in the options //Set a containment if given in the options
if(o.containment) if(o.containment) {
this._setContainment(); this._setContainment();
}
//Trigger event + callbacks //Trigger event + callbacks
if(this._trigger("start", event) === false) { if(this._trigger("start", event) === false) {
@ -155,14 +162,17 @@ $.widget("ui.draggable", $.ui.mouse, {
this._cacheHelperProportions(); this._cacheHelperProportions();
//Prepare the droppable offsets //Prepare the droppable offsets
if ($.ui.ddmanager && !o.dropBehaviour) if ($.ui.ddmanager && !o.dropBehaviour) {
$.ui.ddmanager.prepareOffsets(this, event); $.ui.ddmanager.prepareOffsets(this, event);
}
this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003) //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event); if ( $.ui.ddmanager ) {
$.ui.ddmanager.dragStart(this, event);
}
return true; return true;
}, },
@ -183,9 +193,15 @@ $.widget("ui.draggable", $.ui.mouse, {
this.position = ui.position; this.position = ui.position;
} }
if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px'; if(!this.options.axis || this.options.axis !== "y") {
if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px'; this.helper[0].style.left = this.position.left+'px';
if($.ui.ddmanager) $.ui.ddmanager.drag(this, event); }
if(!this.options.axis || this.options.axis !== "x") {
this.helper[0].style.top = this.position.top+'px';
}
if($.ui.ddmanager) {
$.ui.ddmanager.drag(this, event);
}
return false; return false;
}, },
@ -193,9 +209,13 @@ $.widget("ui.draggable", $.ui.mouse, {
_mouseStop: function(event) { _mouseStop: function(event) {
//If we are using droppables, inform the manager about the drop //If we are using droppables, inform the manager about the drop
var dropped = false; var element,
if ($.ui.ddmanager && !this.options.dropBehaviour) that = this,
elementInDom = false,
dropped = false;
if ($.ui.ddmanager && !this.options.dropBehaviour) {
dropped = $.ui.ddmanager.drop(this, event); dropped = $.ui.ddmanager.drop(this, event);
}
//if a drop comes from outside (a sortable) //if a drop comes from outside (a sortable)
if(this.dropped) { if(this.dropped) {
@ -204,17 +224,17 @@ $.widget("ui.draggable", $.ui.mouse, {
} }
//if the original element is no longer in the DOM don't bother to continue (see #8269) //if the original element is no longer in the DOM don't bother to continue (see #8269)
var element = this.element[0], elementInDom = false; element = this.element[0];
while ( element && (element = element.parentNode) ) { while ( element && (element = element.parentNode) ) {
if (element == document ) { if (element === document ) {
elementInDom = true; elementInDom = true;
} }
} }
if ( !elementInDom && this.options.helper === "original" ) if ( !elementInDom && this.options.helper === "original" ) {
return false; return false;
}
if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) { if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
var that = this;
$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
if(that._trigger("stop", event) !== false) { if(that._trigger("stop", event) !== false) {
that._clear(); that._clear();
@ -236,7 +256,9 @@ $.widget("ui.draggable", $.ui.mouse, {
}); });
//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003) //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event); if( $.ui.ddmanager ) {
$.ui.ddmanager.dragStop(this, event);
}
return $.ui.mouse.prototype._mouseUp.call(this, event); return $.ui.mouse.prototype._mouseUp.call(this, event);
}, },
@ -260,7 +282,9 @@ $.widget("ui.draggable", $.ui.mouse, {
.find("*") .find("*")
.andSelf() .andSelf()
.each(function() { .each(function() {
if(this == event.target) handle = true; if(this === event.target) {
handle = true;
}
}); });
return handle; return handle;
@ -269,21 +293,23 @@ $.widget("ui.draggable", $.ui.mouse, {
_createHelper: function(event) { _createHelper: function(event) {
var o = this.options; var o = this.options,
var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element); helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper === 'clone' ? this.element.clone().removeAttr('id') : this.element);
if(!helper.parents('body').length) if(!helper.parents('body').length) {
helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)); helper.appendTo((o.appendTo === 'parent' ? this.element[0].parentNode : o.appendTo));
}
if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) if(helper[0] !== this.element[0] && !(/(fixed|absolute)/).test(helper.css("position"))) {
helper.css("position", "absolute"); helper.css("position", "absolute");
}
return helper; return helper;
}, },
_adjustOffsetFromHelper: function(obj) { _adjustOffsetFromHelper: function(obj) {
if (typeof obj == 'string') { if (typeof obj === 'string') {
obj = obj.split(' '); obj = obj.split(' ');
} }
if ($.isArray(obj)) { if ($.isArray(obj)) {
@ -313,14 +339,17 @@ $.widget("ui.draggable", $.ui.mouse, {
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
// the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) { if(this.cssPosition === 'absolute' && this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
po.left += this.scrollParent.scrollLeft(); po.left += this.scrollParent.scrollLeft();
po.top += this.scrollParent.scrollTop(); po.top += this.scrollParent.scrollTop();
} }
if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information //This needs to be actually done for all browsers, since pageX/pageY includes this information
|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix //Ugly IE fix
if((this.offsetParent[0] === document.body) ||
(this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() === 'html' && $.ui.ie)) {
po = { top: 0, left: 0 }; po = { top: 0, left: 0 };
}
return { return {
top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0), top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
@ -331,7 +360,7 @@ $.widget("ui.draggable", $.ui.mouse, {
_getRelativeOffset: function() { _getRelativeOffset: function() {
if(this.cssPosition == "relative") { if(this.cssPosition === "relative") {
var p = this.element.position(); var p = this.element.position();
return { return {
top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(), top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
@ -361,19 +390,30 @@ $.widget("ui.draggable", $.ui.mouse, {
_setContainment: function() { _setContainment: function() {
var o = this.options; var over, c, ce,
if(o.containment == 'parent') o.containment = this.helper[0].parentNode; o = this.options;
if(o.containment == 'document' || o.containment == 'window') this.containment = [
o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
(o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
(o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) { if(o.containment === 'parent') {
var c = $(o.containment); o.containment = this.helper[0].parentNode;
var ce = c[0]; if(!ce) return; }
var over = ($(ce).css("overflow") != 'hidden'); if(o.containment === 'document' || o.containment === 'window') {
this.containment = [
o.containment === 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
o.containment === 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
(o.containment === 'document' ? 0 : $(window).scrollLeft()) + $(o.containment === 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
(o.containment === 'document' ? 0 : $(window).scrollTop()) + ($(o.containment === 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
];
}
if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor !== Array) {
c = $(o.containment);
ce = c[0];
if(!ce) {
return;
}
over = ($(ce).css("overflow") !== 'hidden');
this.containment = [ this.containment = [
(parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0), (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
@ -383,7 +423,7 @@ $.widget("ui.draggable", $.ui.mouse, {
]; ];
this.relative_container = c; this.relative_container = c;
} else if(o.containment.constructor == Array) { } else if(o.containment.constructor === Array) {
this.containment = o.containment; this.containment = o.containment;
} }
@ -391,22 +431,25 @@ $.widget("ui.draggable", $.ui.mouse, {
_convertPositionTo: function(d, pos) { _convertPositionTo: function(d, pos) {
if(!pos) pos = this.position; if(!pos) {
var mod = d == "absolute" ? 1 : -1; pos = this.position;
var scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); }
var mod = d === "absolute" ? 1 : -1,
scroll = this.cssPosition === 'absolute' && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
return { return {
top: ( top: (
pos.top // The absolute mouse position pos.top + // The absolute mouse position
+ this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.relative.top * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) this.offset.parent.top * mod - // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) ( ( this.cssPosition === 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
), ),
left: ( left: (
pos.left // The absolute mouse position pos.left + // The absolute mouse position
+ this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.relative.left * mod + // Only for relative positioned nodes: Relative offset from element to offset parent
+ this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) this.offset.parent.left * mod - // The offsetParent's offset without borders (offset + border)
- ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) ( ( this.cssPosition === 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
) )
}; };
@ -414,9 +457,12 @@ $.widget("ui.draggable", $.ui.mouse, {
_generatePosition: function(event) { _generatePosition: function(event) {
var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); var containment, co, top, left,
var pageX = event.pageX; o = this.options,
var pageY = event.pageY; scroll = this.cssPosition === 'absolute' && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName),
pageX = event.pageX,
pageY = event.pageY;
/* /*
* - Position constraining - * - Position constraining -
@ -424,10 +470,9 @@ $.widget("ui.draggable", $.ui.mouse, {
*/ */
if(this.originalPosition) { //If we are not dragging yet, we won't check for options if(this.originalPosition) { //If we are not dragging yet, we won't check for options
var containment;
if(this.containment) { if(this.containment) {
if (this.relative_container){ if (this.relative_container){
var co = this.relative_container.offset(); co = this.relative_container.offset();
containment = [ this.containment[0] + co.left, containment = [ this.containment[0] + co.left,
this.containment[1] + co.top, this.containment[1] + co.top,
this.containment[2] + co.left, this.containment[2] + co.left,
@ -437,18 +482,26 @@ $.widget("ui.draggable", $.ui.mouse, {
containment = this.containment; containment = this.containment;
} }
if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left; if(event.pageX - this.offset.click.left < containment[0]) {
if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top; pageX = containment[0] + this.offset.click.left;
if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left; }
if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top; if(event.pageY - this.offset.click.top < containment[1]) {
pageY = containment[1] + this.offset.click.top;
}
if(event.pageX - this.offset.click.left > containment[2]) {
pageX = containment[2] + this.offset.click.left;
}
if(event.pageY - this.offset.click.top > containment[3]) {
pageY = containment[3] + this.offset.click.top;
}
} }
if(o.grid) { if(o.grid) {
//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950) //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY; top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; pageY = containment ? ((top - this.offset.click.top >= containment[1] || top - this.offset.click.top > containment[3]) ? top : ((top - this.offset.click.top >= containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX; left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; pageX = containment ? ((left - this.offset.click.left >= containment[0] || left - this.offset.click.left > containment[2]) ? left : ((left - this.offset.click.left >= containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
} }
@ -456,18 +509,18 @@ $.widget("ui.draggable", $.ui.mouse, {
return { return {
top: ( top: (
pageY // The absolute mouse position pageY - // The absolute mouse position
- this.offset.click.top // Click offset (relative to the element) this.offset.click.top - // Click offset (relative to the element)
- this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.relative.top - // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.top // The offsetParent's offset without borders (offset + border) this.offset.parent.top + // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) ( ( this.cssPosition === 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
), ),
left: ( left: (
pageX // The absolute mouse position pageX - // The absolute mouse position
- this.offset.click.left // Click offset (relative to the element) this.offset.click.left - // Click offset (relative to the element)
- this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent this.offset.relative.left - // Only for relative positioned nodes: Relative offset from element to offset parent
- this.offset.parent.left // The offsetParent's offset without borders (offset + border) this.offset.parent.left + // The offsetParent's offset without borders (offset + border)
+ ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) ( ( this.cssPosition === 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
) )
}; };
@ -475,8 +528,9 @@ $.widget("ui.draggable", $.ui.mouse, {
_clear: function() { _clear: function() {
this.helper.removeClass("ui-draggable-dragging"); this.helper.removeClass("ui-draggable-dragging");
if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove(); if(this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
//if($.ui.ddmanager) $.ui.ddmanager.current = null; this.helper.remove();
}
this.helper = null; this.helper = null;
this.cancelHelperRemoval = false; this.cancelHelperRemoval = false;
}, },
@ -486,7 +540,10 @@ $.widget("ui.draggable", $.ui.mouse, {
_trigger: function(type, event, ui) { _trigger: function(type, event, ui) {
ui = ui || this._uiHash(); ui = ui || this._uiHash();
$.ui.plugin.call(this, type, [event, ui]); $.ui.plugin.call(this, type, [event, ui]);
if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins //The absolute position has to be recalculated after plugins
if(type === "drag") {
this.positionAbs = this._convertPositionTo("absolute");
}
return $.Widget.prototype._trigger.call(this, type, event, ui); return $.Widget.prototype._trigger.call(this, type, event, ui);
}, },
@ -537,7 +594,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work) this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid' //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
if(this.shouldRevert) this.instance.options.revert = true; if(this.shouldRevert) {
this.instance.options.revert = true;
}
//Trigger the stop of the sortable //Trigger the stop of the sortable
this.instance._mouseStop(event); this.instance._mouseStop(event);
@ -545,8 +604,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.options.helper = this.instance.options._helper; this.instance.options.helper = this.instance.options._helper;
//If the helper has been the original item, restore properties in the sortable //If the helper has been the original item, restore properties in the sortable
if(inst.options.helper == 'original') if(inst.options.helper === 'original') {
this.instance.currentItem.css({ top: 'auto', left: 'auto' }); this.instance.currentItem.css({ top: 'auto', left: 'auto' });
}
} else { } else {
this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
@ -562,8 +622,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
$.each(inst.sortables, function() { $.each(inst.sortables, function() {
var innermostIntersecting = false; var innermostIntersecting = false,
var thisSortable = this; thisSortable = this;
//Copy over some variables to allow calling the sortable's native _intersectsWith //Copy over some variables to allow calling the sortable's native _intersectsWith
this.instance.positionAbs = inst.positionAbs; this.instance.positionAbs = inst.positionAbs;
this.instance.helperProportions = inst.helperProportions; this.instance.helperProportions = inst.helperProportions;
@ -575,10 +636,12 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.positionAbs = inst.positionAbs; this.instance.positionAbs = inst.positionAbs;
this.instance.helperProportions = inst.helperProportions; this.instance.helperProportions = inst.helperProportions;
this.instance.offset.click = inst.offset.click; this.instance.offset.click = inst.offset.click;
if (this != thisSortable if (this !== thisSortable &&
&& this.instance._intersectsWith(this.instance.containerCache) this.instance._intersectsWith(this.instance.containerCache) &&
&& $.ui.contains(thisSortable.instance.element[0], this.instance.element[0])) $.ui.contains(thisSortable.instance.element[0], this.instance.element[0])
) {
innermostIntersecting = false; innermostIntersecting = false;
}
return innermostIntersecting; return innermostIntersecting;
}); });
} }
@ -615,7 +678,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
} }
//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
if(this.instance.currentItem) this.instance._mouseDrag(event); if(this.instance.currentItem) {
this.instance._mouseDrag(event);
}
} else { } else {
@ -637,7 +702,9 @@ $.ui.plugin.add("draggable", "connectToSortable", {
//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
this.instance.currentItem.remove(); this.instance.currentItem.remove();
if(this.instance.placeholder) this.instance.placeholder.remove(); if(this.instance.placeholder) {
this.instance.placeholder.remove();
}
inst._trigger("fromSortable", event); inst._trigger("fromSortable", event);
inst.dropped = false; //draggable revert needs that inst.dropped = false; //draggable revert needs that
@ -653,72 +720,87 @@ $.ui.plugin.add("draggable", "connectToSortable", {
$.ui.plugin.add("draggable", "cursor", { $.ui.plugin.add("draggable", "cursor", {
start: function() { start: function() {
var t = $('body'), o = $(this).data('ui-draggable').options; var t = $('body'), o = $(this).data('ui-draggable').options;
if (t.css("cursor")) o._cursor = t.css("cursor"); if (t.css("cursor")) {
o._cursor = t.css("cursor");
}
t.css("cursor", o.cursor); t.css("cursor", o.cursor);
}, },
stop: function() { stop: function() {
var o = $(this).data('ui-draggable').options; var o = $(this).data('ui-draggable').options;
if (o._cursor) $('body').css("cursor", o._cursor); if (o._cursor) {
$('body').css("cursor", o._cursor);
}
} }
}); });
$.ui.plugin.add("draggable", "opacity", { $.ui.plugin.add("draggable", "opacity", {
start: function(event, ui) { start: function(event, ui) {
var t = $(ui.helper), o = $(this).data('ui-draggable').options; var t = $(ui.helper), o = $(this).data('ui-draggable').options;
if(t.css("opacity")) o._opacity = t.css("opacity"); if(t.css("opacity")) {
o._opacity = t.css("opacity");
}
t.css('opacity', o.opacity); t.css('opacity', o.opacity);
}, },
stop: function(event, ui) { stop: function(event, ui) {
var o = $(this).data('ui-draggable').options; var o = $(this).data('ui-draggable').options;
if(o._opacity) $(ui.helper).css('opacity', o._opacity); if(o._opacity) {
$(ui.helper).css('opacity', o._opacity);
}
} }
}); });
$.ui.plugin.add("draggable", "scroll", { $.ui.plugin.add("draggable", "scroll", {
start: function() { start: function() {
var i = $(this).data("ui-draggable"); var i = $(this).data("ui-draggable");
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== 'HTML') {
i.overflowOffset = i.scrollParent.offset();
}
}, },
drag: function( event ) { drag: function( event ) {
var i = $(this).data("ui-draggable"), o = i.options, scrolled = false; var i = $(this).data("ui-draggable"), o = i.options, scrolled = false;
if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== 'HTML') {
if(!o.axis || o.axis != 'x') { if(!o.axis || o.axis !== 'x') {
if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) } else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
} }
}
if(!o.axis || o.axis != 'y') { if(!o.axis || o.axis !== 'y') {
if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) {
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) } else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
} }
}
} else { } else {
if(!o.axis || o.axis != 'x') { if(!o.axis || o.axis !== 'x') {
if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) } else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) {
scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
} }
}
if(!o.axis || o.axis != 'y') { if(!o.axis || o.axis !== 'y') {
if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) } else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {
scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
} }
}
} }
if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
$.ui.ddmanager.prepareOffsets(i, event); $.ui.ddmanager.prepareOffsets(i, event);
}
} }
}); });
@ -726,65 +808,92 @@ $.ui.plugin.add("draggable", "scroll", {
$.ui.plugin.add("draggable", "snap", { $.ui.plugin.add("draggable", "snap", {
start: function() { start: function() {
var i = $(this).data("ui-draggable"), o = i.options; var i = $(this).data("ui-draggable"),
o = i.options;
i.snapElements = []; i.snapElements = [];
$(o.snap.constructor != String ? ( o.snap.items || ':data(ui-draggable)' ) : o.snap).each(function() { $(o.snap.constructor !== String ? ( o.snap.items || ':data(ui-draggable)' ) : o.snap).each(function() {
var $t = $(this); var $o = $t.offset(); var $t = $(this),
if(this != i.element[0]) i.snapElements.push({ $o = $t.offset();
if(this !== i.element[0]) {
i.snapElements.push({
item: this, item: this,
width: $t.outerWidth(), height: $t.outerHeight(), width: $t.outerWidth(), height: $t.outerHeight(),
top: $o.top, left: $o.left top: $o.top, left: $o.left
}); });
}
}); });
}, },
drag: function(event, ui) { drag: function(event, ui) {
var inst = $(this).data("ui-draggable"), o = inst.options; var ts, bs, ls, rs, l, r, t, b, i, first,
var d = o.snapTolerance; inst = $(this).data("ui-draggable"),
o = inst.options,
var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, d = o.snapTolerance,
x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
for (var i = inst.snapElements.length - 1; i >= 0; i--){ for (i = inst.snapElements.length - 1; i >= 0; i--){
var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width, l = inst.snapElements[i].left;
t = inst.snapElements[i].top, b = t + inst.snapElements[i].height; r = l + inst.snapElements[i].width;
t = inst.snapElements[i].top;
b = t + inst.snapElements[i].height;
//Yes, I know, this is insane ;) //Yes, I know, this is insane ;)
if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) { if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); if(inst.snapElements[i].snapping) {
(inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}
inst.snapElements[i].snapping = false; inst.snapElements[i].snapping = false;
continue; continue;
} }
if(o.snapMode != 'inner') { if(o.snapMode !== 'inner') {
var ts = Math.abs(t - y2) <= d; ts = Math.abs(t - y2) <= d;
var bs = Math.abs(b - y1) <= d; bs = Math.abs(b - y1) <= d;
var ls = Math.abs(l - x2) <= d; ls = Math.abs(l - x2) <= d;
var rs = Math.abs(r - x1) <= d; rs = Math.abs(r - x1) <= d;
if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top; if(ts) {
if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top; ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left; }
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left; if(bs) {
ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
}
if(ls) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
}
if(rs) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
}
} }
var first = (ts || bs || ls || rs); first = (ts || bs || ls || rs);
if(o.snapMode != 'outer') { if(o.snapMode !== 'outer') {
var ts = Math.abs(t - y1) <= d; ts = Math.abs(t - y1) <= d;
var bs = Math.abs(b - y2) <= d; bs = Math.abs(b - y2) <= d;
var ls = Math.abs(l - x1) <= d; ls = Math.abs(l - x1) <= d;
var rs = Math.abs(r - x2) <= d; rs = Math.abs(r - x2) <= d;
if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top; if(ts) {
if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top; ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left; }
if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left; if(bs) {
ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
}
if(ls) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
}
if(rs) {
ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
}
} }
if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item }))); (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
}
inst.snapElements[i].snapping = (ts || bs || ls || rs || first); inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
} }
@ -795,14 +904,15 @@ $.ui.plugin.add("draggable", "snap", {
$.ui.plugin.add("draggable", "stack", { $.ui.plugin.add("draggable", "stack", {
start: function() { start: function() {
var o = $(this).data("ui-draggable").options; var min,
o = $(this).data("ui-draggable").options,
var group = $.makeArray($(o.stack)).sort(function(a,b) { group = $.makeArray($(o.stack)).sort(function(a,b) {
return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0); return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
}); });
if (!group.length) { return; } if (!group.length) { return; }
var min = parseInt(group[0].style.zIndex, 10) || 0; min = parseInt(group[0].style.zIndex, 10) || 0;
$(group).each(function(i) { $(group).each(function(i) {
this.style.zIndex = min + i; this.style.zIndex = min + i;
}); });
@ -815,12 +925,16 @@ $.ui.plugin.add("draggable", "stack", {
$.ui.plugin.add("draggable", "zIndex", { $.ui.plugin.add("draggable", "zIndex", {
start: function(event, ui) { start: function(event, ui) {
var t = $(ui.helper), o = $(this).data("ui-draggable").options; var t = $(ui.helper), o = $(this).data("ui-draggable").options;
if(t.css("zIndex")) o._zIndex = t.css("zIndex"); if(t.css("zIndex")) {
o._zIndex = t.css("zIndex");
}
t.css('zIndex', o.zIndex); t.css('zIndex', o.zIndex);
}, },
stop: function(event, ui) { stop: function(event, ui) {
var o = $(this).data("ui-draggable").options; var o = $(this).data("ui-draggable").options;
if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex); if(o._zIndex) {
$(ui.helper).css('zIndex', o._zIndex);
}
} }
}); });

View File

@ -16,7 +16,6 @@
*/ */
(function( $, undefined ) { (function( $, undefined ) {
/*jshint onevar: false, curly: false, eqeqeq: false, laxbreak: true */
$.widget("ui.droppable", { $.widget("ui.droppable", {
version: "@VERSION", version: "@VERSION",
widgetEventPrefix: "drop", widgetEventPrefix: "drop",
@ -31,8 +30,11 @@ $.widget("ui.droppable", {
}, },
_create: function() { _create: function() {
var o = this.options, accept = o.accept; var o = this.options,
this.isover = 0; this.isout = 1; accept = o.accept;
this.isover = false;
this.isout = true;
this.accept = $.isFunction(accept) ? accept : function(d) { this.accept = $.isFunction(accept) ? accept : function(d) {
return d.is(accept); return d.is(accept);
@ -50,17 +52,21 @@ $.widget("ui.droppable", {
}, },
_destroy: function() { _destroy: function() {
var drop = $.ui.ddmanager.droppables[this.options.scope]; var i = 0,
for ( var i = 0; i < drop.length; i++ ) drop = $.ui.ddmanager.droppables[this.options.scope];
if ( drop[i] == this )
for ( ; i < drop.length; i++ ) {
if ( drop[i] === this ) {
drop.splice(i, 1); drop.splice(i, 1);
}
}
this.element.removeClass("ui-droppable ui-droppable-disabled"); this.element.removeClass("ui-droppable ui-droppable-disabled");
}, },
_setOption: function(key, value) { _setOption: function(key, value) {
if(key == 'accept') { if(key === 'accept') {
this.accept = $.isFunction(value) ? value : function(d) { this.accept = $.isFunction(value) ? value : function(d) {
return d.is(value); return d.is(value);
}; };
@ -70,23 +76,37 @@ $.widget("ui.droppable", {
_activate: function(event) { _activate: function(event) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
if(this.options.activeClass) this.element.addClass(this.options.activeClass); if(this.options.activeClass) {
(draggable && this._trigger('activate', event, this.ui(draggable))); this.element.addClass(this.options.activeClass);
}
if(draggable){
this._trigger('activate', event, this.ui(draggable));
}
}, },
_deactivate: function(event) { _deactivate: function(event) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
if(this.options.activeClass) this.element.removeClass(this.options.activeClass); if(this.options.activeClass) {
(draggable && this._trigger('deactivate', event, this.ui(draggable))); this.element.removeClass(this.options.activeClass);
}
if(draggable){
this._trigger('deactivate', event, this.ui(draggable));
}
}, },
_over: function(event) { _over: function(event) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
// Bail if draggable and droppable are same element
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
return;
}
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.hoverClass) this.element.addClass(this.options.hoverClass); if(this.options.hoverClass) {
this.element.addClass(this.options.hoverClass);
}
this._trigger('over', event, this.ui(draggable)); this._trigger('over', event, this.ui(draggable));
} }
@ -95,10 +115,16 @@ $.widget("ui.droppable", {
_out: function(event) { _out: function(event) {
var draggable = $.ui.ddmanager.current; var draggable = $.ui.ddmanager.current;
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
// Bail if draggable and droppable are same element
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
return;
}
if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); if(this.options.hoverClass) {
this.element.removeClass(this.options.hoverClass);
}
this._trigger('out', event, this.ui(draggable)); this._trigger('out', event, this.ui(draggable));
} }
@ -106,25 +132,35 @@ $.widget("ui.droppable", {
_drop: function(event,custom) { _drop: function(event,custom) {
var draggable = custom || $.ui.ddmanager.current; var draggable = custom || $.ui.ddmanager.current,
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element childrenIntersection = false;
// Bail if draggable and droppable are same element
if (!draggable || (draggable.currentItem || draggable.element)[0] === this.element[0]) {
return false;
}
var childrenIntersection = false;
this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() { this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() {
var inst = $.data(this, 'ui-droppable'); var inst = $.data(this, 'ui-droppable');
if( if(
inst.options.greedy inst.options.greedy &&
&& !inst.options.disabled !inst.options.disabled &&
&& inst.options.scope == draggable.options.scope inst.options.scope === draggable.options.scope &&
&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) &&
&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance) $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
) { childrenIntersection = true; return false; } ) { childrenIntersection = true; return false; }
}); });
if(childrenIntersection) return false; if(childrenIntersection) {
return false;
}
if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
if(this.options.activeClass) this.element.removeClass(this.options.activeClass); if(this.options.activeClass) {
if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass); this.element.removeClass(this.options.activeClass);
}
if(this.options.hoverClass) {
this.element.removeClass(this.options.hoverClass);
}
this._trigger('drop', event, this.ui(draggable)); this._trigger('drop', event, this.ui(draggable));
return this.element; return this.element;
} }
@ -146,27 +182,28 @@ $.widget("ui.droppable", {
$.ui.intersect = function(draggable, droppable, toleranceMode) { $.ui.intersect = function(draggable, droppable, toleranceMode) {
if (!droppable.offset) return false; if (!droppable.offset) {
return false;
}
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width, var draggableLeft, draggableTop,
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height; x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
var l = droppable.offset.left, r = l + droppable.proportions.width, y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height,
l = droppable.offset.left, r = l + droppable.proportions.width,
t = droppable.offset.top, b = t + droppable.proportions.height; t = droppable.offset.top, b = t + droppable.proportions.height;
switch (toleranceMode) { switch (toleranceMode) {
case 'fit': case 'fit':
return (l <= x1 && x2 <= r return (l <= x1 && x2 <= r && t <= y1 && y2 <= b);
&& t <= y1 && y2 <= b);
case 'intersect': case 'intersect':
return (l < x1 + (draggable.helperProportions.width / 2) // Right Half return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half x2 - (draggable.helperProportions.width / 2) < r && // Left Half
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
case 'pointer': case 'pointer':
var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left), draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left);
draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top), draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top);
isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width); return $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
return isOver;
case 'touch': case 'touch':
return ( return (
(y1 >= t && y1 <= b) || // Top edge touching (y1 >= t && y1 <= b) || // Top edge touching
@ -191,23 +228,35 @@ $.ui.ddmanager = {
droppables: { 'default': [] }, droppables: { 'default': [] },
prepareOffsets: function(t, event) { prepareOffsets: function(t, event) {
var m = $.ui.ddmanager.droppables[t.options.scope] || []; var i, j,
var type = event ? event.type : null; // workaround for #2317 m = $.ui.ddmanager.droppables[t.options.scope] || [],
var list = (t.currentItem || t.element).find(":data(ui-droppable)").andSelf(); type = event ? event.type : null, // workaround for #2317
list = (t.currentItem || t.element).find(":data(ui-droppable)").andSelf();
droppablesLoop: for (var i = 0; i < m.length; i++) { droppablesLoop: for (i = 0; i < m.length; i++) {
//No disabled and non-accepted
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) {
continue;
}
if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue; //No disabled and non-accepted
// Filter out elements in the current dragged item // Filter out elements in the current dragged item
for (var j=0; j < list.length; j++) { for (j=0; j < list.length; j++) {
if(list[j] == m[i].element[0]) { if(list[j] === m[i].element[0]) {
m[i].proportions.height = 0; m[i].proportions.height = 0;
continue droppablesLoop; continue droppablesLoop;
} }
} }
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables m[i].visible = m[i].element.css("display") !== "none";
if(!m[i].visible) {
continue;
}
//Activate the droppable if used directly from draggables
if(type === "mousedown") {
m[i]._activate.call(m[i], event);
}
m[i].offset = m[i].element.offset(); m[i].offset = m[i].element.offset();
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight }; m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
@ -220,12 +269,16 @@ $.ui.ddmanager = {
var dropped = false; var dropped = false;
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
if(!this.options) return; if(!this.options) {
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) return;
}
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance)) {
dropped = this._drop.call(this, event) || dropped; dropped = this._drop.call(this, event) || dropped;
}
if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) { if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
this.isout = 1; this.isover = 0; this.isout = true;
this.isover = false;
this._deactivate.call(this, event); this._deactivate.call(this, event);
} }
@ -236,51 +289,60 @@ $.ui.ddmanager = {
dragStart: function( draggable, event ) { dragStart: function( draggable, event ) {
//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003) //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() { draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); if( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
}); });
}, },
drag: function(draggable, event) { drag: function(draggable, event) {
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse. //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event); if(draggable.options.refreshPositions) {
$.ui.ddmanager.prepareOffsets(draggable, event);
}
//Run through all droppables and check their positions based on specific tolerance options //Run through all droppables and check their positions based on specific tolerance options
$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() { $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
if(this.options.disabled || this.greedyChild || !this.visible) return; if(this.options.disabled || this.greedyChild || !this.visible) {
var intersects = $.ui.intersect(draggable, this, this.options.tolerance); return;
}
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover === 0 ? 'isover' : null); var parentInstance, scope, parent,
if(!c) return; intersects = $.ui.intersect(draggable, this, this.options.tolerance),
c = !intersects && this.isover ? 'isout' : (intersects && !this.isover ? 'isover' : null);
if(!c) {
return;
}
var parentInstance;
if (this.options.greedy) { if (this.options.greedy) {
// find droppable parents with same scope // find droppable parents with same scope
var scope = this.options.scope; scope = this.options.scope;
var parent = this.element.parents(':data(ui-droppable)').filter(function () { parent = this.element.parents(':data(ui-droppable)').filter(function () {
return $.data(this, 'ui-droppable').options.scope === scope; return $.data(this, 'ui-droppable').options.scope === scope;
}); });
if (parent.length) { if (parent.length) {
parentInstance = $.data(parent[0], 'ui-droppable'); parentInstance = $.data(parent[0], 'ui-droppable');
parentInstance.greedyChild = (c == 'isover' ? 1 : 0); parentInstance.greedyChild = (c === 'isover');
} }
} }
// we just moved into a greedy child // we just moved into a greedy child
if (parentInstance && c == 'isover') { if (parentInstance && c === 'isover') {
parentInstance.isover = 0; parentInstance.isover = false;
parentInstance.isout = 1; parentInstance.isout = true;
parentInstance._out.call(parentInstance, event); parentInstance._out.call(parentInstance, event);
} }
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0; this[c] = true;
this[c == "isover" ? "_over" : "_out"].call(this, event); this[c === 'isout' ? 'isover' : 'isout'] = false;
this[c === "isover" ? "_over" : "_out"].call(this, event);
// we just moved out of a greedy child // we just moved out of a greedy child
if (parentInstance && c == 'isout') { if (parentInstance && c === 'isout') {
parentInstance.isout = 0; parentInstance.isout = false;
parentInstance.isover = 1; parentInstance.isover = true;
parentInstance._over.call(parentInstance, event); parentInstance._over.call(parentInstance, event);
} }
}); });
@ -289,7 +351,9 @@ $.ui.ddmanager = {
dragStop: function( draggable, event ) { dragStop: function( draggable, event ) {
draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" ); draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003) //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event ); if( !draggable.options.refreshPositions ) {
$.ui.ddmanager.prepareOffsets( draggable, event );
}
} }
}; };

View File

@ -21,7 +21,9 @@ $.effects.effect.puff = function( o, done ) {
factor = percent / 100, factor = percent / 100,
original = { original = {
height: elem.height(), height: elem.height(),
width: elem.width() width: elem.width(),
outerHeight: elem.outerHeight(),
outerWidth: elem.outerWidth()
}; };
$.extend( o, { $.extend( o, {
@ -35,7 +37,9 @@ $.effects.effect.puff = function( o, done ) {
original : original :
{ {
height: original.height * factor, height: original.height * factor,
width: original.width * factor width: original.width * factor,
outerHeight: original.outerHeight * factor,
outerWidth: original.outerWidth * factor
} }
}); });
@ -74,7 +78,12 @@ $.effects.effect.scale = function( o, done ) {
options.restore = true; options.restore = true;
} }
options.from = o.from || ( mode === "show" ? { height: 0, width: 0 } : original ); options.from = o.from || ( mode === "show" ? {
height: 0,
width: 0,
outerHeight: 0,
outerWidth: 0
} : original );
options.to = { options.to = {
height: original.height * factor.y, height: original.height * factor.y,
width: original.width * factor.x, width: original.width * factor.x,
@ -124,7 +133,9 @@ $.effects.effect.size = function( o, done ) {
props = restore ? props0 : props1, props = restore ? props0 : props1,
zero = { zero = {
height: 0, height: 0,
width: 0 width: 0,
outerHeight: 0,
outerWidth: 0
}; };
if ( mode === "show" ) { if ( mode === "show" ) {
@ -213,7 +224,9 @@ $.effects.effect.size = function( o, done ) {
var child = $( this ), var child = $( this ),
c_original = { c_original = {
height: child.height(), height: child.height(),
width: child.width() width: child.width(),
outerHeight: child.outerHeight(),
outerWidth: child.outerWidth()
}; };
if (restore) { if (restore) {
$.effects.save(child, props2); $.effects.save(child, props2);
@ -221,11 +234,15 @@ $.effects.effect.size = function( o, done ) {
child.from = { child.from = {
height: c_original.height * factor.from.y, height: c_original.height * factor.from.y,
width: c_original.width * factor.from.x width: c_original.width * factor.from.x,
outerHeight: c_original.outerHeight * factor.from.y,
outerWidth: c_original.outerWidth * factor.from.x
}; };
child.to = { child.to = {
height: c_original.height * factor.to.y, height: c_original.height * factor.to.y,
width: c_original.width * factor.to.x width: c_original.width * factor.to.x,
outerHeight: c_original.height * factor.to.y,
outerWidth: c_original.width * factor.to.x
}; };
// Vertical props scaling // Vertical props scaling

View File

@ -36,7 +36,7 @@ $.widget( "ui.progressbar", {
"aria-valuenow": this.options.value "aria-valuenow": this.options.value
}); });
this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'><div></div></div>" )
.appendTo( this.element ); .appendTo( this.element );
this.oldValue = this.options.value; this.oldValue = this.options.value;
@ -71,16 +71,19 @@ $.widget( "ui.progressbar", {
val = newValue; val = newValue;
} }
this.indeterminate = val === false;
// sanitize value // sanitize value
if ( typeof val !== "number" ) { if ( typeof val !== "number" ) {
val = 0; val = 0;
} }
return Math.min( this.options.max, Math.max( this.min, val ) ); return this.indeterminate ? false : Math.min( this.options.max, Math.max( this.min, val ) );
}, },
_setOptions: function( options ) { _setOptions: function( options ) {
var val = options.value; var val = options.value;
// Ensure "value" option is set after other values (like max)
delete options.value; delete options.value;
this._super( options ); this._super( options );
@ -106,26 +109,36 @@ $.widget( "ui.progressbar", {
}, },
_percentage: function() { _percentage: function() {
return 100 * this.options.value / this.options.max; return this.indeterminate ? 100 : 100 * this.options.value / this.options.max;
}, },
_refreshValue: function() { _refreshValue: function() {
var percentage = this._percentage(); var value = this.options.value,
percentage = this._percentage(),
overlay = this.valueDiv.children().eq( 0 );
if ( this.oldValue !== this.options.value ) { overlay.toggleClass( "ui-progressbar-overlay", this.indeterminate );
this.oldValue = this.options.value; this.valueDiv.toggleClass( "ui-progressbar-indeterminate", this.indeterminate );
if ( this.oldValue !== value ) {
this.oldValue = value;
this._trigger( "change" ); this._trigger( "change" );
} }
if ( this.options.value === this.options.max ) { if ( value === this.options.max ) {
this._trigger( "complete" ); this._trigger( "complete" );
} }
this.valueDiv this.valueDiv
.toggle( this.options.value > this.min ) .toggle( this.indeterminate || value > this.min )
.toggleClass( "ui-corner-right", this.options.value === this.options.max ) .toggleClass( "ui-corner-right", value === this.options.max )
.width( percentage.toFixed(0) + "%" ); .width( percentage.toFixed(0) + "%" );
if ( this.indeterminate ) {
this.element.removeAttr( "aria-valuemax" );
this.element.removeAttr( "aria-valuenow" );
} else {
this.element.attr( "aria-valuemax", this.options.max ); this.element.attr( "aria-valuemax", this.options.max );
this.element.attr( "aria-valuenow", this.options.value ); this.element.attr( "aria-valuenow", value );
}
} }
}); });

View File

@ -15,8 +15,6 @@
*/ */
(function( $, undefined ) { (function( $, undefined ) {
/*jshint onevar: false, curly: false, eqeqeq: false, funcscope: true, loopfunc: true */
function num(v) { function num(v) {
return parseInt(v, 10) || 0; return parseInt(v, 10) || 0;
} }
@ -48,7 +46,9 @@ $.widget("ui.resizable", $.ui.mouse, {
}, },
_create: function() { _create: function() {
var that = this, o = this.options; var n, i, handle, axis, hname,
that = this,
o = this.options;
this.element.addClass("ui-resizable"); this.element.addClass("ui-resizable");
$.extend(this, { $.extend(this, {
@ -100,21 +100,26 @@ $.widget("ui.resizable", $.ui.mouse, {
} }
this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' }); this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
if(this.handles.constructor == String) { if(this.handles.constructor === String) {
if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw'; if ( this.handles === 'all') {
var n = this.handles.split(","); this.handles = {}; this.handles = 'n,e,s,w,se,sw,ne,nw';
}
for(var i = 0; i < n.length; i++) { n = this.handles.split(",");
this.handles = {};
var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle; for(i = 0; i < n.length; i++) {
var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
handle = $.trim(n[i]);
hname = 'ui-resizable-'+handle;
axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
// Apply zIndex to all handles - see #7960 // Apply zIndex to all handles - see #7960
axis.css({ zIndex: o.zIndex }); axis.css({ zIndex: o.zIndex });
//TODO : What's going on here? //TODO : What's going on here?
if ('se' == handle) { if ('se' === handle) {
axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se'); axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
} }
@ -127,23 +132,26 @@ $.widget("ui.resizable", $.ui.mouse, {
this._renderAxis = function(target) { this._renderAxis = function(target) {
var i, axis, padPos, padWrapper;
target = target || this.element; target = target || this.element;
for(var i in this.handles) { for(i in this.handles) {
if(this.handles[i].constructor == String) if(this.handles[i].constructor === String) {
this.handles[i] = $(this.handles[i], this.element).show(); this.handles[i] = $(this.handles[i], this.element).show();
}
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls) //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) { if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
var axis = $(this.handles[i], this.element), padWrapper = 0; axis = $(this.handles[i], this.element);
//Checking the correct pad and border //Checking the correct pad and border
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth(); padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
//The padding type i have to apply... //The padding type i have to apply...
var padPos = [ 'padding', padPos = [ 'padding',
/ne|nw|n/.test(i) ? 'Top' : /ne|nw|n/.test(i) ? 'Top' :
/se|sw|s/.test(i) ? 'Bottom' : /se|sw|s/.test(i) ? 'Bottom' :
/^e$/.test(i) ? 'Right' : 'Left' ].join(""); /^e$/.test(i) ? 'Right' : 'Left' ].join("");
@ -155,9 +163,9 @@ $.widget("ui.resizable", $.ui.mouse, {
} }
//TODO: What's that good for? There's not anything to be executed left //TODO: What's that good for? There's not anything to be executed left
if(!$(this.handles[i]).length) if(!$(this.handles[i]).length) {
continue; continue;
}
} }
}; };
@ -170,8 +178,9 @@ $.widget("ui.resizable", $.ui.mouse, {
//Matching axis name //Matching axis name
this._handles.mouseover(function() { this._handles.mouseover(function() {
if (!that.resizing) { if (!that.resizing) {
if (this.className) if (this.className) {
var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i); axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
}
//Axis, default = se //Axis, default = se
that.axis = axis && axis[1] ? axis[1] : 'se'; that.axis = axis && axis[1] ? axis[1] : 'se';
} }
@ -183,12 +192,16 @@ $.widget("ui.resizable", $.ui.mouse, {
$(this.element) $(this.element)
.addClass("ui-resizable-autohide") .addClass("ui-resizable-autohide")
.mouseenter(function() { .mouseenter(function() {
if (o.disabled) return; if (o.disabled) {
return;
}
$(this).removeClass("ui-resizable-autohide"); $(this).removeClass("ui-resizable-autohide");
that._handles.show(); that._handles.show();
}) })
.mouseleave(function(){ .mouseleave(function(){
if (o.disabled) return; if (o.disabled) {
return;
}
if (!that.resizing) { if (!that.resizing) {
$(this).addClass("ui-resizable-autohide"); $(this).addClass("ui-resizable-autohide");
that._handles.hide(); that._handles.hide();
@ -205,7 +218,8 @@ $.widget("ui.resizable", $.ui.mouse, {
this._mouseDestroy(); this._mouseDestroy();
var _destroy = function(exp) { var wrapper,
_destroy = function(exp) {
$(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing") $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
.removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove(); .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
}; };
@ -213,7 +227,7 @@ $.widget("ui.resizable", $.ui.mouse, {
//TODO: Unwrap at same DOM position //TODO: Unwrap at same DOM position
if (this.elementIsWrapper) { if (this.elementIsWrapper) {
_destroy(this.element); _destroy(this.element);
var wrapper = this.element; wrapper = this.element;
this.originalElement.css({ this.originalElement.css({
position: wrapper.css('position'), position: wrapper.css('position'),
width: wrapper.outerWidth(), width: wrapper.outerWidth(),
@ -231,10 +245,12 @@ $.widget("ui.resizable", $.ui.mouse, {
}, },
_mouseCapture: function(event) { _mouseCapture: function(event) {
var capture = false; var i, handle,
for (var i in this.handles) { capture = false;
var handle = $(this.handles[i])[0];
if (handle == event.target || $.contains(handle, event.target)) { for (i in this.handles) {
handle = $(this.handles[i])[0];
if (handle === event.target || $.contains(handle, event.target)) {
capture = true; capture = true;
} }
} }
@ -244,19 +260,24 @@ $.widget("ui.resizable", $.ui.mouse, {
_mouseStart: function(event) { _mouseStart: function(event) {
var o = this.options, iniPos = this.element.position(), el = this.element; var curleft, curtop, cursor,
o = this.options,
iniPos = this.element.position(),
el = this.element;
this.resizing = true; this.resizing = true;
this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
// bugfix for http://dev.jquery.com/ticket/1749 // bugfix for http://dev.jquery.com/ticket/1749
if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) { if ( (/absolute/).test( el.css('position') ) ) {
el.css({ position: 'absolute', top: el.css('top'), left: el.css('left') });
} else if (el.is('.ui-draggable')) {
el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left }); el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
} }
this._renderProxy(); this._renderProxy();
var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top')); curleft = num(this.helper.css('left'));
curtop = num(this.helper.css('top'));
if (o.containment) { if (o.containment) {
curleft += $(o.containment).scrollLeft() || 0; curleft += $(o.containment).scrollLeft() || 0;
@ -273,10 +294,10 @@ $.widget("ui.resizable", $.ui.mouse, {
this.originalMousePosition = { left: event.pageX, top: event.pageY }; this.originalMousePosition = { left: event.pageX, top: event.pageY };
//Aspect Ratio //Aspect Ratio
this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1); this.aspectRatio = (typeof o.aspectRatio === 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
var cursor = $('.ui-resizable-' + this.axis).css('cursor'); cursor = $('.ui-resizable-' + this.axis).css('cursor');
$('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor); $('body').css('cursor', cursor === 'auto' ? this.axis + '-resize' : cursor);
el.addClass("ui-resizable-resizing"); el.addClass("ui-resizable-resizing");
this._propagate("start", event); this._propagate("start", event);
@ -286,22 +307,30 @@ $.widget("ui.resizable", $.ui.mouse, {
_mouseDrag: function(event) { _mouseDrag: function(event) {
//Increase performance, avoid regex //Increase performance, avoid regex
var el = this.helper, props = {}, var data,
smp = this.originalMousePosition, a = this.axis, el = this.helper, props = {},
prevTop = this.position.top, prevLeft = this.position.left, smp = this.originalMousePosition,
prevWidth = this.size.width, prevHeight = this.size.height; a = this.axis,
prevTop = this.position.top,
prevLeft = this.position.left,
prevWidth = this.size.width,
prevHeight = this.size.height,
dx = (event.pageX-smp.left)||0,
dy = (event.pageY-smp.top)||0,
trigger = this._change[a];
var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0; if (!trigger) {
var trigger = this._change[a]; return false;
if (!trigger) return false; }
// Calculate the attrs that will be change // Calculate the attrs that will be change
var data = trigger.apply(this, [event, dx, dy]); data = trigger.apply(this, [event, dx, dy]);
// Put this in the mouseDrag handler since the user can start pressing shift while resizing // Put this in the mouseDrag handler since the user can start pressing shift while resizing
this._updateVirtualBoundaries(event.shiftKey); this._updateVirtualBoundaries(event.shiftKey);
if (this._aspectRatio || event.shiftKey) if (this._aspectRatio || event.shiftKey) {
data = this._updateRatio(data, event); data = this._updateRatio(data, event);
}
data = this._respectSize(data, event); data = this._respectSize(data, event);
@ -324,8 +353,9 @@ $.widget("ui.resizable", $.ui.mouse, {
} }
el.css(props); el.css(props);
if (!this._helper && this._proportionallyResizeElements.length) if (!this._helper && this._proportionallyResizeElements.length) {
this._proportionallyResize(); this._proportionallyResize();
}
// Call the user callback if the element was resized // Call the user callback if the element was resized
if ( ! $.isEmptyObject(props) ) { if ( ! $.isEmptyObject(props) ) {
@ -338,24 +368,30 @@ $.widget("ui.resizable", $.ui.mouse, {
_mouseStop: function(event) { _mouseStop: function(event) {
this.resizing = false; this.resizing = false;
var o = this.options, that = this; var pr, ista, soffseth, soffsetw, s, left, top,
o = this.options, that = this;
if(this._helper) { if(this._helper) {
var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, pr = this._proportionallyResizeElements;
ista = pr.length && (/textarea/i).test(pr[0].nodeName);
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height;
soffsetw = ista ? 0 : that.sizeDiff.width; soffsetw = ista ? 0 : that.sizeDiff.width;
var s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) }, s = { width: (that.helper.width() - soffsetw), height: (that.helper.height() - soffseth) };
left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null;
top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
if (!o.animate) if (!o.animate) {
this.element.css($.extend(s, { top: top, left: left })); this.element.css($.extend(s, { top: top, left: left }));
}
that.helper.height(that.size.height); that.helper.height(that.size.height);
that.helper.width(that.size.width); that.helper.width(that.size.width);
if (this._helper && !o.animate) this._proportionallyResize(); if (this._helper && !o.animate) {
this._proportionallyResize();
}
} }
$('body').css('cursor', 'auto'); $('body').css('cursor', 'auto');
@ -364,13 +400,17 @@ $.widget("ui.resizable", $.ui.mouse, {
this._propagate("stop", event); this._propagate("stop", event);
if (this._helper) this.helper.remove(); if (this._helper) {
this.helper.remove();
}
return false; return false;
}, },
_updateVirtualBoundaries: function(forceAspectRatio) { _updateVirtualBoundaries: function(forceAspectRatio) {
var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b; var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
o = this.options;
b = { b = {
minWidth: isNumber(o.minWidth) ? o.minWidth : 0, minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
@ -387,34 +427,55 @@ $.widget("ui.resizable", $.ui.mouse, {
pMaxWidth = b.maxHeight * this.aspectRatio; pMaxWidth = b.maxHeight * this.aspectRatio;
pMaxHeight = b.maxWidth / this.aspectRatio; pMaxHeight = b.maxWidth / this.aspectRatio;
if(pMinWidth > b.minWidth) b.minWidth = pMinWidth; if(pMinWidth > b.minWidth) {
if(pMinHeight > b.minHeight) b.minHeight = pMinHeight; b.minWidth = pMinWidth;
if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth; }
if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight; if(pMinHeight > b.minHeight) {
b.minHeight = pMinHeight;
}
if(pMaxWidth < b.maxWidth) {
b.maxWidth = pMaxWidth;
}
if(pMaxHeight < b.maxHeight) {
b.maxHeight = pMaxHeight;
}
} }
this._vBoundaries = b; this._vBoundaries = b;
}, },
_updateCache: function(data) { _updateCache: function(data) {
this.offset = this.helper.offset(); this.offset = this.helper.offset();
if (isNumber(data.left)) this.position.left = data.left; if (isNumber(data.left)) {
if (isNumber(data.top)) this.position.top = data.top; this.position.left = data.left;
if (isNumber(data.height)) this.size.height = data.height; }
if (isNumber(data.width)) this.size.width = data.width; if (isNumber(data.top)) {
this.position.top = data.top;
}
if (isNumber(data.height)) {
this.size.height = data.height;
}
if (isNumber(data.width)) {
this.size.width = data.width;
}
}, },
_updateRatio: function( data ) { _updateRatio: function( data ) {
var cpos = this.position, csize = this.size, a = this.axis; var cpos = this.position,
csize = this.size,
a = this.axis;
if (isNumber(data.height)) data.width = (data.height * this.aspectRatio); if (isNumber(data.height)) {
else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio); data.width = (data.height * this.aspectRatio);
} else if (isNumber(data.width)) {
data.height = (data.width / this.aspectRatio);
}
if (a == 'sw') { if (a === 'sw') {
data.left = cpos.left + (csize.width - data.width); data.left = cpos.left + (csize.width - data.width);
data.top = null; data.top = null;
} }
if (a == 'nw') { if (a === 'nw') {
data.top = cpos.top + (csize.height - data.height); data.top = cpos.top + (csize.height - data.height);
data.left = cpos.left + (csize.width - data.width); data.left = cpos.left + (csize.width - data.width);
} }
@ -424,48 +485,70 @@ $.widget("ui.resizable", $.ui.mouse, {
_respectSize: function( data ) { _respectSize: function( data ) {
var o = this._vBoundaries, a = this.axis, var o = this._vBoundaries,
a = this.axis,
ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height), ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height); isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
dw = this.originalPosition.left + this.originalSize.width,
dh = this.position.top + this.size.height,
cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
if (isminw) {
data.width = o.minWidth;
}
if (isminh) {
data.height = o.minHeight;
}
if (ismaxw) {
data.width = o.maxWidth;
}
if (ismaxh) {
data.height = o.maxHeight;
}
if (isminw) data.width = o.minWidth; if (isminw && cw) {
if (isminh) data.height = o.minHeight; data.left = dw - o.minWidth;
if (ismaxw) data.width = o.maxWidth; }
if (ismaxh) data.height = o.maxHeight; if (ismaxw && cw) {
data.left = dw - o.maxWidth;
var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height; }
var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a); if (isminh && ch) {
data.top = dh - o.minHeight;
if (isminw && cw) data.left = dw - o.minWidth; }
if (ismaxw && cw) data.left = dw - o.maxWidth; if (ismaxh && ch) {
if (isminh && ch) data.top = dh - o.minHeight; data.top = dh - o.maxHeight;
if (ismaxh && ch) data.top = dh - o.maxHeight; }
// fixing jump error on top/left - bug #2330 // fixing jump error on top/left - bug #2330
var isNotwh = !data.width && !data.height; if (!data.width && !data.height && !data.left && data.top) {
if (isNotwh && !data.left && data.top) data.top = null; data.top = null;
else if (isNotwh && !data.top && data.left) data.left = null; } else if (!data.width && !data.height && !data.top && data.left) {
data.left = null;
}
return data; return data;
}, },
_proportionallyResize: function() { _proportionallyResize: function() {
if (!this._proportionallyResizeElements.length) return; if (!this._proportionallyResizeElements.length) {
var element = this.helper || this.element; return;
}
for (var i=0; i < this._proportionallyResizeElements.length; i++) { var i, j, borders, paddings, prel,
element = this.helper || this.element;
var prel = this._proportionallyResizeElements[i]; for ( i=0; i < this._proportionallyResizeElements.length; i++) {
prel = this._proportionallyResizeElements[i];
if (!this.borderDif) { if (!this.borderDif) {
var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')], this.borderDif = [];
p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')]; borders = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')];
paddings = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
this.borderDif = $.map(b, function(v, i) { for ( j = 0; j < borders.length; j++ ) {
var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0; this.borderDif[ j ] = ( parseInt( borders[ j ], 10 ) || 0 ) + ( parseInt( paddings[ j ], 10 ) || 0 );
return border + padding; }
});
} }
prel.css({ prel.css({
@ -536,7 +619,7 @@ $.widget("ui.resizable", $.ui.mouse, {
_propagate: function(n, event) { _propagate: function(n, event) {
$.ui.plugin.call(this, n, [event, this.ui()]); $.ui.plugin.call(this, n, [event, this.ui()]);
(n != "resize" && this._trigger(n, event, this.ui())); (n !== "resize" && this._trigger(n, event, this.ui()));
}, },
plugins: {}, plugins: {},
@ -562,9 +645,9 @@ $.widget("ui.resizable", $.ui.mouse, {
$.ui.plugin.add("resizable", "alsoResize", { $.ui.plugin.add("resizable", "alsoResize", {
start: function () { start: function () {
var that = $(this).data("ui-resizable"), o = that.options; var that = $(this).data("ui-resizable"),
o = that.options,
var _store = function (exp) { _store = function (exp) {
$(exp).each(function() { $(exp).each(function() {
var el = $(this); var el = $(this);
el.data("ui-resizable-alsoresize", { el.data("ui-resizable-alsoresize", {
@ -574,7 +657,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
}); });
}; };
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { if (typeof(o.alsoResize) === 'object' && !o.alsoResize.parentNode) {
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
else { $.each(o.alsoResize, function (exp) { _store(exp); }); } else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
}else{ }else{
@ -583,9 +666,11 @@ $.ui.plugin.add("resizable", "alsoResize", {
}, },
resize: function (event, ui) { resize: function (event, ui) {
var that = $(this).data("ui-resizable"), o = that.options, os = that.originalSize, op = that.originalPosition; var that = $(this).data("ui-resizable"),
o = that.options,
var delta = { os = that.originalSize,
op = that.originalPosition,
delta = {
height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0, height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0 top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
}, },
@ -597,15 +682,16 @@ $.ui.plugin.add("resizable", "alsoResize", {
$.each(css, function (i, prop) { $.each(css, function (i, prop) {
var sum = (start[prop]||0) + (delta[prop]||0); var sum = (start[prop]||0) + (delta[prop]||0);
if (sum && sum >= 0) if (sum && sum >= 0) {
style[prop] = sum || null; style[prop] = sum || null;
}
}); });
el.css(style); el.css(style);
}); });
}; };
if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { if (typeof(o.alsoResize) === 'object' && !o.alsoResize.nodeType) {
$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); }); $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
}else{ }else{
_alsoResize(o.alsoResize); _alsoResize(o.alsoResize);
@ -620,13 +706,13 @@ $.ui.plugin.add("resizable", "alsoResize", {
$.ui.plugin.add("resizable", "animate", { $.ui.plugin.add("resizable", "animate", {
stop: function( event ) { stop: function( event ) {
var that = $(this).data("ui-resizable"), o = that.options; var that = $(this).data("ui-resizable"),
o = that.options,
var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName), pr = that._proportionallyResizeElements,
ista = pr.length && (/textarea/i).test(pr[0].nodeName),
soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height, soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
soffsetw = ista ? 0 : that.sizeDiff.width; soffsetw = ista ? 0 : that.sizeDiff.width,
style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null, left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null; top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
@ -643,7 +729,9 @@ $.ui.plugin.add("resizable", "animate", {
left: parseInt(that.element.css('left'), 10) left: parseInt(that.element.css('left'), 10)
}; };
if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height }); if (pr && pr.length) {
$(pr[0]).css({ width: data.width, height: data.height });
}
// propagating resize, and updating values for each animation step // propagating resize, and updating values for each animation step
that._updateCache(data); that._updateCache(data);
@ -659,13 +747,20 @@ $.ui.plugin.add("resizable", "animate", {
$.ui.plugin.add("resizable", "containment", { $.ui.plugin.add("resizable", "containment", {
start: function() { start: function() {
var that = $(this).data("ui-resizable"), o = that.options, el = that.element; var element, p, co, ch, cw, width, height,
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc; that = $(this).data("ui-resizable"),
if (!ce) return; o = that.options,
el = that.element,
oc = o.containment,
ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
if (!ce) {
return;
}
that.containerElement = $(ce); that.containerElement = $(ce);
if (/document/.test(oc) || oc == document) { if (/document/.test(oc) || oc === document) {
that.containerOffset = { left: 0, top: 0 }; that.containerOffset = { left: 0, top: 0 };
that.containerPosition = { left: 0, top: 0 }; that.containerPosition = { left: 0, top: 0 };
@ -677,15 +772,19 @@ $.ui.plugin.add("resizable", "containment", {
// i'm a node, so compute top, left, right, bottom // i'm a node, so compute top, left, right, bottom
else { else {
var element = $(ce), p = []; element = $(ce);
p = [];
$([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); }); $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
that.containerOffset = element.offset(); that.containerOffset = element.offset();
that.containerPosition = element.position(); that.containerPosition = element.position();
that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) }; that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
var co = that.containerOffset, ch = that.containerSize.height, cw = that.containerSize.width, co = that.containerOffset;
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch); ch = that.containerSize.height;
cw = that.containerSize.width;
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw );
height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
that.parentData = { that.parentData = {
element: ce, left: co.left, top: co.top, width: width, height: height element: ce, left: co.left, top: co.top, width: width, height: height
@ -694,57 +793,79 @@ $.ui.plugin.add("resizable", "containment", {
}, },
resize: function( event ) { resize: function( event ) {
var that = $(this).data("ui-resizable"), o = that.options, var woset, hoset, isParent, isOffsetRelative,
that = $(this).data("ui-resizable"),
o = that.options,
co = that.containerOffset, cp = that.position, co = that.containerOffset, cp = that.position,
pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement; pRatio = that._aspectRatio || event.shiftKey,
cop = { top:0, left:0 }, ce = that.containerElement;
if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co; if (ce[0] !== document && (/static/).test(ce.css('position'))) {
cop = co;
}
if (cp.left < (that._helper ? co.left : 0)) { if (cp.left < (that._helper ? co.left : 0)) {
that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left)); that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
if (pRatio) that.size.height = that.size.width / that.aspectRatio; if (pRatio) {
that.size.height = that.size.width / that.aspectRatio;
}
that.position.left = o.helper ? co.left : 0; that.position.left = o.helper ? co.left : 0;
} }
if (cp.top < (that._helper ? co.top : 0)) { if (cp.top < (that._helper ? co.top : 0)) {
that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top); that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
if (pRatio) that.size.width = that.size.height * that.aspectRatio; if (pRatio) {
that.size.width = that.size.height * that.aspectRatio;
}
that.position.top = that._helper ? co.top : 0; that.position.top = that._helper ? co.top : 0;
} }
that.offset.left = that.parentData.left+that.position.left; that.offset.left = that.parentData.left+that.position.left;
that.offset.top = that.parentData.top+that.position.top; that.offset.top = that.parentData.top+that.position.top;
var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ), woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width );
hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height ); hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
var isParent = that.containerElement.get(0) == that.element.parent().get(0), isParent = that.containerElement.get(0) === that.element.parent().get(0);
isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position')); isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position'));
if(isParent && isOffsetRelative) woset -= that.parentData.left; if(isParent && isOffsetRelative) {
woset -= that.parentData.left;
}
if (woset + that.size.width >= that.parentData.width) { if (woset + that.size.width >= that.parentData.width) {
that.size.width = that.parentData.width - woset; that.size.width = that.parentData.width - woset;
if (pRatio) that.size.height = that.size.width / that.aspectRatio; if (pRatio) {
that.size.height = that.size.width / that.aspectRatio;
}
} }
if (hoset + that.size.height >= that.parentData.height) { if (hoset + that.size.height >= that.parentData.height) {
that.size.height = that.parentData.height - hoset; that.size.height = that.parentData.height - hoset;
if (pRatio) that.size.width = that.size.height * that.aspectRatio; if (pRatio) {
that.size.width = that.size.height * that.aspectRatio;
}
} }
}, },
stop: function(){ stop: function(){
var that = $(this).data("ui-resizable"), o = that.options, var that = $(this).data("ui-resizable"),
co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement; o = that.options,
co = that.containerOffset,
cop = that.containerPosition,
ce = that.containerElement,
helper = $(that.helper),
ho = helper.offset(),
w = helper.outerWidth() - that.sizeDiff.width,
h = helper.outerHeight() - that.sizeDiff.height;
var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height; if (that._helper && !o.animate && (/relative/).test(ce.css('position'))) {
if (that._helper && !o.animate && (/relative/).test(ce.css('position')))
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
}
if (that._helper && !o.animate && (/static/).test(ce.css('position'))) if (that._helper && !o.animate && (/static/).test(ce.css('position'))) {
$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h }); $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
}
} }
}); });
@ -759,7 +880,7 @@ $.ui.plugin.add("resizable", "ghost", {
that.ghost that.ghost
.css({ opacity: 0.25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }) .css({ opacity: 0.25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
.addClass('ui-resizable-ghost') .addClass('ui-resizable-ghost')
.addClass(typeof o.ghost == 'string' ? o.ghost : ''); .addClass(typeof o.ghost === 'string' ? o.ghost : '');
that.ghost.appendTo(that.helper); that.ghost.appendTo(that.helper);
@ -767,12 +888,16 @@ $.ui.plugin.add("resizable", "ghost", {
resize: function(){ resize: function(){
var that = $(this).data("ui-resizable"); var that = $(this).data("ui-resizable");
if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width }); if (that.ghost) {
that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width });
}
}, },
stop: function() { stop: function() {
var that = $(this).data("ui-resizable"); var that = $(this).data("ui-resizable");
if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0)); if (that.ghost && that.helper) {
that.helper.get(0).removeChild(that.ghost.get(0));
}
} }
}); });
@ -780,13 +905,25 @@ $.ui.plugin.add("resizable", "ghost", {
$.ui.plugin.add("resizable", "grid", { $.ui.plugin.add("resizable", "grid", {
resize: function() { resize: function() {
var that = $(this).data("ui-resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis; var that = $(this).data("ui-resizable"),
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid; o = that.options,
var gridX = (o.grid[0]||1), gridY = (o.grid[1]||1), cs = that.size,
ox = Math.round((cs.width - os.width) / gridX) * gridX, oy = Math.round((cs.height - os.height) / gridY) * gridY, os = that.originalSize,
newWidth = os.width + ox, newHeight = os.height + oy, op = that.originalPosition,
isMaxWidth = o.maxWidth && (o.maxWidth < newWidth), isMaxHeight = o.maxHeight && (o.maxHeight < newHeight), a = that.axis,
isMinWidth = o.minWidth && (o.minWidth > newWidth), isMinHeight = o.minHeight && (o.minHeight > newHeight); grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
gridX = (grid[0]||1),
gridY = (grid[1]||1),
ox = Math.round((cs.width - os.width) / gridX) * gridX,
oy = Math.round((cs.height - os.height) / gridY) * gridY,
newWidth = os.width + ox,
newHeight = os.height + oy,
isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
isMinWidth = o.minWidth && (o.minWidth > newWidth),
isMinHeight = o.minHeight && (o.minHeight > newHeight);
o.grid = grid;
if (isMinWidth) { if (isMinWidth) {
newWidth = newWidth + gridX; newWidth = newWidth + gridX;

View File

@ -54,8 +54,7 @@ $.widget( "ui.slider", $.ui.mouse, {
" ui-slider-" + this.orientation + " ui-slider-" + this.orientation +
" ui-widget" + " ui-widget" +
" ui-widget-content" + " ui-widget-content" +
" ui-corner-all" + " ui-corner-all");
( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
this.range = $([]); this.range = $([]);
@ -116,6 +115,8 @@ $.widget( "ui.slider", $.ui.mouse, {
$( this ).data( "ui-slider-handle-index", i ); $( this ).data( "ui-slider-handle-index", i );
}); });
this._setOption( "disabled", o.disabled );
this._on( this.handles, { this._on( this.handles, {
keydown: function( event ) { keydown: function( event ) {
var allowed, curVal, newVal, step, var allowed, curVal, newVal, step,
@ -205,7 +206,6 @@ $.widget( "ui.slider", $.ui.mouse, {
.removeClass( "ui-slider" + .removeClass( "ui-slider" +
" ui-slider-horizontal" + " ui-slider-horizontal" +
" ui-slider-vertical" + " ui-slider-vertical" +
" ui-slider-disabled" +
" ui-widget" + " ui-widget" +
" ui-widget-content" + " ui-widget-content" +
" ui-corner-all" ); " ui-corner-all" );
@ -233,21 +233,15 @@ $.widget( "ui.slider", $.ui.mouse, {
distance = this._valueMax() - this._valueMin() + 1; distance = this._valueMax() - this._valueMin() + 1;
this.handles.each(function( i ) { this.handles.each(function( i ) {
var thisDistance = Math.abs( normValue - that.values(i) ); var thisDistance = Math.abs( normValue - that.values(i) );
if ( distance > thisDistance ) { if (( distance > thisDistance ) ||
( distance === thisDistance &&
(i === that._lastChangedValue || that.values(i) === o.min ))) {
distance = thisDistance; distance = thisDistance;
closestHandle = $( this ); closestHandle = $( this );
index = i; index = i;
} }
}); });
// workaround for bug #3736 (if both handles of a range are at 0,
// the first is always used as the one with least distance,
// and moving it is obviously prevented by preventing negative ranges)
if( o.range === true && this.values(1) === o.min ) {
index += 1;
closestHandle = $( this.handles[index] );
}
allowed = this._start( event, index ); allowed = this._start( event, index );
if ( allowed === false ) { if ( allowed === false ) {
return false; return false;
@ -419,6 +413,9 @@ $.widget( "ui.slider", $.ui.mouse, {
uiHash.values = this.values(); uiHash.values = this.values();
} }
//store the last changed value index for reference when handles overlap
this._lastChangedValue = index;
this._trigger( "change", event, uiHash ); this._trigger( "change", event, uiHash );
} }
}, },
@ -483,10 +480,8 @@ $.widget( "ui.slider", $.ui.mouse, {
this.handles.filter( ".ui-state-focus" ).blur(); this.handles.filter( ".ui-state-focus" ).blur();
this.handles.removeClass( "ui-state-hover" ); this.handles.removeClass( "ui-state-hover" );
this.handles.prop( "disabled", true ); this.handles.prop( "disabled", true );
this.element.addClass( "ui-disabled" );
} else { } else {
this.handles.prop( "disabled", false ); this.handles.prop( "disabled", false );
this.element.removeClass( "ui-disabled" );
} }
break; break;
case "orientation": case "orientation":

File diff suppressed because it is too large Load Diff

View File

@ -684,8 +684,6 @@ $.widget( "ui.tabs", {
.removeClass( "ui-tabs-anchor" ) .removeClass( "ui-tabs-anchor" )
.removeAttr( "role" ) .removeAttr( "role" )
.removeAttr( "tabIndex" ) .removeAttr( "tabIndex" )
.removeData( "href.tabs" )
.removeData( "load.tabs" )
.removeUniqueId(); .removeUniqueId();
this.tabs.add( this.panels ).each(function() { this.tabs.add( this.panels ).each(function() {
@ -710,7 +708,9 @@ $.widget( "ui.tabs", {
var li = $( this ), var li = $( this ),
prev = li.data( "ui-tabs-aria-controls" ); prev = li.data( "ui-tabs-aria-controls" );
if ( prev ) { if ( prev ) {
li.attr( "aria-controls", prev ); li
.attr( "aria-controls", prev )
.removeData( "ui-tabs-aria-controls" );
} else { } else {
li.removeAttr( "aria-controls" ); li.removeAttr( "aria-controls" );
} }