mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Removed all trailing whitespace from .js and .html files
This commit is contained in:
parent
ce69e7ced4
commit
29f7dc9a2c
@ -3,22 +3,22 @@
|
||||
<head>
|
||||
<title>jQuery UI - Functional demos</title>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
|
||||
|
||||
<meta name="keywords" content="jquery,user interface,ui,widgets,interaction,javascript" />
|
||||
<meta name="description" content="jQuery UI is jQuery's user interface library that comes with many widgets, interaction modules and themes." />
|
||||
<meta name="author" content="Paul Bakaus" />
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="images/favicon.ico" />
|
||||
<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="css/base.css" type="text/css" media="screen">
|
||||
<link rel="stylesheet" href="css/functional_demos.css" type="text/css" media="screen">
|
||||
<link rel="stylesheet" href="css/chilli-recipes.css" type="text/css" media="screen">
|
||||
<link rel="stylesheet" href="../../themes/default/ui.all.css" type="text/css" media="screen" title="Flora (Default)" />
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../../ui/ui.accordion.js"></script>
|
||||
<script type="text/javascript" src="../../ui/ui.datepicker.js"></script>
|
||||
@ -82,7 +82,7 @@
|
||||
<script type="text/javascript" src="../../ui/effects.shake.js"></script>
|
||||
<script type="text/javascript" src="../../ui/effects.slide.js"></script>
|
||||
<script type="text/javascript" src="../../ui/effects.transfer.js"></script>
|
||||
|
||||
|
||||
<script src="js/behaviour.js" type="text/javascript"></script>
|
||||
<script src="js/behaviour.functionaldemos.js" type="text/javascript"></script>
|
||||
|
||||
@ -111,7 +111,7 @@
|
||||
<h1 class="logo">
|
||||
<a href="http://ui.jquery.com/" title="jQuery User Interface"><span>jQuery User Interface</span></a>
|
||||
</h1>
|
||||
|
||||
|
||||
<div id="dock">
|
||||
<div class="left"></div>
|
||||
|
||||
@ -204,7 +204,7 @@
|
||||
<li><a href="#ui.resizable" title="Goto Resizable's Component Page">Resizable</a></li>
|
||||
<li><a href="#ui.selectable" title="Goto Selectable's Component Page">Selectable</a></li>
|
||||
<li><a href="#ui.sortable" title="Goto Sortable's Component Page">Sortable</a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<br style="clear:both;">
|
||||
@ -245,7 +245,7 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="normal">
|
||||
|
||||
|
||||
<div class="normal" id="containerDemo">
|
||||
<h3>
|
||||
Instructions
|
||||
@ -254,14 +254,14 @@
|
||||
|
||||
The functional demos are provided to give users an idea of how jQuery UI works. You only need to copy and paste code from the demos. Have fun playing with it.
|
||||
</p>
|
||||
|
||||
|
||||
<div id="functional-demo-face" style="margin-left: 10px;">
|
||||
<img src="images/functional-demo-face.png">
|
||||
</div>
|
||||
|
||||
|
||||
<br>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@ -270,7 +270,7 @@
|
||||
</form> </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="footer">
|
||||
|
||||
<div class="bg"></div>
|
||||
|
@ -1,9 +1,9 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
$('.component-links a').history(function() {
|
||||
loadDemo( $(this).attr('href').replace(/^#/, "") );
|
||||
});
|
||||
|
||||
$.ajaxHistory.initialize();
|
||||
|
||||
|
||||
});
|
@ -1,21 +1,21 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
// link demos
|
||||
|
||||
|
||||
$(".demoflow div.wrapper").click(function() {
|
||||
|
||||
|
||||
var demo = $(this).children('img').attr('_demo');
|
||||
|
||||
|
||||
if (demo) {
|
||||
location.href = '/repository/real-world/' + demo;
|
||||
}else {
|
||||
//alert('Under construction!');
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
if ($("div.demoflow").size()) {
|
||||
|
||||
|
||||
var inst = new $.ui.carousel($("div.demoflow")[0], { height: 200, width: 310 });
|
||||
|
||||
$("div.demoflow-button-left, div.demoflow-button-right").bind("mousedown", function() {
|
||||
@ -26,14 +26,14 @@ $(document).ready(function() {
|
||||
.bind("mouseup", function() {
|
||||
window.clearInterval(inst.timer);
|
||||
});
|
||||
|
||||
|
||||
$('.demoflow div.shadow').hover(function() {
|
||||
this._lastopacity = $(this).css('opacity');
|
||||
$(this).stop().animate({opacity: 0 }, 300);
|
||||
}, function() {
|
||||
$(this).stop().animate({opacity: this._lastopacity }, 300);
|
||||
});
|
||||
|
||||
|
||||
|
||||
window.setTimeout(function() {
|
||||
inst.element.animate({ opacity: 1 },2000); inst.rotate(0,2000,0.45);
|
||||
@ -47,13 +47,13 @@ $(document).ready(function() {
|
||||
$('a').click(function(){
|
||||
this.blur();
|
||||
});
|
||||
|
||||
|
||||
// smooth hover effects by DragonInteractive
|
||||
var hover = hoverEffects();
|
||||
hover.init();
|
||||
|
||||
});
|
||||
|
||||
|
||||
$.ui.carousel = function(element, options) {
|
||||
|
||||
this.element = $(element);
|
||||
@ -68,41 +68,41 @@ $(document).ready(function() {
|
||||
paddingX: this.element.outerWidth() / 2,
|
||||
paddingY: this.element.outerHeight() / 2
|
||||
});
|
||||
|
||||
|
||||
$("> *", this.element).css({ position: "absolute", top: 0, left: 0, zIndex: 1 });
|
||||
this.rotate();
|
||||
this.rotate("right");
|
||||
|
||||
|
||||
this.element.parent().bind("mousewheel", function(event ,delta) {
|
||||
if(self.autoRotator) window.clearInterval(self.autoRotator);
|
||||
self.rotate(delta < 0 ? "right" : "left");
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
$.ui.carousel.prototype.rotate = function(d,ani,speed) {
|
||||
|
||||
this.start = this.start + (d == "right" ? -(speed || 0.03) : (speed || 0.03));
|
||||
var o = this.options;
|
||||
var self = this;
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
$("> *", self.element).each(function(i) {
|
||||
var angle = self.start + i * self.step;
|
||||
var x = self.radiusX * Math.cos(angle);
|
||||
var y = self.radiusY * Math.sin(angle);
|
||||
var _self = this;
|
||||
|
||||
|
||||
var width = o.width * ((self.radiusY+y) / (2 * self.radiusY));
|
||||
width = (width * width * width) / (o.width * o.width); //This makes the pieces smaller
|
||||
var height = parseInt(width * o.height / o.width);
|
||||
|
||||
|
||||
//This is highly custom - it will hide the elements at the back
|
||||
$(_self).css({ visibility: height < 30 ? "hidden" : "visible" });
|
||||
if(height < 30 && !ani) return; //This imrpoves the speed, but cannot be used with animation
|
||||
|
||||
|
||||
|
||||
|
||||
if(ani) {
|
||||
$(_self).animate({
|
||||
top: Math.round(self.paddingY + y - height/2) + "px",
|
||||
@ -122,7 +122,7 @@ $(document).ready(function() {
|
||||
}
|
||||
|
||||
$("div.shadow",_self).css({ opacity: 1 - (width / o.width) });
|
||||
|
||||
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
@ -200,6 +200,6 @@ var hoverEffects = function() {
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return self;
|
||||
};
|
@ -6,38 +6,38 @@ var uid = 0;
|
||||
* @param {Object} model
|
||||
*/
|
||||
var uiRenderDemo = function(model) {
|
||||
|
||||
|
||||
var title = model.title, renderAt = $(model.renderAt);
|
||||
|
||||
|
||||
function nl2br( str ) {
|
||||
return str.replace(/([^>])\n/g, '$1<br />\n');
|
||||
}
|
||||
|
||||
|
||||
var js2html = function(code) {
|
||||
var src = (js_beautify(code) || "");
|
||||
|
||||
|
||||
//if ($.browser.msie)
|
||||
// src = src.replace(/([^>])\n/g, '$1<br />\n');
|
||||
|
||||
|
||||
return src;
|
||||
};
|
||||
|
||||
|
||||
renderAt.append(
|
||||
'<h3>'+ title +'</h3>'
|
||||
);
|
||||
|
||||
$.each(model.demos, function(i, demo) {
|
||||
|
||||
|
||||
/**
|
||||
* Rendering each demo
|
||||
*/
|
||||
|
||||
if (!demo) return;
|
||||
|
||||
|
||||
var uiHtmlRendered = $('<div class="ui-html-rendered"></div>');
|
||||
|
||||
|
||||
if (model.onRenderStart) model.onRenderStart.apply(window);
|
||||
|
||||
|
||||
var gid = 'ui-gen-'+uid++, demoBox = $('<div id="'+gid+'"></div>');
|
||||
|
||||
renderAt.append(demoBox);
|
||||
@ -45,15 +45,15 @@ var uiRenderDemo = function(model) {
|
||||
var detailsHtml = $(
|
||||
'<br><div class="ui-details"><div class="menutitle">'+demo.title+'</div></div>'
|
||||
);
|
||||
|
||||
|
||||
var descBox = $(
|
||||
'<div class="ui-demo-description">'+(demo.desc||'')+'</div>'
|
||||
);
|
||||
|
||||
|
||||
var optionsBox = $(
|
||||
'<div class="ui-demo-options"><label for="select-'+gid+'">Try more options on the fly: </label></div>'
|
||||
);
|
||||
|
||||
|
||||
var codesBox = $(
|
||||
'<div id="code-'+gid+'"></div>'
|
||||
)
|
||||
@ -62,19 +62,19 @@ var uiRenderDemo = function(model) {
|
||||
var sourceTmpl = $(
|
||||
'<div></div>'
|
||||
);
|
||||
|
||||
|
||||
var preTmpl = $(
|
||||
'<span style="white-space: pre;"></span>'
|
||||
);
|
||||
|
||||
|
||||
var codeTmpl = $(
|
||||
'<code></code>'
|
||||
);
|
||||
|
||||
|
||||
var htmlCode = '', sourceHtml = sourceTmpl.clone(), sourceJs = sourceTmpl.clone(), entitiesHtml = function(html) {
|
||||
return html.replace(/</g,"<").replace(/>/g,">");
|
||||
};
|
||||
|
||||
|
||||
// Render simple HTML
|
||||
if (typeof demo.html == 'string') {
|
||||
uiHtmlRendered.html(demo.html);
|
||||
@ -82,9 +82,9 @@ var uiRenderDemo = function(model) {
|
||||
}
|
||||
// Render data html by URL
|
||||
if (typeof demo.html == 'object' && demo.html.url) {
|
||||
|
||||
|
||||
uiHtmlRendered.html("<img src='/images/ajax-loader.gif'>");
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: demo.html.url,
|
||||
@ -92,26 +92,26 @@ var uiRenderDemo = function(model) {
|
||||
success: function(data) {
|
||||
uiHtmlRendered.html(data);
|
||||
htmlCode = data;
|
||||
|
||||
|
||||
// set html code view
|
||||
sourceHtml.html(preTmpl.clone().html( codeTmpl.clone().addClass('colored html').html(entitiesHtml(htmlCode)) ));
|
||||
|
||||
|
||||
$.each(demo.options, function(x, o) {
|
||||
// eval the first source of <select>
|
||||
if (!x) jQuery.globalEval(o.source);
|
||||
});
|
||||
|
||||
|
||||
$('#'+gid).find('.colored.html').chili();
|
||||
|
||||
|
||||
// fire renderEnd callback to ajax async transactions
|
||||
if (model.onRenderEnd) model.onRenderEnd.apply(window);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// set html code view
|
||||
sourceHtml.html(preTmpl.clone().html( codeTmpl.clone().addClass('colored html').html(entitiesHtml(htmlCode)) ));
|
||||
|
||||
|
||||
var select = $('<select id="select-'+ gid+'"></select>').change(function() {
|
||||
var ecode = decodeURIComponent($(this).val());
|
||||
|
||||
@ -137,7 +137,7 @@ var uiRenderDemo = function(model) {
|
||||
select, a, '<br>', codesBox.append('<br>JavaScript:<br>', sourceJs, '<br>HTML:<br>', sourceHtml)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// population select with the demo options
|
||||
$.each(demo.options, function(x, o) {
|
||||
if (o && o.desc) {
|
||||
@ -150,28 +150,28 @@ var uiRenderDemo = function(model) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#'+gid).find('.colored.javascript').chili();
|
||||
$('#'+gid).find('.colored.html').chili();
|
||||
|
||||
|
||||
// fire renderEnd callback to direct-html-render
|
||||
if (typeof demo.html != 'object' && model.onRenderEnd) model.onRenderEnd.apply(window);
|
||||
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
var loadDemo = function(comp) {
|
||||
|
||||
|
||||
$("#dialog").dialog().remove();
|
||||
|
||||
|
||||
$('#containerDemo').html("<img src='images/ajax-loader.gif'>");
|
||||
|
||||
|
||||
$("#containerDemo").ajaxError(function(request, settings){
|
||||
$(this).html("Oops, there is no template file for this component.");
|
||||
});
|
||||
|
||||
|
||||
$.get('templates/'+comp+'.html', function(data) {
|
||||
$('#containerDemo').html(data);
|
||||
});
|
||||
|
||||
|
||||
};
|
@ -1,11 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var model = {
|
||||
|
||||
|
||||
renderAt: '#containerDemo',
|
||||
|
||||
title: 'Dialog Demos',
|
||||
|
||||
|
||||
demos: [
|
||||
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
<img src="templates/images/P1010044.JPG" alt="Tatry 4" title="Drag me!" />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div class="droppable-photos-container" style="text-align: center;">Drop here!</div>
|
||||
|
||||
</div>
|
@ -95,7 +95,7 @@
|
||||
{ desc: 'Bounce ease in out', source: '$("#area").click(function(event) { moveToHere(event, "easeInOutBounce"); });' },
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
};
|
||||
|
@ -75,7 +75,7 @@
|
||||
{ desc: 'Scale from bottom-right', source: '$("#doScale").click(function() { $("#scale").effect("scale", {origin: ["bottom", "right"], percent: 50}, 800); });' }
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
title: 'Size',
|
||||
desc: 'Changes the size of an element by specifying a width and height.',
|
||||
@ -126,7 +126,7 @@
|
||||
{ desc: 'Transfer with extra class', source: '$("#doTransfer").click(function() { $("#transfer").effect("transfer", {to: "#target", className: "transferring"}, 800); });' }
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
|
||||
};
|
||||
|
@ -1,11 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var model = {
|
||||
|
||||
|
||||
renderAt: '#containerDemo',
|
||||
|
||||
title: 'Progressbar Demos',
|
||||
|
||||
|
||||
demos: [
|
||||
|
||||
{
|
||||
|
@ -1,11 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var model = {
|
||||
|
||||
|
||||
renderAt: '#containerDemo',
|
||||
|
||||
title: 'Slider Demos',
|
||||
|
||||
|
||||
demos: [
|
||||
|
||||
{
|
||||
@ -20,7 +20,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
title: 'Multiple slides',
|
||||
desc: 'You can also have multiples slides.',
|
||||
|
@ -1,16 +1,16 @@
|
||||
<div class="sortable-container">
|
||||
|
||||
|
||||
<div id="example1">
|
||||
|
||||
|
||||
<button onclick="$('#selectedUsers').sortable('enable')" type="button">Enable</button>
|
||||
<button onclick="$('#selectedUsers').sortable('disable')" type="button">Disable</button>
|
||||
<button onclick="alert($('#selectedUsers').sortable('serialize'))" type="button">Serialize!</button>
|
||||
<button onclick="alert($('#selectedUsers').sortable('toArray'))" type="button">ID's to Array!</button>
|
||||
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
<div id="sortable-ex" style="min-height: 110px; min-height:110px; height: auto !important;">
|
||||
|
||||
|
||||
<div style="float: left;">
|
||||
Selected users
|
||||
<ul id="selectedUsers" style="cursor: hand; cursor: pointer;">
|
||||
@ -21,7 +21,7 @@
|
||||
<li id='user_Kate'>Kate</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<div style="float: left; margin-left: 50px;">
|
||||
User list
|
||||
<ul id="userList" style="cursor: hand; cursor: pointer;">
|
||||
@ -32,9 +32,9 @@
|
||||
<li id='user_Daniel'>Daniel</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<br style="clear: both;">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,7 +1,7 @@
|
||||
<div class="sortable-container">
|
||||
|
||||
|
||||
<div id="example3">
|
||||
|
||||
|
||||
<div style="min-height: 50px; min-height:50px; height:auto !important;">
|
||||
<style type="text/css" media="screen">
|
||||
#placeholderSortable li {
|
||||
@ -15,9 +15,9 @@
|
||||
<li id='user_Claire'>Claire</li>
|
||||
<li id='user_Daniel'>Daniel</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
@ -1,21 +1,21 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var model = {
|
||||
|
||||
|
||||
onRenderEnd: function() {
|
||||
|
||||
|
||||
$.ui.disableSelection($('#sortable-ex').get(0));
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
renderAt: '#containerDemo',
|
||||
|
||||
title: 'Sortable Demos',
|
||||
|
||||
|
||||
demos: [
|
||||
|
||||
{
|
||||
|
||||
|
||||
title: 'Sortable',
|
||||
desc: 'With few lines of code you could have sortable elements. You can try more options on the fly!',
|
||||
html: { url: 'templates/ui.sortable.ex1.html' },
|
||||
|
@ -1,11 +1,11 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var model = {
|
||||
|
||||
|
||||
renderAt: '#containerDemo',
|
||||
|
||||
title: 'Spinner Demos',
|
||||
|
||||
|
||||
demos: [
|
||||
|
||||
{
|
||||
|
@ -1,13 +1,13 @@
|
||||
<div id="tabsEx1">
|
||||
|
||||
|
||||
<input type="button" onclick="$('#tabsEx1 > ul').tabs('add', '#appended-tab', 'New Tab');" value="Add new tab">
|
||||
<input type="button" onclick="$('#tabsEx1 > ul').tabs('add', '#inserted-tab', 'New Tab', 1);" value="Insert tab">
|
||||
<input type="button" onclick="$('#tabsEx1 > ul').tabs('disable', 1);" value="Disable tab 2">
|
||||
<input type="button" onclick="$('#tabsEx1 > ul').tabs('enable', 1);" value="Enable tab 2">
|
||||
<input type="button" onclick="$('#tabsEx1 > ul').tabs('select', 2);" value="Select tab 3">
|
||||
|
||||
|
||||
<br><br>
|
||||
|
||||
|
||||
<ul style="height: 30px;">
|
||||
<li><a href="#fragment-1"><span>One</span></a></li>
|
||||
<li><a href="#fragment-2"><span>Two</span></a></li>
|
||||
|
@ -1,5 +1,5 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
$("div.effect")
|
||||
.hover(function() {
|
||||
$(this).addClass("hover");
|
||||
@ -7,16 +7,16 @@ $(document).ready(function() {
|
||||
$(this).removeClass("hover");
|
||||
})
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
var effect = function(el, n, o) {
|
||||
|
||||
|
||||
$.extend(o, {
|
||||
easing: "easeOutQuint"
|
||||
});
|
||||
|
||||
|
||||
$(el).bind("click", function() {
|
||||
|
||||
|
||||
$(this).addClass("current").hide(n, o, 1000, function() {
|
||||
var self = this;
|
||||
window.setTimeout(function() {
|
||||
@ -24,42 +24,42 @@ $(document).ready(function() {
|
||||
},500);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
effect("#blindHorizontally", "blind", { direction: "horizontal" });
|
||||
effect("#blindVertically", "blind", { direction: "vertical" });
|
||||
|
||||
|
||||
effect("#bounce3times", "bounce", { times: 3 });
|
||||
|
||||
|
||||
effect("#clipHorizontally", "clip", { direction: "horizontal" });
|
||||
effect("#clipVertically", "clip", { direction: "vertical" });
|
||||
|
||||
|
||||
effect("#dropDown", "drop", { direction: "down" });
|
||||
effect("#dropUp", "drop", { direction: "up" });
|
||||
effect("#dropLeft", "drop", { direction: "left" });
|
||||
effect("#dropRight", "drop", { direction: "right" });
|
||||
|
||||
|
||||
effect("#explode9", "explode", { });
|
||||
effect("#explode36", "explode", { pieces: 36 });
|
||||
|
||||
|
||||
effect("#fold", "fold", { size: 50 });
|
||||
|
||||
|
||||
effect("#highlight", "highlight", { });
|
||||
|
||||
|
||||
effect("#pulsate", "pulsate", { times: 2 });
|
||||
|
||||
|
||||
effect("#puff", "puff", { times: 2 });
|
||||
effect("#scale", "scale", { });
|
||||
|
||||
|
||||
$("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); });
|
||||
|
||||
|
||||
effect("#slideDown", "slide", { direction: "down" });
|
||||
effect("#slideUp", "slide", { direction: "up" });
|
||||
effect("#slideLeft", "slide", { direction: "left" });
|
||||
effect("#slideRight", "slide", { direction: "right" });
|
||||
|
||||
|
||||
$("#transfer").bind("click", function() { $(this).addClass("current").effect("transfer", { to: "div:eq(0)" }, 1000, function() { $(this).removeClass("current"); }); });
|
||||
|
||||
|
||||
});
|
@ -4,10 +4,10 @@
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<title>Effects Test Suite</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8" />
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/effects.core.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../ui/effects.blind.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/effects.bounce.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/effects.clip.js"></script>
|
||||
@ -20,7 +20,7 @@
|
||||
<script type="text/javascript" src="../../../ui/effects.shake.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/effects.slide.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/effects.transfer.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="demo.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -38,121 +38,121 @@
|
||||
<p>Blind vertically</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="bounce3times">
|
||||
<p>Bounce 3 times</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="clipHorizontally">
|
||||
<p>Clip horizontally</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="clipVertically">
|
||||
<p>Clip vertically</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropDown">
|
||||
<p>Drop down</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropUp">
|
||||
<p>Drop up</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropLeft">
|
||||
<p>Drop left</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropRight">
|
||||
<p>Drop right</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="explode9">
|
||||
<p>Explode in 9 pieces</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="explode36">
|
||||
<p>Explode in 36 pieces</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="fold">
|
||||
<p>Fold</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="highlight">
|
||||
<p>Highlight</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="pulsate">
|
||||
<p>Pulsate 2 times</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="puff">
|
||||
<p>Puff</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="scale">
|
||||
<p>Scale</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="shake">
|
||||
<p>Shake</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideDown">
|
||||
<p>Slide down</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideUp">
|
||||
<p>Slide up</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideLeft">
|
||||
<p>Slide left</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideRight">
|
||||
<p>Slide right</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="transfer">
|
||||
<p>Transfer to first element</p>
|
||||
|
@ -9,7 +9,7 @@
|
||||
<script type="text/javascript" src="../../../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/ui.resizable.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/ui.draggable.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../ui/effects.core.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/effects.bounce.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/effects.scale.js"></script>
|
||||
@ -112,7 +112,7 @@
|
||||
//animate:true,
|
||||
|
||||
handles: 'all',
|
||||
|
||||
|
||||
knobHandles: true,
|
||||
|
||||
//transparent: true,
|
||||
@ -127,9 +127,9 @@
|
||||
|
||||
resize: function(event, ui) {
|
||||
var self = $(this).data("resizable");
|
||||
|
||||
|
||||
this.style.backgroundPosition = '-' + (self.position.left) + 'px -' + (self.position.top) + 'px';
|
||||
|
||||
|
||||
|
||||
$("#log-top").html(self.position.top+"px");
|
||||
$("#log-left").html(self.position.left+"px");
|
||||
|
@ -6,28 +6,28 @@
|
||||
.filter(':first').addClass('first').find('.up').addClass('disabled').end().end()
|
||||
.filter(':last').addClass('last').find('.down').addClass('disabled').end().end();
|
||||
};
|
||||
|
||||
|
||||
function moveUpDown() {
|
||||
var link = $(this),
|
||||
dl = link.parents('dl'),
|
||||
prev = dl.prev('dl'),
|
||||
next = dl.next('dl');
|
||||
|
||||
|
||||
if(link.is('.up') && prev.length > 0)
|
||||
dl.insertBefore(prev);
|
||||
|
||||
|
||||
if(link.is('.down') && next.length > 0)
|
||||
dl.insertAfter(next);
|
||||
|
||||
|
||||
updateUpDown(dl.parent());
|
||||
};
|
||||
|
||||
|
||||
function addControls() {
|
||||
$(this).append('<span class="options"><a class="up">up</a><a class="down">down</a></span>')
|
||||
.find('a.up, a.down').bind('click', moveUpDown);
|
||||
updateUpDown($(this).parents(".ui-sortable:first"));
|
||||
}
|
||||
|
||||
|
||||
var counter = 1;
|
||||
function addItem() {
|
||||
var sortable = $(this).parents('.ui-sortable:first');
|
||||
@ -38,11 +38,11 @@
|
||||
sortable.append(html).sortable('refresh').find('a.up, a.down').bind('click', moveUpDown);
|
||||
updateUpDown(sortable);
|
||||
};
|
||||
|
||||
|
||||
function emptyTrashCan(item) {
|
||||
item.remove();
|
||||
};
|
||||
|
||||
|
||||
function sortableChange(event, ui) {
|
||||
if(ui.sender){
|
||||
var w = ui.element.width();
|
||||
@ -50,7 +50,7 @@
|
||||
ui.helper.css("width",ui.element.children().width());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function sortableUpdate(event, ui) {
|
||||
if(ui.element[0].id == 'trashcan'){
|
||||
emptyTrashCan(ui.item);
|
||||
@ -60,22 +60,22 @@
|
||||
updateUpDown(ui.sender[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
var els = ['#header', '#content', '#sidebar', '#footer', '#trashcan'];
|
||||
var $els = $(els.toString());
|
||||
|
||||
|
||||
$('h2', $els.slice(0,-1)).append('<span class="options"><a class="add">add</a></span>');
|
||||
$('dt', $els).each(addControls);
|
||||
//$('dt', $els).append('<span class="options"><a class="up">up</a><a class="down">down</a></span>');
|
||||
|
||||
|
||||
$('a.add').bind('click', addItem);
|
||||
//$('a.up, a.down').bind('click', moveUpDown);
|
||||
|
||||
|
||||
$els.each(function(){
|
||||
updateUpDown(this);
|
||||
});
|
||||
|
||||
|
||||
$els.sortable({
|
||||
items: '> dl',
|
||||
handle: 'dt',
|
||||
@ -101,7 +101,7 @@
|
||||
handle: 'dt'
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
$(window).bind('load',function(){
|
||||
setTimeout(function(){
|
||||
// fixes the weird scrolling in IE while killing the fade
|
||||
|
@ -3,27 +3,27 @@
|
||||
<head>
|
||||
<title>UI Sortable: Layout Demo</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
|
||||
|
||||
<meta name="title" content="UI Sortable: Layout Demo" />
|
||||
<meta name="description" content="A sortable layout created with the jQuery UI suite" />
|
||||
|
||||
|
||||
<meta name="author" content="Joan Piedra" />
|
||||
<meta name="author-url" content="http://www.joanpiedra.com/" />
|
||||
<meta name="author-url" content="http://www.justaquit.com/" />
|
||||
<meta name="author-url" content="http://jquery.com/" />
|
||||
|
||||
|
||||
<link rel="shortcut icon" href="http://jquery.com/favicon.ico" />
|
||||
<link rel="icon" href="http://jquery.com/favicon.ico" type="image/x-icon" />
|
||||
|
||||
|
||||
<link rel="stylesheet" href="demo.css" type="text/css" media="screen" />
|
||||
<!--[if IE]>
|
||||
<link rel="stylesheet" href="demo-ie.css" type="text/css" media="screen" />
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
|
||||
<body id="uidemo">
|
||||
<h1>UI Sortable: <em>Layout demo</em></h1>
|
||||
|
||||
|
||||
<div id="container">
|
||||
<div id="header" class="ui-sortable">
|
||||
<h2>Header</h2>
|
||||
@ -32,7 +32,7 @@
|
||||
<dd>Main Navigation</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="content" class="ui-sortable">
|
||||
<h2>Content</h2>
|
||||
<dl class="sort">
|
||||
@ -40,7 +40,7 @@
|
||||
<dd>Main blog post</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="sidebar" class="ui-sortable">
|
||||
<h2>Sidebar</h2>
|
||||
<dl class="sort">
|
||||
@ -56,9 +56,9 @@
|
||||
<dd>Random Links</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
|
||||
<div id="footer" class="ui-sortable">
|
||||
<h2>Footer</h2>
|
||||
<dl class="sort">
|
||||
@ -67,7 +67,7 @@
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="meta">
|
||||
<div id="components" class="ui-sortable">
|
||||
<h2>Components</h2>
|
||||
@ -81,20 +81,20 @@
|
||||
<dd>Caption</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="trashcan" class="ui-sortable">
|
||||
<h2>Trash can</h2>
|
||||
<p>Drag modules here to delete them.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clear"></div>
|
||||
<div id="overlay">
|
||||
<div id="preloader"><img src="loader.gif" alt="" /></div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../jquery-1.2.6.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/ui.draggable.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/ui.droppable.js"></script>
|
||||
|
@ -125,8 +125,8 @@
|
||||
<div style="margin: 5px; padding: 5px;min-height:20px" class="ui-slider-2 ui-slider" id="sliderSize">
|
||||
<a style="cursor: default;" href="javascript:void(0)">
|
||||
<div class="ui-slider-handle" style="left: 150px;min-height:20px"></div>
|
||||
</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box" id="trash">
|
||||
<h2>Trash (drag me back)</h2>
|
||||
|
@ -117,15 +117,15 @@ $(window).bind('load', function() {
|
||||
.displayBox();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
var sliderChange = function(event, ui){
|
||||
$('.img_content').each(function(index, item){
|
||||
var _new = 1.44 * $('#sliderSize').slider("value");
|
||||
|
||||
|
||||
$(this).css("width", _new+'px')
|
||||
.parent().css("width", (_new+16)+'px');
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
$('#sliderSize').slider({
|
||||
@ -136,7 +136,7 @@ $(window).bind('load', function() {
|
||||
slide : sliderChange,
|
||||
change : sliderChange
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
function createGalleryItem(img) {
|
||||
|
@ -8,15 +8,15 @@
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
|
||||
$.extend($.fn, {
|
||||
livequery: function(type, fn, fn2) {
|
||||
var self = this, q;
|
||||
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
|
||||
// See if Live Query already exists
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
@ -24,34 +24,34 @@ $.extend($.fn, {
|
||||
// Found the query, exit the each loop
|
||||
return (q = query) && false;
|
||||
});
|
||||
|
||||
|
||||
// Create new Live Query if it wasn't found
|
||||
q = q || new $.livequery(this.selector, this.context, type, fn, fn2);
|
||||
|
||||
|
||||
// Make sure it is running
|
||||
q.stopped = false;
|
||||
|
||||
|
||||
// Run it
|
||||
$.livequery.run( q.id );
|
||||
|
||||
|
||||
// Contnue the chain
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
expire: function(type, fn, fn2) {
|
||||
var self = this;
|
||||
|
||||
|
||||
// Handle different call patterns
|
||||
if ($.isFunction(type))
|
||||
fn2 = fn, fn = type, type = undefined;
|
||||
|
||||
|
||||
// Find the Live Query based on arguments and stop it
|
||||
$.each( $.livequery.queries, function(i, query) {
|
||||
if ( self.selector == query.selector && self.context == query.context &&
|
||||
(!type || type == query.type) && (!fn || fn.$lqguid == query.fn.$lqguid) && (!fn2 || fn2.$lqguid == query.fn2.$lqguid) && !this.stopped )
|
||||
$.livequery.stop(query.id);
|
||||
});
|
||||
|
||||
|
||||
// Continue the chain
|
||||
return this;
|
||||
}
|
||||
@ -65,14 +65,14 @@ $.livequery = function(selector, context, type, fn, fn2) {
|
||||
this.fn2 = fn2;
|
||||
this.elements = [];
|
||||
this.stopped = false;
|
||||
|
||||
|
||||
// The id is the index of the Live Query in $.livequery.queries
|
||||
this.id = $.livequery.queries.push(this)-1;
|
||||
|
||||
|
||||
// Mark the functions for matching later on
|
||||
fn.$lqguid = fn.$lqguid || $.livequery.guid++;
|
||||
if (fn2) fn2.$lqguid = fn2.$lqguid || $.livequery.guid++;
|
||||
|
||||
|
||||
// Return the Live Query
|
||||
return this;
|
||||
};
|
||||
@ -80,7 +80,7 @@ $.livequery = function(selector, context, type, fn, fn2) {
|
||||
$.livequery.prototype = {
|
||||
stop: function() {
|
||||
var query = this;
|
||||
|
||||
|
||||
if ( this.type )
|
||||
// Unbind all bound events
|
||||
this.elements.unbind(this.type, this.fn);
|
||||
@ -89,30 +89,30 @@ $.livequery.prototype = {
|
||||
this.elements.each(function(i, el) {
|
||||
query.fn2.apply(el);
|
||||
});
|
||||
|
||||
|
||||
// Clear out matched elements
|
||||
this.elements = [];
|
||||
|
||||
|
||||
// Stop the Live Query from running until restarted
|
||||
this.stopped = true;
|
||||
},
|
||||
|
||||
|
||||
run: function() {
|
||||
// Short-circuit if stopped
|
||||
if ( this.stopped ) return;
|
||||
var query = this;
|
||||
|
||||
|
||||
var oEls = this.elements,
|
||||
els = $(this.selector, this.context),
|
||||
nEls = els.not(oEls);
|
||||
|
||||
|
||||
// Set elements to the latest set of matched elements
|
||||
this.elements = els;
|
||||
|
||||
|
||||
if (this.type) {
|
||||
// Bind events to newly matched elements
|
||||
nEls.bind(this.type, this.fn);
|
||||
|
||||
|
||||
// Unbind events to elements no longer matched
|
||||
if (oEls.length > 0)
|
||||
$.each(oEls, function(i, el) {
|
||||
@ -125,7 +125,7 @@ $.livequery.prototype = {
|
||||
nEls.each(function() {
|
||||
query.fn.apply(this);
|
||||
});
|
||||
|
||||
|
||||
// Call the second function for elements no longer matched
|
||||
if ( this.fn2 && oEls.length > 0 )
|
||||
$.each(oEls, function(i, el) {
|
||||
@ -142,7 +142,7 @@ $.extend($.livequery, {
|
||||
queue: [],
|
||||
running: false,
|
||||
timeout: null,
|
||||
|
||||
|
||||
checkQueue: function() {
|
||||
if ( $.livequery.running && $.livequery.queue.length ) {
|
||||
var length = $.livequery.queue.length;
|
||||
@ -151,41 +151,41 @@ $.extend($.livequery, {
|
||||
$.livequery.queries[ $.livequery.queue.shift() ].run();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
pause: function() {
|
||||
// Don't run anymore Live Queries until restarted
|
||||
$.livequery.running = false;
|
||||
},
|
||||
|
||||
|
||||
play: function() {
|
||||
// Restart Live Queries
|
||||
$.livequery.running = true;
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
},
|
||||
|
||||
|
||||
registerPlugin: function() {
|
||||
$.each( arguments, function(i,n) {
|
||||
// Short-circuit if the method doesn't exist
|
||||
if (!$.fn[n]) return;
|
||||
|
||||
|
||||
// Save a reference to the original method
|
||||
var old = $.fn[n];
|
||||
|
||||
|
||||
// Create a new method
|
||||
$.fn[n] = function() {
|
||||
// Call the original method
|
||||
var r = old.apply(this, arguments);
|
||||
|
||||
|
||||
// Request a run of the Live Queries
|
||||
$.livequery.run();
|
||||
|
||||
|
||||
// Return the original methods result
|
||||
return r;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
run: function(id) {
|
||||
if (id != undefined) {
|
||||
// Put the particular Live Query in the queue if it doesn't already exist
|
||||
@ -198,13 +198,13 @@ $.extend($.livequery, {
|
||||
if ( $.inArray(id, $.livequery.queue) < 0 )
|
||||
$.livequery.queue.push( id );
|
||||
});
|
||||
|
||||
|
||||
// Clear timeout if it already exists
|
||||
if ($.livequery.timeout) clearTimeout($.livequery.timeout);
|
||||
// Create a timeout to check the queue and actually run the Live Queries
|
||||
$.livequery.timeout = setTimeout($.livequery.checkQueue, 20);
|
||||
},
|
||||
|
||||
|
||||
stop: function(id) {
|
||||
if (id != undefined)
|
||||
// Stop are particular Live Query
|
||||
@ -231,20 +231,20 @@ var init = $.prototype.init;
|
||||
$.prototype.init = function(a,c) {
|
||||
// Call the original init and save the result
|
||||
var r = init.apply(this, arguments);
|
||||
|
||||
|
||||
// Copy over properties if they exist already
|
||||
if (a && a.selector)
|
||||
r.context = a.context, r.selector = a.selector;
|
||||
|
||||
|
||||
// Set properties
|
||||
if ( typeof a == 'string' )
|
||||
r.context = c || document, r.selector = a;
|
||||
|
||||
|
||||
// Return the result
|
||||
return r;
|
||||
};
|
||||
|
||||
// Give the init function the jQuery prototype for later instantiation (needed after Rev 4091)
|
||||
$.prototype.init.prototype = $.prototype;
|
||||
|
||||
|
||||
})(jQuery);
|
@ -57,7 +57,7 @@
|
||||
<div id="col-1">
|
||||
<div id="slider1" class="ui-slider-2">
|
||||
<div class="ui-slider-handle"></div>
|
||||
<div class="ui-slider-handle"></div>
|
||||
<div class="ui-slider-handle"></div>
|
||||
<span class="label-1">0</span>
|
||||
<span class="label-2">100</span>
|
||||
</div>
|
||||
@ -76,7 +76,7 @@
|
||||
<option>bounce</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="col-2">
|
||||
<div>0</div>
|
||||
<div>10</div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
<!-- jQuery -->
|
||||
<script type="text/javascript" src="../../../jquery-1.2.6.js"></script>
|
||||
|
||||
|
||||
<!-- jQuery UI -->
|
||||
<script type="text/javascript" src="../../../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../../../ui/ui.resizable.js"></script>
|
||||
@ -26,9 +26,9 @@
|
||||
<span class="ui-toolbar-item-hide-icon"></span> <span>jQuery UI Resizable SplitPanel</span>
|
||||
</div>
|
||||
<table id="container" cellpadding="0" cellspacing="0" border="0">
|
||||
|
||||
|
||||
<tr>
|
||||
|
||||
|
||||
<td class="ui-split-side-box">
|
||||
<div class="ui-split-side">
|
||||
<ul id="component-links">
|
||||
@ -43,17 +43,17 @@
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
|
||||
<td class="ui-split-main-box">
|
||||
<div class="ui-split-main1">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum commodo mollis tortor. Ut dapibus turpis consequat quam. Nulla lacinia. Donec nunc. Donec sollicitudin. Vivamus orci. Pellentesque tempus velit vitae odio. Maecenas enim arcu, volutpat ac, viverra id, bibendum eu, felis. Vestibulum imperdiet arcu. Ut nisi. Cras vel lectus consectetuer mauris luctus ultrices. Duis fringilla pellentesque sapien.
|
||||
<br><br>
|
||||
Cras tristique justo vel metus. Pellentesque dolor libero, ullamcorper ac, vehicula eget, porttitor at, dui. Ut a nibh. Nunc sit amet turpis. Aenean diam dui, consequat vel, scelerisque id, accumsan a, lectus. Duis ultrices, enim vitae pharetra tincidunt, elit nunc sollicitudin felis, dapibus pellentesque urna velit ut quam. Donec scelerisque vehicula dolor. Suspendisse lectus dui, posuere sit amet, sagittis nec, vulputate in, libero. Morbi tempus sagittis est. Phasellus in nisi. Sed a ligula. Vivamus condimentum quam non nibh. Fusce pellentesque, neque ac scelerisque luctus, leo elit bibendum elit, in rutrum leo erat tristique felis. Etiam consequat fringilla eros. Nullam neque. Aenean mollis, odio at consectetuer sollicitudin, tortor lorem facilisis nunc, sit amet condimentum lectus libero convallis dolor. Vivamus quis risus.
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
<td class="ui-split-main-box">
|
||||
<div class="ui-split-main2">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum commodo mollis tortor. Ut dapibus turpis consequat quam. Nulla lacinia. Donec nunc. Donec sollicitudin. Vivamus orci. Pellentesque tempus velit vitae odio. Maecenas enim arcu, volutpat ac, viverra id, bibendum eu, felis. Vestibulum imperdiet arcu. Ut nisi. Cras vel lectus consectetuer mauris luctus ultrices. Duis fringilla pellentesque sapien.
|
||||
@ -61,7 +61,7 @@
|
||||
Cras tristique justo vel metus. Pellentesque dolor libero, ullamcorper ac, vehicula eget, porttitor at, dui. Ut a nibh. Nunc sit amet turpis. Aenean diam dui, consequat vel, scelerisque id, accumsan a, lectus. Duis ultrices, enim vitae pharetra tincidunt, elit nunc sollicitudin felis, dapibus pellentesque urna velit ut quam. Donec scelerisque vehicula dolor. Suspendisse lectus dui, posuere sit amet, sagittis nec, vulputate in, libero. Morbi tempus sagittis est. Phasellus in nisi. Sed a ligula. Vivamus condimentum quam non nibh. Fusce pellentesque, neque ac scelerisque luctus, leo elit bibendum elit, in rutrum leo erat tristique felis. Etiam consequat fringilla eros. Nullam neque. Aenean mollis, odio at consectetuer sollicitudin, tortor lorem facilisis nunc, sit amet condimentum lectus libero convallis dolor. Vivamus quis risus.
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
<td class="ui-split-main-box">
|
||||
<div class="ui-split-main3">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum commodo mollis tortor. Ut dapibus turpis consequat quam. Nulla lacinia. Donec nunc. Donec sollicitudin. Vivamus orci. Pellentesque tempus velit vitae odio. Maecenas enim arcu, volutpat ac, viverra id, bibendum eu, felis. Vestibulum imperdiet arcu. Ut nisi. Cras vel lectus consectetuer mauris luctus ultrices. Duis fringilla pellentesque sapien.
|
||||
@ -69,9 +69,9 @@
|
||||
Cras tristique justo vel metus. Pellentesque dolor libero, ullamcorper ac, vehicula eget, porttitor at, dui. Ut a nibh. Nunc sit amet turpis. Aenean diam dui, consequat vel, scelerisque id, accumsan a, lectus. Duis ultrices, enim vitae pharetra tincidunt, elit nunc sollicitudin felis, dapibus pellentesque urna velit ut quam. Donec scelerisque vehicula dolor. Suspendisse lectus dui, posuere sit amet, sagittis nec, vulputate in, libero. Morbi tempus sagittis est. Phasellus in nisi. Sed a ligula. Vivamus condimentum quam non nibh. Fusce pellentesque, neque ac scelerisque luctus, leo elit bibendum elit, in rutrum leo erat tristique felis. Etiam consequat fringilla eros. Nullam neque. Aenean mollis, odio at consectetuer sollicitudin, tortor lorem facilisis nunc, sit amet condimentum lectus libero convallis dolor. Vivamus quis risus.
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
@ -82,7 +82,7 @@
|
||||
minWidth: 200,
|
||||
maxWidth: 800
|
||||
});
|
||||
|
||||
|
||||
$('div.ui-split-side').resizable({
|
||||
handles: 'e',
|
||||
proxy: 'proxy',
|
||||
|
@ -2,13 +2,13 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>jQuery UI Accordion Test Suite</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
@ -109,7 +109,7 @@
|
||||
Cool kids are blue.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<div id="list3">
|
||||
<div>
|
||||
<div class="title">Tennis</div>
|
||||
@ -134,7 +134,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
@ -133,7 +133,7 @@ test("accessibility", function () {
|
||||
expect(9);
|
||||
var ac = $('#list1').accordion().accordion("activate", 1);
|
||||
var headers = $(".ui-accordion-header");
|
||||
|
||||
|
||||
equals( headers.eq(1).attr("tabindex"), "0", "active header should have tabindex=0");
|
||||
equals( headers.eq(0).attr("tabindex"), "-1", "inactive header should have tabindex=-1");
|
||||
equals( ac.attr("role"), "tablist", "main role");
|
||||
|
@ -18,7 +18,7 @@
|
||||
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.spinner.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
<script type="text/javascript" src="plugins/cookie/jquery.cookie.js"></script>
|
||||
@ -152,7 +152,7 @@
|
||||
Cool kids are blue.
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<div id="list3">
|
||||
<div>
|
||||
<div class="title">Tennis</div>
|
||||
@ -222,7 +222,7 @@
|
||||
<div id="colon:test"></div>
|
||||
<div style="height: 300px;" id="inline-style"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -33,10 +33,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
|
||||
@ -51,7 +51,7 @@
|
||||
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.spinner.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
<script type="text/javascript" src="plugins/cookie/jquery.cookie.js"></script>
|
||||
|
@ -2,16 +2,16 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>jQuery UI Core Test Suite</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
<!--link rel="stylesheet" href="../themes/flora/flora.dialog.css" type="text/css" media="screen"-->
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="core.js"></script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
html { border: 0; }
|
||||
</style>
|
||||
|
@ -7,7 +7,7 @@ module("selectors");
|
||||
|
||||
test("tabbable - enabled elements", function() {
|
||||
expect(10);
|
||||
|
||||
|
||||
ok( $('#input1-1').is(':tabbable'), 'input, no type');
|
||||
ok( $('#input1-2').is(':tabbable'), 'input, type text');
|
||||
ok( $('#input1-3').is(':tabbable'), 'input, type checkbox');
|
||||
@ -22,7 +22,7 @@ test("tabbable - enabled elements", function() {
|
||||
|
||||
test("tabbable - disabled elements", function() {
|
||||
expect(8);
|
||||
|
||||
|
||||
ok(!$('#input2-1').is(':tabbable'), 'input, no type');
|
||||
ok(!$('#input2-2').is(':tabbable'), 'input, type text');
|
||||
ok(!$('#input2-3').is(':tabbable'), 'input, type checkbox');
|
||||
@ -35,7 +35,7 @@ test("tabbable - disabled elements", function() {
|
||||
|
||||
test("tabbable - hidden styles", function() {
|
||||
expect(6);
|
||||
|
||||
|
||||
ok(!$('#input3-1').is(':tabbable'), 'input, hidden wrapper - display: none');
|
||||
ok(!$('#anchor3-1').is(':tabbable'), 'anchor, hidden wrapper - display: none');
|
||||
ok(!$('#input3-2').is(':tabbable'), 'input, hidden wrapper - visibility: hidden');
|
||||
@ -46,7 +46,7 @@ test("tabbable - hidden styles", function() {
|
||||
|
||||
test("tabbable - tabindex", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
ok( $('#input4-1').is(':tabbable'), 'input, tabindex 0');
|
||||
ok( $('#input4-2').is(':tabbable'), 'input, tabindex 10');
|
||||
ok(!$('#input4-3').is(':tabbable'), 'input, tabindex -1');
|
||||
@ -57,20 +57,20 @@ module('jQuery extensions');
|
||||
|
||||
test("attr - aria", function() {
|
||||
expect(6);
|
||||
|
||||
|
||||
var el = $('#aria');
|
||||
|
||||
|
||||
ok(!el.attr('role'), 'role is empty via attr');
|
||||
equals(el.attr('role', 'tablist').attr('role'), 'tablist', 'role is tablist');
|
||||
|
||||
|
||||
equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined');
|
||||
|
||||
|
||||
el.attr('aria-expanded', true);
|
||||
equals(el.attr('aria-expanded'), 'true', 'aria expanded is true');
|
||||
|
||||
|
||||
el.removeAttr('aria-expanded');
|
||||
equals(el.attr('aria-expanded'), undefined, 'aria expanded is undefined after removing');
|
||||
|
||||
|
||||
el.attr('aria-expanded', false);
|
||||
equals(el.attr('aria-expanded'), 'false', 'aria expanded is false');
|
||||
});
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>jQuery UI Datepicker Test Suite</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
@ -10,7 +10,7 @@
|
||||
<script type="text/javascript" src="../ui/ui.datepicker.js"></script>
|
||||
<script type="text/javascript" src="../ui/i18n/ui.datepicker-fr.js"></script>
|
||||
<script type="text/javascript" src="../ui/i18n/ui.datepicker-he.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
@ -5,18 +5,18 @@
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
<!--link rel="stylesheet" href="../themes/flora/flora.dialog.css" type="text/css" media="screen"-->
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.dialog.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="dialog.js"></script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
html { border: 0; }
|
||||
</style>
|
||||
|
138
tests/dialog.js
138
tests/dialog.js
@ -114,24 +114,24 @@ module("dialog");
|
||||
|
||||
test("init", function() {
|
||||
expect(6);
|
||||
|
||||
|
||||
$("<div></div>").appendTo('body').dialog().remove();
|
||||
ok(true, '.dialog() called on element');
|
||||
|
||||
|
||||
$([]).dialog().remove();
|
||||
ok(true, '.dialog() called on empty collection');
|
||||
|
||||
|
||||
$('<div></div>').dialog().remove();
|
||||
ok(true, '.dialog() called on disconnected DOMElement');
|
||||
|
||||
|
||||
$('<div></div>').dialog().dialog("foo").remove();
|
||||
ok(true, 'arbitrary method called after init');
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
var foo = el.data("foo.dialog");
|
||||
el.remove();
|
||||
ok(true, 'arbitrary option getter after init');
|
||||
|
||||
|
||||
$('<div></div>').dialog().data("foo.dialog", "bar").remove();
|
||||
ok(true, 'arbitrary option setter after init');
|
||||
});
|
||||
@ -193,22 +193,22 @@ test("defaults", function() {
|
||||
|
||||
test("title id", function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
var titleId;
|
||||
|
||||
|
||||
// reset the uuid so we know what values to expect
|
||||
$.ui.dialog.uuid = 0;
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
titleId = dlg().find('.ui-dialog-title').attr('id');
|
||||
equals(titleId, 'ui-dialog-title-1', 'auto-numbered title id');
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
titleId = dlg().find('.ui-dialog-title').attr('id');
|
||||
equals(titleId, 'ui-dialog-title-2', 'auto-numbered title id');
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div id="foo"/>').dialog();
|
||||
titleId = dlg().find('.ui-dialog-title').attr('id');
|
||||
equals(titleId, 'ui-dialog-title-foo', 'carried over title id');
|
||||
@ -219,11 +219,11 @@ module("dialog: Options");
|
||||
|
||||
test("autoOpen", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ autoOpen: false });
|
||||
isNotOpen('.dialog({ autoOpen: false })');
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ autoOpen: true });
|
||||
isOpen('.dialog({ autoOpen: true })');
|
||||
el.remove();
|
||||
@ -231,12 +231,12 @@ test("autoOpen", function() {
|
||||
|
||||
test("autoResize", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
var actual,
|
||||
before,
|
||||
expected,
|
||||
handle;
|
||||
|
||||
|
||||
el = $('<div>content<br>content<br>content<br>content<br>content</div>').dialog({ autoResize: false });
|
||||
expected = { height: el.height() };
|
||||
handle = $(".ui-resizable-se", dlg());
|
||||
@ -256,7 +256,7 @@ test("autoResize", function() {
|
||||
|
||||
test("buttons", function() {
|
||||
expect(17);
|
||||
|
||||
|
||||
var buttons = {
|
||||
"Ok": function(ev, ui) {
|
||||
ok(true, "button click fires callback");
|
||||
@ -269,20 +269,20 @@ test("buttons", function() {
|
||||
equals(ev.target, btn[1], "event target");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ buttons: buttons });
|
||||
var btn = $("button", dlg());
|
||||
equals(btn.length, 2, "number of buttons");
|
||||
|
||||
|
||||
var i = 0;
|
||||
$.each(buttons, function(key, val) {
|
||||
equals(btn.eq(i).text(), key, "text of button " + (i+1));
|
||||
i++;
|
||||
});
|
||||
|
||||
|
||||
equals(btn.parent().attr('className'), 'ui-dialog-buttonpane', "buttons in container");
|
||||
btn.trigger("click");
|
||||
|
||||
|
||||
var newButtons = {
|
||||
"Close": function(ev, ui) {
|
||||
ok(true, "button click fires callback");
|
||||
@ -290,35 +290,35 @@ test("buttons", function() {
|
||||
equals(ev.target, btn[0], "event target");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
equals(el.data("buttons.dialog"), buttons, '.data("buttons.dialog") getter');
|
||||
el.data("buttons.dialog", newButtons);
|
||||
equals(el.data("buttons.dialog"), newButtons, '.data("buttons.dialog", ...) setter');
|
||||
|
||||
|
||||
btn = $("button", dlg());
|
||||
equals(btn.length, 1, "number of buttons after setter");
|
||||
btn.trigger('click');
|
||||
|
||||
|
||||
i = 0;
|
||||
$.each(newButtons, function(key, val) {
|
||||
equals(btn.eq(i).text(), key, "text of button " + (i+1));
|
||||
i += 1;
|
||||
});
|
||||
|
||||
|
||||
el.remove();
|
||||
});
|
||||
|
||||
test("dialogClass", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
equals(dlg().is(".foo"), false, 'dialogClass not specified. foo class added');
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ dialogClass: "foo" });
|
||||
equals(dlg().is(".foo"), true, 'dialogClass in init. foo class added');
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ dialogClass: "foo bar" });
|
||||
equals(dlg().is(".foo"), true, 'dialogClass in init, two classes. foo class added');
|
||||
equals(dlg().is(".bar"), true, 'dialogClass in init, two classes. bar class added');
|
||||
@ -327,13 +327,13 @@ test("dialogClass", function() {
|
||||
|
||||
test("draggable", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ draggable: false });
|
||||
shouldnotmove();
|
||||
el.data('draggable.dialog', true);
|
||||
shouldmove();
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ draggable: true });
|
||||
shouldmove();
|
||||
el.data('draggable.dialog', false);
|
||||
@ -343,15 +343,15 @@ test("draggable", function() {
|
||||
|
||||
test("height", function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
equals(dlg().height(), defaults.height, "default height");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ height: 437 });
|
||||
equals(dlg().height(), 437, "explicit height");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
el.data('height.dialog', 438);
|
||||
equals(dlg().height(), 438, "explicit height set after init");
|
||||
@ -360,17 +360,17 @@ test("height", function() {
|
||||
|
||||
test("maxHeight", function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ maxHeight: 400 });
|
||||
drag('.ui-resizable-s', 1000, 1000);
|
||||
equals(heightAfter, 400, "maxHeight");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ maxHeight: 400 });
|
||||
drag('.ui-resizable-n', -1000, -1000);
|
||||
equals(heightAfter, 400, "maxHeight");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ maxHeight: 400 }).data('maxHeight.dialog', 600);
|
||||
drag('.ui-resizable-n', -1000, -1000);
|
||||
equals(heightAfter, 600, "maxHeight");
|
||||
@ -379,17 +379,17 @@ test("maxHeight", function() {
|
||||
|
||||
test("maxWidth", function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ maxWidth: 400 });
|
||||
drag('.ui-resizable-e', 1000, 1000);
|
||||
equals(widthAfter, 400, "maxWidth");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ maxWidth: 400 });
|
||||
drag('.ui-resizable-w', -1000, -1000);
|
||||
equals(widthAfter, 400, "maxWidth");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ maxWidth: 400 }).data('maxWidth.dialog', 600);
|
||||
drag('.ui-resizable-w', -1000, -1000);
|
||||
equals(widthAfter, 600, "maxWidth");
|
||||
@ -398,17 +398,17 @@ test("maxWidth", function() {
|
||||
|
||||
test("minHeight", function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ minHeight: 10 });
|
||||
drag('.ui-resizable-s', -1000, -1000);
|
||||
equals(heightAfter, 10, "minHeight");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ minHeight: 10 });
|
||||
drag('.ui-resizable-n', 1000, 1000);
|
||||
equals(heightAfter, 10, "minHeight");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ minHeight: 10 }).data('minHeight.dialog', 30);
|
||||
drag('.ui-resizable-n', 1000, 1000);
|
||||
equals(heightAfter, 30, "minHeight");
|
||||
@ -417,17 +417,17 @@ test("minHeight", function() {
|
||||
|
||||
test("minWidth", function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ minWidth: 10 });
|
||||
drag('.ui-resizable-e', -1000, -1000);
|
||||
equals(widthAfter, 10, "minWidth");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ minWidth: 10 });
|
||||
drag('.ui-resizable-w', 1000, 1000);
|
||||
equals(widthAfter, 10, "minWidth");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ minWidth: 30 }).data('minWidth.dialog', 30);
|
||||
drag('.ui-resizable-w', 1000, 1000);
|
||||
equals(widthAfter, 30, "minWidth");
|
||||
@ -448,13 +448,13 @@ test("position", function() {
|
||||
|
||||
test("resizable", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
shouldresize("[default]");
|
||||
el.data('resizable.dialog', false);
|
||||
shouldnotresize('disabled after init');
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ resizable: false });
|
||||
shouldnotresize("disabled in init options");
|
||||
el.data('resizable.dialog', true);
|
||||
@ -468,27 +468,27 @@ test("stack", function() {
|
||||
|
||||
test("title", function() {
|
||||
expect(5);
|
||||
|
||||
|
||||
function titleText() {
|
||||
return dlg().find(".ui-dialog-title").html();
|
||||
}
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
equals(titleText(), " ", "[default]");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div title="foo"/>').dialog();
|
||||
equals(titleText(), "foo", "title in element attribute");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({ title: 'foo' });
|
||||
equals(titleText(), "foo", "title in init options");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div title="foo"/>').dialog({ title: 'bar' });
|
||||
equals(titleText(), "bar", "title in init options should override title in element attribute");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog().data('title.dialog', 'foo');
|
||||
equals(titleText(), 'foo', 'title after init');
|
||||
el.remove();
|
||||
@ -496,11 +496,11 @@ test("title", function() {
|
||||
|
||||
test("width", function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
equals(dlg().width(), defaults.width, "default width");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({width: 437 });
|
||||
equals(dlg().width(), 437, "explicit width");
|
||||
el.data('width.dialog', 438);
|
||||
@ -512,13 +512,13 @@ module("dialog: Methods");
|
||||
|
||||
test("isOpen", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog();
|
||||
equals(el.dialog('isOpen'), true, "dialog is open after init");
|
||||
el.dialog('close');
|
||||
equals(el.dialog('isOpen'), false, "dialog is closed");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({autoOpen: false});
|
||||
equals(el.dialog('isOpen'), false, "dialog is closed after init");
|
||||
el.dialog('open');
|
||||
@ -530,7 +530,7 @@ module("dialog: Callbacks");
|
||||
|
||||
test("open", function() {
|
||||
expect(6);
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
open: function(ev, ui) {
|
||||
@ -539,7 +539,7 @@ test("open", function() {
|
||||
}
|
||||
});
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
autoOpen: false,
|
||||
@ -550,7 +550,7 @@ test("open", function() {
|
||||
});
|
||||
el.dialog("open");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({
|
||||
autoOpen: false
|
||||
});
|
||||
@ -564,7 +564,7 @@ test("open", function() {
|
||||
|
||||
test("dragStart", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
dragStart: function(ev, ui) {
|
||||
@ -579,7 +579,7 @@ test("dragStart", function() {
|
||||
|
||||
test("drag", function() {
|
||||
var fired = false;
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
drag: function(ev, ui) {
|
||||
@ -595,7 +595,7 @@ test("drag", function() {
|
||||
|
||||
test("dragStop", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
dragStop: function(ev, ui) {
|
||||
@ -610,7 +610,7 @@ test("dragStop", function() {
|
||||
|
||||
test("resizeStart", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
resizeStart: function(ev, ui) {
|
||||
@ -625,7 +625,7 @@ test("resizeStart", function() {
|
||||
|
||||
test("resize", function() {
|
||||
var fired = false;
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
resize: function(ev, ui) {
|
||||
@ -641,7 +641,7 @@ test("resize", function() {
|
||||
|
||||
test("resizeStop", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
el = $("<div></div>");
|
||||
el.dialog({
|
||||
resizeStop: function(ev, ui) {
|
||||
@ -656,7 +656,7 @@ test("resizeStop", function() {
|
||||
|
||||
test("close", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({
|
||||
close: function(ev, ui) {
|
||||
ok(true, '.dialog("close") fires close callback');
|
||||
@ -665,7 +665,7 @@ test("close", function() {
|
||||
});
|
||||
el.dialog("close");
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog().bind('dialogclose', function(ev, ui) {
|
||||
ok(true, '.dialog("close") firse dialogclose event');
|
||||
equals(this, el[0], 'context of event');
|
||||
@ -676,7 +676,7 @@ test("close", function() {
|
||||
|
||||
test("beforeclose", function() {
|
||||
expect(6);
|
||||
|
||||
|
||||
el = $('<div></div>').dialog({
|
||||
beforeclose: function(ev, ui) {
|
||||
ok(true, '.dialog("close") fires beforeclose callback');
|
||||
@ -687,7 +687,7 @@ test("beforeclose", function() {
|
||||
el.dialog('close');
|
||||
isOpen('beforeclose callback should prevent dialog from closing');
|
||||
el.remove();
|
||||
|
||||
|
||||
el = $('<div></div>').dialog().bind('dialogbeforeclose', function(ev, ui) {
|
||||
ok(true, '.dialog("close") triggers dialogbeforeclose event');
|
||||
equals(this, el[0], "context of event");
|
||||
|
@ -4,16 +4,16 @@
|
||||
<title>jQuery UI Draggable Test Suite</title>
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="draggable.js"></script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
html { border: 0; }
|
||||
#main {
|
||||
|
@ -98,7 +98,7 @@ test("init", function() {
|
||||
test("destroy", function() {
|
||||
expect(6);
|
||||
|
||||
$("<div></div>").appendTo('body').draggable().draggable("destroy").remove();
|
||||
$("<div></div>").appendTo('body').draggable().draggable("destroy").remove();
|
||||
ok(true, '.draggable("destroy") called on element');
|
||||
|
||||
$([]).draggable().draggable("destroy");
|
||||
@ -186,7 +186,7 @@ test("No options, relative", function() {
|
||||
test("No options, absolute", function() {
|
||||
el = $("#draggable2").draggable();
|
||||
drag(el, 50, 50);
|
||||
moved(50, 50);
|
||||
moved(50, 50);
|
||||
});
|
||||
|
||||
module("draggable: Options");
|
||||
@ -230,7 +230,7 @@ test("{ cancel: 'span' }", function() {
|
||||
el = $("#draggable2").draggable();
|
||||
drag("#draggable2 span", 50, 50);
|
||||
moved(50, 50);
|
||||
|
||||
|
||||
el.draggable("destroy");
|
||||
|
||||
el = $("#draggable2").draggable({ cancel: 'span' });
|
||||
@ -282,37 +282,37 @@ test("{ containment: 'parent' }, absolute", function() {
|
||||
});
|
||||
|
||||
test("{ cursor: 'move' }", function() {
|
||||
|
||||
|
||||
function getCursor() { return $("body").css("cursor"); }
|
||||
|
||||
|
||||
expect(2);
|
||||
|
||||
|
||||
var expected = "move", actual, before, after;
|
||||
|
||||
|
||||
el = $("#draggable2").draggable({
|
||||
cursor: expected,
|
||||
start: function(event, ui) {
|
||||
actual = getCursor();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
before = getCursor();
|
||||
drag("#draggable2", -1, -1);
|
||||
after = getCursor();
|
||||
|
||||
|
||||
equals(actual, expected, "start callback: cursor '" + expected + "'");
|
||||
equals(after, before, "after drag: cursor restored");
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("{ cursorAt: { left: -5, top: -5 } }", function() {
|
||||
|
||||
|
||||
expect(4);
|
||||
|
||||
|
||||
var dx = -3, dy = -3;
|
||||
var ox = 5, oy = 5;
|
||||
var cax = -5, cay = -5;
|
||||
|
||||
|
||||
var actual = null;
|
||||
$("#draggable2").draggable({
|
||||
cursorAt: { left: cax, top: cay },
|
||||
@ -321,7 +321,7 @@ test("{ cursorAt: { left: -5, top: -5 } }", function() {
|
||||
}
|
||||
});
|
||||
var el = $("#draggable2").data("draggable").element;
|
||||
|
||||
|
||||
var before = el.offset();
|
||||
var pos = { clientX: before.left + ox, clientY: before.top + oy };
|
||||
$("#draggable2").simulate("mousedown", pos);
|
||||
@ -333,10 +333,10 @@ test("{ cursorAt: { left: -5, top: -5 } }", function() {
|
||||
left: before.left + ox - cax + dx,
|
||||
top: before.top + oy - cay + dy
|
||||
};
|
||||
|
||||
|
||||
equals(actual.left, expected.left, "Absolute: -1px left");
|
||||
equals(actual.top, expected.top, "Absolute: -1px top");
|
||||
|
||||
|
||||
var actual = null;
|
||||
$("#draggable1").draggable({
|
||||
cursorAt: { left: cax, top: cay },
|
||||
@ -345,7 +345,7 @@ test("{ cursorAt: { left: -5, top: -5 } }", function() {
|
||||
}
|
||||
});
|
||||
var el = $("#draggable2").data("draggable").element;
|
||||
|
||||
|
||||
var before = el.offset();
|
||||
var pos = { clientX: before.left + ox, clientY: before.top + oy };
|
||||
$("#draggable2").simulate("mousedown", pos);
|
||||
@ -357,10 +357,10 @@ test("{ cursorAt: { left: -5, top: -5 } }", function() {
|
||||
left: before.left + ox - cax + dx,
|
||||
top: before.top + oy - cay + dy
|
||||
};
|
||||
|
||||
|
||||
equals(actual.left, expected.left, "Relative: -1px left");
|
||||
equals(actual.top, expected.top, "Relative: -1px top");
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("{ distance: 10 }", function() {
|
||||
@ -374,7 +374,7 @@ test("{ distance: 10 }", function() {
|
||||
|
||||
drag(el, 9, 9);
|
||||
moved(0, 0, 'distance not met');
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("{ grid: [50, 50] }, relative", function() {
|
||||
@ -412,13 +412,13 @@ test("{ helper: 'clone' }, relative", function() {
|
||||
test("{ helper: 'clone' }, absolute", function() {
|
||||
el = $("#draggable2").draggable({ helper: "clone" });
|
||||
drag(el, 50, 50);
|
||||
moved(0, 0);
|
||||
moved(0, 0);
|
||||
});
|
||||
|
||||
test("{ opacity: 0.5 }", function() {
|
||||
|
||||
|
||||
expect(1);
|
||||
|
||||
|
||||
var opacity = null;
|
||||
el = $("#draggable2").draggable({
|
||||
opacity: 0.5,
|
||||
@ -426,19 +426,19 @@ test("{ opacity: 0.5 }", function() {
|
||||
opacity = $(this).css("opacity");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
drag("#draggable2", -1, -1);
|
||||
|
||||
|
||||
equals(opacity, 0.5, "start callback: opacity is");
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("{ zIndex: 10 }", function() {
|
||||
|
||||
|
||||
expect(1);
|
||||
|
||||
var expected = 10, actual;
|
||||
|
||||
|
||||
var zIndex = null;
|
||||
el = $("#draggable2").draggable({
|
||||
zIndex: expected,
|
||||
@ -446,32 +446,32 @@ test("{ zIndex: 10 }", function() {
|
||||
actual = $(this).css("zIndex");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
drag("#draggable2", -1, -1);
|
||||
|
||||
|
||||
equals(actual, expected, "start callback: zIndex is");
|
||||
|
||||
|
||||
});
|
||||
|
||||
module("draggable: Callbacks");
|
||||
|
||||
test("callbacks occurance count", function() {
|
||||
|
||||
|
||||
expect(3);
|
||||
|
||||
|
||||
var start = 0, stop = 0, dragc = 0;
|
||||
el = $("#draggable2").draggable({
|
||||
start: function() { start++; },
|
||||
drag: function() { dragc++; },
|
||||
stop: function() { stop++; }
|
||||
});
|
||||
|
||||
|
||||
drag(el, 10, 10);
|
||||
|
||||
|
||||
equals(start, 1, "start callback should happen exactly once");
|
||||
equals(dragc, 3 + 1, "drag callback should happen exactly once per mousemove + 1");
|
||||
equals(stop, 1, "stop callback should happen exactly once");
|
||||
|
||||
|
||||
});
|
||||
|
||||
module("draggable: Scroll offsets");
|
||||
@ -538,7 +538,7 @@ if(!($.browser.msie && $.browser.version < 7)) {
|
||||
moved(50, 50);
|
||||
$("#main")[0].scrollTop = 0;
|
||||
});
|
||||
|
||||
|
||||
test("{ helper: 'original' }, fixed, with scroll offset on root", function() {
|
||||
el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
|
||||
$(document).scrollTop(100);
|
||||
@ -546,7 +546,7 @@ if(!($.browser.msie && $.browser.version < 7)) {
|
||||
moved(50, 50);
|
||||
$(document).scrollTop(0);
|
||||
});
|
||||
|
||||
|
||||
test("{ helper: 'original' }, fixed, with scroll offset on root and parent", function() {
|
||||
el = $("#draggable1").css({ position: 'fixed', top: 0, left: 0 }).draggable({ helper: "original" });
|
||||
$(document).scrollTop(100);
|
||||
@ -562,67 +562,67 @@ if(!($.browser.msie && $.browser.version < 7)) {
|
||||
|
||||
|
||||
test("{ helper: 'clone' }, absolute", function() {
|
||||
|
||||
|
||||
var helperOffset = null;
|
||||
var origOffset = $("#draggable1").offset();
|
||||
|
||||
|
||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||
helperOffset = ui.helper.offset();
|
||||
} });
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
|
||||
});
|
||||
|
||||
test("{ helper: 'clone' }, absolute with scroll offset on parent", function() {
|
||||
|
||||
|
||||
$("#main")[0].scrollTop = 100;
|
||||
var helperOffset = null;
|
||||
var origOffset = $("#draggable1").offset();
|
||||
|
||||
|
||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||
helperOffset = ui.helper.offset();
|
||||
} });
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
$("#main")[0].scrollTop = 0;
|
||||
|
||||
});
|
||||
|
||||
test("{ helper: 'clone' }, absolute with scroll offset on root", function() {
|
||||
|
||||
|
||||
$(document).scrollTop(100);
|
||||
var helperOffset = null;
|
||||
var origOffset = $("#draggable1").offset();
|
||||
|
||||
|
||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||
helperOffset = ui.helper.offset();
|
||||
} });
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
$(document).scrollTop(0);
|
||||
|
||||
});
|
||||
|
||||
test("{ helper: 'clone' }, absolute with scroll offset on root and parent", function() {
|
||||
|
||||
|
||||
$(document).scrollTop(100);
|
||||
$("#main")[0].scrollTop = 100;
|
||||
var helperOffset = null;
|
||||
var origOffset = $("#draggable1").offset();
|
||||
|
||||
|
||||
el = $("#draggable1").draggable({ helper: "clone", drag: function(event, ui) {
|
||||
helperOffset = ui.helper.offset();
|
||||
} });
|
||||
|
||||
drag(el, 1, 1);
|
||||
|
||||
|
||||
same({ top: helperOffset.top-1, left: helperOffset.left-1 }, origOffset, 'dragged[' + dragged.dx + ', ' + dragged.dy + '] ');
|
||||
$(document).scrollTop(0);
|
||||
$("#main")[0].scrollTop = 0;
|
||||
@ -641,9 +641,9 @@ module("draggable: Tickets");
|
||||
/* This needs to be rewritten
|
||||
|
||||
test("#2965 cursorAt with margin", function() {
|
||||
|
||||
|
||||
expect(2);
|
||||
|
||||
|
||||
var ox = 0, oy = 0;
|
||||
|
||||
var actual, expected;
|
||||
@ -654,7 +654,7 @@ test("#2965 cursorAt with margin", function() {
|
||||
}
|
||||
});
|
||||
var el = $("#draggable2").data("draggable").element;
|
||||
|
||||
|
||||
$("#draggable2").css('margin', '0px !important');
|
||||
|
||||
var before = el.offset();
|
||||
@ -675,10 +675,10 @@ test("#2965 cursorAt with margin", function() {
|
||||
$(document).simulate("mousemove", { clientX: pos.clientX + 1, clientY: pos.clientY + 1});
|
||||
$(document).simulate("mousemove", pos);
|
||||
$("#draggable2").simulate("mouseup", pos);
|
||||
|
||||
|
||||
equals(actual.left, expected.left, "10px margin. left");
|
||||
equals(actual.top, expected.top, "10px margin. top");
|
||||
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>jQuery UI Droppable Test Suite</title>
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.draggable.js"></script>
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="droppable.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
|
@ -55,7 +55,7 @@ test("init", function() {
|
||||
test("destroy", function() {
|
||||
expect(6);
|
||||
|
||||
$("<div></div>").appendTo('body').droppable().droppable("destroy").remove();
|
||||
$("<div></div>").appendTo('body').droppable().droppable("destroy").remove();
|
||||
ok(true, '.droppable("destroy") called on element');
|
||||
|
||||
$([]).droppable().droppable("destroy");
|
||||
|
@ -4,14 +4,14 @@
|
||||
<title>jQuery UI Progressbar Test Suite</title>
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.progressbar.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="progressbar.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@ -34,6 +34,6 @@
|
||||
<div id="main" style="position:absolute;top:-20000px">
|
||||
<div id="progressbar"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -31,7 +31,7 @@ test("init", function() {
|
||||
test("destroy", function() {
|
||||
expect(1);
|
||||
|
||||
$("<div></div>").appendTo('body').progressbar().progressbar("destroy").remove();
|
||||
$("<div></div>").appendTo('body').progressbar().progressbar("destroy").remove();
|
||||
ok(true, '.progressbar("destroy") called on element');
|
||||
|
||||
});
|
||||
|
@ -4,14 +4,14 @@
|
||||
<title>jQuery UI Resizable Test Suite</title>
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.resizable.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="resizable.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
|
@ -35,10 +35,10 @@ var defaults = {
|
||||
};
|
||||
|
||||
var drag = function(el, dx, dy, complete) {
|
||||
|
||||
|
||||
// speed = sync -> Drag syncrhonously.
|
||||
// speed = fast|slow -> Drag asyncrhonously - animated.
|
||||
|
||||
|
||||
//this mouseover is to work around a limitation in resizable
|
||||
//TODO: fix resizable so handle doesn't require mouseover in order to be used
|
||||
$(el).simulate("mouseover");
|
||||
@ -127,7 +127,7 @@ test("defaults", function() {
|
||||
|
||||
test("n", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, 0, -50);
|
||||
@ -139,7 +139,7 @@ test("n", function() {
|
||||
|
||||
test("s", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, 0, 50);
|
||||
@ -151,7 +151,7 @@ test("s", function() {
|
||||
|
||||
test("e", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, 50);
|
||||
@ -163,7 +163,7 @@ test("e", function() {
|
||||
|
||||
test("w", function() {
|
||||
expect(2);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, -50);
|
||||
@ -175,7 +175,7 @@ test("w", function() {
|
||||
|
||||
test("ne", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-ne', target = $('#resizable1').css({ overflow: 'hidden' }).resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, -50, -50);
|
||||
@ -189,7 +189,7 @@ test("ne", function() {
|
||||
|
||||
test("se", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, 50, 50);
|
||||
@ -203,7 +203,7 @@ test("se", function() {
|
||||
|
||||
test("sw", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, -50, -50);
|
||||
@ -217,7 +217,7 @@ test("sw", function() {
|
||||
|
||||
test("nw", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all' });
|
||||
|
||||
drag(handle, -50, -50);
|
||||
@ -233,7 +233,7 @@ module("resizable: Options");
|
||||
|
||||
test("aspectRatio: 'preserve' (e)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-e', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||
|
||||
drag(handle, 80);
|
||||
@ -247,7 +247,7 @@ test("aspectRatio: 'preserve' (e)", function() {
|
||||
|
||||
test("aspectRatio: 'preserve' (w)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-w', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||
|
||||
drag(handle, -80);
|
||||
@ -261,7 +261,7 @@ test("aspectRatio: 'preserve' (w)", function() {
|
||||
|
||||
test("aspectRatio: 'preserve' (n)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-n', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||
|
||||
drag(handle, 0, -80);
|
||||
@ -275,7 +275,7 @@ test("aspectRatio: 'preserve' (n)", function() {
|
||||
|
||||
test("aspectRatio: 'preserve' (s)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-s', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||
|
||||
drag(handle, 0, 80);
|
||||
@ -289,7 +289,7 @@ test("aspectRatio: 'preserve' (s)", function() {
|
||||
|
||||
test("aspectRatio: 'preserve' (se)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||
|
||||
drag(handle, 80, 80);
|
||||
@ -303,7 +303,7 @@ test("aspectRatio: 'preserve' (se)", function() {
|
||||
|
||||
test("aspectRatio: 'preserve' (sw)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||
|
||||
drag(handle, -80, 80);
|
||||
@ -317,7 +317,7 @@ test("aspectRatio: 'preserve' (sw)", function() {
|
||||
|
||||
test("aspectRatio: 'preserve' (ne)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ aspectRatio: 'preserve', handles: 'all', minWidth: 70, minHeight: 50, maxWidth: 150, maxHeight: 130 });
|
||||
|
||||
drag(handle, 80, -80);
|
||||
@ -331,7 +331,7 @@ test("aspectRatio: 'preserve' (ne)", function() {
|
||||
|
||||
test("grid", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', grid: [0, 20] });
|
||||
|
||||
drag(handle, 3, 9);
|
||||
@ -345,13 +345,13 @@ test("grid", function() {
|
||||
|
||||
test("grid (wrapped)", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-se', target = $('#resizable2').resizable({ handles: 'all', grid: [0, 20] });
|
||||
|
||||
drag(handle, 3, 9);
|
||||
equals( target.width(), 103, "compare width");
|
||||
equals( target.height(), 100, "compare height");
|
||||
|
||||
|
||||
drag(handle, 15, 11);
|
||||
equals( target.width(), 118, "compare width");
|
||||
equals( target.height(), 120, "compare height");
|
||||
@ -361,11 +361,11 @@ test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
||||
expect(4);
|
||||
|
||||
var handle = '.ui-resizable-se', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||
|
||||
|
||||
drag(handle, -50, -50);
|
||||
equals( target.width(), 60, "compare minWidth" );
|
||||
equals( target.height(), 60, "compare minHeight" );
|
||||
|
||||
|
||||
drag(handle, 70, 70);
|
||||
equals( target.width(), 100, "compare maxWidth" );
|
||||
equals( target.height(), 100, "compare maxHeight" );
|
||||
@ -373,13 +373,13 @@ test("ui-resizable-se { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
||||
|
||||
test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-sw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||
|
||||
|
||||
drag(handle, 50, -50);
|
||||
equals( target.width(), 60, "compare minWidth" );
|
||||
equals( target.height(), 60, "compare minHeight" );
|
||||
|
||||
|
||||
drag(handle, -70, 70);
|
||||
equals( target.width(), 100, "compare maxWidth" );
|
||||
equals( target.height(), 100, "compare maxHeight" );
|
||||
@ -387,13 +387,13 @@ test("ui-resizable-sw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
||||
|
||||
test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-ne', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||
|
||||
|
||||
drag(handle, -50, 50);
|
||||
equals( target.width(), 60, "compare minWidth" );
|
||||
equals( target.height(), 60, "compare minHeight" );
|
||||
|
||||
|
||||
drag(handle, 70, -70);
|
||||
equals( target.width(), 100, "compare maxWidth" );
|
||||
equals( target.height(), 100, "compare maxHeight" );
|
||||
@ -401,13 +401,13 @@ test("ui-resizable-ne { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 1
|
||||
|
||||
test("ui-resizable-nw { handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 }", function() {
|
||||
expect(4);
|
||||
|
||||
|
||||
var handle = '.ui-resizable-nw', target = $('#resizable1').resizable({ handles: 'all', minWidth: 60, minHeight: 60, maxWidth: 100, maxHeight: 100 });
|
||||
|
||||
|
||||
drag(handle, 70, 70);
|
||||
equals( target.width(), 60, "compare minWidth" );
|
||||
equals( target.height(), 60, "compare minHeight" );
|
||||
|
||||
|
||||
drag(handle, -70, -70);
|
||||
equals( target.width(), 100, "compare maxWidth" );
|
||||
equals( target.height(), 100, "compare maxHeight" );
|
||||
|
@ -5,16 +5,16 @@
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
<!--link rel="stylesheet" href="../themes/flora/flora.selectable.css" type="text/css" media="screen"-->
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.selectable.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="selectable.js"></script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
html { border: 0; }
|
||||
</style>
|
||||
|
@ -23,7 +23,7 @@ $.fn.extend({
|
||||
$.simulate = function(el, type, options) {
|
||||
this.target = el;
|
||||
this.options = options;
|
||||
|
||||
|
||||
if (/^drag$/.test(type)) {
|
||||
this[type].apply(this, [this.target, options]);
|
||||
} else {
|
||||
@ -52,9 +52,9 @@ $.extend($.simulate.prototype, {
|
||||
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
|
||||
button: 0, relatedTarget: undefined
|
||||
}, options);
|
||||
|
||||
|
||||
var relatedTarget = $(e.relatedTarget)[0];
|
||||
|
||||
|
||||
if ($.isFunction(document.createEvent)) {
|
||||
evt = document.createEvent("MouseEvents");
|
||||
evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail,
|
||||
@ -70,12 +70,12 @@ $.extend($.simulate.prototype, {
|
||||
},
|
||||
keyboardEvent: function(type, options) {
|
||||
var evt;
|
||||
|
||||
|
||||
var e = $.extend({ bubbles: true, cancelable: true, view: window,
|
||||
ctrlKey: false, altKey: false, shiftKey: false, metaKey: false,
|
||||
keyCode: 0, charCode: 0
|
||||
}, options);
|
||||
|
||||
|
||||
if ($.isFunction(document.createEvent)) {
|
||||
try {
|
||||
evt = document.createEvent("KeyEvents");
|
||||
@ -100,7 +100,7 @@ $.extend($.simulate.prototype, {
|
||||
}
|
||||
return evt;
|
||||
},
|
||||
|
||||
|
||||
dispatchEvent: function(el, type, evt) {
|
||||
if (el.dispatchEvent) {
|
||||
el.dispatchEvent(evt);
|
||||
@ -109,7 +109,7 @@ $.extend($.simulate.prototype, {
|
||||
}
|
||||
return evt;
|
||||
},
|
||||
|
||||
|
||||
drag: function(el) {
|
||||
var self = this, center = this.findCenter(this.target),
|
||||
options = this.options, x = Math.floor(center.x), y = Math.floor(center.y),
|
||||
|
@ -4,14 +4,14 @@
|
||||
<title>jQuery UI Slider Test Suite</title>
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.slider.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="slider.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@ -37,6 +37,6 @@
|
||||
<div class="ui-slider-handle" style="position: absolute; height: 21px; left: 0px; bottom: 0px; width: 17px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -54,24 +54,24 @@ module("slider");
|
||||
|
||||
test("init", function() {
|
||||
expect(6);
|
||||
|
||||
|
||||
$("<div></div>").appendTo('body').slider().remove();
|
||||
ok(true, '.slider() called on element');
|
||||
|
||||
|
||||
$([]).slider().remove();
|
||||
ok(true, '.slider() called on empty collection');
|
||||
|
||||
|
||||
$('<div></div>').slider().remove();
|
||||
ok(true, '.slider() called on disconnected DOMElement');
|
||||
|
||||
|
||||
$('<div></div>').slider().slider("foo").remove();
|
||||
ok(true, 'arbitrary method called after init');
|
||||
|
||||
|
||||
el = $('<div></div>').slider();
|
||||
var foo = el.data("foo.slider");
|
||||
el.remove();
|
||||
ok(true, 'arbitrary option getter after init');
|
||||
|
||||
|
||||
$('<div></div>').slider().data("foo.slider", "bar").remove();
|
||||
ok(true, 'arbitrary option setter after init');
|
||||
});
|
||||
@ -166,12 +166,12 @@ test("destroy and recreate", function() {
|
||||
slider.slider("moveTo", "+=20");
|
||||
equals(slider.slider("value"), 20);
|
||||
slider.slider("destroy");
|
||||
|
||||
|
||||
slider.slider("moveTo", "+=30");
|
||||
ok(true, "nothing happens after slider is destroyed");
|
||||
|
||||
|
||||
slider.slider().slider("moveTo", "30");
|
||||
|
||||
|
||||
equals(Math.round(slider.slider("value")), 30);
|
||||
})
|
||||
|
||||
|
@ -4,16 +4,16 @@
|
||||
<title>jQuery UI Sortable Test Suite</title>
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="sortable.js"></script>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
html { border: 0; }
|
||||
#main {
|
||||
|
@ -94,7 +94,7 @@ test("enable", function() {
|
||||
el = $("#sortable").sortable({ disabled: true });
|
||||
|
||||
sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })');
|
||||
|
||||
|
||||
el.sortable("enable");
|
||||
equals(el.data("disabled.sortable"), false, "disabled.sortable getter");
|
||||
|
||||
@ -102,7 +102,7 @@ test("enable", function() {
|
||||
el.sortable({ disabled: true });
|
||||
el.data("disabled.sortable", false);
|
||||
equals(el.data("disabled.sortable"), false, "disabled.sortable setter");
|
||||
|
||||
|
||||
sort($("li", el)[0], 0, 40, 2, '.data("disabled.sortable", false)');
|
||||
});
|
||||
|
||||
@ -133,12 +133,12 @@ test("defaults", function() {
|
||||
});
|
||||
|
||||
test("#3019: Stop fires too early", function() {
|
||||
|
||||
|
||||
var helper = null;
|
||||
el = $("#sortable").sortable({ stop: function(event, ui) {
|
||||
helper = ui.helper;
|
||||
}});
|
||||
|
||||
|
||||
sort($("li", el)[0], 0, 40, 2, 'Dragging the sortable');
|
||||
equals(helper, null, "helper should be false");
|
||||
|
||||
|
@ -4,14 +4,14 @@
|
||||
<title>jQuery UI Spinner Test Suite</title>
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.spinner.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="simulate/jquery.simulate.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="spinner.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
@ -34,6 +34,6 @@
|
||||
<div id="main" style="position:absolute;top:-20000px">
|
||||
<input type="text" id="spin" />
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -226,7 +226,7 @@ test("decimal options", function() {
|
||||
el.simulate("keyup",{keyCode:$.simulate.VK_UP});
|
||||
|
||||
equals(el.val(), "7.0", "keydown 11 times");
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("spin without auto-incremental stepping", function() {
|
||||
@ -344,7 +344,7 @@ test("currency formats", function() {
|
||||
expect(8);
|
||||
|
||||
// default
|
||||
|
||||
|
||||
el = $("#spin").spinner({ currency: 'HK$', stepping: 1500.50, start: 1000 });
|
||||
|
||||
equals(el.val(), "HK$1,000.00", "Hong Kong Dollar");
|
||||
@ -355,7 +355,7 @@ test("currency formats", function() {
|
||||
equals(el.val(), "HK$2,500.50", "Hong Kong Dollar step-up once");
|
||||
|
||||
// space and comma
|
||||
|
||||
|
||||
el.spinner('destroy').val('').spinner({ currency: '$', group: ' ', point: '.', stepping: 1500.50, start: 1000 });
|
||||
|
||||
equals(el.val(), "$1 000.00", "Australian Dollar");
|
||||
@ -366,7 +366,7 @@ test("currency formats", function() {
|
||||
equals(el.val(), "$2 500.50", "Australian Dollar step-up once");
|
||||
|
||||
// apos and point
|
||||
|
||||
|
||||
el.spinner('destroy').val('').spinner({ currency: 'Fr ', group: "'", point: '.', stepping: 1500.50, start: 1000 });
|
||||
|
||||
equals(el.val(), "Fr 1'000.00", "Swiss Franc");
|
||||
@ -375,9 +375,9 @@ test("currency formats", function() {
|
||||
.simulate("keyup",{keyCode:$.simulate.VK_UP});
|
||||
|
||||
equals(el.val(), "Fr 2'500.50", "Swiss Franc step-up once");
|
||||
|
||||
|
||||
// point and comma
|
||||
|
||||
|
||||
el.spinner('destroy').val('').spinner({ currency: 'RUB', group: ".", point: ',', stepping: 1.5, start: 1000 });
|
||||
|
||||
equals(el.val(), "RUB1.000,00", "Russian Ruble");
|
||||
@ -386,7 +386,7 @@ test("currency formats", function() {
|
||||
.simulate("keyup",{keyCode:$.simulate.VK_UP});
|
||||
|
||||
equals(el.val(), "RUB1.001,50", "Russian Ruble step-up once");
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
<ol id="tests"></ol>
|
||||
|
||||
<div id="main" style="position:absolute;top:-20000px">
|
||||
|
||||
|
||||
<div id="tabs1">
|
||||
<ul>
|
||||
<li><a href="#fragment-1">1</a></li>
|
||||
@ -52,7 +52,7 @@
|
||||
<div id="colon:test"></div>
|
||||
<div style="height: 300px;" id="inline-style"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
@ -37,7 +37,7 @@ function defer(defered, ms) {
|
||||
setTimeout(function() {
|
||||
queue.shift()();
|
||||
if (!queue.length) start();
|
||||
}, ms || 100);
|
||||
}, ms || 100);
|
||||
}
|
||||
|
||||
module('tabs');
|
||||
@ -47,17 +47,17 @@ module('tabs');
|
||||
|
||||
var el = $('#tabs1 > ul').tabs();
|
||||
ok(true, '.tabs() called on element');
|
||||
|
||||
|
||||
el.tabs('destroy').tabs({ selected: 1 });
|
||||
equals( el.data('selected.tabs'), 1, 'selected.tabs set' );
|
||||
equals( $('li', el).index( $('li.ui-tabs-selected', el) ), 1, 'second tab active');
|
||||
equals( $('div', '#tabs1').index( $('div.ui-tabs-hide', '#tabs1') ), 0, 'first panel should be hidden' );
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('destroy', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test("defaults", function() {
|
||||
@ -71,37 +71,37 @@ module('tabs');
|
||||
|
||||
test('add', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('remove', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('enable', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('disable', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('select', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('load', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('url', function() {
|
||||
expect(0);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -109,33 +109,33 @@ module('tabs: Options');
|
||||
|
||||
test('select: null', function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
var el = $('#tabs1 > ul');
|
||||
|
||||
|
||||
el.tabs({ selected: null });
|
||||
equals( el.data('selected.tabs'), null, 'option set' );
|
||||
equals( $('li.ui-tabs-selected', el).length, 0, 'all tabs should be deselected' );
|
||||
equals( $('div.ui-tabs-hide', '#tabs1').length, 3, 'all panels should be hidden' );
|
||||
|
||||
|
||||
// TODO select == null with cookie
|
||||
// TODO select == null with select method
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('deselectable: true', function() {
|
||||
expect(7);
|
||||
|
||||
|
||||
var el = $('#tabs1 > ul');
|
||||
|
||||
|
||||
el.tabs({ deselectable: true });
|
||||
equals( el.data('deselectable.tabs'), true, 'option set' );
|
||||
equals( $('li.ui-tabs-deselectable', el).length, 1, 'class "ui-tabs-deselectable" attached once');
|
||||
equals( $('li', el).index( $('li.ui-tabs-deselectable', el) ), 0, 'class "ui-tabs-deselectable" attached to first tab');
|
||||
|
||||
|
||||
el.tabs('select', 1);
|
||||
equals( $('li.ui-tabs-deselectable', el).length, 1, 'class "ui-tabs-deselectable" attached once');
|
||||
equals( $('li', el).index( $('li.ui-tabs-deselectable', el) ), 1, 'class "ui-tabs-deselectable" attached to second tab');
|
||||
|
||||
|
||||
el.tabs('select', 1);
|
||||
equals( $('li.ui-tabs-deselectable', el).length, 0, 'class "ui-tabs-deselectable" not attached');
|
||||
defer(function() {
|
||||
@ -146,32 +146,32 @@ module('tabs: Options');
|
||||
|
||||
test('cookie', function() {
|
||||
expect(5);
|
||||
|
||||
|
||||
var el = $('#tabs1 > ul');
|
||||
var cookieName = 'ui-tabs-' + $.data(el[0]);
|
||||
$.cookie(cookieName, null); // blank state
|
||||
var cookie = function() {
|
||||
return parseInt($.cookie(cookieName), 10);
|
||||
};
|
||||
|
||||
|
||||
el.tabs({ cookie: {} });
|
||||
equals(cookie(), 0, 'initial cookie value, no cookie given');
|
||||
|
||||
|
||||
el.tabs('destroy');
|
||||
el.tabs({ selected: 1, cookie: {} });
|
||||
equals(cookie(), 1, 'initial cookie value, given selected');
|
||||
|
||||
el.tabs('select', 2);
|
||||
equals(cookie(), 2, 'cookie value after tabs select');
|
||||
|
||||
|
||||
el.tabs('destroy');
|
||||
$.cookie(cookieName, 1);
|
||||
el.tabs({ cookie: {} });
|
||||
equals(cookie(), 1, 'initial cookie value, from existing cookie');
|
||||
|
||||
|
||||
el.tabs('destroy');
|
||||
ok($.cookie(cookieName) === null, 'erase cookie after destroy');
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -183,42 +183,42 @@ module('tabs: Tickets');
|
||||
var el = $('#tabs2 > ul').tabs();
|
||||
ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
|
||||
ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );
|
||||
|
||||
|
||||
el.tabs('select', 1).tabs('select', 0);
|
||||
defer(function() {
|
||||
ok( $('div.ui-tabs-panel:eq(0)', '#tabs2').is(':visible'), 'first panel should be visible' );
|
||||
ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );
|
||||
ok( $('div.ui-tabs-panel:eq(1)', '#tabs2').is(':hidden'), 'second panel should be hidden' );
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
test('panel containing inline style, #????', function() {
|
||||
expect(3);
|
||||
|
||||
|
||||
var inlineStyle = function(property) {
|
||||
return $('#inline-style')[0].style[property];
|
||||
};
|
||||
var expected = inlineStyle('height');
|
||||
|
||||
|
||||
var el = $('#tabs2 > ul').tabs();
|
||||
equals(inlineStyle('height'), expected, 'init should not remove inline style');
|
||||
|
||||
|
||||
el.tabs('select', 1);
|
||||
defer(function() {
|
||||
equals(inlineStyle('height'), expected, 'show tab should not remove inline style');
|
||||
|
||||
|
||||
el.tabs('select', 0);
|
||||
defer(function() {
|
||||
equals(inlineStyle('height'), expected, 'hide tab should not remove inline style');
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
// test('', function() {
|
||||
// expect(0);
|
||||
//
|
||||
//
|
||||
// });
|
||||
|
||||
})(jQuery);
|
||||
|
@ -2,9 +2,9 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>jQuery UI Test Suite</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="qunit/testsuite.css" type="text/css" media="screen">
|
||||
|
||||
|
||||
<script type="text/javascript" src="../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.accordion.js"></script>
|
||||
@ -19,10 +19,10 @@
|
||||
<script type="text/javascript" src="../ui/ui.sortable.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.spinner.js"></script>
|
||||
<script type="text/javascript" src="../ui/ui.tabs.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="qunit/testrunner.js"></script>
|
||||
<script type="text/javascript" src="ui.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body class="flora">
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<title>Effects Test Suite</title>
|
||||
<link rel="stylesheet" href="effects.all.css" type="text/css" media="screen" title="no title" charset="utf-8" />
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../jquery-1.2.6.js"></script>
|
||||
<script type="text/javascript" src="../../ui/effects.core.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="../../ui/effects.blind.js"></script>
|
||||
<script type="text/javascript" src="../../ui/effects.bounce.js"></script>
|
||||
<script type="text/javascript" src="../../ui/effects.clip.js"></script>
|
||||
@ -20,7 +20,7 @@
|
||||
<script type="text/javascript" src="../../ui/effects.shake.js"></script>
|
||||
<script type="text/javascript" src="../../ui/effects.slide.js"></script>
|
||||
<script type="text/javascript" src="../../ui/effects.transfer.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="effects.all.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
@ -38,121 +38,121 @@
|
||||
<p>Blind vertically</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="bounce3times">
|
||||
<p>Bounce 3 times</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="clipHorizontally">
|
||||
<p>Clip horizontally</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="clipVertically">
|
||||
<p>Clip vertically</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropDown">
|
||||
<p>Drop down</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropUp">
|
||||
<p>Drop up</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropLeft">
|
||||
<p>Drop left</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="dropRight">
|
||||
<p>Drop right</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="explode9">
|
||||
<p>Explode in 9 pieces</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="explode36">
|
||||
<p>Explode in 36 pieces</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="fold">
|
||||
<p>Fold</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="highlight">
|
||||
<p>Highlight</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="pulsate">
|
||||
<p>Pulsate 2 times</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="puff">
|
||||
<p>Puff</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="scale">
|
||||
<p>Scale</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="shake">
|
||||
<p>Shake</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideDown">
|
||||
<p>Slide down</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideUp">
|
||||
<p>Slide up</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideLeft">
|
||||
<p>Slide left</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="slideRight">
|
||||
<p>Slide right</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<div class="effect" id="transfer">
|
||||
<p>Transfer to first element</p>
|
||||
|
@ -1,5 +1,5 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
$("div.effect")
|
||||
.hover(function() {
|
||||
$(this).addClass("hover");
|
||||
@ -7,16 +7,16 @@ $(document).ready(function() {
|
||||
$(this).removeClass("hover");
|
||||
})
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
var effect = function(el, n, o) {
|
||||
|
||||
|
||||
$.extend(o, {
|
||||
easing: "easeOutQuint"
|
||||
});
|
||||
|
||||
|
||||
$(el).bind("click", function() {
|
||||
|
||||
|
||||
$(this).addClass("current").hide(n, o, 1000, function() {
|
||||
var self = this;
|
||||
window.setTimeout(function() {
|
||||
@ -24,42 +24,42 @@ $(document).ready(function() {
|
||||
},500);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
effect("#blindHorizontally", "blind", { direction: "horizontal" });
|
||||
effect("#blindVertically", "blind", { direction: "vertical" });
|
||||
|
||||
|
||||
effect("#bounce3times", "bounce", { times: 3 });
|
||||
|
||||
|
||||
effect("#clipHorizontally", "clip", { direction: "horizontal" });
|
||||
effect("#clipVertically", "clip", { direction: "vertical" });
|
||||
|
||||
|
||||
effect("#dropDown", "drop", { direction: "down" });
|
||||
effect("#dropUp", "drop", { direction: "up" });
|
||||
effect("#dropLeft", "drop", { direction: "left" });
|
||||
effect("#dropRight", "drop", { direction: "right" });
|
||||
|
||||
|
||||
effect("#explode9", "explode", { });
|
||||
effect("#explode36", "explode", { pieces: 36 });
|
||||
|
||||
|
||||
effect("#fold", "fold", { size: 50 });
|
||||
|
||||
|
||||
effect("#highlight", "highlight", { });
|
||||
|
||||
|
||||
effect("#pulsate", "pulsate", { times: 2 });
|
||||
|
||||
|
||||
effect("#puff", "puff", { times: 2 });
|
||||
effect("#scale", "scale", { });
|
||||
|
||||
|
||||
$("#shake").bind("click", function() { $(this).addClass("current").effect("shake", {}, 100, function() { $(this).removeClass("current"); }); });
|
||||
|
||||
|
||||
effect("#slideDown", "slide", { direction: "down" });
|
||||
effect("#slideUp", "slide", { direction: "up" });
|
||||
effect("#slideLeft", "slide", { direction: "left" });
|
||||
effect("#slideRight", "slide", { direction: "right" });
|
||||
|
||||
|
||||
$("#transfer").bind("click", function() { $(this).addClass("current").effect("transfer", { to: "div:eq(0)" }, 1000, function() { $(this).removeClass("current"); }); });
|
||||
|
||||
|
||||
});
|
@ -6,11 +6,11 @@
|
||||
<script type="text/javascript" src="../../ui/ui.core.js"></script>
|
||||
<script type="text/javascript" src="../../ui/ui.sortable.js"></script>
|
||||
<script type="text/javascript" src="../../ui/ui.draggable.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
|
||||
|
||||
$(document).ready( function() {
|
||||
$('ul').not(".draggable").sortable({ items: "li" });
|
||||
$("ul.draggable li").draggable({ helper: "clone", connectToSortable: "ul" });
|
||||
|
@ -20,7 +20,7 @@ $(function(){
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var itemList = [
|
||||
{url: "http://ejohn.org", title: "John Resig"},
|
||||
{url: "http://bassistance.de/", title: "Jörn Zaefferer"},
|
||||
@ -36,7 +36,7 @@ $(function(){
|
||||
{url: "http://www.codylindley.com/", title: "Cody Lindley"},
|
||||
{url: "http://malsup.com/jquery/", title: "Mike Alsup"}
|
||||
];
|
||||
|
||||
|
||||
var opts = {
|
||||
's1': {},
|
||||
's2': {stepping: 0.25},
|
||||
@ -52,7 +52,7 @@ $(function(){
|
||||
ui.add('<a href="'+ itemList[i].url +'" target="_blank">'+ itemList[i].title +'</a>');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// method 2: use the format and items options in combination
|
||||
format: '%(title) <a href="%(url)" target="_blank">»</a>',
|
||||
items: itemList
|
||||
|
@ -23,7 +23,7 @@ $("ul.sortable").tree({
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -18,18 +18,18 @@ $.effects.blind = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var direction = o.options.direction || 'vertical'; // Default direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||
var ref = (direction == 'vertical') ? 'height' : 'width';
|
||||
var distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();
|
||||
if(mode == 'show') wrapper.css(ref, 0); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {};
|
||||
animation[ref] = mode == 'show' ? distance : 0;
|
||||
@ -41,9 +41,9 @@ $.effects.blind = function(o) {
|
||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -36,7 +36,7 @@ $.effects.bounce = function(o) {
|
||||
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
||||
if (mode == 'hide') distance = distance / (times * 2);
|
||||
if (mode != 'hide') times--;
|
||||
|
||||
|
||||
// Animate
|
||||
if (mode == 'show') { // Show Bounce
|
||||
var animation = {opacity: 1};
|
||||
@ -72,7 +72,7 @@ $.effects.bounce = function(o) {
|
||||
el.queue('fx', function() { el.dequeue(); });
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -18,11 +18,11 @@ $.effects.clip = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left','height','width'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var direction = o.options.direction || 'vertical'; // Default direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||
@ -33,12 +33,12 @@ $.effects.clip = function(o) {
|
||||
};
|
||||
var distance = (direction == 'vertical') ? animate.height() : animate.width();
|
||||
if(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {};
|
||||
animation[ref.size] = mode == 'show' ? distance : 0;
|
||||
animation[ref.position] = mode == 'show' ? 0 : distance / 2;
|
||||
|
||||
|
||||
// Animate
|
||||
animate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
@ -46,9 +46,9 @@ $.effects.clip = function(o) {
|
||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -300,7 +300,7 @@ var colors = {
|
||||
yellow:[255,255,0],
|
||||
transparent: [255,255,255]
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
||||
*
|
||||
|
@ -18,11 +18,11 @@ $.effects.drop = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left','opacity'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var direction = o.options.direction || 'left'; // Default Direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
$.effects.createWrapper(el); // Create Wrapper
|
||||
@ -30,11 +30,11 @@ $.effects.drop = function(o) {
|
||||
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
||||
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2);
|
||||
if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {opacity: mode == 'show' ? 1 : 0};
|
||||
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
@ -42,9 +42,9 @@ $.effects.drop = function(o) {
|
||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -18,15 +18,15 @@ $.effects.explode = function(o) {
|
||||
|
||||
var rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
|
||||
var cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;
|
||||
|
||||
|
||||
o.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;
|
||||
var el = $(this).show().css('visibility', 'hidden');
|
||||
var offset = el.offset();
|
||||
|
||||
|
||||
//Substract the margins - not fixing the problem yet.
|
||||
offset.top -= parseInt(el.css("marginTop")) || 0;
|
||||
offset.left -= parseInt(el.css("marginLeft")) || 0;
|
||||
|
||||
|
||||
var width = el.outerWidth(true);
|
||||
var height = el.outerHeight(true);
|
||||
|
||||
@ -62,18 +62,18 @@ $.effects.explode = function(o) {
|
||||
|
||||
// Set a timeout, to call the callback approx. when the other animations have finished
|
||||
setTimeout(function() {
|
||||
|
||||
|
||||
o.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();
|
||||
if(o.callback) o.callback.apply(el[0]); // Callback
|
||||
el.dequeue();
|
||||
|
||||
|
||||
$('.effects-explode').remove();
|
||||
|
||||
|
||||
}, o.duration || 500);
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -18,12 +18,12 @@ $.effects.fold = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var size = o.options.size || 15; // Default fold size
|
||||
var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||
@ -33,12 +33,12 @@ $.effects.fold = function(o) {
|
||||
var percent = /([0-9]+)%/.exec(size);
|
||||
if(percent) size = parseInt(percent[1]) / 100 * distance[mode == 'hide' ? 0 : 1];
|
||||
if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation1 = {}, animation2 = {};
|
||||
animation1[ref[0]] = mode == 'show' ? distance[0] : size;
|
||||
animation2[ref[1]] = mode == 'show' ? distance[1] : 0;
|
||||
|
||||
|
||||
// Animate
|
||||
wrapper.animate(animation1, o.duration / 2, o.options.easing)
|
||||
.animate(animation2, o.duration / 2, o.options.easing, function() {
|
||||
@ -47,9 +47,9 @@ $.effects.fold = function(o) {
|
||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -15,23 +15,23 @@
|
||||
$.effects.highlight = function(o) {
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['backgroundImage','backgroundColor','opacity'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
||||
var color = o.options.color || "#ffff99"; // Default highlight color
|
||||
var oldColor = el.css("backgroundColor");
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
el.css({backgroundImage: 'none', backgroundColor: color}); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {backgroundColor: oldColor };
|
||||
if (mode == "hide") animation['opacity'] = 0;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == "hide") el.hide();
|
||||
@ -40,9 +40,9 @@ $.effects.highlight = function(o) {
|
||||
if(o.callback) o.callback.apply(this, arguments);
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -15,14 +15,14 @@
|
||||
$.effects.pulsate = function(o) {
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
||||
var times = o.options.times || 5; // Default # of times
|
||||
|
||||
|
||||
// Adjust
|
||||
if (mode == 'hide') times--;
|
||||
if (el.is(':hidden')) { // Show fadeIn
|
||||
@ -31,7 +31,7 @@ $.effects.pulsate = function(o) {
|
||||
el.animate({opacity: 1}, o.duration / 2, o.options.easing);
|
||||
times = times-2;
|
||||
}
|
||||
|
||||
|
||||
// Animate
|
||||
for (var i = 0; i < times; i++) { // Pulsate
|
||||
el.animate({opacity: 0}, o.duration / 2, o.options.easing).animate({opacity: 1}, o.duration / 2, o.options.easing);
|
||||
@ -49,7 +49,7 @@ $.effects.pulsate = function(o) {
|
||||
el.queue('fx', function() { el.dequeue(); });
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -18,34 +18,34 @@ $.effects.puff = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
|
||||
// Set options
|
||||
var options = $.extend(true, {}, o.options);
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||
var percent = parseInt(o.options.percent) || 150; // Set default puff percent
|
||||
options.fade = true; // It's not a puff if it doesn't fade! :)
|
||||
var original = {height: el.height(), width: el.width()}; // Save original
|
||||
|
||||
|
||||
// Adjust
|
||||
var factor = percent / 100;
|
||||
el.from = (mode == 'hide') ? original : {height: original.height * factor, width: original.width * factor};
|
||||
|
||||
|
||||
// Animation
|
||||
options.from = el.from;
|
||||
options.percent = (mode == 'hide') ? percent : 100;
|
||||
options.mode = mode;
|
||||
|
||||
|
||||
// Animate
|
||||
el.effect('scale', options, o.duration, o.callback);
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$.effects.scale = function(o) {
|
||||
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
@ -61,33 +61,33 @@ $.effects.scale = function(o) {
|
||||
}
|
||||
var original = {height: el.height(), width: el.width()}; // Save original
|
||||
el.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state
|
||||
|
||||
|
||||
// Adjust
|
||||
var factor = { // Set scaling factor
|
||||
y: direction != 'horizontal' ? (percent / 100) : 1,
|
||||
x: direction != 'vertical' ? (percent / 100) : 1
|
||||
};
|
||||
el.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state
|
||||
|
||||
|
||||
if (o.options.fade) { // Fade option to support puff
|
||||
if (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};
|
||||
if (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};
|
||||
};
|
||||
|
||||
|
||||
// Animation
|
||||
options.from = el.from; options.to = el.to; options.mode = mode;
|
||||
|
||||
|
||||
// Animate
|
||||
el.effect('size', options, o.duration, o.callback);
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
$.effects.size = function(o) {
|
||||
|
||||
return this.queue(function() {
|
||||
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left','width','height','overflow','opacity'];
|
||||
var props1 = ['position','top','left','overflow','opacity']; // Always restore
|
||||
@ -95,7 +95,7 @@ $.effects.size = function(o) {
|
||||
var cProps = ['fontSize'];
|
||||
var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
|
||||
var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
||||
var restore = o.options.restore || false; // Default restore
|
||||
@ -138,7 +138,7 @@ $.effects.size = function(o) {
|
||||
$.effects.save(el, restore ? props : props1); el.show(); // Save & Show
|
||||
$.effects.createWrapper(el); // Create Wrapper
|
||||
el.css('overflow','hidden').css(el.from); // Shift
|
||||
|
||||
|
||||
// Animate
|
||||
if (scale == 'content' || scale == 'both') { // Scale the children
|
||||
vProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size
|
||||
@ -164,7 +164,7 @@ $.effects.size = function(o) {
|
||||
}); // Animate children
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
@ -172,7 +172,7 @@ $.effects.size = function(o) {
|
||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
@ -18,26 +18,26 @@ $.effects.shake = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
||||
var direction = o.options.direction || 'left'; // Default direction
|
||||
var distance = o.options.distance || 20; // Default distance
|
||||
var times = o.options.times || 3; // Default # of times
|
||||
var speed = o.duration || o.options.duration || 140; // Default speed per shake
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
$.effects.createWrapper(el); // Create Wrapper
|
||||
var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
|
||||
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {}, animation1 = {}, animation2 = {};
|
||||
animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
|
||||
animation1[ref] = (motion == 'pos' ? '+=' : '-=') + distance * 2;
|
||||
animation2[ref] = (motion == 'pos' ? '-=' : '+=') + distance * 2;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, speed, o.options.easing);
|
||||
for (var i = 1; i < times; i++) { // Shakes
|
||||
@ -51,7 +51,7 @@ $.effects.shake = function(o) {
|
||||
el.queue('fx', function() { el.dequeue(); });
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -18,11 +18,11 @@ $.effects.slide = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this), props = ['position','top','left'];
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
|
||||
var direction = o.options.direction || 'left'; // Default Direction
|
||||
|
||||
|
||||
// Adjust
|
||||
$.effects.save(el, props); el.show(); // Save & Show
|
||||
$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||
@ -30,11 +30,11 @@ $.effects.slide = function(o) {
|
||||
var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
|
||||
var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
|
||||
if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
|
||||
|
||||
|
||||
// Animation
|
||||
var animation = {};
|
||||
animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
|
||||
|
||||
|
||||
// Animate
|
||||
el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
|
||||
if(mode == 'hide') el.hide(); // Hide
|
||||
@ -42,9 +42,9 @@ $.effects.slide = function(o) {
|
||||
if(o.callback) o.callback.apply(this, arguments); // Callback
|
||||
el.dequeue();
|
||||
}});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -18,14 +18,14 @@ $.effects.transfer = function(o) {
|
||||
|
||||
// Create element
|
||||
var el = $(this);
|
||||
|
||||
|
||||
// Set options
|
||||
var mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode
|
||||
var target = $(o.options.to); // Find Target
|
||||
var position = el.offset();
|
||||
var transfer = $('<div class="ui-effects-transfer"></div>').appendTo(document.body);
|
||||
if(o.options.className) transfer.addClass(o.options.className);
|
||||
|
||||
|
||||
// Set target css
|
||||
transfer.addClass(o.options.className);
|
||||
transfer.css({
|
||||
@ -35,7 +35,7 @@ $.effects.transfer = function(o) {
|
||||
width: el.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')),
|
||||
position: 'absolute'
|
||||
});
|
||||
|
||||
|
||||
// Animation
|
||||
position = target.offset();
|
||||
animation = {
|
||||
@ -44,16 +44,16 @@ $.effects.transfer = function(o) {
|
||||
height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
|
||||
width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth'))
|
||||
};
|
||||
|
||||
|
||||
// Animate
|
||||
transfer.animate(animation, o.duration, o.options.easing, function() {
|
||||
transfer.remove(); // Remove div
|
||||
if(o.callback) o.callback.apply(el[0], arguments); // Callback
|
||||
el.dequeue();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
@ -15,7 +15,7 @@
|
||||
$.widget("ui.accordion", {
|
||||
_init: function() {
|
||||
var options = this.options;
|
||||
|
||||
|
||||
if ( options.navigation ) {
|
||||
var current = this.element.find("a").filter(options.navigationFilter);
|
||||
if ( current.length ) {
|
||||
@ -27,23 +27,23 @@ $.widget("ui.accordion", {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// calculate active if not specified, using the first header
|
||||
options.headers = this.element.find(options.header);
|
||||
options.active = findActive(options.headers, options.active);
|
||||
|
||||
|
||||
// IE7-/Win - Extra vertical space in Lists fixed
|
||||
if ($.browser.msie) {
|
||||
this.element.find('a').css('zoom', '1');
|
||||
}
|
||||
|
||||
|
||||
if (!this.element.hasClass("ui-accordion")) {
|
||||
this.element.addClass("ui-accordion");
|
||||
$('<span class="ui-accordion-left"/>').insertBefore(options.headers);
|
||||
$('<span class="ui-accordion-right"/>').appendTo(options.headers);
|
||||
options.headers.addClass("ui-accordion-header");
|
||||
}
|
||||
|
||||
|
||||
var maxHeight;
|
||||
if ( options.fillSpace ) {
|
||||
maxHeight = this.element.parent().height();
|
||||
@ -60,7 +60,7 @@ $.widget("ui.accordion", {
|
||||
maxHeight = Math.max(maxHeight, $(this).outerHeight());
|
||||
}).height(maxHeight);
|
||||
}
|
||||
|
||||
|
||||
this.element.attr('role','tablist');
|
||||
|
||||
var self=this;
|
||||
@ -69,14 +69,14 @@ $.widget("ui.accordion", {
|
||||
.bind('keydown', function(event) { return self._keydown(event); })
|
||||
.next()
|
||||
.attr('role','tabpanel');
|
||||
|
||||
|
||||
options.headers
|
||||
.not(options.active || "")
|
||||
.attr('aria-expanded','false')
|
||||
.attr("tabIndex", "-1")
|
||||
.next()
|
||||
.hide();
|
||||
|
||||
|
||||
// make sure at least one header is in the tab order
|
||||
if (!options.active.length) {
|
||||
options.headers.eq(0).attr('tabIndex','0');
|
||||
@ -86,26 +86,26 @@ $.widget("ui.accordion", {
|
||||
.attr("tabIndex", "0")
|
||||
.parent().andSelf().addClass(options.selectedClass);
|
||||
}
|
||||
|
||||
|
||||
// only need links in taborder for Safari
|
||||
if (!$.browser.safari)
|
||||
options.headers.find('a').attr('tabIndex','-1');
|
||||
|
||||
|
||||
if (options.event) {
|
||||
this.element.bind((options.event) + ".accordion", clickHandler);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_keydown: function(event) {
|
||||
if (this.options.disabled || event.altKey || event.ctrlKey)
|
||||
return;
|
||||
|
||||
var keyCode = $.keyCode;
|
||||
|
||||
|
||||
var length = this.options.headers.length;
|
||||
var currentIndex = this.options.headers.index(event.target);
|
||||
var toFocus = false;
|
||||
|
||||
|
||||
switch(event.keyCode) {
|
||||
case keyCode.RIGHT:
|
||||
case keyCode.DOWN:
|
||||
@ -119,7 +119,7 @@ $.widget("ui.accordion", {
|
||||
case keyCode.ENTER:
|
||||
return clickHandler.call(this.element[0], { target: event.target });
|
||||
}
|
||||
|
||||
|
||||
if (toFocus) {
|
||||
$(event.target).attr('tabIndex','-1');
|
||||
$(toFocus).attr('tabIndex','0');
|
||||
@ -129,14 +129,14 @@ $.widget("ui.accordion", {
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
||||
activate: function(index) {
|
||||
// call clickHandler with custom event
|
||||
clickHandler.call(this.element[0], {
|
||||
target: findActive( this.options.headers, index )[0]
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
destroy: function() {
|
||||
this.options.headers.parent().andSelf().removeClass(this.options.selectedClass);
|
||||
this.options.headers.prev(".ui-accordion-left").remove();
|
||||
@ -146,7 +146,7 @@ $.widget("ui.accordion", {
|
||||
this.options.headers.next().css("height", "");
|
||||
}
|
||||
$.removeData(this.element[0], "accordion");
|
||||
|
||||
|
||||
this.element.removeClass("ui-accordion").unbind(".accordion");
|
||||
}
|
||||
});
|
||||
@ -162,7 +162,7 @@ function completed(cancel) {
|
||||
if (!$.data(this, "accordion")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var instance = $.data(this, "accordion");
|
||||
var options = instance.options;
|
||||
options.running = cancel ? 0 : --options.running;
|
||||
@ -184,15 +184,15 @@ function toggle(toShow, toHide, data, clickedActive, down) {
|
||||
options.toHide = toHide;
|
||||
options.data = data;
|
||||
var complete = scopeCallback(completed, this);
|
||||
|
||||
|
||||
$.data(this, "accordion")._trigger("changestart", null, options.data);
|
||||
|
||||
|
||||
// count elements to animate
|
||||
options.running = toHide.size() === 0 ? toShow.size() : toHide.size();
|
||||
|
||||
|
||||
if ( options.animated ) {
|
||||
var animOptions = {};
|
||||
|
||||
|
||||
if ( !options.alwaysOpen && clickedActive ) {
|
||||
animOptions = {
|
||||
toShow: $([]),
|
||||
@ -210,25 +210,25 @@ function toggle(toShow, toHide, data, clickedActive, down) {
|
||||
autoHeight: options.autoHeight
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (!options.proxied) {
|
||||
options.proxied = options.animated;
|
||||
}
|
||||
|
||||
|
||||
if (!options.proxiedDuration) {
|
||||
options.proxiedDuration = options.duration;
|
||||
}
|
||||
|
||||
|
||||
options.animated = $.isFunction(options.proxied) ?
|
||||
options.proxied(animOptions) : options.proxied;
|
||||
|
||||
|
||||
options.duration = $.isFunction(options.proxiedDuration) ?
|
||||
options.proxiedDuration(animOptions) : options.proxiedDuration;
|
||||
|
||||
var animations = $.ui.accordion.animations,
|
||||
duration = options.duration,
|
||||
easing = options.animated;
|
||||
|
||||
|
||||
if (!animations[easing]) {
|
||||
animations[easing] = function(options) {
|
||||
this.slide(options, {
|
||||
@ -237,9 +237,9 @@ function toggle(toShow, toHide, data, clickedActive, down) {
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
animations[easing](animOptions);
|
||||
|
||||
|
||||
} else {
|
||||
if ( !options.alwaysOpen && clickedActive ) {
|
||||
toShow.toggle();
|
||||
@ -258,7 +258,7 @@ function clickHandler(event) {
|
||||
if (options.disabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// called only when using activate(false) to close all parts programmatically
|
||||
if ( !event.target && !options.alwaysOpen ) {
|
||||
options.active.parent().andSelf().toggleClass(options.selectedClass);
|
||||
@ -276,14 +276,14 @@ function clickHandler(event) {
|
||||
}
|
||||
// get the click target
|
||||
var clicked = $(event.target);
|
||||
|
||||
|
||||
// due to the event delegation model, we have to check if one
|
||||
// of the parent elements is our actual header, and find that
|
||||
// otherwise stick with the initial target
|
||||
clicked = $( clicked.parents(options.header)[0] || clicked );
|
||||
|
||||
|
||||
var clickedActive = clicked[0] == options.active[0];
|
||||
|
||||
|
||||
// if animations are still active, or the active header is the target, ignore click
|
||||
if (options.running || (options.alwaysOpen && clickedActive)) {
|
||||
return false;
|
||||
@ -291,13 +291,13 @@ function clickHandler(event) {
|
||||
if (!clicked.is(options.header)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// switch classes
|
||||
options.active.parent().andSelf().toggleClass(options.selectedClass);
|
||||
if ( !clickedActive ) {
|
||||
clicked.parent().andSelf().addClass(options.selectedClass);
|
||||
}
|
||||
|
||||
|
||||
// find elements to show and hide
|
||||
var toShow = clicked.next(),
|
||||
toHide = options.active.next(),
|
||||
@ -309,10 +309,10 @@ function clickHandler(event) {
|
||||
oldContent: toHide
|
||||
},
|
||||
down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
|
||||
|
||||
|
||||
options.active = clickedActive ? $([]) : clicked;
|
||||
toggle.call(this, toShow, toHide, data, clickedActive, down );
|
||||
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
148
ui/ui.core.js
148
ui/ui.core.js
@ -45,9 +45,9 @@ var _remove = $.fn.remove,
|
||||
|
||||
//Helper functions and ui object
|
||||
$.ui = {
|
||||
|
||||
|
||||
version: "@VERSION",
|
||||
|
||||
|
||||
// $.ui.plugin is deprecated. Use the proxy pattern instead.
|
||||
plugin: {
|
||||
add: function(module, option, set) {
|
||||
@ -60,7 +60,7 @@ $.ui = {
|
||||
call: function(instance, name, args) {
|
||||
var set = instance.plugins[name];
|
||||
if(!set) { return; }
|
||||
|
||||
|
||||
for (var i = 0; i < set.length; i++) {
|
||||
if (instance.options[set[i][0]]) {
|
||||
set[i][1].apply(instance.element, args);
|
||||
@ -68,7 +68,7 @@ $.ui = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
contains: function(a, b) {
|
||||
var safari2 = $.browser.safari && $.browser.version < 522;
|
||||
if (a.contains && !safari2) {
|
||||
@ -80,15 +80,15 @@ $.ui = {
|
||||
if (b == a) return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
cssCache: {},
|
||||
css: function(name) {
|
||||
if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
|
||||
var tmp = $('<div class="ui-gen">').addClass(name).css({position:'absolute', top:'-5000px', left:'-5000px', display:'block'}).appendTo('body');
|
||||
|
||||
|
||||
//if (!$.browser.safari)
|
||||
//tmp.appendTo('body');
|
||||
|
||||
|
||||
//Opera and Safari set width and height to 0px instead of auto
|
||||
//Safari returns rgba(0,0,0,0) when bgcolor is not set
|
||||
$.ui.cssCache[name] = !!(
|
||||
@ -100,15 +100,15 @@ $.ui = {
|
||||
},
|
||||
|
||||
hasScroll: function(el, a) {
|
||||
|
||||
|
||||
//If overflow is hidden, the element might have extra content, but the user wants to hide it
|
||||
if ($(el).css('overflow') == 'hidden') { return false; }
|
||||
|
||||
|
||||
var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
|
||||
has = false;
|
||||
|
||||
|
||||
if (el[scroll] > 0) { return true; }
|
||||
|
||||
|
||||
// TODO: determine which cases actually cause this to happen
|
||||
// if the element doesn't have the scroll set, see if it's possible to
|
||||
// set the scroll
|
||||
@ -117,17 +117,17 @@ $.ui = {
|
||||
el[scroll] = 0;
|
||||
return has;
|
||||
},
|
||||
|
||||
|
||||
isOverHeight: function(y, top, height) {
|
||||
//Determines when y coordinate is over "b" element height
|
||||
return (y > top) && (y < (top + height));
|
||||
},
|
||||
|
||||
|
||||
isOverWidth: function(x, left, width) {
|
||||
//Determines when x coordinate is over "b" element width
|
||||
return (x > left) && (x < (left + width));
|
||||
},
|
||||
|
||||
|
||||
isOver: function(y, x, top, left, height, width) {
|
||||
//Determines when x, y coordinates is over "b" element
|
||||
return $.ui.isOverHeight(y, top, height) && $.ui.isOverWidth(x, left, width);
|
||||
@ -141,10 +141,10 @@ if (isFF2) {
|
||||
ariaNS = "http://www.w3.org/2005/07/aaa",
|
||||
ariaState = /^aria-/,
|
||||
ariaRole = /^wairole:/;
|
||||
|
||||
|
||||
$.attr = function(elem, name, value) {
|
||||
var set = value !== undefined;
|
||||
|
||||
|
||||
return (name == 'role'
|
||||
? (set
|
||||
? attr.call(this, elem, name, "wairole:" + value)
|
||||
@ -156,7 +156,7 @@ if (isFF2) {
|
||||
: attr.call(this, elem, name.replace(ariaState, "aaa:")))
|
||||
: attr.apply(this, arguments)));
|
||||
};
|
||||
|
||||
|
||||
$.fn.removeAttr = function(name) {
|
||||
return (ariaState.test(name)
|
||||
? this.each(function() {
|
||||
@ -167,7 +167,7 @@ if (isFF2) {
|
||||
|
||||
//jQuery plugins
|
||||
$.fn.extend({
|
||||
|
||||
|
||||
remove: function() {
|
||||
// Safari has a native remove event which actually removes DOM elements,
|
||||
// so we have to use triggerHandler instead of trigger (#3037).
|
||||
@ -176,65 +176,65 @@ $.fn.extend({
|
||||
});
|
||||
return _remove.apply(this, arguments );
|
||||
},
|
||||
|
||||
|
||||
enableSelection: function() {
|
||||
return this
|
||||
.attr('unselectable', 'off')
|
||||
.css('MozUserSelect', '')
|
||||
.unbind('selectstart.ui');
|
||||
},
|
||||
|
||||
|
||||
disableSelection: function() {
|
||||
return this
|
||||
.attr('unselectable', 'on')
|
||||
.css('MozUserSelect', 'none')
|
||||
.bind('selectstart.ui', function() { return false; });
|
||||
},
|
||||
|
||||
|
||||
scrollParent: function() {
|
||||
return $(this).parents().filter(function() {
|
||||
return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
|
||||
}).eq(0);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
//Additional selectors
|
||||
$.extend($.expr[':'], {
|
||||
|
||||
|
||||
data: function(a, i, m) {
|
||||
return $.data(a, m[3]);
|
||||
},
|
||||
|
||||
|
||||
// TODO: add support for object, area
|
||||
tabbable: function(a, i, m) {
|
||||
|
||||
|
||||
var nodeName = a.nodeName.toLowerCase();
|
||||
function isVisible(element) {
|
||||
return !($(element).is(':hidden') || $(element).parents(':hidden').length);
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
// in tab order
|
||||
a.tabIndex >= 0 &&
|
||||
|
||||
|
||||
( // filter node types that participate in the tab order
|
||||
|
||||
|
||||
// anchor tag
|
||||
('a' == nodeName && a.href) ||
|
||||
|
||||
|
||||
// enabled form element
|
||||
(/input|select|textarea|button/.test(nodeName) &&
|
||||
'hidden' != a.type && !a.disabled)
|
||||
) &&
|
||||
|
||||
|
||||
// visible on page
|
||||
isVisible(a)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -246,7 +246,7 @@ function getter(namespace, plugin, method, args) {
|
||||
var methods = $[namespace][plugin][type] || [];
|
||||
return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
|
||||
}
|
||||
|
||||
|
||||
var methods = getMethods('getter');
|
||||
if (args.length == 1 && typeof args[0] == 'string') {
|
||||
methods = methods.concat(getMethods('getterSetter'));
|
||||
@ -257,53 +257,53 @@ function getter(namespace, plugin, method, args) {
|
||||
$.widget = function(name, prototype) {
|
||||
var namespace = name.split(".")[0];
|
||||
name = name.split(".")[1];
|
||||
|
||||
|
||||
// create plugin method
|
||||
$.fn[name] = function(options) {
|
||||
var isMethodCall = (typeof options == 'string'),
|
||||
args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
|
||||
// prevent calls to internal methods
|
||||
if (isMethodCall && options.substring(0, 1) == '_') {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
// handle getter methods
|
||||
if (isMethodCall && getter(namespace, name, options, args)) {
|
||||
var instance = $.data(this[0], name);
|
||||
return (instance ? instance[options].apply(instance, args)
|
||||
: undefined);
|
||||
}
|
||||
|
||||
|
||||
// handle initialization and non-getter methods
|
||||
return this.each(function() {
|
||||
var instance = $.data(this, name);
|
||||
|
||||
|
||||
// constructor
|
||||
(!instance && !isMethodCall &&
|
||||
$.data(this, name, new $[namespace][name](this, options)));
|
||||
|
||||
|
||||
// method call
|
||||
(instance && isMethodCall && $.isFunction(instance[options]) &&
|
||||
instance[options].apply(instance, args));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// create widget constructor
|
||||
$[namespace] = $[namespace] || {};
|
||||
$[namespace][name] = function(element, options) {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.widgetName = name;
|
||||
this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
|
||||
this.widgetBaseClass = namespace + '-' + name;
|
||||
|
||||
|
||||
this.options = $.extend({},
|
||||
$.widget.defaults,
|
||||
$[namespace][name].defaults,
|
||||
$.metadata && $.metadata.get(element)[name],
|
||||
options);
|
||||
|
||||
|
||||
this.element = $(element)
|
||||
.bind('setData.' + name, function(event, key, value) {
|
||||
return self._setData(key, value);
|
||||
@ -314,13 +314,13 @@ $.widget = function(name, prototype) {
|
||||
.bind('remove', function() {
|
||||
return self.destroy();
|
||||
});
|
||||
|
||||
|
||||
this._init();
|
||||
};
|
||||
|
||||
|
||||
// add widget prototype
|
||||
$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
|
||||
|
||||
|
||||
// TODO: merge getter and getterSetter properties from widget prototype
|
||||
// and plugin prototype
|
||||
$[namespace][name].getterSetter = 'option';
|
||||
@ -331,11 +331,11 @@ $.widget.prototype = {
|
||||
destroy: function() {
|
||||
this.element.removeData(this.widgetName);
|
||||
},
|
||||
|
||||
|
||||
option: function(key, value) {
|
||||
var options = key,
|
||||
self = this;
|
||||
|
||||
|
||||
if (typeof key == "string") {
|
||||
if (value === undefined) {
|
||||
return this._getData(key);
|
||||
@ -343,7 +343,7 @@ $.widget.prototype = {
|
||||
options = {};
|
||||
options[key] = value;
|
||||
}
|
||||
|
||||
|
||||
$.each(options, function(key, value) {
|
||||
self._setData(key, value);
|
||||
});
|
||||
@ -353,20 +353,20 @@ $.widget.prototype = {
|
||||
},
|
||||
_setData: function(key, value) {
|
||||
this.options[key] = value;
|
||||
|
||||
|
||||
if (key == 'disabled') {
|
||||
this.element[value ? 'addClass' : 'removeClass'](
|
||||
this.widgetBaseClass + '-disabled');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
enable: function() {
|
||||
this._setData('disabled', false);
|
||||
},
|
||||
disable: function() {
|
||||
this._setData('disabled', true);
|
||||
},
|
||||
|
||||
|
||||
_trigger: function(type, event, data) {
|
||||
var eventName = (type == this.widgetEventPrefix
|
||||
? type : this.widgetEventPrefix + type);
|
||||
@ -385,7 +385,7 @@ $.widget.defaults = {
|
||||
$.ui.mouse = {
|
||||
_mouseInit: function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.element
|
||||
.bind('mousedown.'+this.widgetName, function(event) {
|
||||
return self._mouseDown(event);
|
||||
@ -396,46 +396,46 @@ $.ui.mouse = {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Prevent text selection in IE
|
||||
if ($.browser.msie) {
|
||||
this._mouseUnselectable = this.element.attr('unselectable');
|
||||
this.element.attr('unselectable', 'on');
|
||||
}
|
||||
|
||||
|
||||
this.started = false;
|
||||
},
|
||||
|
||||
|
||||
// TODO: make sure destroying one instance of mouse doesn't mess with
|
||||
// other instances of mouse
|
||||
_mouseDestroy: function() {
|
||||
this.element.unbind('.'+this.widgetName);
|
||||
|
||||
|
||||
// Restore text selection in IE
|
||||
($.browser.msie
|
||||
&& this.element.attr('unselectable', this._mouseUnselectable));
|
||||
},
|
||||
|
||||
|
||||
_mouseDown: function(event) {
|
||||
// we may have missed mouseup (out of window)
|
||||
(this._mouseStarted && this._mouseUp(event));
|
||||
|
||||
|
||||
this._mouseDownEvent = event;
|
||||
|
||||
|
||||
var self = this,
|
||||
btnIsLeft = (event.which == 1),
|
||||
elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
|
||||
if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
this.mouseDelayMet = !this.options.delay;
|
||||
if (!this.mouseDelayMet) {
|
||||
this._mouseDelayTimer = setTimeout(function() {
|
||||
self.mouseDelayMet = true;
|
||||
}, this.options.delay);
|
||||
}
|
||||
|
||||
|
||||
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
||||
this._mouseStarted = (this._mouseStart(event) !== false);
|
||||
if (!this._mouseStarted) {
|
||||
@ -443,7 +443,7 @@ $.ui.mouse = {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// these delegates are required to keep context
|
||||
this._mouseMoveDelegate = function(event) {
|
||||
return self._mouseMove(event);
|
||||
@ -454,44 +454,44 @@ $.ui.mouse = {
|
||||
$(document)
|
||||
.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
||||
.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
_mouseMove: function(event) {
|
||||
// IE mouseup check - mouseup happened when mouse was out of window
|
||||
if ($.browser.msie && !event.button) {
|
||||
return this._mouseUp(event);
|
||||
}
|
||||
|
||||
|
||||
if (this._mouseStarted) {
|
||||
this._mouseDrag(event);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
|
||||
this._mouseStarted =
|
||||
(this._mouseStart(this._mouseDownEvent, event) !== false);
|
||||
(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
|
||||
}
|
||||
|
||||
|
||||
return !this._mouseStarted;
|
||||
},
|
||||
|
||||
|
||||
_mouseUp: function(event) {
|
||||
$(document)
|
||||
.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
|
||||
.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
|
||||
|
||||
|
||||
if (this._mouseStarted) {
|
||||
this._mouseStarted = false;
|
||||
this._preventClickEvent = true;
|
||||
this._mouseStop(event);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
_mouseDistanceMet: function(event) {
|
||||
return (Math.max(
|
||||
Math.abs(this._mouseDownEvent.pageX - event.pageX),
|
||||
@ -499,11 +499,11 @@ $.ui.mouse = {
|
||||
) >= this.options.distance
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
_mouseDelayMet: function(event) {
|
||||
return this.mouseDelayMet;
|
||||
},
|
||||
|
||||
|
||||
// These are placeholder methods, to be overriden by extending plugin
|
||||
_mouseStart: function(event) {},
|
||||
_mouseDrag: function(event) {},
|
||||
|
@ -139,13 +139,13 @@ function Datepicker() {
|
||||
$.extend(Datepicker.prototype, {
|
||||
/* Class name added to elements to indicate already configured with a date picker. */
|
||||
markerClassName: 'hasDatepicker',
|
||||
|
||||
|
||||
/* Debug logging (if enabled). */
|
||||
log: function () {
|
||||
if (this.debug)
|
||||
console.log.apply('', arguments);
|
||||
},
|
||||
|
||||
|
||||
/* Override the default settings for all instances of the date picker.
|
||||
@param settings object - the new settings to use as defaults (anonymous object)
|
||||
@return the manager object */
|
||||
@ -153,7 +153,7 @@ $.extend(Datepicker.prototype, {
|
||||
extendRemove(this._defaults, settings || {});
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
/* Attach the date picker to a jQuery selection.
|
||||
@param target element - the target input field or division or span
|
||||
@param settings object - the new settings to use for this date picker instance (anonymous) */
|
||||
@ -183,7 +183,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._inlineDatepicker(target, inst);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Create a new instance object. */
|
||||
_newInst: function(target, inline) {
|
||||
var id = target[0].id.replace(/([:\[\]\.])/g, '\\\\$1'); // escape jQuery meta chars
|
||||
@ -194,7 +194,7 @@ $.extend(Datepicker.prototype, {
|
||||
dpDiv: (!inline ? this.dpDiv : // presentation div
|
||||
$('<div class="' + this._inlineClass + '"></div>'))};
|
||||
},
|
||||
|
||||
|
||||
/* Attach the date picker to an input field. */
|
||||
_connectDatepicker: function(target, inst) {
|
||||
var input = $(target);
|
||||
@ -233,7 +233,7 @@ $.extend(Datepicker.prototype, {
|
||||
});
|
||||
$.data(target, PROP_NAME, inst);
|
||||
},
|
||||
|
||||
|
||||
/* Attach an inline date picker to a div. */
|
||||
_inlineDatepicker: function(target, inst) {
|
||||
var divSpan = $(target);
|
||||
@ -250,7 +250,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._updateDatepicker(inst);
|
||||
this._updateAlternate(inst);
|
||||
},
|
||||
|
||||
|
||||
/* Pop-up the date picker in a "dialog" box.
|
||||
@param input element - ignored
|
||||
@param dateText string - the initial date to display (in the current format)
|
||||
@ -274,7 +274,7 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
extendRemove(inst.settings, settings || {});
|
||||
this._dialogInput.val(dateText);
|
||||
|
||||
|
||||
this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
|
||||
if (!this._pos) {
|
||||
var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
||||
@ -284,7 +284,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._pos = // should use actual width/height below
|
||||
[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
|
||||
}
|
||||
|
||||
|
||||
// move input on screen for focus, but hidden behind dialog
|
||||
this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
|
||||
inst.settings.onSelect = onSelect;
|
||||
@ -296,7 +296,7 @@ $.extend(Datepicker.prototype, {
|
||||
$.data(this._dialogInput[0], PROP_NAME, inst);
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
/* Detach a datepicker from its control.
|
||||
@param target element - the target input field or division or span */
|
||||
_destroyDatepicker: function(target) {
|
||||
@ -316,7 +316,7 @@ $.extend(Datepicker.prototype, {
|
||||
} else if (nodeName == 'div' || nodeName == 'span')
|
||||
$target.removeClass(this.markerClassName).empty();
|
||||
},
|
||||
|
||||
|
||||
/* Enable the date picker to a jQuery selection.
|
||||
@param target element - the target input field or division or span */
|
||||
_enableDatepicker: function(target) {
|
||||
@ -338,7 +338,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._disabledInputs = $.map(this._disabledInputs,
|
||||
function(value) { return (value == target ? null : value); }); // delete entry
|
||||
},
|
||||
|
||||
|
||||
/* Disable the date picker to a jQuery selection.
|
||||
@param target element - the target input field or division or span */
|
||||
_disableDatepicker: function(target) {
|
||||
@ -374,7 +374,7 @@ $.extend(Datepicker.prototype, {
|
||||
function(value) { return (value == target ? null : value); }); // delete entry
|
||||
this._disabledInputs[this._disabledInputs.length] = target;
|
||||
},
|
||||
|
||||
|
||||
/* Is the first field in a jQuery collection disabled as a datepicker?
|
||||
@param target element - the target input field or division or span
|
||||
@return boolean - true if disabled, false if enabled */
|
||||
@ -387,7 +387,7 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
/* Retrieve the instance data for the target control.
|
||||
@param target element - the target input field or division or span
|
||||
@return object - the associated instance data
|
||||
@ -400,7 +400,7 @@ $.extend(Datepicker.prototype, {
|
||||
throw 'Missing instance data for this datepicker';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Update the settings for a date picker attached to an input field or division.
|
||||
@param target element - the target input field or division or span
|
||||
@param name object - the new settings to update or
|
||||
@ -429,12 +429,12 @@ $.extend(Datepicker.prototype, {
|
||||
this._updateDatepicker(inst);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// change method deprecated
|
||||
_changeDatepicker: function(target, name, value) {
|
||||
this._optionDatepicker(target, name, value);
|
||||
},
|
||||
|
||||
|
||||
/* Redraw the date picker attached to an input field or division.
|
||||
@param target element - the target input field or division or span */
|
||||
_refreshDatepicker: function(target) {
|
||||
@ -443,7 +443,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._updateDatepicker(inst);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Set the dates for a jQuery selection.
|
||||
@param target element - the target input field or division or span
|
||||
@param date Date - the new date
|
||||
@ -456,7 +456,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._updateAlternate(inst);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Get the date(s) for the first entry in a jQuery selection.
|
||||
@param target element - the target input field or division or span
|
||||
@return Date - the current date or
|
||||
@ -467,7 +467,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._setDateFromField(inst);
|
||||
return (inst ? this._getDate(inst) : null);
|
||||
},
|
||||
|
||||
|
||||
/* Handle keystrokes. */
|
||||
_doKeyDown: function(event) {
|
||||
var inst = $.datepicker._getInst(event.target);
|
||||
@ -535,7 +535,7 @@ $.extend(Datepicker.prototype, {
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Filter entered characters - based on date format. */
|
||||
_doKeyPress: function(event) {
|
||||
var inst = $.datepicker._getInst(event.target);
|
||||
@ -545,7 +545,7 @@ $.extend(Datepicker.prototype, {
|
||||
return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Pop-up the date picker for a given input field.
|
||||
@param input element - the input field attached to the date picker or
|
||||
event - if triggered by focus */
|
||||
@ -610,7 +610,7 @@ $.extend(Datepicker.prototype, {
|
||||
$.datepicker._curInst = inst;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Generate the date picker content. */
|
||||
_updateDatepicker: function(inst) {
|
||||
var dims = {width: inst.dpDiv.width() + 4,
|
||||
@ -626,7 +626,7 @@ $.extend(Datepicker.prototype, {
|
||||
if (inst.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
|
||||
$(inst.input[0]).focus();
|
||||
},
|
||||
|
||||
|
||||
/* Check positioning to remain on screen. */
|
||||
_checkOffset: function(inst, offset, isFixed) {
|
||||
var pos = inst.input ? this._findPos(inst.input[0]) : null;
|
||||
@ -652,7 +652,7 @@ $.extend(Datepicker.prototype, {
|
||||
offset.top -= (isFixed ? scrollY : 0);
|
||||
return offset;
|
||||
},
|
||||
|
||||
|
||||
/* Find an object's position on the screen. */
|
||||
_findPos: function(obj) {
|
||||
while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
|
||||
@ -661,7 +661,7 @@ $.extend(Datepicker.prototype, {
|
||||
var position = $(obj).offset();
|
||||
return [position.left, position.top];
|
||||
},
|
||||
|
||||
|
||||
/* Hide the date picker from view.
|
||||
@param input element - the input field attached to the date picker
|
||||
@param duration string - the duration over which to close the date picker */
|
||||
@ -706,13 +706,13 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
this._curInst = null;
|
||||
},
|
||||
|
||||
|
||||
/* Tidy up after a dialog display. */
|
||||
_tidyDialog: function(inst) {
|
||||
inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker');
|
||||
$('.' + this._promptClass, inst.dpDiv).remove();
|
||||
},
|
||||
|
||||
|
||||
/* Close date picker if clicked elsewhere. */
|
||||
_checkExternalClick: function(event) {
|
||||
if (!$.datepicker._curInst)
|
||||
@ -724,7 +724,7 @@ $.extend(Datepicker.prototype, {
|
||||
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
|
||||
$.datepicker._hideDatepicker(null, '');
|
||||
},
|
||||
|
||||
|
||||
/* Adjust one of the date sub-fields. */
|
||||
_adjustDate: function(id, offset, period) {
|
||||
var target = $(id);
|
||||
@ -732,7 +732,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._adjustInstDate(inst, offset, period);
|
||||
this._updateDatepicker(inst);
|
||||
},
|
||||
|
||||
|
||||
/* Action for current link. */
|
||||
_gotoToday: function(id) {
|
||||
var target = $(id);
|
||||
@ -751,7 +751,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._notifyChange(inst);
|
||||
this._adjustDate(target);
|
||||
},
|
||||
|
||||
|
||||
/* Action for selecting a new month/year. */
|
||||
_selectMonthYear: function(id, select, period) {
|
||||
var target = $(id);
|
||||
@ -763,7 +763,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._notifyChange(inst);
|
||||
this._adjustDate(target);
|
||||
},
|
||||
|
||||
|
||||
/* Restore input focus after not changing month/year. */
|
||||
_clickMonthYear: function(id) {
|
||||
var target = $(id);
|
||||
@ -772,7 +772,7 @@ $.extend(Datepicker.prototype, {
|
||||
inst.input[0].focus();
|
||||
inst._selectingMonthYear = !inst._selectingMonthYear;
|
||||
},
|
||||
|
||||
|
||||
/* Action for changing the first week day. */
|
||||
_changeFirstDay: function(id, day) {
|
||||
var target = $(id);
|
||||
@ -780,7 +780,7 @@ $.extend(Datepicker.prototype, {
|
||||
inst.settings.firstDay = day;
|
||||
this._updateDatepicker(inst);
|
||||
},
|
||||
|
||||
|
||||
/* Action for selecting a day. */
|
||||
_selectDay: function(id, month, year, td) {
|
||||
if ($(td).hasClass(this._unselectableClass))
|
||||
@ -822,7 +822,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._updateDatepicker(inst);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Erase the input field and hide the date picker. */
|
||||
_clearDate: function(id) {
|
||||
var target = $(id);
|
||||
@ -833,7 +833,7 @@ $.extend(Datepicker.prototype, {
|
||||
inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
|
||||
this._selectDate(target, '');
|
||||
},
|
||||
|
||||
|
||||
/* Update the input field with the selected date. */
|
||||
_selectDate: function(id, dateStr) {
|
||||
var target = $(id);
|
||||
@ -860,7 +860,7 @@ $.extend(Datepicker.prototype, {
|
||||
this._lastInput = null;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Update any alternate field to synchronise with the main field. */
|
||||
_updateAlternate: function(inst) {
|
||||
var altField = this._get(inst, 'altField');
|
||||
@ -875,7 +875,7 @@ $.extend(Datepicker.prototype, {
|
||||
$(altField).each(function() { $(this).val(dateStr); });
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/* Set as beforeShowDay function to prevent selection of weekends.
|
||||
@param date Date - the date to customise
|
||||
@return [boolean, string] - is this date selectable?, what is its CSS class? */
|
||||
@ -883,7 +883,7 @@ $.extend(Datepicker.prototype, {
|
||||
var day = date.getDay();
|
||||
return [(day > 0 && day < 6), ''];
|
||||
},
|
||||
|
||||
|
||||
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
|
||||
@param date Date - the date to get the week for
|
||||
@return number - the number of the week within the year that contains this date */
|
||||
@ -903,7 +903,7 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date
|
||||
},
|
||||
|
||||
|
||||
/* Provide status text for a particular date.
|
||||
@param date the date to get the status for
|
||||
@param inst the current datepicker instance
|
||||
@ -912,7 +912,7 @@ $.extend(Datepicker.prototype, {
|
||||
return $.datepicker.formatDate($.datepicker._get(inst, 'dateStatus'),
|
||||
date, $.datepicker._getFormatConfig(inst));
|
||||
},
|
||||
|
||||
|
||||
/* Parse a string value into a date object.
|
||||
See formatDate below for the possible formats.
|
||||
|
||||
@ -946,7 +946,7 @@ $.extend(Datepicker.prototype, {
|
||||
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
||||
if (matches)
|
||||
iFormat++;
|
||||
return matches;
|
||||
return matches;
|
||||
};
|
||||
// Extract a number from the string value
|
||||
var getNumber = function(match) {
|
||||
@ -1050,7 +1050,7 @@ $.extend(Datepicker.prototype, {
|
||||
throw 'Invalid date'; // E.g. 31/02/*
|
||||
return date;
|
||||
},
|
||||
|
||||
|
||||
/* Standard date formats. */
|
||||
ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
|
||||
COOKIE: 'D, dd M yy',
|
||||
@ -1063,7 +1063,7 @@ $.extend(Datepicker.prototype, {
|
||||
RSS: 'D, d M y', // RFC 822
|
||||
TIMESTAMP: '@',
|
||||
W3C: 'yy-mm-dd', // ISO 8601
|
||||
|
||||
|
||||
/* Format a date object into a string value.
|
||||
The format can be combinations of the following:
|
||||
d - day of month (no leading zero)
|
||||
@ -1081,7 +1081,7 @@ $.extend(Datepicker.prototype, {
|
||||
@ - Unix timestamp (ms since 01/01/1970)
|
||||
'...' - literal text
|
||||
'' - single quote
|
||||
|
||||
|
||||
@param format string - the desired format of the date
|
||||
@param date Date - the date value to format
|
||||
@param settings Object - attributes include:
|
||||
@ -1102,7 +1102,7 @@ $.extend(Datepicker.prototype, {
|
||||
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
||||
if (matches)
|
||||
iFormat++;
|
||||
return matches;
|
||||
return matches;
|
||||
};
|
||||
// Format a number, with leading zero if necessary
|
||||
var formatNumber = function(match, value, len) {
|
||||
@ -1164,7 +1164,7 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
return output;
|
||||
},
|
||||
|
||||
|
||||
/* Extract all possible characters from the date format. */
|
||||
_possibleChars: function (format) {
|
||||
var chars = '';
|
||||
@ -1193,13 +1193,13 @@ $.extend(Datepicker.prototype, {
|
||||
}
|
||||
return chars;
|
||||
},
|
||||
|
||||
|
||||
/* Get a setting value, defaulting if necessary. */
|
||||
_get: function(inst, name) {
|
||||
return inst.settings[name] !== undefined ?
|
||||
inst.settings[name] : this._defaults[name];
|
||||
},
|
||||
|
||||
|
||||
/* Parse existing date and initialise date picker. */
|
||||
_setDateFromField: function(inst) {
|
||||
var dateFormat = this._get(inst, 'dateFormat');
|
||||
@ -1229,7 +1229,7 @@ $.extend(Datepicker.prototype, {
|
||||
inst.currentYear = (dates[0] ? date.getFullYear() : 0);
|
||||
this._adjustInstDate(inst);
|
||||
},
|
||||
|
||||
|
||||
/* Retrieve the default date shown on opening. */
|
||||
_getDefaultDate: function(inst) {
|
||||
var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
|
||||
@ -1239,7 +1239,7 @@ $.extend(Datepicker.prototype, {
|
||||
date = (maxDate && date > maxDate ? maxDate : date);
|
||||
return date;
|
||||
},
|
||||
|
||||
|
||||
/* A date may be specified as an exact value or a relative one. */
|
||||
_determineDate: function(date, defaultDate) {
|
||||
var offsetNumeric = function(offset) {
|
||||
@ -1327,7 +1327,7 @@ $.extend(Datepicker.prototype, {
|
||||
(!this._get(inst, 'rangeSelect') ? '' : this._get(inst, 'rangeSeparator') +
|
||||
this._formatDate(inst, inst.endDay, inst.endMonth, inst.endYear)));
|
||||
},
|
||||
|
||||
|
||||
/* Retrieve the date(s) directly. */
|
||||
_getDate: function(inst) {
|
||||
var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
|
||||
@ -1340,7 +1340,7 @@ $.extend(Datepicker.prototype, {
|
||||
} else
|
||||
return startDate;
|
||||
},
|
||||
|
||||
|
||||
/* Generate the HTML for the current state of the date picker. */
|
||||
_generateHTML: function(inst) {
|
||||
var today = new Date();
|
||||
@ -1535,7 +1535,7 @@ $.extend(Datepicker.prototype, {
|
||||
inst._keyEvent = false;
|
||||
return html;
|
||||
},
|
||||
|
||||
|
||||
/* Generate the month and year header. */
|
||||
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
|
||||
selectedDate, secondary, showStatus, initStatus, monthNames) {
|
||||
@ -1603,7 +1603,7 @@ $.extend(Datepicker.prototype, {
|
||||
html += '</div>'; // Close datepicker_header
|
||||
return html;
|
||||
},
|
||||
|
||||
|
||||
/* Provide code to set and clear the status panel. */
|
||||
_addStatus: function(showStatus, id, text, initStatus) {
|
||||
return (showStatus ? ' onmouseover="jQuery(\'#ui-datepicker-status-' + id +
|
||||
@ -1611,7 +1611,7 @@ $.extend(Datepicker.prototype, {
|
||||
'onmouseout="jQuery(\'#ui-datepicker-status-' + id +
|
||||
'\').html(\'' + initStatus + '\');"' : '');
|
||||
},
|
||||
|
||||
|
||||
/* Adjust one of the date sub-fields. */
|
||||
_adjustInstDate: function(inst, offset, period) {
|
||||
var year = inst.drawYear + (period == 'Y' ? offset : 0);
|
||||
@ -1630,7 +1630,7 @@ $.extend(Datepicker.prototype, {
|
||||
if (period == 'M' || period == 'Y')
|
||||
this._notifyChange(inst);
|
||||
},
|
||||
|
||||
|
||||
/* Notify change of month/year. */
|
||||
_notifyChange: function(inst) {
|
||||
var onChange = this._get(inst, 'onChangeMonthYear');
|
||||
@ -1638,30 +1638,30 @@ $.extend(Datepicker.prototype, {
|
||||
onChange.apply((inst.input ? inst.input[0] : null),
|
||||
[inst.selectedYear, inst.selectedMonth + 1, inst]);
|
||||
},
|
||||
|
||||
|
||||
/* Determine the number of months to show. */
|
||||
_getNumberOfMonths: function(inst) {
|
||||
var numMonths = this._get(inst, 'numberOfMonths');
|
||||
return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
|
||||
},
|
||||
|
||||
|
||||
/* Determine the current maximum date - ensure no time components are set - may be overridden for a range. */
|
||||
_getMinMaxDate: function(inst, minMax, checkRange) {
|
||||
var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
|
||||
return (!checkRange || !inst.rangeStart ? date :
|
||||
(!date || inst.rangeStart > date ? inst.rangeStart : date));
|
||||
},
|
||||
|
||||
|
||||
/* Find the number of days in a given month. */
|
||||
_getDaysInMonth: function(year, month) {
|
||||
return 32 - new Date(year, month, 32).getDate();
|
||||
},
|
||||
|
||||
|
||||
/* Find the day of the week of the first of a month. */
|
||||
_getFirstDayOfMonth: function(year, month) {
|
||||
return new Date(year, month, 1).getDay();
|
||||
},
|
||||
|
||||
|
||||
/* Determines if we should allow a "next/prev" month display change. */
|
||||
_canAdjustMonth: function(inst, offset, curYear, curMonth) {
|
||||
var numMonths = this._getNumberOfMonths(inst);
|
||||
@ -1671,7 +1671,7 @@ $.extend(Datepicker.prototype, {
|
||||
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
|
||||
return this._isInRange(inst, date);
|
||||
},
|
||||
|
||||
|
||||
/* Is the given date in the accepted range? */
|
||||
_isInRange: function(inst, date) {
|
||||
// during range selection, use minimum of selected date and range start
|
||||
@ -1682,7 +1682,7 @@ $.extend(Datepicker.prototype, {
|
||||
var maxDate = this._getMinMaxDate(inst, 'max');
|
||||
return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
|
||||
},
|
||||
|
||||
|
||||
/* Provide the configuration settings for formatting/parsing. */
|
||||
_getFormatConfig: function(inst) {
|
||||
var shortYearCutoff = this._get(inst, 'shortYearCutoff');
|
||||
@ -1692,7 +1692,7 @@ $.extend(Datepicker.prototype, {
|
||||
dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
|
||||
monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
|
||||
},
|
||||
|
||||
|
||||
/* Format the given date for display. */
|
||||
_formatDate: function(inst, day, month, year) {
|
||||
if (!day) {
|
||||
@ -1727,14 +1727,14 @@ function isArray(a) {
|
||||
Object - settings for attaching new datepicker functionality
|
||||
@return jQuery object */
|
||||
$.fn.datepicker = function(options){
|
||||
|
||||
|
||||
/* Initialise the date picker. */
|
||||
if (!$.datepicker.initialized) {
|
||||
$(document.body).append($.datepicker.dpDiv).
|
||||
mousedown($.datepicker._checkExternalClick);
|
||||
$.datepicker.initialized = true;
|
||||
}
|
||||
|
||||
|
||||
var otherArgs = Array.prototype.slice.call(arguments, 1);
|
||||
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
|
||||
return $.datepicker['_' + options + 'Datepicker'].
|
||||
|
126
ui/ui.dialog.js
126
ui/ui.dialog.js
@ -31,16 +31,16 @@ $.widget("ui.dialog", {
|
||||
_init: function() {
|
||||
this.originalTitle = this.element.attr('title');
|
||||
this.options.title = this.options.title || this.originalTitle;
|
||||
|
||||
|
||||
var self = this,
|
||||
options = this.options,
|
||||
|
||||
|
||||
uiDialogContent = this.element
|
||||
.removeAttr('title')
|
||||
.addClass('ui-dialog-content')
|
||||
.wrap('<div/>')
|
||||
.wrap('<div/>'),
|
||||
|
||||
|
||||
uiDialogContainer = (this.uiDialogContainer = uiDialogContent.parent())
|
||||
.addClass('ui-dialog-container')
|
||||
.css({
|
||||
@ -48,7 +48,7 @@ $.widget("ui.dialog", {
|
||||
width: '100%',
|
||||
height: '100%'
|
||||
}),
|
||||
|
||||
|
||||
uiDialogTitlebar = (this.uiDialogTitlebar = $('<div/>'))
|
||||
.addClass('ui-dialog-titlebar')
|
||||
.append('<a href="#" class="ui-dialog-titlebar-close"><span>X</span></a>')
|
||||
@ -56,7 +56,7 @@ $.widget("ui.dialog", {
|
||||
self.moveToTop();
|
||||
})
|
||||
.prependTo(uiDialogContainer),
|
||||
|
||||
|
||||
title = options.title || ' ',
|
||||
titleId = $.ui.dialog.getTitleId(this.element),
|
||||
uiDialogTitle = $('<span/>')
|
||||
@ -64,7 +64,7 @@ $.widget("ui.dialog", {
|
||||
.attr('id', titleId)
|
||||
.html(title)
|
||||
.prependTo(uiDialogTitlebar),
|
||||
|
||||
|
||||
uiDialog = (this.uiDialog = uiDialogContainer.parent())
|
||||
.appendTo(document.body)
|
||||
.hide()
|
||||
@ -90,7 +90,7 @@ $.widget("ui.dialog", {
|
||||
.mouseup(function() {
|
||||
self.moveToTop();
|
||||
}),
|
||||
|
||||
|
||||
uiDialogButtonPane = (this.uiDialogButtonPane = $('<div/>'))
|
||||
.addClass('ui-dialog-buttonpane')
|
||||
.css({
|
||||
@ -98,7 +98,7 @@ $.widget("ui.dialog", {
|
||||
bottom: 0
|
||||
})
|
||||
.appendTo(uiDialog),
|
||||
|
||||
|
||||
uiDialogTitlebarClose = $('.ui-dialog-titlebar-close', uiDialogTitlebar)
|
||||
.hover(
|
||||
function() {
|
||||
@ -115,19 +115,19 @@ $.widget("ui.dialog", {
|
||||
self.close();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection();
|
||||
|
||||
|
||||
(options.draggable && $.fn.draggable && this._makeDraggable());
|
||||
(options.resizable && $.fn.resizable && this._makeResizable());
|
||||
|
||||
|
||||
this._createButtons(options.buttons);
|
||||
this._isOpen = false;
|
||||
|
||||
|
||||
(options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
|
||||
(options.autoOpen && this.open());
|
||||
},
|
||||
|
||||
|
||||
destroy: function() {
|
||||
(this.overlay && this.overlay.destroy());
|
||||
this.uiDialog.hide();
|
||||
@ -137,45 +137,45 @@ $.widget("ui.dialog", {
|
||||
.removeClass('ui-dialog-content')
|
||||
.hide().appendTo('body');
|
||||
this.uiDialog.remove();
|
||||
|
||||
|
||||
(this.originalTitle && this.element.attr('title', this.originalTitle));
|
||||
},
|
||||
|
||||
|
||||
close: function() {
|
||||
if (false === this._trigger('beforeclose', null, { options: this.options })) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
(this.overlay && this.overlay.destroy());
|
||||
this.uiDialog
|
||||
.hide(this.options.hide)
|
||||
.unbind('keypress.ui-dialog');
|
||||
|
||||
|
||||
this._trigger('close', null, { options: this.options });
|
||||
$.ui.dialog.overlay.resize();
|
||||
|
||||
|
||||
this._isOpen = false;
|
||||
},
|
||||
|
||||
|
||||
isOpen: function() {
|
||||
return this._isOpen;
|
||||
},
|
||||
|
||||
|
||||
// the force parameter allows us to move modal dialogs to their correct
|
||||
// position on open
|
||||
moveToTop: function(force) {
|
||||
|
||||
|
||||
if ((this.options.modal && !force)
|
||||
|| (!this.options.stack && !this.options.modal)) {
|
||||
return this._trigger('focus', null, { options: this.options });
|
||||
}
|
||||
|
||||
|
||||
var maxZ = this.options.zIndex, options = this.options;
|
||||
$('.ui-dialog:visible').each(function() {
|
||||
maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex);
|
||||
});
|
||||
(this.overlay && this.overlay.$el.css('z-index', ++maxZ));
|
||||
|
||||
|
||||
//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.
|
||||
// http://ui.jquery.com/bugs/ticket/3193
|
||||
var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') };
|
||||
@ -183,27 +183,27 @@ $.widget("ui.dialog", {
|
||||
this.element.attr(saveScroll);
|
||||
this._trigger('focus', null, { options: this.options });
|
||||
},
|
||||
|
||||
|
||||
open: function() {
|
||||
if (this._isOpen) { return; }
|
||||
|
||||
|
||||
this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;
|
||||
(this.uiDialog.next().length && this.uiDialog.appendTo('body'));
|
||||
this._position(this.options.position);
|
||||
this.uiDialog.show(this.options.show);
|
||||
(this.options.autoResize && this._size());
|
||||
this.moveToTop(true);
|
||||
|
||||
|
||||
// prevent tabbing out of modal dialogs
|
||||
(this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(event) {
|
||||
if (event.keyCode != $.keyCode.TAB) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var tabbables = $(':tabbable', this),
|
||||
first = tabbables.filter(':first')[0],
|
||||
last = tabbables.filter(':last')[0];
|
||||
|
||||
|
||||
if (event.target == last && !event.shiftKey) {
|
||||
setTimeout(function() {
|
||||
first.focus();
|
||||
@ -214,20 +214,20 @@ $.widget("ui.dialog", {
|
||||
}, 1);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
this.uiDialog.find(':tabbable:first').focus();
|
||||
this._trigger('open', null, { options: this.options });
|
||||
this._isOpen = true;
|
||||
},
|
||||
|
||||
|
||||
_createButtons: function(buttons) {
|
||||
var self = this,
|
||||
hasButtons = false,
|
||||
uiDialogButtonPane = this.uiDialogButtonPane;
|
||||
|
||||
|
||||
// remove any existing buttons
|
||||
uiDialogButtonPane.empty().hide();
|
||||
|
||||
|
||||
$.each(buttons, function() { return !(hasButtons = true); });
|
||||
if (hasButtons) {
|
||||
uiDialogButtonPane.show();
|
||||
@ -239,11 +239,11 @@ $.widget("ui.dialog", {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_makeDraggable: function() {
|
||||
var self = this,
|
||||
options = this.options;
|
||||
|
||||
|
||||
this.uiDialog.draggable({
|
||||
cancel: '.ui-dialog-content',
|
||||
helper: options.dragHelper,
|
||||
@ -261,7 +261,7 @@ $.widget("ui.dialog", {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
_makeResizable: function(handles) {
|
||||
handles = (handles === undefined ? this.options.resizable : handles);
|
||||
var self = this,
|
||||
@ -269,7 +269,7 @@ $.widget("ui.dialog", {
|
||||
resizeHandles = typeof handles == 'string'
|
||||
? handles
|
||||
: 'n,e,s,w,se,sw,ne,nw';
|
||||
|
||||
|
||||
this.uiDialog.resizable({
|
||||
cancel: '.ui-dialog-content',
|
||||
helper: options.resizeHelper,
|
||||
@ -292,12 +292,12 @@ $.widget("ui.dialog", {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
_position: function(pos) {
|
||||
var wnd = $(window), doc = $(document),
|
||||
pTop = doc.scrollTop(), pLeft = doc.scrollLeft(),
|
||||
minTop = pTop;
|
||||
|
||||
|
||||
if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) {
|
||||
pos = [
|
||||
pos == 'right' || pos == 'left' ? pos : 'center',
|
||||
@ -337,13 +337,13 @@ $.widget("ui.dialog", {
|
||||
pTop += (wnd.height() - this.uiDialog.height()) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// prevent the dialog from being too high (make sure the titlebar
|
||||
// is accessible)
|
||||
pTop = Math.max(pTop, minTop);
|
||||
this.uiDialog.css({top: pTop, left: pLeft});
|
||||
},
|
||||
|
||||
|
||||
_setData: function(key, value){
|
||||
(setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value));
|
||||
switch (key) {
|
||||
@ -364,17 +364,17 @@ $.widget("ui.dialog", {
|
||||
case "resizable":
|
||||
var uiDialog = this.uiDialog,
|
||||
isResizable = this.uiDialog.is(':data(resizable)');
|
||||
|
||||
|
||||
// currently resizable, becoming non-resizable
|
||||
(isResizable && !value && uiDialog.resizable('destroy'));
|
||||
|
||||
|
||||
// currently resizable, changing handles
|
||||
(isResizable && typeof value == 'string' &&
|
||||
uiDialog.resizable('option', 'handles', value));
|
||||
|
||||
|
||||
// currently non-resizable, becoming resizable
|
||||
(isResizable || this._makeResizable(value));
|
||||
|
||||
|
||||
break;
|
||||
case "title":
|
||||
$(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' ');
|
||||
@ -383,10 +383,10 @@ $.widget("ui.dialog", {
|
||||
this.uiDialog.width(value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$.widget.prototype._setData.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
_size: function() {
|
||||
var container = this.uiDialogContainer,
|
||||
titlebar = this.uiDialogTitlebar,
|
||||
@ -420,14 +420,14 @@ $.extend($.ui.dialog, {
|
||||
width: 300,
|
||||
zIndex: 1000
|
||||
},
|
||||
|
||||
|
||||
getter: 'isOpen',
|
||||
|
||||
|
||||
uuid: 0,
|
||||
getTitleId: function($el) {
|
||||
return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid);
|
||||
},
|
||||
|
||||
|
||||
overlay: function(dialog) {
|
||||
this.$el = $.ui.dialog.overlay.create(dialog);
|
||||
}
|
||||
@ -464,17 +464,17 @@ $.extend($.ui.dialog.overlay, {
|
||||
return allow;
|
||||
});
|
||||
}, 1);
|
||||
|
||||
|
||||
// allow closing by pressing the escape key
|
||||
$(document).bind('keydown.dialog-overlay', function(event) {
|
||||
(dialog.options.closeOnEscape && event.keyCode
|
||||
&& event.keyCode == $.keyCode.ESCAPE && dialog.close());
|
||||
});
|
||||
|
||||
|
||||
// handle window resize
|
||||
$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
|
||||
}
|
||||
|
||||
|
||||
var $el = $('<div/>').appendTo(document.body)
|
||||
.addClass('ui-dialog-overlay').css($.extend({
|
||||
borderWidth: 0, margin: 0, padding: 0,
|
||||
@ -482,23 +482,23 @@ $.extend($.ui.dialog.overlay, {
|
||||
width: this.width(),
|
||||
height: this.height()
|
||||
}, dialog.options.overlay));
|
||||
|
||||
|
||||
(dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe());
|
||||
|
||||
|
||||
this.instances.push($el);
|
||||
return $el;
|
||||
},
|
||||
|
||||
|
||||
destroy: function($el) {
|
||||
this.instances.splice($.inArray(this.instances, $el), 1);
|
||||
|
||||
|
||||
if (this.instances.length === 0) {
|
||||
$('a, :input').add([document, window]).unbind('.dialog-overlay');
|
||||
}
|
||||
|
||||
|
||||
$el.remove();
|
||||
},
|
||||
|
||||
|
||||
height: function() {
|
||||
// handle IE 6
|
||||
if ($.browser.msie && $.browser.version < 7) {
|
||||
@ -510,7 +510,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
document.documentElement.offsetHeight,
|
||||
document.body.offsetHeight
|
||||
);
|
||||
|
||||
|
||||
if (scrollHeight < offsetHeight) {
|
||||
return $(window).height() + 'px';
|
||||
} else {
|
||||
@ -527,7 +527,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
return $(document).height() + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
width: function() {
|
||||
// handle IE 6
|
||||
if ($.browser.msie && $.browser.version < 7) {
|
||||
@ -539,7 +539,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
document.documentElement.offsetWidth,
|
||||
document.body.offsetWidth
|
||||
);
|
||||
|
||||
|
||||
if (scrollWidth < offsetWidth) {
|
||||
return $(window).width() + 'px';
|
||||
} else {
|
||||
@ -556,7 +556,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
return $(document).width() + 'px';
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
resize: function() {
|
||||
/* If the dialog is draggable and the user drags it past the
|
||||
* right edge of the window, the document becomes wider so we
|
||||
@ -570,7 +570,7 @@ $.extend($.ui.dialog.overlay, {
|
||||
$.each($.ui.dialog.overlay.instances, function() {
|
||||
$overlays = $overlays.add(this);
|
||||
});
|
||||
|
||||
|
||||
$overlays.css({
|
||||
width: 0,
|
||||
height: 0
|
||||
|
@ -14,9 +14,9 @@
|
||||
(function($) {
|
||||
|
||||
$.widget("ui.droppable", {
|
||||
|
||||
|
||||
_setData: function(key, value) {
|
||||
|
||||
|
||||
if(key == 'accept') {
|
||||
this.options.accept = value && $.isFunction(value) ? value : function(d) {
|
||||
return d.is(accept);
|
||||
@ -24,27 +24,27 @@ $.widget("ui.droppable", {
|
||||
} else {
|
||||
$.widget.prototype._setData.apply(this, arguments);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_init: function() {
|
||||
|
||||
|
||||
var o = this.options, accept = o.accept;
|
||||
this.isover = 0; this.isout = 1;
|
||||
|
||||
|
||||
this.options.accept = this.options.accept && $.isFunction(this.options.accept) ? this.options.accept : function(d) {
|
||||
return d.is(accept);
|
||||
};
|
||||
|
||||
|
||||
//Store the droppable's proportions
|
||||
this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
|
||||
|
||||
|
||||
// Add the reference and positions to the manager
|
||||
$.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
|
||||
$.ui.ddmanager.droppables[this.options.scope].push(this);
|
||||
|
||||
|
||||
(this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable"));
|
||||
|
||||
|
||||
},
|
||||
plugins: {},
|
||||
ui: function(c) {
|
||||
@ -62,39 +62,39 @@ $.widget("ui.droppable", {
|
||||
for ( var i = 0; i < drop.length; i++ )
|
||||
if ( drop[i] == this )
|
||||
drop.splice(i, 1);
|
||||
|
||||
|
||||
this.element
|
||||
.removeClass("ui-droppable-disabled")
|
||||
.removeData("droppable")
|
||||
.unbind(".droppable");
|
||||
},
|
||||
_over: function(event) {
|
||||
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
||||
|
||||
|
||||
if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
$.ui.plugin.call(this, 'over', [event, this.ui(draggable)]);
|
||||
this.element.triggerHandler("dropover", [event, this.ui(draggable)], this.options.over);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
_out: function(event) {
|
||||
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
|
||||
|
||||
|
||||
if (this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
$.ui.plugin.call(this, 'out', [event, this.ui(draggable)]);
|
||||
this.element.triggerHandler("dropout", [event, this.ui(draggable)], this.options.out);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
_drop: function(event,custom) {
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
var childrenIntersection = false;
|
||||
this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
|
||||
var inst = $.data(this, 'droppable');
|
||||
@ -103,29 +103,29 @@ $.widget("ui.droppable", {
|
||||
}
|
||||
});
|
||||
if(childrenIntersection) return false;
|
||||
|
||||
|
||||
if(this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
$.ui.plugin.call(this, 'drop', [event, this.ui(draggable)]);
|
||||
this.element.triggerHandler("drop", [event, this.ui(draggable)], this.options.drop);
|
||||
return this.element;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
},
|
||||
_activate: function(event) {
|
||||
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
$.ui.plugin.call(this, 'activate', [event, this.ui(draggable)]);
|
||||
if(draggable) this.element.triggerHandler("dropactivate", [event, this.ui(draggable)], this.options.activate);
|
||||
|
||||
|
||||
},
|
||||
_deactivate: function(event) {
|
||||
|
||||
|
||||
var draggable = $.ui.ddmanager.current;
|
||||
$.ui.plugin.call(this, 'deactivate', [event, this.ui(draggable)]);
|
||||
if(draggable) this.element.triggerHandler("dropdeactivate", [event, this.ui(draggable)], this.options.deactivate);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -143,14 +143,14 @@ $.extend($.ui.droppable, {
|
||||
});
|
||||
|
||||
$.ui.intersect = function(draggable, droppable, toleranceMode) {
|
||||
|
||||
|
||||
if (!droppable.offset) return false;
|
||||
|
||||
|
||||
var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
|
||||
y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
|
||||
var l = droppable.offset.left, r = l + droppable.proportions.width,
|
||||
t = droppable.offset.top, b = t + droppable.proportions.height;
|
||||
|
||||
|
||||
switch (toleranceMode) {
|
||||
case 'fit':
|
||||
return (l < x1 && x2 < r
|
||||
@ -183,7 +183,7 @@ $.ui.intersect = function(draggable, droppable, toleranceMode) {
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
@ -193,58 +193,58 @@ $.ui.ddmanager = {
|
||||
current: null,
|
||||
droppables: { 'default': [] },
|
||||
prepareOffsets: function(t, event) {
|
||||
|
||||
|
||||
var m = $.ui.ddmanager.droppables[t.options.scope];
|
||||
var type = event ? event.type : null; // workaround for #2317
|
||||
var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
|
||||
|
||||
|
||||
droppablesLoop: for (var i = 0; i < m.length; i++) {
|
||||
|
||||
|
||||
if(m[i].options.disabled || (t && !m[i].options.accept.call(m[i].element,(t.currentItem || t.element)))) continue; //No disabled and non-accepted
|
||||
for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
|
||||
m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue; //If the element is not visible, continue
|
||||
|
||||
|
||||
m[i].offset = m[i].element.offset();
|
||||
m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
|
||||
|
||||
|
||||
if(type == "dragstart" || type == "sortactivate") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
drop: function(draggable, event) {
|
||||
|
||||
|
||||
var dropped = false;
|
||||
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
|
||||
|
||||
|
||||
if(!this.options) return;
|
||||
if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
|
||||
dropped = this._drop.call(this, event);
|
||||
|
||||
|
||||
if (!this.options.disabled && this.visible && this.options.accept.call(this.element,(draggable.currentItem || draggable.element))) {
|
||||
this.isout = 1; this.isover = 0;
|
||||
this._deactivate.call(this, event);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
return dropped;
|
||||
|
||||
|
||||
},
|
||||
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(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
|
||||
|
||||
|
||||
//Run through all droppables and check their positions based on specific tolerance options
|
||||
|
||||
|
||||
$.each($.ui.ddmanager.droppables[draggable.options.scope], function() {
|
||||
|
||||
|
||||
if(this.options.disabled || this.greedyChild || !this.visible) return;
|
||||
var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
|
||||
|
||||
|
||||
var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
|
||||
if(!c) return;
|
||||
|
||||
|
||||
var parentInstance;
|
||||
if (this.options.greedy) {
|
||||
var parent = this.element.parents(':data(droppable):eq(0)');
|
||||
@ -253,17 +253,17 @@ $.ui.ddmanager = {
|
||||
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we just moved into a greedy child
|
||||
if (parentInstance && c == 'isover') {
|
||||
parentInstance['isover'] = 0;
|
||||
parentInstance['isout'] = 1;
|
||||
parentInstance._out.call(parentInstance, event);
|
||||
}
|
||||
|
||||
|
||||
this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
|
||||
this[c == "isover" ? "_over" : "_out"].call(this, event);
|
||||
|
||||
|
||||
// we just moved out of a greedy child
|
||||
if (parentInstance && c == 'isout') {
|
||||
parentInstance['isout'] = 0;
|
||||
@ -271,7 +271,7 @@ $.ui.ddmanager = {
|
||||
parentInstance._over.call(parentInstance, event);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -14,14 +14,14 @@
|
||||
|
||||
$.widget("ui.progressbar", {
|
||||
_init: function() {
|
||||
|
||||
|
||||
this._interval = this.options.interval;
|
||||
|
||||
|
||||
var self = this,
|
||||
options = this.options,
|
||||
identifier = 'progressbar' + (++$.ui.progressbar.uuid),
|
||||
text = options.text || '0%';
|
||||
|
||||
|
||||
this.element
|
||||
.addClass("ui-progressbar")
|
||||
.width(options.width)
|
||||
@ -31,17 +31,17 @@ $.widget("ui.progressbar", {
|
||||
"aria-valuemax": 100,
|
||||
"aria-valuenow": 0
|
||||
});
|
||||
|
||||
|
||||
$.extend(this, {
|
||||
active: false,
|
||||
pixelState: 0,
|
||||
percentState: 0,
|
||||
identifier: identifier
|
||||
});
|
||||
|
||||
|
||||
this.wrapper = $('<div class="ui-progressbar-wrap"></div>')
|
||||
.appendTo(this.element);
|
||||
|
||||
|
||||
this.bar = $('<div class="ui-progressbar-bar ui-hidden"></div>')
|
||||
.css({
|
||||
width: 0,
|
||||
@ -49,7 +49,7 @@ $.widget("ui.progressbar", {
|
||||
zIndex: 100
|
||||
})
|
||||
.appendTo(this.wrapper);
|
||||
|
||||
|
||||
this.textElement = $('<div class="ui-progressbar-text"></div>')
|
||||
.html(text)
|
||||
.css({
|
||||
@ -57,7 +57,7 @@ $.widget("ui.progressbar", {
|
||||
overflow: 'hidden'
|
||||
})
|
||||
.appendTo(this.bar);
|
||||
|
||||
|
||||
this.textBg = $('<div class="ui-progressbar-text ui-progressbar-text-back"></div>')
|
||||
.html(text)
|
||||
.css({
|
||||
@ -70,7 +70,7 @@ $.widget("ui.progressbar", {
|
||||
var self = this,
|
||||
options = this.options,
|
||||
interval = options.interval;
|
||||
|
||||
|
||||
this.bar.animate(
|
||||
{
|
||||
width: options.width
|
||||
@ -97,15 +97,15 @@ $.widget("ui.progressbar", {
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
destroy: function() {
|
||||
this.stop();
|
||||
|
||||
|
||||
this.element
|
||||
.removeClass("ui-progressbar ui-progressbar-disabled")
|
||||
.removeData("progressbar").unbind(".progressbar")
|
||||
.find('.ui-progressbar-wrap').remove();
|
||||
|
||||
|
||||
delete $.easing[this.identifier];
|
||||
},
|
||||
|
||||
@ -114,27 +114,27 @@ $.widget("ui.progressbar", {
|
||||
this.disabled = true;
|
||||
this.element.attr("aria-disabled", true);
|
||||
},
|
||||
|
||||
|
||||
enable: function() {
|
||||
this.element.removeClass("ui-progressbar-disabled");
|
||||
this.disabled = false;
|
||||
this.element.attr("aria-disabled", false);
|
||||
},
|
||||
|
||||
|
||||
pause: function() {
|
||||
if (this.disabled) return;
|
||||
this.bar.stop();
|
||||
this._trigger('pause', null, this.ui());
|
||||
},
|
||||
|
||||
|
||||
progress: function(percentState) {
|
||||
this.bar.removeClass('ui-hidden');
|
||||
|
||||
|
||||
this.percentState = percentState > 100 ? 100 : percentState;
|
||||
this.pixelState = (this.percentState/100) * this.options.width;
|
||||
this.bar.width(this.pixelState);
|
||||
this.textElement.width(this.pixelState);
|
||||
|
||||
|
||||
var percent = Math.round(this.percentState);
|
||||
if (this.options.range && !this.options.text) {
|
||||
this._setText(percent + '%');
|
||||
@ -142,14 +142,14 @@ $.widget("ui.progressbar", {
|
||||
this.element.attr("aria-valuenow", percent);
|
||||
this._trigger('progress', null, this.ui());
|
||||
},
|
||||
|
||||
|
||||
start: function() {
|
||||
var self = this, options = this.options;
|
||||
|
||||
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$.easing[this.identifier] = function (x, t, b, c, d) {
|
||||
var inc = options.increment,
|
||||
width = options.width,
|
||||
@ -157,26 +157,26 @@ $.widget("ui.progressbar", {
|
||||
state = Math.round(x/step)*step;
|
||||
return state > 1 ? 1 : state;
|
||||
};
|
||||
|
||||
|
||||
self.active = true;
|
||||
|
||||
|
||||
if (options.duration < options.interval) {
|
||||
options.duration = options.interval;
|
||||
}
|
||||
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
self.active = false;
|
||||
},
|
||||
options.duration
|
||||
);
|
||||
|
||||
|
||||
this._animate();
|
||||
|
||||
|
||||
this._trigger('start', null, this.ui());
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
stop: function() {
|
||||
this.bar.stop();
|
||||
this.bar.width(0);
|
||||
@ -185,7 +185,7 @@ $.widget("ui.progressbar", {
|
||||
this.options.interval = this._interval;
|
||||
this._trigger('stop', null, this.ui());
|
||||
},
|
||||
|
||||
|
||||
ui: function() {
|
||||
return {
|
||||
options: this.options,
|
||||
@ -193,17 +193,17 @@ $.widget("ui.progressbar", {
|
||||
percentState: this.percentState
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
_setData: function(key, value){
|
||||
switch (key) {
|
||||
case 'text':
|
||||
this._setText(value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$.widget.prototype._setData.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
_setText: function(text){
|
||||
this.textElement.add(this.textBg).html(text);
|
||||
}
|
||||
@ -219,7 +219,7 @@ $.extend($.ui.progressbar, {
|
||||
range: true,
|
||||
text: ''
|
||||
},
|
||||
|
||||
|
||||
uuid: 0
|
||||
});
|
||||
|
||||
|
@ -14,25 +14,25 @@
|
||||
|
||||
$.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
_init: function() {
|
||||
|
||||
|
||||
var self = this, o = this.options;
|
||||
|
||||
|
||||
var elpos = this.element.css('position');
|
||||
|
||||
|
||||
this.originalElement = this.element;
|
||||
|
||||
|
||||
// simulate .ui-resizable { position: relative; }
|
||||
this.element.addClass("ui-resizable").css({ position: /static/.test(elpos) ? 'relative' : elpos });
|
||||
|
||||
|
||||
$.extend(o, {
|
||||
_aspectRatio: !!(o.aspectRatio),
|
||||
helper: o.helper || o.ghost || o.animate ? o.helper || 'proxy' : null,
|
||||
knobHandles: o.knobHandles === true ? 'ui-resizable-knob-handle' : o.knobHandles
|
||||
});
|
||||
|
||||
|
||||
//Default Theme
|
||||
var aBorder = '1px solid #DEDEDE';
|
||||
|
||||
|
||||
o.defaultTheme = {
|
||||
'ui-resizable': { display: 'block' },
|
||||
'ui-resizable-handle': { position: 'absolute', background: '#F2F2F2', fontSize: '0.1px' },
|
||||
@ -45,7 +45,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
'ui-resizable-ne': { cursor: 'ne-resize', width: '4px', height: '4px', borderRight: aBorder, borderTop: aBorder },
|
||||
'ui-resizable-nw': { cursor: 'nw-resize', width: '4px', height: '4px', borderLeft: aBorder, borderTop: aBorder }
|
||||
};
|
||||
|
||||
|
||||
o.knobTheme = {
|
||||
'ui-resizable-handle': { background: '#F2F2F2', border: '1px solid #808080', height: '8px', width: '8px' },
|
||||
'ui-resizable-n': { cursor: 'n-resize', top: '0px', left: '45%' },
|
||||
@ -57,17 +57,17 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
'ui-resizable-nw': { cursor: 'nw-resize', left: '0px', top: '0px' },
|
||||
'ui-resizable-ne': { cursor: 'ne-resize', right: '0px', top: '0px' }
|
||||
};
|
||||
|
||||
|
||||
o._nodeName = this.element[0].nodeName;
|
||||
|
||||
|
||||
//Wrap the element if it cannot hold child nodes
|
||||
if(o._nodeName.match(/canvas|textarea|input|select|button|img/i)) {
|
||||
var el = this.element;
|
||||
|
||||
|
||||
//Opera fixing relative position
|
||||
if (/relative/.test(el.css('position')) && $.browser.opera)
|
||||
el.css({ position: 'relative', top: 'auto', left: 'auto' });
|
||||
|
||||
|
||||
//Create a wrapper element and set the wrapper to the new current internal element
|
||||
el.wrap(
|
||||
$('<div class="ui-wrapper" style="overflow: hidden;"></div>').css( {
|
||||
@ -78,40 +78,40 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
left: el.css('left')
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
var oel = this.element; this.element = this.element.parent();
|
||||
|
||||
|
||||
// store instance on wrapper
|
||||
this.element.data('resizable', this);
|
||||
|
||||
|
||||
//Move margins to the wrapper
|
||||
this.element.css({ marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"),
|
||||
marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")
|
||||
});
|
||||
|
||||
|
||||
oel.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
|
||||
|
||||
|
||||
//Prevent Safari textarea resize
|
||||
if ($.browser.safari && o.preventDefault) oel.css('resize', 'none');
|
||||
|
||||
|
||||
o.proportionallyResize = oel.css({ position: 'static', zoom: 1, display: 'block' });
|
||||
|
||||
|
||||
// avoid IE jump
|
||||
this.element.css({ margin: oel.css('margin') });
|
||||
|
||||
|
||||
// fix handlers offset
|
||||
this._proportionallyResize();
|
||||
}
|
||||
|
||||
|
||||
if(!o.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(o.handles.constructor == String) {
|
||||
|
||||
|
||||
o.zIndex = o.zIndex || 1000;
|
||||
|
||||
|
||||
if(o.handles == 'all') o.handles = 'n,e,s,w,se,sw,ne,nw';
|
||||
|
||||
|
||||
var n = o.handles.split(","); o.handles = {};
|
||||
|
||||
|
||||
// insertions are applied when don't have theme loaded
|
||||
var insertionsDefault = {
|
||||
handle: 'position: absolute; display: none; overflow:hidden;',
|
||||
@ -124,18 +124,18 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
ne: 'top: 0pt; right: 0px;',
|
||||
nw: 'top: 0pt; left: 0px;'
|
||||
};
|
||||
|
||||
|
||||
for(var i = 0; i < n.length; i++) {
|
||||
var handle = $.trim(n[i]), dt = o.defaultTheme, hname = 'ui-resizable-'+handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css('ui-resizable-knob-handle'),
|
||||
allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {});
|
||||
|
||||
|
||||
// increase zIndex of sw, se, ne, nw axis
|
||||
var applyZIndex = /sw|se|ne|nw/.test(handle) ? { zIndex: ++o.zIndex } : {};
|
||||
|
||||
|
||||
var defCss = (loadDefault ? insertionsDefault[handle] : ''),
|
||||
axis = $(['<div class="ui-resizable-handle ', hname, '" style="', defCss, insertionsDefault.handle, '"></div>'].join('')).css( applyZIndex );
|
||||
o.handles[handle] = '.ui-resizable-'+handle;
|
||||
|
||||
|
||||
this.element.append(
|
||||
//Theme detection, if not loaded, load o.defaultTheme
|
||||
axis.css( loadDefault ? allDefTheme : {} )
|
||||
@ -143,50 +143,50 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
.css( o.knobHandles ? allKnobTheme : {} ).addClass(o.knobHandles ? 'ui-resizable-knob-handle' : '').addClass(o.knobHandles)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if (o.knobHandles) this.element.addClass('ui-resizable-knob').css( !$.ui.css('ui-resizable-knob') ? { /*border: '1px #fff dashed'*/ } : {} );
|
||||
}
|
||||
|
||||
|
||||
this._renderAxis = function(target) {
|
||||
target = target || this.element;
|
||||
|
||||
|
||||
for(var i in o.handles) {
|
||||
if(o.handles[i].constructor == String)
|
||||
o.handles[i] = $(o.handles[i], this.element).show();
|
||||
|
||||
|
||||
if (o.transparent)
|
||||
o.handles[i].css({opacity:0});
|
||||
|
||||
|
||||
//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
|
||||
if (this.element.is('.ui-wrapper') &&
|
||||
o._nodeName.match(/textarea|input|select|button/i)) {
|
||||
|
||||
|
||||
var axis = $(o.handles[i], this.element), padWrapper = 0;
|
||||
|
||||
|
||||
//Checking the correct pad and border
|
||||
padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
|
||||
|
||||
|
||||
//The padding type i have to apply...
|
||||
var padPos = [ 'padding',
|
||||
/ne|nw|n/.test(i) ? 'Top' :
|
||||
/se|sw|s/.test(i) ? 'Bottom' :
|
||||
/^e$/.test(i) ? 'Right' : 'Left' ].join("");
|
||||
|
||||
|
||||
if (!o.transparent)
|
||||
target.css(padPos, padWrapper);
|
||||
|
||||
|
||||
this._proportionallyResize();
|
||||
}
|
||||
if(!$(o.handles[i]).length) continue;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this._renderAxis(this.element);
|
||||
o._handles = $('.ui-resizable-handle', self.element);
|
||||
|
||||
|
||||
if (o.disableSelection)
|
||||
o._handles.disableSelection();
|
||||
|
||||
|
||||
//Matching axis name
|
||||
o._handles.mouseover(function() {
|
||||
if (!o.resizing) {
|
||||
@ -196,7 +196,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
self.axis = o.axis = axis && axis[1] ? axis[1] : 'se';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//If we want to auto hide the elements
|
||||
if (o.autoHide) {
|
||||
o._handles.hide();
|
||||
@ -211,7 +211,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this._mouseInit();
|
||||
},
|
||||
plugins: {},
|
||||
@ -233,16 +233,16 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
},
|
||||
destroy: function() {
|
||||
var el = this.element, wrapped = el.children(".ui-resizable").get(0);
|
||||
|
||||
|
||||
this._mouseDestroy();
|
||||
|
||||
|
||||
var _destroy = function(exp) {
|
||||
$(exp).removeClass("ui-resizable ui-resizable-disabled")
|
||||
.removeData("resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
|
||||
};
|
||||
|
||||
|
||||
_destroy(el);
|
||||
|
||||
|
||||
if (el.is('.ui-wrapper') && wrapped) {
|
||||
el.parent().append(
|
||||
$(wrapped).css({
|
||||
@ -253,55 +253,55 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
left: el.css('left')
|
||||
})
|
||||
).end().remove();
|
||||
|
||||
|
||||
_destroy(wrapped);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_mouseCapture: function(event) {
|
||||
|
||||
|
||||
if(this.options.disabled) return false;
|
||||
|
||||
|
||||
var handle = false;
|
||||
for(var i in this.options.handles) {
|
||||
if($(this.options.handles[i])[0] == event.target) handle = true;
|
||||
}
|
||||
if (!handle) return false;
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_mouseStart: function(event) {
|
||||
|
||||
|
||||
var o = this.options, iniPos = this.element.position(), el = this.element,
|
||||
num = function(v) { return parseInt(v, 10) || 0; }, ie6 = $.browser.msie && $.browser.version < 7;
|
||||
o.resizing = true;
|
||||
o.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
|
||||
|
||||
|
||||
// bugfix #1749
|
||||
if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
|
||||
|
||||
|
||||
// sOffset decides if document scrollOffset will be added to the top/left of the resizable element
|
||||
var sOffset = $.browser.msie && !o.containment && (/absolute/).test(el.css('position')) && !(/relative/).test(el.parent().css('position'));
|
||||
var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0;
|
||||
|
||||
|
||||
el.css({ position: 'absolute', top: (iniPos.top + dscrollt), left: (iniPos.left + dscrolll) });
|
||||
}
|
||||
|
||||
|
||||
//Opera fixing relative position
|
||||
if ($.browser.opera && (/relative/).test(el.css('position')))
|
||||
el.css({ position: 'relative', top: 'auto', left: 'auto' });
|
||||
|
||||
|
||||
this._renderProxy();
|
||||
|
||||
|
||||
var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
|
||||
|
||||
|
||||
if (o.containment) {
|
||||
curleft += $(o.containment).scrollLeft()||0;
|
||||
curtop += $(o.containment).scrollTop()||0;
|
||||
}
|
||||
|
||||
|
||||
//Store needed variables
|
||||
this.offset = this.helper.offset();
|
||||
this.position = { left: curleft, top: curtop };
|
||||
@ -310,79 +310,79 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
this.originalPosition = { left: curleft, top: curtop };
|
||||
this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
|
||||
this.originalMousePosition = { left: event.pageX, top: event.pageY };
|
||||
|
||||
|
||||
//Aspect Ratio
|
||||
o.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height)||1);
|
||||
|
||||
|
||||
if (o.preserveCursor)
|
||||
$('body').css('cursor', this.axis + '-resize');
|
||||
|
||||
|
||||
this._propagate("start", event);
|
||||
return true;
|
||||
},
|
||||
_mouseDrag: function(event) {
|
||||
|
||||
|
||||
//Increase performance, avoid regex
|
||||
var el = this.helper, o = this.options, props = {},
|
||||
self = this, smp = this.originalMousePosition, a = this.axis;
|
||||
|
||||
|
||||
var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
|
||||
var trigger = this._change[a];
|
||||
if (!trigger) return false;
|
||||
|
||||
|
||||
// Calculate the attrs that will be change
|
||||
var data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;
|
||||
|
||||
|
||||
if (o._aspectRatio || event.shiftKey)
|
||||
data = this._updateRatio(data, event);
|
||||
|
||||
|
||||
data = this._respectSize(data, event);
|
||||
|
||||
|
||||
// plugins callbacks need to be called first
|
||||
this._propagate("resize", event);
|
||||
|
||||
|
||||
el.css({
|
||||
top: this.position.top + "px", left: this.position.left + "px",
|
||||
width: this.size.width + "px", height: this.size.height + "px"
|
||||
});
|
||||
|
||||
|
||||
if (!o.helper && o.proportionallyResize)
|
||||
this._proportionallyResize();
|
||||
|
||||
|
||||
this._updateCache(data);
|
||||
|
||||
|
||||
// calling the user callback at the end
|
||||
this.element.triggerHandler("resize", [event, this.ui()], this.options["resize"]);
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_mouseStop: function(event) {
|
||||
|
||||
|
||||
this.options.resizing = false;
|
||||
var o = this.options, num = function(v) { return parseInt(v, 10) || 0; }, self = this;
|
||||
|
||||
|
||||
if(o.helper) {
|
||||
var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
|
||||
soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
|
||||
soffsetw = ista ? 0 : self.sizeDiff.width;
|
||||
|
||||
|
||||
var s = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
|
||||
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
|
||||
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
|
||||
|
||||
|
||||
if (!o.animate)
|
||||
this.element.css($.extend(s, { top: top, left: left }));
|
||||
|
||||
|
||||
if (o.helper && !o.animate) this._proportionallyResize();
|
||||
}
|
||||
|
||||
|
||||
if (o.preserveCursor)
|
||||
$('body').css('cursor', 'auto');
|
||||
|
||||
|
||||
this._propagate("stop", event);
|
||||
|
||||
|
||||
if (o.helper) this.helper.remove();
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_updateCache: function(data) {
|
||||
@ -394,12 +394,12 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
if (data.width) this.size.width = data.width;
|
||||
},
|
||||
_updateRatio: function(data, event) {
|
||||
|
||||
|
||||
var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
|
||||
|
||||
|
||||
if (data.height) data.width = (csize.height * o.aspectRatio);
|
||||
else if (data.width) data.height = (csize.width / o.aspectRatio);
|
||||
|
||||
|
||||
if (a == 'sw') {
|
||||
data.left = cpos.left + (csize.width - data.width);
|
||||
data.top = null;
|
||||
@ -408,44 +408,44 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
data.top = cpos.top + (csize.height - data.height);
|
||||
data.left = cpos.left + (csize.width - data.width);
|
||||
}
|
||||
|
||||
|
||||
return data;
|
||||
},
|
||||
_respectSize: function(data, event) {
|
||||
|
||||
|
||||
var el = this.helper, o = this.options, pRatio = o._aspectRatio || event.shiftKey, a = this.axis,
|
||||
ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height,
|
||||
isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height;
|
||||
|
||||
|
||||
if (isminw) data.width = o.minWidth;
|
||||
if (isminh) data.height = o.minHeight;
|
||||
if (ismaxw) data.width = o.maxWidth;
|
||||
if (ismaxh) data.height = o.maxHeight;
|
||||
|
||||
|
||||
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 (isminw && cw) data.left = dw - o.minWidth;
|
||||
if (ismaxw && cw) data.left = dw - o.maxWidth;
|
||||
if (isminh && ch) data.top = dh - o.minHeight;
|
||||
if (ismaxh && ch) data.top = dh - o.maxHeight;
|
||||
|
||||
|
||||
// fixing jump error on top/left - bug #2330
|
||||
var isNotwh = !data.width && !data.height;
|
||||
if (isNotwh && !data.left && data.top) data.top = null;
|
||||
else if (isNotwh && !data.top && data.left) data.left = null;
|
||||
|
||||
|
||||
return data;
|
||||
},
|
||||
_proportionallyResize: function() {
|
||||
var o = this.options;
|
||||
if (!o.proportionallyResize) return;
|
||||
var prel = o.proportionallyResize, el = this.helper || this.element;
|
||||
|
||||
|
||||
if (!o.borderDif) {
|
||||
var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
|
||||
p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
|
||||
|
||||
|
||||
o.borderDif = $.map(b, function(v, i) {
|
||||
var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
|
||||
return border + padding;
|
||||
@ -459,14 +459,14 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
_renderProxy: function() {
|
||||
var el = this.element, o = this.options;
|
||||
this.elementOffset = el.offset();
|
||||
|
||||
|
||||
if(o.helper) {
|
||||
this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
|
||||
|
||||
|
||||
// fix ie6 offset
|
||||
var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),
|
||||
pxyoffset = ( ie6 ? 2 : -1 );
|
||||
|
||||
|
||||
this.helper.addClass(o.helper).css({
|
||||
width: el.outerWidth() + pxyoffset,
|
||||
height: el.outerHeight() + pxyoffset,
|
||||
@ -475,12 +475,12 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
|
||||
top: this.elementOffset.top - ie6offset +'px',
|
||||
zIndex: ++o.zIndex
|
||||
});
|
||||
|
||||
|
||||
this.helper.appendTo("body");
|
||||
|
||||
|
||||
if (o.disableSelection)
|
||||
$.ui.disableSelection(this.helper.get(0));
|
||||
|
||||
|
||||
} else {
|
||||
this.helper = el;
|
||||
}
|
||||
@ -548,95 +548,95 @@ $.extend($.ui.resizable, {
|
||||
*/
|
||||
|
||||
$.ui.plugin.add("resizable", "containment", {
|
||||
|
||||
|
||||
start: function(event, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"), el = self.element;
|
||||
var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
|
||||
if (!ce) return;
|
||||
|
||||
|
||||
self.containerElement = $(ce);
|
||||
|
||||
|
||||
if (/document/.test(oc) || oc == document) {
|
||||
self.containerOffset = { left: 0, top: 0 };
|
||||
self.containerPosition = { left: 0, top: 0 };
|
||||
|
||||
|
||||
self.parentData = {
|
||||
element: $(document), left: 0, top: 0,
|
||||
width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// i'm a node, so compute top, left, right, bottom
|
||||
else{
|
||||
self.containerOffset = $(ce).offset();
|
||||
self.containerPosition = $(ce).position();
|
||||
self.containerSize = { height: $(ce).innerHeight(), width: $(ce).innerWidth() };
|
||||
|
||||
|
||||
var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width,
|
||||
width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
|
||||
|
||||
|
||||
self.parentData = {
|
||||
element: ce, left: co.left, top: co.top, width: width, height: height
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
resize: function(event, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"),
|
||||
ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,
|
||||
pRatio = o._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;
|
||||
|
||||
|
||||
if (ce[0] != document && (/static/).test(ce.css('position')))
|
||||
cop = self.containerPosition;
|
||||
|
||||
|
||||
if (cp.left < (o.helper ? co.left : cop.left)) {
|
||||
self.size.width = self.size.width + (o.helper ? (self.position.left - co.left) : (self.position.left - cop.left));
|
||||
if (pRatio) self.size.height = self.size.width / o.aspectRatio;
|
||||
self.position.left = o.helper ? co.left : cop.left;
|
||||
}
|
||||
|
||||
|
||||
if (cp.top < (o.helper ? co.top : 0)) {
|
||||
self.size.height = self.size.height + (o.helper ? (self.position.top - co.top) : self.position.top);
|
||||
if (pRatio) self.size.width = self.size.height * o.aspectRatio;
|
||||
self.position.top = o.helper ? co.top : 0;
|
||||
}
|
||||
|
||||
|
||||
var woset = (o.helper ? self.offset.left - co.left : (self.position.left - cop.left)) + self.sizeDiff.width,
|
||||
hoset = (o.helper ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;
|
||||
|
||||
|
||||
if (woset + self.size.width >= self.parentData.width) {
|
||||
self.size.width = self.parentData.width - woset;
|
||||
if (pRatio) self.size.height = self.size.width / o.aspectRatio;
|
||||
}
|
||||
|
||||
|
||||
if (hoset + self.size.height >= self.parentData.height) {
|
||||
self.size.height = self.parentData.height - hoset;
|
||||
if (pRatio) self.size.width = self.size.height * o.aspectRatio;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
stop: function(event, ui){
|
||||
var o = ui.options, self = $(this).data("resizable"), cp = self.position,
|
||||
co = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;
|
||||
|
||||
|
||||
var helper = $(self.helper), ho = helper.offset(), w = helper.innerWidth(), h = helper.innerHeight();
|
||||
|
||||
|
||||
if (o.helper && !o.animate && (/relative/).test(ce.css('position')))
|
||||
$(this).css({ left: (ho.left - co.left), top: (ho.top - co.top), width: w, height: h });
|
||||
|
||||
|
||||
if (o.helper && !o.animate && (/static/).test(ce.css('position')))
|
||||
$(this).css({ left: cop.left + (ho.left - co.left), top: cop.top + (ho.top - co.top), width: w, height: h });
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "grid", {
|
||||
|
||||
|
||||
resize: function(event, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"), cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;
|
||||
o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
|
||||
var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
|
||||
|
||||
|
||||
if (/^(se|s|e)$/.test(a)) {
|
||||
self.size.width = os.width + ox;
|
||||
self.size.height = os.height + oy;
|
||||
@ -658,84 +658,84 @@ $.ui.plugin.add("resizable", "grid", {
|
||||
self.position.left = op.left - ox;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "animate", {
|
||||
|
||||
|
||||
stop: function(event, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable");
|
||||
|
||||
|
||||
var pr = o.proportionallyResize, ista = pr && (/textarea/i).test(pr.get(0).nodeName),
|
||||
soffseth = ista && $.ui.hasScroll(pr.get(0), 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,
|
||||
soffsetw = ista ? 0 : self.sizeDiff.width;
|
||||
|
||||
|
||||
var style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },
|
||||
left = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,
|
||||
top = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;
|
||||
|
||||
|
||||
self.element.animate(
|
||||
$.extend(style, top && left ? { top: top, left: left } : {}), {
|
||||
duration: o.animateDuration,
|
||||
easing: o.animateEasing,
|
||||
step: function() {
|
||||
|
||||
|
||||
var data = {
|
||||
width: parseInt(self.element.css('width'), 10),
|
||||
height: parseInt(self.element.css('height'), 10),
|
||||
top: parseInt(self.element.css('top'), 10),
|
||||
left: parseInt(self.element.css('left'), 10)
|
||||
};
|
||||
|
||||
|
||||
if (pr) pr.css({ width: data.width, height: data.height });
|
||||
|
||||
|
||||
// propagating resize, and updating values for each animation step
|
||||
self._updateCache(data);
|
||||
self._propagate("animate", event);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "ghost", {
|
||||
|
||||
|
||||
start: function(event, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize, cs = self.size;
|
||||
|
||||
|
||||
if (!pr) self.ghost = self.element.clone();
|
||||
else self.ghost = pr.clone();
|
||||
|
||||
|
||||
self.ghost.css(
|
||||
{ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 }
|
||||
)
|
||||
.addClass('ui-resizable-ghost').addClass(typeof o.ghost == 'string' ? o.ghost : '');
|
||||
|
||||
|
||||
self.ghost.appendTo(self.helper);
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
resize: function(event, ui){
|
||||
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
|
||||
|
||||
|
||||
if (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
stop: function(event, ui){
|
||||
var o = ui.options, self = $(this).data("resizable"), pr = o.proportionallyResize;
|
||||
if (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$.ui.plugin.add("resizable", "alsoResize", {
|
||||
|
||||
|
||||
start: function(event, ui) {
|
||||
var o = ui.options, self = $(this).data("resizable"),
|
||||
|
||||
|
||||
_store = function(exp) {
|
||||
$(exp).each(function() {
|
||||
$(this).data("resizable-alsoresize", {
|
||||
@ -744,7 +744,7 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
if (typeof(o.alsoResize) == 'object') {
|
||||
if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
|
||||
else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); }
|
||||
@ -752,19 +752,19 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
||||
_store(o.alsoResize);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
resize: function(event, ui){
|
||||
var o = ui.options, self = $(this).data("resizable"), os = self.originalSize, op = self.originalPosition;
|
||||
|
||||
|
||||
var delta = {
|
||||
height: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,
|
||||
top: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0
|
||||
},
|
||||
|
||||
|
||||
_alsoResize = function(exp, c) {
|
||||
$(exp).each(function() {
|
||||
var start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left'];
|
||||
|
||||
|
||||
$.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {
|
||||
var sum = (start[prop]||0) + (delta[prop]||0);
|
||||
if (sum && sum >= 0)
|
||||
@ -773,14 +773,14 @@ $.ui.plugin.add("resizable", "alsoResize", {
|
||||
$(this).css(style);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
if (typeof(o.alsoResize) == 'object') {
|
||||
$.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); });
|
||||
}else{
|
||||
_alsoResize(o.alsoResize);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
stop: function(event, ui){
|
||||
$(this).removeData("resizable-alsoresize-start");
|
||||
}
|
||||
|
@ -15,11 +15,11 @@
|
||||
$.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
_init: function() {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.element.addClass("ui-selectable");
|
||||
|
||||
|
||||
this.dragged = false;
|
||||
|
||||
|
||||
// cache selectee children based on filter
|
||||
var selectees;
|
||||
this.refresh = function() {
|
||||
@ -42,11 +42,11 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
});
|
||||
};
|
||||
this.refresh();
|
||||
|
||||
|
||||
this.selectees = selectees.addClass("ui-selectee");
|
||||
|
||||
|
||||
this._mouseInit();
|
||||
|
||||
|
||||
this.helper = $(document.createElement('div'))
|
||||
.css({border:'1px dotted black'})
|
||||
.addClass("ui-selectable-helper");
|
||||
@ -67,22 +67,22 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
},
|
||||
_mouseStart: function(event) {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.opos = [event.pageX, event.pageY];
|
||||
|
||||
|
||||
if (this.options.disabled)
|
||||
return;
|
||||
|
||||
|
||||
var options = this.options;
|
||||
|
||||
|
||||
this.selectees = $(options.filter, this.element[0]);
|
||||
|
||||
|
||||
// selectable START callback
|
||||
this.element.triggerHandler("selectablestart", [event, {
|
||||
"selectable": this.element[0],
|
||||
"options": options
|
||||
}], options.start);
|
||||
|
||||
|
||||
$('body').append(this.helper);
|
||||
// position helper (lasso)
|
||||
this.helper.css({
|
||||
@ -93,11 +93,11 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
"width": 0,
|
||||
"height": 0
|
||||
});
|
||||
|
||||
|
||||
if (options.autoRefresh) {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
|
||||
this.selectees.filter('.ui-selected').each(function() {
|
||||
var selectee = $.data(this, "selectable-item");
|
||||
selectee.startselected = true;
|
||||
@ -114,7 +114,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
}], options.unselecting);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var isSelectee = false;
|
||||
$(event.target).parents().andSelf().each(function() {
|
||||
if($.data(this, "selectable-item")) isSelectee = true;
|
||||
@ -124,17 +124,17 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
_mouseDrag: function(event) {
|
||||
var self = this;
|
||||
this.dragged = true;
|
||||
|
||||
|
||||
if (this.options.disabled)
|
||||
return;
|
||||
|
||||
|
||||
var options = this.options;
|
||||
|
||||
|
||||
var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
|
||||
if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
|
||||
if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
|
||||
this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
|
||||
|
||||
|
||||
this.selectees.each(function() {
|
||||
var selectee = $.data(this, "selectable-item");
|
||||
//prevent helper from being selected if appendTo: selectable
|
||||
@ -146,7 +146,7 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
} else if (options.tolerance == 'fit') {
|
||||
hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
|
||||
}
|
||||
|
||||
|
||||
if (hit) {
|
||||
// SELECT
|
||||
if (selectee.selected) {
|
||||
@ -207,16 +207,16 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
_mouseStop: function(event) {
|
||||
var self = this;
|
||||
|
||||
|
||||
this.dragged = false;
|
||||
|
||||
|
||||
var options = this.options;
|
||||
|
||||
|
||||
$('.ui-unselecting', this.element[0]).each(function() {
|
||||
var selectee = $.data(this, "selectable-item");
|
||||
selectee.$element.removeClass('ui-unselecting');
|
||||
@ -244,9 +244,9 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
|
||||
selectable: self.element[0],
|
||||
options: this.options
|
||||
}], this.options.stop);
|
||||
|
||||
|
||||
this.helper.remove();
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}));
|
||||
|
116
ui/ui.slider.js
116
ui/ui.slider.js
@ -36,12 +36,12 @@ $.widget("ui.slider", {
|
||||
this.element.triggerHandler(n == "slide" ? n : "slide"+n, [event, this.ui()], this.options[n]);
|
||||
},
|
||||
destroy: function() {
|
||||
|
||||
|
||||
this.element
|
||||
.removeClass("ui-slider ui-slider-disabled")
|
||||
.removeData("slider")
|
||||
.unbind(".slider");
|
||||
|
||||
|
||||
if(this.handle && this.handle.length) {
|
||||
this.handle
|
||||
.unwrap("a");
|
||||
@ -50,28 +50,28 @@ $.widget("ui.slider", {
|
||||
mouse && mouse._mouseDestroy();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this.generated && this.generated.remove();
|
||||
|
||||
|
||||
},
|
||||
_setData: function(key, value) {
|
||||
$.widget.prototype._setData.apply(this, arguments);
|
||||
if (/min|max|steps/.test(key)) {
|
||||
this._initBoundaries();
|
||||
}
|
||||
|
||||
|
||||
if(key == "range") {
|
||||
value ? this.handle.length == 2 && this._createRange() : this._removeRange();
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
_init: function() {
|
||||
|
||||
|
||||
var self = this;
|
||||
this.element.addClass("ui-slider");
|
||||
this._initBoundaries();
|
||||
|
||||
|
||||
// Initialize mouse and key events for interaction
|
||||
this.handle = $(this.options.handle, this.element);
|
||||
if (!this.handle.length) {
|
||||
@ -82,20 +82,20 @@ $.widget("ui.slider", {
|
||||
return handle[0];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var handleclass = function(el) {
|
||||
this.element = $(el);
|
||||
this.element.data("mouse", this);
|
||||
this.options = self.options;
|
||||
|
||||
|
||||
this.element.bind("mousedown", function() {
|
||||
if(self.currentHandle) this.blur(self.currentHandle);
|
||||
self._focus(this, true);
|
||||
});
|
||||
|
||||
|
||||
this._mouseInit();
|
||||
};
|
||||
|
||||
|
||||
$.extend(handleclass.prototype, $.ui.mouse, {
|
||||
_mouseStart: function(event) { return self._start.call(self, event, this.element[0]); },
|
||||
_mouseStop: function(event) { return self._stop.call(self, event, this.element[0]); },
|
||||
@ -103,7 +103,7 @@ $.widget("ui.slider", {
|
||||
_mouseCapture: function() { return true; },
|
||||
trigger: function(event) { this._mouseDown(event); }
|
||||
});
|
||||
|
||||
|
||||
$(this.handle)
|
||||
.each(function() {
|
||||
new handleclass(this);
|
||||
@ -115,29 +115,29 @@ $.widget("ui.slider", {
|
||||
.bind('blur', function(event) { self._blur(this.firstChild); })
|
||||
.bind('keydown', function(event) { if(!self.options.noKeyboard) return self._keydown(event.keyCode, this.firstChild); })
|
||||
;
|
||||
|
||||
|
||||
// Bind the click to the slider itself
|
||||
this.element.bind('mousedown.slider', function(event) {
|
||||
self._click.apply(self, [event]);
|
||||
self.currentHandle.data("mouse").trigger(event);
|
||||
self.firstValue = self.firstValue + 1; //This is for always triggering the change event
|
||||
});
|
||||
|
||||
|
||||
// Move the first handle to the startValue
|
||||
$.each(this.options.handles || [], function(index, handle) {
|
||||
self.moveTo(handle.start, index, true);
|
||||
});
|
||||
if (!isNaN(this.options.startValue))
|
||||
this.moveTo(this.options.startValue, 0, true);
|
||||
|
||||
|
||||
this.previousHandle = $(this.handle[0]); //set the previous handle to the first to allow clicking before selecting the handle
|
||||
if(this.handle.length == 2 && this.options.range) this._createRange();
|
||||
},
|
||||
_initBoundaries: function() {
|
||||
|
||||
|
||||
var element = this.element[0], o = this.options;
|
||||
this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
|
||||
|
||||
|
||||
$.extend(o, {
|
||||
axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),
|
||||
max: !isNaN(parseInt(o.max,10)) ? { x: parseInt(o.max, 10), y: parseInt(o.max, 10) } : ({ x: o.max && o.max.x || 100, y: o.max && o.max.y || 100 }),
|
||||
@ -154,7 +154,7 @@ $.widget("ui.slider", {
|
||||
y: o.stepping && o.stepping.y || parseInt(o.stepping, 10) || (o.steps ? o.realMax.y/(o.steps.y || parseInt(o.steps, 10) || o.realMax.y) : 0)
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
_keydown: function(keyCode, handle) {
|
||||
if (this.options.disabled)
|
||||
return;
|
||||
@ -193,9 +193,9 @@ $.widget("ui.slider", {
|
||||
// - The user didn't click a handle
|
||||
// - The Slider is not disabled
|
||||
// - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
|
||||
|
||||
|
||||
var pointer = [event.pageX, event.pageY];
|
||||
|
||||
|
||||
var clickedHandle = false;
|
||||
this.handle.each(function() {
|
||||
if(this == event.target)
|
||||
@ -203,20 +203,20 @@ $.widget("ui.slider", {
|
||||
});
|
||||
if (clickedHandle || this.options.disabled || !(this.currentHandle || this.previousHandle))
|
||||
return;
|
||||
|
||||
|
||||
// If a previous handle was focussed, focus it again
|
||||
if (!this.currentHandle && this.previousHandle)
|
||||
this._focus(this.previousHandle, true);
|
||||
|
||||
|
||||
// propagate only for distance > 0, otherwise propagation is done my drag
|
||||
this.offset = this.element.offset();
|
||||
|
||||
|
||||
this.moveTo({
|
||||
y: this._convertValue(event.pageY - this.offset.top - this.currentHandle[0].offsetHeight/2, "y"),
|
||||
x: this._convertValue(event.pageX - this.offset.left - this.currentHandle[0].offsetWidth/2, "x")
|
||||
}, null, !this.options.distance);
|
||||
},
|
||||
|
||||
|
||||
_createRange: function() {
|
||||
if(this.rangeElement) return;
|
||||
this.rangeElement = $('<div></div>')
|
||||
@ -238,7 +238,7 @@ $.widget("ui.slider", {
|
||||
_getRange: function() {
|
||||
return this.rangeElement ? this._convertValue(parseInt(this.rangeElement.css(this.options.axis == "vertical" ? "height" : "width"),10), this.options.axis == "vertical" ? "y" : "x") : null;
|
||||
},
|
||||
|
||||
|
||||
_handleIndex: function() {
|
||||
return this.handle.index(this.currentHandle[0]);
|
||||
},
|
||||
@ -247,7 +247,7 @@ $.widget("ui.slider", {
|
||||
if(!axis) axis = this.options.axis == "vertical" ? "y" : "x";
|
||||
|
||||
var curHandle = $(handle != undefined && handle !== null ? this.handle[handle] || handle : this.currentHandle);
|
||||
|
||||
|
||||
if(curHandle.data("mouse").sliderValue) {
|
||||
return parseInt(curHandle.data("mouse").sliderValue[axis],10);
|
||||
} else {
|
||||
@ -258,7 +258,7 @@ $.widget("ui.slider", {
|
||||
_convertValue: function(value,axis) {
|
||||
return this.options.min[axis] + (value / (this.actualSize[axis == "x" ? "width" : "height"] - this._handleSize(null,axis))) * this.options.realMax[axis];
|
||||
},
|
||||
|
||||
|
||||
_translateValue: function(value,axis) {
|
||||
return ((value - this.options.min[axis]) / this.options.realMax[axis]) * (this.actualSize[axis == "x" ? "width" : "height"] - this._handleSize(null,axis));
|
||||
},
|
||||
@ -297,28 +297,28 @@ $.widget("ui.slider", {
|
||||
},
|
||||
|
||||
_start: function(event, handle) {
|
||||
|
||||
|
||||
var o = this.options;
|
||||
if(o.disabled) return false;
|
||||
|
||||
|
||||
// Prepare the outer size
|
||||
this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
|
||||
|
||||
|
||||
// This is a especially ugly fix for strange blur events happening on mousemove events
|
||||
if (!this.currentHandle)
|
||||
this._focus(this.previousHandle, true);
|
||||
|
||||
|
||||
this.offset = this.element.offset();
|
||||
|
||||
|
||||
this.handleOffset = this.currentHandle.offset();
|
||||
this.clickOffset = { top: event.pageY - this.handleOffset.top, left: event.pageX - this.handleOffset.left };
|
||||
|
||||
|
||||
this.firstValue = this.value();
|
||||
|
||||
|
||||
this._propagate('start', event);
|
||||
this._drag(event, handle);
|
||||
return true;
|
||||
|
||||
|
||||
},
|
||||
_stop: function(event) {
|
||||
this._propagate('stop', event);
|
||||
@ -329,14 +329,14 @@ $.widget("ui.slider", {
|
||||
return false;
|
||||
},
|
||||
_drag: function(event, handle) {
|
||||
|
||||
|
||||
var o = this.options;
|
||||
var position = { top: event.pageY - this.offset.top - this.clickOffset.top, left: event.pageX - this.offset.left - this.clickOffset.left};
|
||||
if(!this.currentHandle) this._focus(this.previousHandle, true); //This is a especially ugly fix for strange blur events happening on mousemove events
|
||||
|
||||
|
||||
position.left = this._translateLimits(position.left, "x");
|
||||
position.top = this._translateLimits(position.top, "y");
|
||||
|
||||
|
||||
if (o.stepping.x) {
|
||||
var value = this._convertValue(position.left, "x");
|
||||
value = Math.round(value / o.stepping.x) * o.stepping.x;
|
||||
@ -347,49 +347,49 @@ $.widget("ui.slider", {
|
||||
value = Math.round(value / o.stepping.y) * o.stepping.y;
|
||||
position.top = this._translateValue(value, "y");
|
||||
}
|
||||
|
||||
|
||||
position.left = this._translateRange(position.left, "x");
|
||||
position.top = this._translateRange(position.top, "y");
|
||||
|
||||
|
||||
if(o.axis != "vertical") this.currentHandle.css({ left: position.left });
|
||||
if(o.axis != "horizontal") this.currentHandle.css({ top: position.top });
|
||||
|
||||
|
||||
//Store the slider's value
|
||||
this.currentHandle.data("mouse").sliderValue = {
|
||||
x: Math.round(this._convertValue(position.left, "x")) || 0,
|
||||
y: Math.round(this._convertValue(position.top, "y")) || 0
|
||||
};
|
||||
|
||||
|
||||
if (this.rangeElement)
|
||||
this._updateRange();
|
||||
this._propagate('slide', event);
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
moveTo: function(value, handle, noPropagation) {
|
||||
|
||||
|
||||
var o = this.options;
|
||||
|
||||
|
||||
// Prepare the outer size
|
||||
this.actualSize = { width: this.element.outerWidth() , height: this.element.outerHeight() };
|
||||
|
||||
|
||||
//If no handle has been passed, no current handle is available and we have multiple handles, return false
|
||||
if (handle == undefined && !this.currentHandle && this.handle.length != 1)
|
||||
return false;
|
||||
|
||||
|
||||
//If only one handle is available, use it
|
||||
if (handle == undefined && !this.currentHandle)
|
||||
handle = 0;
|
||||
|
||||
|
||||
if (handle != undefined)
|
||||
this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);
|
||||
|
||||
|
||||
if(value.x !== undefined && value.y !== undefined) {
|
||||
var x = value.x, y = value.y;
|
||||
} else {
|
||||
var x = value, y = value;
|
||||
}
|
||||
|
||||
|
||||
if(x !== undefined && x.constructor != Number) {
|
||||
var me = /^\-\=/.test(x), pe = /^\+\=/.test(x);
|
||||
if(me || pe) {
|
||||
@ -398,7 +398,7 @@ $.widget("ui.slider", {
|
||||
x = isNaN(parseInt(x, 10)) ? undefined : parseInt(x, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(y !== undefined && y.constructor != Number) {
|
||||
var me = /^\-\=/.test(y), pe = /^\+\=/.test(y);
|
||||
if(me || pe) {
|
||||
@ -407,7 +407,7 @@ $.widget("ui.slider", {
|
||||
y = isNaN(parseInt(y, 10)) ? undefined : parseInt(y, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(o.axis != "vertical" && x !== undefined) {
|
||||
if(o.stepping.x) x = Math.round(x / o.stepping.x) * o.stepping.x;
|
||||
x = this._translateValue(x, "x");
|
||||
@ -416,7 +416,7 @@ $.widget("ui.slider", {
|
||||
|
||||
o.animate ? this.currentHandle.stop().animate({ left: x }, (Math.abs(parseInt(this.currentHandle.css("left")) - x)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ left: x });
|
||||
}
|
||||
|
||||
|
||||
if(o.axis != "horizontal" && y !== undefined) {
|
||||
if(o.stepping.y) y = Math.round(y / o.stepping.y) * o.stepping.y;
|
||||
y = this._translateValue(y, "y");
|
||||
@ -424,16 +424,16 @@ $.widget("ui.slider", {
|
||||
y = this._translateRange(y, "y");
|
||||
o.animate ? this.currentHandle.stop().animate({ top: y }, (Math.abs(parseInt(this.currentHandle.css("top")) - y)) * (!isNaN(parseInt(o.animate)) ? o.animate : 5)) : this.currentHandle.css({ top: y });
|
||||
}
|
||||
|
||||
|
||||
if (this.rangeElement)
|
||||
this._updateRange();
|
||||
|
||||
|
||||
//Store the slider's value
|
||||
this.currentHandle.data("mouse").sliderValue = {
|
||||
x: Math.round(this._convertValue(x, "x")) || 0,
|
||||
y: Math.round(this._convertValue(y, "y")) || 0
|
||||
};
|
||||
|
||||
|
||||
if (!noPropagation) {
|
||||
this._propagate('start', null);
|
||||
this._propagate("slide", null);
|
||||
|
@ -15,7 +15,7 @@
|
||||
$.widget('ui.spinner', {
|
||||
_init: function() {
|
||||
this._trigger('init', null, this.ui(null));
|
||||
|
||||
|
||||
// perform data bind on generic objects
|
||||
if (typeof this.options.items[0] == 'object' && !this.element.is('input')) {
|
||||
var data = this.options.items;
|
||||
@ -23,22 +23,22 @@ $.widget('ui.spinner', {
|
||||
this._addItem(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check for decimals in steppinng and set _decimals as internal
|
||||
this._decimals = parseInt(this.options.decimals, 10);
|
||||
if (this.options.stepping.toString().indexOf('.') != -1 && this._decimals == 0) {
|
||||
var s = this.options.stepping.toString();
|
||||
this._decimals = s.slice(s.indexOf('.')+1, s.length).length;
|
||||
}
|
||||
|
||||
|
||||
//Initialize needed constants
|
||||
var self = this;
|
||||
this.element
|
||||
.addClass('ui-spinner-box')
|
||||
.attr('autocomplete', 'off'); // switch off autocomplete in opera
|
||||
|
||||
|
||||
this._setValue( isNaN(this._getValue()) ? this.options.start : this._getValue() );
|
||||
|
||||
|
||||
this.element
|
||||
.wrap('<div>')
|
||||
.parent()
|
||||
@ -137,7 +137,7 @@ $.widget('ui.spinner', {
|
||||
self._propagate('change', event);
|
||||
})
|
||||
.end();
|
||||
|
||||
|
||||
// Give the spinner casing a unique id only if one exists in original input
|
||||
// - this should aid targetted customisations if a page contains multiple instances
|
||||
this.element.attr('id', function(){
|
||||
@ -145,7 +145,7 @@ $.widget('ui.spinner', {
|
||||
$(this).parent().attr('id', this.id+'-ui-spinner');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// DataList: Set contraints for object length and step size.
|
||||
// Manipulate height of spinner.
|
||||
this._items = this.element.children().length;
|
||||
@ -166,7 +166,7 @@ $.widget('ui.spinner', {
|
||||
this.options.min = 0;
|
||||
this.options.max = this._items-1;
|
||||
}
|
||||
|
||||
|
||||
this.element
|
||||
.bind('keydown.spinner', function(event) {
|
||||
if (!self.counter) {
|
||||
@ -181,14 +181,14 @@ $.widget('ui.spinner', {
|
||||
.bind('blur.spinner', function(event) {
|
||||
self._cleanUp();
|
||||
});
|
||||
|
||||
|
||||
if ($.fn.mousewheel) {
|
||||
this.element.mousewheel(function(event, delta) {
|
||||
self._mousewheel(event, delta);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_constrain: function() {
|
||||
if (this.options.min != undefined && this._getValue() < this.options.min) {
|
||||
this._setValue(this.options.min);
|
||||
@ -205,7 +205,7 @@ $.widget('ui.spinner', {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (isNaN(this._getValue())) {
|
||||
this._setValue(this.options.start);
|
||||
}
|
||||
@ -250,7 +250,7 @@ $.widget('ui.spinner', {
|
||||
},
|
||||
_keydown: function(event) {
|
||||
var KEYS = $.keyCode;
|
||||
|
||||
|
||||
if (event.keyCode == KEYS.UP) {
|
||||
this._up(event);
|
||||
}
|
||||
@ -314,10 +314,10 @@ $.widget('ui.spinner', {
|
||||
wrapper = 'li';
|
||||
}
|
||||
var html = obj; // string or object set it to html first
|
||||
|
||||
|
||||
if (typeof obj == 'object') {
|
||||
var format = (fmt !== undefined ? fmt : this.options.format);
|
||||
|
||||
|
||||
html = format.replace(/%(\(([^)]+)\))?/g,
|
||||
(function(data){
|
||||
return function(match, a, lbl) {
|
||||
@ -335,7 +335,7 @@ $.widget('ui.spinner', {
|
||||
this.element.append('<'+ wrapper +' class="ui-spinner-dyn">'+ html + '</'+ wrapper +'>');
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
plugins: {},
|
||||
ui: function(event) {
|
||||
return {
|
||||
|
126
ui/ui.tabs.js
126
ui/ui.tabs.js
@ -48,13 +48,13 @@ $.widget("ui.tabs", {
|
||||
return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
|
||||
},
|
||||
_tabify: function(init) {
|
||||
|
||||
|
||||
this.$lis = $('li:has(a[href])', this.element);
|
||||
this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
|
||||
this.$panels = $([]);
|
||||
|
||||
|
||||
var self = this, o = this.options;
|
||||
|
||||
|
||||
this.$tabs.each(function(i, a) {
|
||||
// inline tab
|
||||
if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash
|
||||
@ -77,14 +77,14 @@ $.widget("ui.tabs", {
|
||||
else
|
||||
o.disabled.push(i + 1);
|
||||
});
|
||||
|
||||
|
||||
// initialization from scratch
|
||||
if (init) {
|
||||
|
||||
|
||||
// attach necessary classes for styling if not present
|
||||
this.element.addClass(o.navClass);
|
||||
this.$panels.addClass(o.panelClass);
|
||||
|
||||
|
||||
// Selected tab
|
||||
// use "selected" option or try to retrieve:
|
||||
// 1. from fragment identifier in url
|
||||
@ -107,7 +107,7 @@ $.widget("ui.tabs", {
|
||||
o.selected = self.$lis.index( self.$lis.filter('.' + o.selectedClass)[0] );
|
||||
}
|
||||
o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; // first tab selected by default
|
||||
|
||||
|
||||
// Take disabling tabs via class attribute from HTML
|
||||
// into account and update option properly.
|
||||
// A selected tab cannot become disabled.
|
||||
@ -117,7 +117,7 @@ $.widget("ui.tabs", {
|
||||
)).sort();
|
||||
if ($.inArray(o.selected, o.disabled) != -1)
|
||||
o.disabled.splice($.inArray(o.selected, o.disabled), 1);
|
||||
|
||||
|
||||
// highlight selected tab
|
||||
this.$panels.addClass(o.hideClass);
|
||||
this.$lis.removeClass(o.selectedClass);
|
||||
@ -126,41 +126,41 @@ $.widget("ui.tabs", {
|
||||
var classes = [o.selectedClass];
|
||||
if (o.deselectable) classes.push(o.deselectableClass);
|
||||
this.$lis.eq(o.selected).addClass(classes.join(' '));
|
||||
|
||||
|
||||
// seems to be expected behavior that the show callback is fired
|
||||
var onShow = function() {
|
||||
self._trigger('show', null,
|
||||
self.ui(self.$tabs[o.selected], self.$panels[o.selected]));
|
||||
};
|
||||
|
||||
|
||||
// load if remote tab
|
||||
if ($.data(this.$tabs[o.selected], 'load.tabs'))
|
||||
this.load(o.selected, onShow);
|
||||
// just trigger show event
|
||||
else onShow();
|
||||
}
|
||||
|
||||
|
||||
// clean up to avoid memory leaks in certain versions of IE 6
|
||||
$(window).bind('unload', function() {
|
||||
self.$tabs.unbind('.tabs');
|
||||
self.$lis = self.$tabs = self.$panels = null;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// update selected after add/remove
|
||||
else
|
||||
o.selected = this.$lis.index( this.$lis.filter('.' + o.selectedClass)[0] );
|
||||
|
||||
|
||||
// set or update cookie after init and add/remove respectively
|
||||
if (o.cookie) this._cookie(o.selected, o.cookie);
|
||||
|
||||
|
||||
// disable tabs
|
||||
for (var i = 0, li; li = this.$lis[i]; i++)
|
||||
$(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
|
||||
|
||||
|
||||
// reset cache if switching from cached to not cached
|
||||
if (o.cache === false) this.$tabs.removeData('cache.tabs');
|
||||
|
||||
|
||||
// set up animations
|
||||
var hideFx, showFx;
|
||||
if (o.fx) {
|
||||
@ -170,7 +170,7 @@ $.widget("ui.tabs", {
|
||||
}
|
||||
else hideFx = showFx = o.fx;
|
||||
}
|
||||
|
||||
|
||||
// Reset certain styles left over from animation
|
||||
// and prevent IE's ClearType bug...
|
||||
function resetStyle($el, fx) {
|
||||
@ -191,7 +191,7 @@ $.widget("ui.tabs", {
|
||||
$show.removeClass(o.hideClass);
|
||||
self._trigger('show', null, self.ui(clicked, $show[0]));
|
||||
};
|
||||
|
||||
|
||||
// Hide a tab, $show is optional...
|
||||
var hideTab = hideFx ?
|
||||
function(clicked, $hide, $show) {
|
||||
@ -205,7 +205,7 @@ $.widget("ui.tabs", {
|
||||
$hide.addClass(o.hideClass);
|
||||
if ($show) showTab(clicked, $show);
|
||||
};
|
||||
|
||||
|
||||
// Switch a tab...
|
||||
function switchTab(clicked, $li, $hide, $show) {
|
||||
var classes = [o.selectedClass];
|
||||
@ -213,15 +213,15 @@ $.widget("ui.tabs", {
|
||||
$li.addClass(classes.join(' ')).siblings().removeClass(classes.join(' '));
|
||||
hideTab(clicked, $hide, $show);
|
||||
}
|
||||
|
||||
|
||||
// attach tab event handler, unbind to avoid duplicates from former tabifying...
|
||||
this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() {
|
||||
|
||||
|
||||
//var trueClick = event.clientX; // add to history only if true click occured, not a triggered click
|
||||
var $li = $(this).parents('li:eq(0)'),
|
||||
$hide = self.$panels.filter(':visible'),
|
||||
$show = $(self._sanitizeSelector(this.hash));
|
||||
|
||||
|
||||
// If tab is already selected and not deselectable or tab disabled or
|
||||
// or is already loading or click callback returns false stop here.
|
||||
// Check if click handler returns false last so that it is not executed
|
||||
@ -234,9 +234,9 @@ $.widget("ui.tabs", {
|
||||
this.blur();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
o.selected = self.$tabs.index(this);
|
||||
|
||||
|
||||
// if tab may be closed
|
||||
if (o.deselectable) {
|
||||
if ($li.hasClass(o.selectedClass)) {
|
||||
@ -257,12 +257,12 @@ $.widget("ui.tabs", {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (o.cookie) self._cookie(o.selected, o.cookie);
|
||||
|
||||
|
||||
// stop possibly running animations
|
||||
self.$panels.stop();
|
||||
|
||||
|
||||
// show new tab
|
||||
if ($show.length) {
|
||||
var a = this;
|
||||
@ -277,31 +277,31 @@ $.widget("ui.tabs", {
|
||||
);
|
||||
} else
|
||||
throw 'jQuery UI Tabs: Mismatching fragment identifier.';
|
||||
|
||||
|
||||
// Prevent IE from keeping other link focussed when using the back button
|
||||
// and remove dotted border from clicked link. This is controlled via CSS
|
||||
// in modern browsers; blur() removes focus from address bar in Firefox
|
||||
// which can become a usability and annoying problem with tabs('rotate').
|
||||
if ($.browser.msie) this.blur();
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
// disable click if event is configured to something else
|
||||
if (o.event != 'click') this.$tabs.bind('click.tabs', function(){return false;});
|
||||
|
||||
|
||||
},
|
||||
add: function(url, label, index) {
|
||||
if (index == undefined)
|
||||
index = this.$tabs.length; // append by default
|
||||
|
||||
|
||||
var o = this.options;
|
||||
var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
|
||||
$li.data('destroy.tabs', true);
|
||||
|
||||
|
||||
var id = url.indexOf('#') == 0 ? url.replace('#', '') : this._tabId( $('a:first-child', $li)[0] );
|
||||
|
||||
|
||||
// try to find an existing element before creating a new one
|
||||
var $panel = $('#' + id);
|
||||
if (!$panel.length) {
|
||||
@ -317,12 +317,12 @@ $.widget("ui.tabs", {
|
||||
$li.insertBefore(this.$lis[index]);
|
||||
$panel.insertBefore(this.$panels[index]);
|
||||
}
|
||||
|
||||
|
||||
o.disabled = $.map(o.disabled,
|
||||
function(n, i) { return n >= index ? ++n : n });
|
||||
|
||||
|
||||
this._tabify();
|
||||
|
||||
|
||||
if (this.$tabs.length == 1) {
|
||||
$li.addClass(o.selectedClass);
|
||||
$panel.removeClass(o.hideClass);
|
||||
@ -330,24 +330,24 @@ $.widget("ui.tabs", {
|
||||
if (href)
|
||||
this.load(index, href);
|
||||
}
|
||||
|
||||
|
||||
// callback
|
||||
this._trigger('add', null, this.ui(this.$tabs[index], this.$panels[index]));
|
||||
},
|
||||
remove: function(index) {
|
||||
var o = this.options, $li = this.$lis.eq(index).remove(),
|
||||
$panel = this.$panels.eq(index).remove();
|
||||
|
||||
|
||||
// If selected tab was removed focus tab to the right or
|
||||
// in case the last tab was removed the tab to the left.
|
||||
if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
|
||||
this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
|
||||
|
||||
|
||||
o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
|
||||
function(n, i) { return n >= index ? --n : n });
|
||||
|
||||
|
||||
this._tabify();
|
||||
|
||||
|
||||
// callback
|
||||
this._trigger('remove', null, this.ui($li.find('a')[0], $panel[0]));
|
||||
},
|
||||
@ -355,7 +355,7 @@ $.widget("ui.tabs", {
|
||||
var o = this.options;
|
||||
if ($.inArray(index, o.disabled) == -1)
|
||||
return;
|
||||
|
||||
|
||||
var $li = this.$lis.eq(index).removeClass(o.disabledClass);
|
||||
if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
|
||||
$li.css('display', 'inline-block');
|
||||
@ -363,9 +363,9 @@ $.widget("ui.tabs", {
|
||||
$li.css('display', 'block');
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
||||
o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });
|
||||
|
||||
|
||||
// callback
|
||||
this._trigger('enable', null, this.ui(this.$tabs[index], this.$panels[index]));
|
||||
},
|
||||
@ -373,10 +373,10 @@ $.widget("ui.tabs", {
|
||||
var self = this, o = this.options;
|
||||
if (index != o.selected) { // cannot disable already selected tab
|
||||
this.$lis.eq(index).addClass(o.disabledClass);
|
||||
|
||||
|
||||
o.disabled.push(index);
|
||||
o.disabled.sort();
|
||||
|
||||
|
||||
// callback
|
||||
this._trigger('disable', null, this.ui(this.$tabs[index], this.$panels[index]));
|
||||
}
|
||||
@ -388,20 +388,20 @@ $.widget("ui.tabs", {
|
||||
this.$tabs.eq(index).trigger(this.options.event + '.tabs');
|
||||
},
|
||||
load: function(index, callback) { // callback is for internal usage only
|
||||
|
||||
|
||||
var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0],
|
||||
bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs');
|
||||
|
||||
|
||||
callback = callback || function() {};
|
||||
|
||||
|
||||
// no remote or from cache - just finish with callback
|
||||
if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
|
||||
callback();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// load remote from here on
|
||||
|
||||
|
||||
var inner = function(parent) {
|
||||
var $parent = $(parent), $inner = $parent.find('*:last');
|
||||
return $inner.length && $inner.is(':not(img)') && $inner || $parent;
|
||||
@ -414,29 +414,29 @@ $.widget("ui.tabs", {
|
||||
});
|
||||
self.xhr = null;
|
||||
};
|
||||
|
||||
|
||||
if (o.spinner) {
|
||||
var label = inner(a).html();
|
||||
inner(a).wrapInner('<em></em>')
|
||||
.find('em').data('label.tabs', label).html(o.spinner);
|
||||
}
|
||||
|
||||
|
||||
var ajaxOptions = $.extend({}, o.ajaxOptions, {
|
||||
url: url,
|
||||
success: function(r, s) {
|
||||
$(self._sanitizeSelector(a.hash)).html(r);
|
||||
cleanup();
|
||||
|
||||
|
||||
if (o.cache)
|
||||
$.data(a, 'cache.tabs', true); // if loaded once do not load them again
|
||||
|
||||
|
||||
// callbacks
|
||||
self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index]));
|
||||
try {
|
||||
o.ajaxOptions.success(r, s);
|
||||
}
|
||||
catch (event) {}
|
||||
|
||||
|
||||
// This callback is required because the switch has to take
|
||||
// place after loading has completed. Call last in order to
|
||||
// fire load before show callback...
|
||||
@ -519,24 +519,24 @@ $.extend($.ui.tabs, {
|
||||
$.extend($.ui.tabs.prototype, {
|
||||
rotation: null,
|
||||
rotate: function(ms, continuing) {
|
||||
|
||||
|
||||
continuing = continuing || false;
|
||||
|
||||
|
||||
var self = this, t = this.options.selected;
|
||||
|
||||
|
||||
function start() {
|
||||
self.rotation = setInterval(function() {
|
||||
t = ++t < self.$tabs.length ? t : 0;
|
||||
self.select(t);
|
||||
}, ms);
|
||||
}
|
||||
|
||||
|
||||
function stop(event) {
|
||||
if (!event || event.clientX) { // only in case of a true click
|
||||
clearInterval(self.rotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// start interval
|
||||
if (ms) {
|
||||
start();
|
||||
|
Loading…
Reference in New Issue
Block a user