merge from dev
This commit is contained in:
parent
1c8f02ce0f
commit
33b01d778c
911 changed files with 34157 additions and 57125 deletions
|
@ -1,21 +0,0 @@
|
|||
removed:
|
||||
text input clear
|
||||
flip
|
||||
flow
|
||||
pop
|
||||
slide
|
||||
slidedown
|
||||
slidefade
|
||||
slideup
|
||||
turn
|
||||
nojs
|
||||
listview auto-dividers
|
||||
listview hide-dividers
|
||||
zoom handling
|
||||
ios orientation
|
||||
grid layouts
|
||||
accordions
|
||||
filterable
|
||||
tabs
|
||||
toolbars:fixed
|
||||
selects: custom menus
|
|
@ -1,350 +1,354 @@
|
|||
/*
|
||||
* "checkboxradio" plugin
|
||||
*/
|
||||
define(['jqmwidget'], function () {
|
||||
|
||||
(function ($, undefined) {
|
||||
/*
|
||||
* "checkboxradio" plugin
|
||||
*/
|
||||
|
||||
var escapeId = $.mobile.path.hashToSelector;
|
||||
(function ($, undefined) {
|
||||
|
||||
$.widget("mobile.checkboxradio", $.extend({
|
||||
var escapeId = $.mobile.path.hashToSelector;
|
||||
|
||||
initSelector: "input[type='checkbox']:not([data-role='none']),input[type='radio']:not([data-role='none'])",
|
||||
$.widget("mobile.checkboxradio", $.extend({
|
||||
|
||||
options: {
|
||||
theme: "inherit",
|
||||
mini: false,
|
||||
wrapperClass: null,
|
||||
enhanced: false,
|
||||
iconpos: "left"
|
||||
initSelector: "input[type='checkbox']:not([data-role='none']),input[type='radio']:not([data-role='none'])",
|
||||
|
||||
},
|
||||
_create: function () {
|
||||
var input = this.element,
|
||||
o = this.options,
|
||||
inheritAttr = function (input, dataAttr) {
|
||||
return input.jqmData(dataAttr) ||
|
||||
input.closest("form, fieldset").jqmData(dataAttr);
|
||||
},
|
||||
label = this.options.enhanced ?
|
||||
options: {
|
||||
theme: "inherit",
|
||||
mini: false,
|
||||
wrapperClass: null,
|
||||
enhanced: false,
|
||||
iconpos: "left"
|
||||
|
||||
},
|
||||
_create: function () {
|
||||
var input = this.element,
|
||||
o = this.options,
|
||||
inheritAttr = function (input, dataAttr) {
|
||||
return input.data(dataAttr) ||
|
||||
input.closest("form, fieldset").data(dataAttr);
|
||||
},
|
||||
label = this.options.enhanced ?
|
||||
{
|
||||
element: this.element.siblings("label"),
|
||||
isParent: false
|
||||
} :
|
||||
this._findLabel(),
|
||||
inputtype = input[0].type,
|
||||
checkedClass = "ui-" + inputtype + "-on",
|
||||
uncheckedClass = "ui-" + inputtype + "-off";
|
||||
this._findLabel(),
|
||||
inputtype = input[0].type,
|
||||
checkedClass = "ui-" + inputtype + "-on",
|
||||
uncheckedClass = "ui-" + inputtype + "-off";
|
||||
|
||||
if (inputtype !== "checkbox" && inputtype !== "radio") {
|
||||
return;
|
||||
}
|
||||
if (inputtype !== "checkbox" && inputtype !== "radio") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.element[0].disabled) {
|
||||
this.options.disabled = true;
|
||||
}
|
||||
if (this.element[0].disabled) {
|
||||
this.options.disabled = true;
|
||||
}
|
||||
|
||||
o.iconpos = inheritAttr(input, "iconpos") ||
|
||||
label.element.attr("data-" + $.mobile.ns + "iconpos") || o.iconpos,
|
||||
o.iconpos = inheritAttr(input, "iconpos") ||
|
||||
label.element.attr("data-iconpos") || o.iconpos,
|
||||
|
||||
// Establish options
|
||||
o.mini = inheritAttr(input, "mini") || o.mini;
|
||||
// Establish options
|
||||
o.mini = inheritAttr(input, "mini") || o.mini;
|
||||
|
||||
// Expose for other methods
|
||||
$.extend(this, {
|
||||
input: input,
|
||||
label: label.element,
|
||||
labelIsParent: label.isParent,
|
||||
inputtype: inputtype,
|
||||
checkedClass: checkedClass,
|
||||
uncheckedClass: uncheckedClass
|
||||
});
|
||||
// Expose for other methods
|
||||
$.extend(this, {
|
||||
input: input,
|
||||
label: label.element,
|
||||
labelIsParent: label.isParent,
|
||||
inputtype: inputtype,
|
||||
checkedClass: checkedClass,
|
||||
uncheckedClass: uncheckedClass
|
||||
});
|
||||
|
||||
if (!this.options.enhanced) {
|
||||
this._enhance();
|
||||
}
|
||||
if (!this.options.enhanced) {
|
||||
this._enhance();
|
||||
}
|
||||
|
||||
this._on(label.element, {
|
||||
mouseover: "_handleLabelVMouseOver",
|
||||
click: "_handleLabelVClick"
|
||||
});
|
||||
this._on(label.element, {
|
||||
mouseover: "_handleLabelVMouseOver",
|
||||
click: "_handleLabelVClick"
|
||||
});
|
||||
|
||||
this._on(input, {
|
||||
mousedown: "_cacheVals",
|
||||
click: "_handleInputVClick",
|
||||
focus: "_handleInputFocus",
|
||||
blur: "_handleInputBlur"
|
||||
});
|
||||
this._on(input, {
|
||||
mousedown: "_cacheVals",
|
||||
click: "_handleInputVClick",
|
||||
focus: "_handleInputFocus",
|
||||
blur: "_handleInputBlur"
|
||||
});
|
||||
|
||||
this.refresh();
|
||||
},
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
_findLabel: function () {
|
||||
var parentLabel, label, isParent,
|
||||
input = this.element,
|
||||
labelsList = input[0].labels;
|
||||
_findLabel: function () {
|
||||
var parentLabel, label, isParent,
|
||||
input = this.element,
|
||||
labelsList = input[0].labels;
|
||||
|
||||
if (labelsList && labelsList.length > 0) {
|
||||
label = $(labelsList[0]);
|
||||
isParent = $.contains(label[0], input[0]);
|
||||
} else {
|
||||
parentLabel = input.closest("label");
|
||||
isParent = (parentLabel.length > 0);
|
||||
|
||||
// NOTE: Windows Phone could not find the label through a selector
|
||||
// filter works though.
|
||||
label = isParent ? parentLabel :
|
||||
$(this.document[0].getElementsByTagName("label"))
|
||||
.filter("[for='" + escapeId(input[0].id) + "']")
|
||||
.first();
|
||||
}
|
||||
|
||||
return {
|
||||
element: label,
|
||||
isParent: isParent
|
||||
};
|
||||
},
|
||||
|
||||
_enhance: function () {
|
||||
this.label.addClass("ui-btn ui-corner-all");
|
||||
|
||||
if (this.labelIsParent) {
|
||||
this.input.add(this.label).wrapAll(this._wrapper());
|
||||
} else {
|
||||
//this.element.replaceWith( this.input.add( this.label ).wrapAll( this._wrapper() ) );
|
||||
this.element.wrap(this._wrapper());
|
||||
this.element.parent().prepend(this.label);
|
||||
}
|
||||
|
||||
// Wrap the input + label in a div
|
||||
|
||||
this._setOptions({
|
||||
"theme": this.options.theme,
|
||||
"iconpos": this.options.iconpos,
|
||||
"mini": this.options.mini
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
_wrapper: function () {
|
||||
return $("<div class='" +
|
||||
(this.options.wrapperClass ? this.options.wrapperClass : "") +
|
||||
" ui-" + this.inputtype +
|
||||
(this.options.disabled ? " ui-state-disabled" : "") + "' ></div>");
|
||||
},
|
||||
|
||||
_handleInputFocus: function () {
|
||||
this.label.addClass($.mobile.focusClass);
|
||||
},
|
||||
|
||||
_handleInputBlur: function () {
|
||||
this.label.removeClass($.mobile.focusClass);
|
||||
},
|
||||
|
||||
_handleInputVClick: function () {
|
||||
// Adds checked attribute to checked input when keyboard is used
|
||||
this.element.prop("checked", this.element.is(":checked"));
|
||||
this._getInputSet().not(this.element).prop("checked", false);
|
||||
this._updateAll(true);
|
||||
},
|
||||
|
||||
_handleLabelVMouseOver: function (event) {
|
||||
if (this.label.parent().hasClass("ui-state-disabled")) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
_handleLabelVClick: function (event) {
|
||||
var input = this.element;
|
||||
|
||||
if (input.is(":disabled")) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this._cacheVals();
|
||||
|
||||
input.prop("checked", this.inputtype === "radio" && true || !input.prop("checked"));
|
||||
|
||||
// trigger click handler's bound directly to the input as a substitute for
|
||||
// how label clicks behave normally in the browsers
|
||||
// TODO: it would be nice to let the browser's handle the clicks and pass them
|
||||
// through to the associate input. we can swallow that click at the parent
|
||||
// wrapper element level
|
||||
input.triggerHandler("click");
|
||||
|
||||
// Input set for common radio buttons will contain all the radio
|
||||
// buttons, but will not for checkboxes. clearing the checked status
|
||||
// of other radios ensures the active button state is applied properly
|
||||
this._getInputSet().not(input).prop("checked", false);
|
||||
|
||||
this._updateAll();
|
||||
return false;
|
||||
},
|
||||
|
||||
_cacheVals: function () {
|
||||
this._getInputSet().each(function () {
|
||||
$(this).attr("data-" + $.mobile.ns + "cacheVal", this.checked);
|
||||
});
|
||||
},
|
||||
|
||||
// Returns those radio buttons that are supposed to be in the same group as
|
||||
// this radio button. In the case of a checkbox or a radio lacking a name
|
||||
// attribute, it returns this.element.
|
||||
_getInputSet: function () {
|
||||
var selector, formId,
|
||||
radio = this.element[0],
|
||||
name = radio.name,
|
||||
form = radio.form,
|
||||
doc = this.element.parents().last().get(0),
|
||||
|
||||
// A radio is always a member of its own group
|
||||
radios = this.element;
|
||||
|
||||
// Only start running selectors if this is an attached radio button with a name
|
||||
if (name && this.inputtype === "radio" && doc) {
|
||||
selector = "input[type='radio'][name='" + escapeId(name) + "']";
|
||||
|
||||
// If we're inside a form
|
||||
if (form) {
|
||||
formId = form.getAttribute("id");
|
||||
|
||||
// If the form has an ID, collect radios scattered throught the document which
|
||||
// nevertheless are part of the form by way of the value of their form attribute
|
||||
if (formId) {
|
||||
radios = $(selector + "[form='" + escapeId(formId) + "']", doc);
|
||||
}
|
||||
|
||||
// Also add to those the radios in the form itself
|
||||
radios = $(form).find(selector).filter(function () {
|
||||
|
||||
// Some radios inside the form may belong to some other form by virtue of
|
||||
// having a form attribute defined on them, so we must filter them out here
|
||||
return (this.form === form);
|
||||
}).add(radios);
|
||||
|
||||
// If we're outside a form
|
||||
if (labelsList && labelsList.length > 0) {
|
||||
label = $(labelsList[0]);
|
||||
isParent = $.contains(label[0], input[0]);
|
||||
} else {
|
||||
parentLabel = input.closest("label");
|
||||
isParent = (parentLabel.length > 0);
|
||||
|
||||
// Collect all those radios which are also outside of a form and match our name
|
||||
radios = $(selector, doc).filter(function () {
|
||||
return !this.form;
|
||||
});
|
||||
// NOTE: Windows Phone could not find the label through a selector
|
||||
// filter works though.
|
||||
label = isParent ? parentLabel :
|
||||
$(this.document[0].getElementsByTagName("label"))
|
||||
.filter("[for='" + escapeId(input[0].id) + "']")
|
||||
.first();
|
||||
}
|
||||
}
|
||||
return radios;
|
||||
},
|
||||
|
||||
_updateAll: function (changeTriggered) {
|
||||
var self = this;
|
||||
return {
|
||||
element: label,
|
||||
isParent: isParent
|
||||
};
|
||||
},
|
||||
|
||||
this._getInputSet().each(function () {
|
||||
var $this = $(this);
|
||||
_enhance: function () {
|
||||
this.label.addClass("ui-btn ui-corner-all");
|
||||
|
||||
if ((this.checked || self.inputtype === "checkbox") && !changeTriggered) {
|
||||
$this.trigger("change");
|
||||
if (this.labelIsParent) {
|
||||
this.input.add(this.label).wrapAll(this._wrapper());
|
||||
} else {
|
||||
//this.element.replaceWith( this.input.add( this.label ).wrapAll( this._wrapper() ) );
|
||||
this.element.wrap(this._wrapper());
|
||||
this.element.parent().prepend(this.label);
|
||||
}
|
||||
})
|
||||
.checkboxradio("refresh");
|
||||
},
|
||||
|
||||
_reset: function () {
|
||||
this.refresh();
|
||||
},
|
||||
// Wrap the input + label in a div
|
||||
|
||||
// Is the widget supposed to display an icon?
|
||||
_hasIcon: function () {
|
||||
var controlgroup, controlgroupWidget,
|
||||
controlgroupConstructor = $.mobile.controlgroup;
|
||||
this._setOptions({
|
||||
"theme": this.options.theme,
|
||||
"iconpos": this.options.iconpos,
|
||||
"mini": this.options.mini
|
||||
});
|
||||
|
||||
// If the controlgroup widget is defined ...
|
||||
if (controlgroupConstructor) {
|
||||
controlgroup = this.element.closest(
|
||||
":mobile-controlgroup," +
|
||||
controlgroupConstructor.prototype.initSelector);
|
||||
},
|
||||
|
||||
// ... and the checkbox is in a controlgroup ...
|
||||
if (controlgroup.length > 0) {
|
||||
_wrapper: function () {
|
||||
return $("<div class='" +
|
||||
(this.options.wrapperClass ? this.options.wrapperClass : "") +
|
||||
" ui-" + this.inputtype +
|
||||
(this.options.disabled ? " ui-state-disabled" : "") + "' ></div>");
|
||||
},
|
||||
|
||||
// ... look for a controlgroup widget instance, and ...
|
||||
controlgroupWidget = $.data(controlgroup[0], "mobile-controlgroup");
|
||||
_handleInputFocus: function () {
|
||||
this.label.addClass($.mobile.focusClass);
|
||||
},
|
||||
|
||||
// ... if found, decide based on the option value, ...
|
||||
return ((controlgroupWidget ? controlgroupWidget.options.type :
|
||||
_handleInputBlur: function () {
|
||||
this.label.removeClass($.mobile.focusClass);
|
||||
},
|
||||
|
||||
// ... otherwise decide based on the "type" data attribute.
|
||||
controlgroup.attr("data-" + $.mobile.ns + "type")) !== "horizontal");
|
||||
_handleInputVClick: function () {
|
||||
// Adds checked attribute to checked input when keyboard is used
|
||||
this.element.prop("checked", this.element.is(":checked"));
|
||||
this._getInputSet().not(this.element).prop("checked", false);
|
||||
this._updateAll(true);
|
||||
},
|
||||
|
||||
_handleLabelVMouseOver: function (event) {
|
||||
if (this.label.parent().hasClass("ui-state-disabled")) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
_handleLabelVClick: function (event) {
|
||||
var input = this.element;
|
||||
|
||||
if (input.is(":disabled")) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
this._cacheVals();
|
||||
|
||||
input.prop("checked", this.inputtype === "radio" && true || !input.prop("checked"));
|
||||
|
||||
// trigger click handler's bound directly to the input as a substitute for
|
||||
// how label clicks behave normally in the browsers
|
||||
// TODO: it would be nice to let the browser's handle the clicks and pass them
|
||||
// through to the associate input. we can swallow that click at the parent
|
||||
// wrapper element level
|
||||
input.triggerHandler("click");
|
||||
|
||||
// Input set for common radio buttons will contain all the radio
|
||||
// buttons, but will not for checkboxes. clearing the checked status
|
||||
// of other radios ensures the active button state is applied properly
|
||||
this._getInputSet().not(input).prop("checked", false);
|
||||
|
||||
this._updateAll();
|
||||
return false;
|
||||
},
|
||||
|
||||
_cacheVals: function () {
|
||||
this._getInputSet().each(function () {
|
||||
$(this).attr("data-cacheVal", this.checked);
|
||||
});
|
||||
},
|
||||
|
||||
// Returns those radio buttons that are supposed to be in the same group as
|
||||
// this radio button. In the case of a checkbox or a radio lacking a name
|
||||
// attribute, it returns this.element.
|
||||
_getInputSet: function () {
|
||||
var selector, formId,
|
||||
radio = this.element[0],
|
||||
name = radio.name,
|
||||
form = radio.form,
|
||||
doc = this.element.parents().last().get(0),
|
||||
|
||||
// A radio is always a member of its own group
|
||||
radios = this.element;
|
||||
|
||||
// Only start running selectors if this is an attached radio button with a name
|
||||
if (name && this.inputtype === "radio" && doc) {
|
||||
selector = "input[type='radio'][name='" + escapeId(name) + "']";
|
||||
|
||||
// If we're inside a form
|
||||
if (form) {
|
||||
formId = form.getAttribute("id");
|
||||
|
||||
// If the form has an ID, collect radios scattered throught the document which
|
||||
// nevertheless are part of the form by way of the value of their form attribute
|
||||
if (formId) {
|
||||
radios = $(selector + "[form='" + escapeId(formId) + "']", doc);
|
||||
}
|
||||
|
||||
// Also add to those the radios in the form itself
|
||||
radios = $(form).find(selector).filter(function () {
|
||||
|
||||
// Some radios inside the form may belong to some other form by virtue of
|
||||
// having a form attribute defined on them, so we must filter them out here
|
||||
return (this.form === form);
|
||||
}).add(radios);
|
||||
|
||||
// If we're outside a form
|
||||
} else {
|
||||
|
||||
// Collect all those radios which are also outside of a form and match our name
|
||||
radios = $(selector, doc).filter(function () {
|
||||
return !this.form;
|
||||
});
|
||||
}
|
||||
}
|
||||
return radios;
|
||||
},
|
||||
|
||||
_updateAll: function (changeTriggered) {
|
||||
var self = this;
|
||||
|
||||
this._getInputSet().each(function () {
|
||||
var $this = $(this);
|
||||
|
||||
if ((this.checked || self.inputtype === "checkbox") && !changeTriggered) {
|
||||
$this.trigger("change");
|
||||
}
|
||||
})
|
||||
.checkboxradio("refresh");
|
||||
},
|
||||
|
||||
_reset: function () {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
// Is the widget supposed to display an icon?
|
||||
_hasIcon: function () {
|
||||
var controlgroup, controlgroupWidget,
|
||||
controlgroupConstructor = $.mobile.controlgroup;
|
||||
|
||||
// If the controlgroup widget is defined ...
|
||||
if (controlgroupConstructor) {
|
||||
controlgroup = this.element.closest(
|
||||
":mobile-controlgroup," +
|
||||
controlgroupConstructor.prototype.initSelector);
|
||||
|
||||
// ... and the checkbox is in a controlgroup ...
|
||||
if (controlgroup.length > 0) {
|
||||
|
||||
// ... look for a controlgroup widget instance, and ...
|
||||
controlgroupWidget = $.data(controlgroup[0], "mobile-controlgroup");
|
||||
|
||||
// ... if found, decide based on the option value, ...
|
||||
return ((controlgroupWidget ? controlgroupWidget.options.type :
|
||||
|
||||
// ... otherwise decide based on the "type" data attribute.
|
||||
controlgroup.attr("data-type")) !== "horizontal");
|
||||
}
|
||||
}
|
||||
|
||||
// Normally, the widget displays an icon.
|
||||
return true;
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
var isChecked = this.element[0].checked,
|
||||
active = $.mobile.activeBtnClass,
|
||||
iconposClass = "ui-btn-icon-" + this.options.iconpos,
|
||||
addClasses = [],
|
||||
removeClasses = [];
|
||||
|
||||
if (this._hasIcon()) {
|
||||
removeClasses.push(active);
|
||||
addClasses.push(iconposClass);
|
||||
} else {
|
||||
removeClasses.push(iconposClass);
|
||||
(isChecked ? addClasses : removeClasses).push(active);
|
||||
}
|
||||
|
||||
if (isChecked) {
|
||||
addClasses.push(this.checkedClass);
|
||||
removeClasses.push(this.uncheckedClass);
|
||||
} else {
|
||||
addClasses.push(this.uncheckedClass);
|
||||
removeClasses.push(this.checkedClass);
|
||||
}
|
||||
|
||||
this.widget().toggleClass("ui-state-disabled", this.element.prop("disabled"));
|
||||
|
||||
this.label
|
||||
.addClass(addClasses.join(" "))
|
||||
.removeClass(removeClasses.join(" "));
|
||||
},
|
||||
|
||||
widget: function () {
|
||||
return this.label.parent();
|
||||
},
|
||||
|
||||
_setOptions: function (options) {
|
||||
var label = this.label,
|
||||
currentOptions = this.options,
|
||||
outer = this.widget(),
|
||||
hasIcon = this._hasIcon();
|
||||
|
||||
if (options.disabled !== undefined) {
|
||||
this.input.prop("disabled", !!options.disabled);
|
||||
outer.toggleClass("ui-state-disabled", !!options.disabled);
|
||||
}
|
||||
if (options.mini !== undefined) {
|
||||
outer.toggleClass("ui-mini", !!options.mini);
|
||||
}
|
||||
if (options.theme !== undefined) {
|
||||
label
|
||||
.removeClass("ui-btn-" + currentOptions.theme)
|
||||
.addClass("ui-btn-" + options.theme);
|
||||
}
|
||||
if (options.wrapperClass !== undefined) {
|
||||
outer
|
||||
.removeClass(currentOptions.wrapperClass)
|
||||
.addClass(options.wrapperClass);
|
||||
}
|
||||
if (options.iconpos !== undefined && hasIcon) {
|
||||
label.removeClass("ui-btn-icon-" + currentOptions.iconpos).addClass("ui-btn-icon-" + options.iconpos);
|
||||
} else if (!hasIcon) {
|
||||
label.removeClass("ui-btn-icon-" + currentOptions.iconpos);
|
||||
}
|
||||
this._super(options);
|
||||
}
|
||||
|
||||
// Normally, the widget displays an icon.
|
||||
return true;
|
||||
},
|
||||
}, $.mobile.behaviors.formReset));
|
||||
|
||||
refresh: function () {
|
||||
var isChecked = this.element[0].checked,
|
||||
active = $.mobile.activeBtnClass,
|
||||
iconposClass = "ui-btn-icon-" + this.options.iconpos,
|
||||
addClasses = [],
|
||||
removeClasses = [];
|
||||
})(jQuery);
|
||||
|
||||
if (this._hasIcon()) {
|
||||
removeClasses.push(active);
|
||||
addClasses.push(iconposClass);
|
||||
} else {
|
||||
removeClasses.push(iconposClass);
|
||||
(isChecked ? addClasses : removeClasses).push(active);
|
||||
}
|
||||
|
||||
if (isChecked) {
|
||||
addClasses.push(this.checkedClass);
|
||||
removeClasses.push(this.uncheckedClass);
|
||||
} else {
|
||||
addClasses.push(this.uncheckedClass);
|
||||
removeClasses.push(this.checkedClass);
|
||||
}
|
||||
|
||||
this.widget().toggleClass("ui-state-disabled", this.element.prop("disabled"));
|
||||
|
||||
this.label
|
||||
.addClass(addClasses.join(" "))
|
||||
.removeClass(removeClasses.join(" "));
|
||||
},
|
||||
|
||||
widget: function () {
|
||||
return this.label.parent();
|
||||
},
|
||||
|
||||
_setOptions: function (options) {
|
||||
var label = this.label,
|
||||
currentOptions = this.options,
|
||||
outer = this.widget(),
|
||||
hasIcon = this._hasIcon();
|
||||
|
||||
if (options.disabled !== undefined) {
|
||||
this.input.prop("disabled", !!options.disabled);
|
||||
outer.toggleClass("ui-state-disabled", !!options.disabled);
|
||||
}
|
||||
if (options.mini !== undefined) {
|
||||
outer.toggleClass("ui-mini", !!options.mini);
|
||||
}
|
||||
if (options.theme !== undefined) {
|
||||
label
|
||||
.removeClass("ui-btn-" + currentOptions.theme)
|
||||
.addClass("ui-btn-" + options.theme);
|
||||
}
|
||||
if (options.wrapperClass !== undefined) {
|
||||
outer
|
||||
.removeClass(currentOptions.wrapperClass)
|
||||
.addClass(options.wrapperClass);
|
||||
}
|
||||
if (options.iconpos !== undefined && hasIcon) {
|
||||
label.removeClass("ui-btn-icon-" + currentOptions.iconpos).addClass("ui-btn-icon-" + options.iconpos);
|
||||
} else if (!hasIcon) {
|
||||
label.removeClass("ui-btn-icon-" + currentOptions.iconpos);
|
||||
}
|
||||
this._super(options);
|
||||
}
|
||||
|
||||
}, $.mobile.behaviors.formReset));
|
||||
|
||||
})(jQuery);
|
||||
});
|
|
@ -1,348 +1,388 @@
|
|||
(function ($, undefined) {
|
||||
define(['jqmwidget'], function () {
|
||||
|
||||
var rInitialLetter = /([A-Z])/g,
|
||||
(function ($, window, undefined) {
|
||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
||||
|
||||
// Construct iconpos class from iconpos value
|
||||
iconposClass = function (iconpos) {
|
||||
return ("ui-btn-icon-" + (iconpos === null ? "left" : iconpos));
|
||||
$.extend($.mobile, {
|
||||
|
||||
// Namespace used framework-wide for data-attrs. Default is no namespace
|
||||
|
||||
// Retrieve an attribute from an element and perform some massaging of the value
|
||||
|
||||
getAttribute: function (element, key) {
|
||||
var data;
|
||||
|
||||
element = element.jquery ? element[0] : element;
|
||||
|
||||
if (element && element.getAttribute) {
|
||||
data = element.getAttribute("data-" + key);
|
||||
}
|
||||
|
||||
// Copied from core's src/data.js:dataAttr()
|
||||
// Convert from a string to a proper data type
|
||||
try {
|
||||
data = data === "true" ? true :
|
||||
data === "false" ? false :
|
||||
data === "null" ? null :
|
||||
// Only convert to a number if it doesn't change the string
|
||||
+data + "" === data ? +data :
|
||||
rbrace.test(data) ? JSON.parse(data) :
|
||||
data;
|
||||
} catch (err) { }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, this);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
var rInitialLetter = /([A-Z])/g,
|
||||
|
||||
// Construct iconpos class from iconpos value
|
||||
iconposClass = function (iconpos) {
|
||||
return ("ui-btn-icon-" + (iconpos === null ? "left" : iconpos));
|
||||
};
|
||||
|
||||
$.widget("mobile.collapsible", {
|
||||
options: {
|
||||
enhanced: false,
|
||||
expandCueText: null,
|
||||
collapseCueText: null,
|
||||
collapsed: true,
|
||||
heading: "h1,h2,h3,h4,h5,h6,legend",
|
||||
collapsedIcon: null,
|
||||
expandedIcon: null,
|
||||
iconpos: null,
|
||||
theme: null,
|
||||
contentTheme: null,
|
||||
inset: null,
|
||||
corners: null,
|
||||
mini: null
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
var elem = this.element,
|
||||
ui = {
|
||||
accordion: elem
|
||||
.closest("[data-role='collapsible-set']," +
|
||||
"[data-role='collapsibleset']" +
|
||||
($.mobile.collapsibleset ? ", :mobile-collapsibleset" :
|
||||
""))
|
||||
.addClass("ui-collapsible-set")
|
||||
};
|
||||
|
||||
this._ui = ui;
|
||||
this._renderedOptions = this._getOptions(this.options);
|
||||
|
||||
if (this.options.enhanced) {
|
||||
ui.heading = this.element.children(".ui-collapsible-heading");
|
||||
ui.content = ui.heading.next();
|
||||
ui.anchor = ui.heading.children();
|
||||
ui.status = ui.anchor.children(".ui-collapsible-heading-status");
|
||||
} else {
|
||||
this._enhance(elem, ui);
|
||||
}
|
||||
|
||||
this._on(ui.heading, {
|
||||
"tap": function () {
|
||||
ui.heading.find("a").first().addClass($.mobile.activeBtnClass);
|
||||
},
|
||||
|
||||
"click": function (event) {
|
||||
this._handleExpandCollapse(!ui.heading.hasClass("ui-collapsible-heading-collapsed"));
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Adjust the keys inside options for inherited values
|
||||
_getOptions: function (options) {
|
||||
var key,
|
||||
accordion = this._ui.accordion,
|
||||
accordionWidget = this._ui.accordionWidget;
|
||||
|
||||
// Copy options
|
||||
options = $.extend({}, options);
|
||||
|
||||
if (accordion.length && !accordionWidget) {
|
||||
this._ui.accordionWidget =
|
||||
accordionWidget = accordion.data("mobile-collapsibleset");
|
||||
}
|
||||
|
||||
for (key in options) {
|
||||
|
||||
// Retrieve the option value first from the options object passed in and, if
|
||||
// null, from the parent accordion or, if that's null too, or if there's no
|
||||
// parent accordion, then from the defaults.
|
||||
options[key] =
|
||||
(options[key] != null) ? options[key] :
|
||||
(accordionWidget) ? accordionWidget.options[key] :
|
||||
accordion.length ? $.mobile.getAttribute(accordion[0],
|
||||
key.replace(rInitialLetter, "-$1").toLowerCase()) :
|
||||
null;
|
||||
|
||||
if (null == options[key]) {
|
||||
options[key] = $.mobile.collapsible.defaults[key];
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_themeClassFromOption: function (prefix, value) {
|
||||
return (value ? (value === "none" ? "" : prefix + value) : "");
|
||||
},
|
||||
|
||||
_enhance: function (elem, ui) {
|
||||
var iconclass,
|
||||
opts = this._renderedOptions,
|
||||
contentThemeClass = this._themeClassFromOption("ui-body-", opts.contentTheme);
|
||||
|
||||
elem.addClass("ui-collapsible " +
|
||||
(opts.inset ? "ui-collapsible-inset " : "") +
|
||||
(opts.inset && opts.corners ? "ui-corner-all " : "") +
|
||||
(contentThemeClass ? "ui-collapsible-themed-content " : ""));
|
||||
ui.originalHeading = elem.children(this.options.heading).first(),
|
||||
ui.content = elem
|
||||
.wrapInner("<div " +
|
||||
"class='ui-collapsible-content " +
|
||||
contentThemeClass + "'></div>")
|
||||
.children(".ui-collapsible-content"),
|
||||
ui.heading = ui.originalHeading;
|
||||
|
||||
// Replace collapsibleHeading if it's a legend
|
||||
if (ui.heading.is("legend")) {
|
||||
ui.heading = $("<div role='heading'>" + ui.heading.html() + "</div>");
|
||||
ui.placeholder = $("<div><!-- placeholder for legend --></div>").insertBefore(ui.originalHeading);
|
||||
ui.originalHeading.remove();
|
||||
}
|
||||
|
||||
iconclass = (opts.collapsed ? (opts.collapsedIcon ? "ui-icon-" + opts.collapsedIcon : "") :
|
||||
(opts.expandedIcon ? "ui-icon-" + opts.expandedIcon : ""));
|
||||
|
||||
ui.status = $("<span class='ui-collapsible-heading-status'></span>");
|
||||
ui.anchor = ui.heading
|
||||
.detach()
|
||||
//modify markup & attributes
|
||||
.addClass("ui-collapsible-heading")
|
||||
.append(ui.status)
|
||||
.wrapInner("<a href='#' class='ui-collapsible-heading-toggle'></a>")
|
||||
.find("a")
|
||||
.first()
|
||||
.addClass("ui-btn " +
|
||||
(iconclass ? iconclass + " " : "") +
|
||||
(iconclass ? iconposClass(opts.iconpos) +
|
||||
" " : "") +
|
||||
this._themeClassFromOption("ui-btn-", opts.theme) + " " +
|
||||
(opts.mini ? "ui-mini " : ""));
|
||||
|
||||
//drop heading in before content
|
||||
ui.heading.insertBefore(ui.content);
|
||||
|
||||
this._handleExpandCollapse(this.options.collapsed);
|
||||
|
||||
return ui;
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
this._applyOptions(this.options);
|
||||
this._renderedOptions = this._getOptions(this.options);
|
||||
},
|
||||
|
||||
_applyOptions: function (options) {
|
||||
var isCollapsed, newTheme, oldTheme, hasCorners, hasIcon,
|
||||
elem = this.element,
|
||||
currentOpts = this._renderedOptions,
|
||||
ui = this._ui,
|
||||
anchor = ui.anchor,
|
||||
status = ui.status,
|
||||
opts = this._getOptions(options);
|
||||
|
||||
// First and foremost we need to make sure the collapsible is in the proper
|
||||
// state, in case somebody decided to change the collapsed option at the
|
||||
// same time as another option
|
||||
if (options.collapsed !== undefined) {
|
||||
this._handleExpandCollapse(options.collapsed);
|
||||
}
|
||||
|
||||
isCollapsed = elem.hasClass("ui-collapsible-collapsed");
|
||||
|
||||
// We only need to apply the cue text for the current state right away.
|
||||
// The cue text for the alternate state will be stored in the options
|
||||
// and applied the next time the collapsible's state is toggled
|
||||
if (isCollapsed) {
|
||||
if (opts.expandCueText !== undefined) {
|
||||
status.text(opts.expandCueText);
|
||||
}
|
||||
} else {
|
||||
if (opts.collapseCueText !== undefined) {
|
||||
status.text(opts.collapseCueText);
|
||||
}
|
||||
}
|
||||
|
||||
// Update icon
|
||||
|
||||
// Is it supposed to have an icon?
|
||||
hasIcon =
|
||||
|
||||
// If the collapsedIcon is being set, consult that
|
||||
(opts.collapsedIcon !== undefined ? opts.collapsedIcon !== false :
|
||||
|
||||
// Otherwise consult the existing option value
|
||||
currentOpts.collapsedIcon !== false);
|
||||
|
||||
|
||||
// If any icon-related options have changed, make sure the new icon
|
||||
// state is reflected by first removing all icon-related classes
|
||||
// reflecting the current state and then adding all icon-related
|
||||
// classes for the new state
|
||||
if (!(opts.iconpos === undefined &&
|
||||
opts.collapsedIcon === undefined &&
|
||||
opts.expandedIcon === undefined)) {
|
||||
|
||||
// Remove all current icon-related classes
|
||||
anchor.removeClass([iconposClass(currentOpts.iconpos)]
|
||||
.concat((currentOpts.expandedIcon ?
|
||||
["ui-icon-" + currentOpts.expandedIcon] : []))
|
||||
.concat((currentOpts.collapsedIcon ?
|
||||
["ui-icon-" + currentOpts.collapsedIcon] : []))
|
||||
.join(" "));
|
||||
|
||||
// Add new classes if an icon is supposed to be present
|
||||
if (hasIcon) {
|
||||
anchor.addClass(
|
||||
[iconposClass(opts.iconpos !== undefined ?
|
||||
opts.iconpos : currentOpts.iconpos)]
|
||||
.concat(isCollapsed ?
|
||||
["ui-icon-" + (opts.collapsedIcon !== undefined ?
|
||||
opts.collapsedIcon :
|
||||
currentOpts.collapsedIcon)] :
|
||||
["ui-icon-" + (opts.expandedIcon !== undefined ?
|
||||
opts.expandedIcon :
|
||||
currentOpts.expandedIcon)])
|
||||
.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.theme !== undefined) {
|
||||
oldTheme = this._themeClassFromOption("ui-btn-", currentOpts.theme);
|
||||
newTheme = this._themeClassFromOption("ui-btn-", opts.theme);
|
||||
anchor.removeClass(oldTheme).addClass(newTheme);
|
||||
}
|
||||
|
||||
if (opts.contentTheme !== undefined) {
|
||||
oldTheme = this._themeClassFromOption("ui-body-",
|
||||
currentOpts.contentTheme);
|
||||
newTheme = this._themeClassFromOption("ui-body-",
|
||||
opts.contentTheme);
|
||||
ui.content.removeClass(oldTheme).addClass(newTheme);
|
||||
}
|
||||
|
||||
if (opts.inset !== undefined) {
|
||||
elem.toggleClass("ui-collapsible-inset", opts.inset);
|
||||
hasCorners = !!(opts.inset && (opts.corners || currentOpts.corners));
|
||||
}
|
||||
|
||||
if (opts.corners !== undefined) {
|
||||
hasCorners = !!(opts.corners && (opts.inset || currentOpts.inset));
|
||||
}
|
||||
|
||||
if (hasCorners !== undefined) {
|
||||
elem.toggleClass("ui-corner-all", hasCorners);
|
||||
}
|
||||
|
||||
if (opts.mini !== undefined) {
|
||||
anchor.toggleClass("ui-mini", opts.mini);
|
||||
}
|
||||
},
|
||||
|
||||
_setOptions: function (options) {
|
||||
this._applyOptions(options);
|
||||
this._super(options);
|
||||
this._renderedOptions = this._getOptions(this.options);
|
||||
},
|
||||
|
||||
_handleExpandCollapse: function (isCollapse) {
|
||||
var opts = this._renderedOptions,
|
||||
ui = this._ui;
|
||||
|
||||
ui.status.text(isCollapse ? opts.expandCueText : opts.collapseCueText);
|
||||
ui.heading
|
||||
.toggleClass("ui-collapsible-heading-collapsed", isCollapse)
|
||||
.find("a").first()
|
||||
.toggleClass("ui-icon-" + opts.expandedIcon, !isCollapse)
|
||||
|
||||
// logic or cause same icon for expanded/collapsed state would remove the ui-icon-class
|
||||
.toggleClass("ui-icon-" + opts.collapsedIcon, (isCollapse || opts.expandedIcon === opts.collapsedIcon))
|
||||
.removeClass($.mobile.activeBtnClass);
|
||||
|
||||
this.element.toggleClass("ui-collapsible-collapsed", isCollapse);
|
||||
ui.content
|
||||
.toggleClass("ui-collapsible-content-collapsed", isCollapse)
|
||||
.attr("aria-hidden", isCollapse)
|
||||
.trigger("updatelayout");
|
||||
this.options.collapsed = isCollapse;
|
||||
this._trigger(isCollapse ? "collapse" : "expand");
|
||||
},
|
||||
|
||||
expand: function () {
|
||||
this._handleExpandCollapse(false);
|
||||
},
|
||||
|
||||
collapse: function () {
|
||||
this._handleExpandCollapse(true);
|
||||
},
|
||||
|
||||
_destroy: function () {
|
||||
var ui = this._ui,
|
||||
opts = this.options;
|
||||
|
||||
if (opts.enhanced) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui.placeholder) {
|
||||
ui.originalHeading.insertBefore(ui.placeholder);
|
||||
ui.placeholder.remove();
|
||||
ui.heading.remove();
|
||||
} else {
|
||||
ui.status.remove();
|
||||
ui.heading
|
||||
.removeClass("ui-collapsible-heading ui-collapsible-heading-collapsed")
|
||||
.children()
|
||||
.contents()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
ui.anchor.contents().unwrap();
|
||||
ui.content.contents().unwrap();
|
||||
this.element
|
||||
.removeClass("ui-collapsible ui-collapsible-collapsed " +
|
||||
"ui-collapsible-themed-content ui-collapsible-inset ui-corner-all");
|
||||
}
|
||||
});
|
||||
|
||||
// Defaults to be used by all instances of collapsible if per-instance values
|
||||
// are unset or if nothing is specified by way of inheritance from an accordion.
|
||||
// Note that this hash does not contain options "collapsed" or "heading",
|
||||
// because those are not inheritable.
|
||||
$.mobile.collapsible.defaults = {
|
||||
expandCueText: " click to expand contents",
|
||||
collapseCueText: " click to collapse contents",
|
||||
collapsedIcon: "plus",
|
||||
contentTheme: "inherit",
|
||||
expandedIcon: "minus",
|
||||
iconpos: "left",
|
||||
inset: true,
|
||||
corners: true,
|
||||
theme: "inherit",
|
||||
mini: false
|
||||
};
|
||||
|
||||
$.widget("mobile.collapsible", {
|
||||
options: {
|
||||
enhanced: false,
|
||||
expandCueText: null,
|
||||
collapseCueText: null,
|
||||
collapsed: true,
|
||||
heading: "h1,h2,h3,h4,h5,h6,legend",
|
||||
collapsedIcon: null,
|
||||
expandedIcon: null,
|
||||
iconpos: null,
|
||||
theme: null,
|
||||
contentTheme: null,
|
||||
inset: null,
|
||||
corners: null,
|
||||
mini: null
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
var elem = this.element,
|
||||
ui = {
|
||||
accordion: elem
|
||||
.closest(":jqmData(role='collapsible-set')," +
|
||||
":jqmData(role='collapsibleset')" +
|
||||
($.mobile.collapsibleset ? ", :mobile-collapsibleset" :
|
||||
""))
|
||||
.addClass("ui-collapsible-set")
|
||||
};
|
||||
|
||||
this._ui = ui;
|
||||
this._renderedOptions = this._getOptions(this.options);
|
||||
|
||||
if (this.options.enhanced) {
|
||||
ui.heading = this.element.children(".ui-collapsible-heading");
|
||||
ui.content = ui.heading.next();
|
||||
ui.anchor = ui.heading.children();
|
||||
ui.status = ui.anchor.children(".ui-collapsible-heading-status");
|
||||
} else {
|
||||
this._enhance(elem, ui);
|
||||
}
|
||||
|
||||
this._on(ui.heading, {
|
||||
"tap": function () {
|
||||
ui.heading.find("a").first().addClass($.mobile.activeBtnClass);
|
||||
},
|
||||
|
||||
"click": function (event) {
|
||||
this._handleExpandCollapse(!ui.heading.hasClass("ui-collapsible-heading-collapsed"));
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Adjust the keys inside options for inherited values
|
||||
_getOptions: function (options) {
|
||||
var key,
|
||||
accordion = this._ui.accordion,
|
||||
accordionWidget = this._ui.accordionWidget;
|
||||
|
||||
// Copy options
|
||||
options = $.extend({}, options);
|
||||
|
||||
if (accordion.length && !accordionWidget) {
|
||||
this._ui.accordionWidget =
|
||||
accordionWidget = accordion.data("mobile-collapsibleset");
|
||||
}
|
||||
|
||||
for (key in options) {
|
||||
|
||||
// Retrieve the option value first from the options object passed in and, if
|
||||
// null, from the parent accordion or, if that's null too, or if there's no
|
||||
// parent accordion, then from the defaults.
|
||||
options[key] =
|
||||
(options[key] != null) ? options[key] :
|
||||
(accordionWidget) ? accordionWidget.options[key] :
|
||||
accordion.length ? $.mobile.getAttribute(accordion[0],
|
||||
key.replace(rInitialLetter, "-$1").toLowerCase()) :
|
||||
null;
|
||||
|
||||
if (null == options[key]) {
|
||||
options[key] = $.mobile.collapsible.defaults[key];
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
_themeClassFromOption: function (prefix, value) {
|
||||
return (value ? (value === "none" ? "" : prefix + value) : "");
|
||||
},
|
||||
|
||||
_enhance: function (elem, ui) {
|
||||
var iconclass,
|
||||
opts = this._renderedOptions,
|
||||
contentThemeClass = this._themeClassFromOption("ui-body-", opts.contentTheme);
|
||||
|
||||
elem.addClass("ui-collapsible " +
|
||||
(opts.inset ? "ui-collapsible-inset " : "") +
|
||||
(opts.inset && opts.corners ? "ui-corner-all " : "") +
|
||||
(contentThemeClass ? "ui-collapsible-themed-content " : ""));
|
||||
ui.originalHeading = elem.children(this.options.heading).first(),
|
||||
ui.content = elem
|
||||
.wrapInner("<div " +
|
||||
"class='ui-collapsible-content " +
|
||||
contentThemeClass + "'></div>")
|
||||
.children(".ui-collapsible-content"),
|
||||
ui.heading = ui.originalHeading;
|
||||
|
||||
// Replace collapsibleHeading if it's a legend
|
||||
if (ui.heading.is("legend")) {
|
||||
ui.heading = $("<div role='heading'>" + ui.heading.html() + "</div>");
|
||||
ui.placeholder = $("<div><!-- placeholder for legend --></div>").insertBefore(ui.originalHeading);
|
||||
ui.originalHeading.remove();
|
||||
}
|
||||
|
||||
iconclass = (opts.collapsed ? (opts.collapsedIcon ? "ui-icon-" + opts.collapsedIcon : "") :
|
||||
(opts.expandedIcon ? "ui-icon-" + opts.expandedIcon : ""));
|
||||
|
||||
ui.status = $("<span class='ui-collapsible-heading-status'></span>");
|
||||
ui.anchor = ui.heading
|
||||
.detach()
|
||||
//modify markup & attributes
|
||||
.addClass("ui-collapsible-heading")
|
||||
.append(ui.status)
|
||||
.wrapInner("<a href='#' class='ui-collapsible-heading-toggle'></a>")
|
||||
.find("a")
|
||||
.first()
|
||||
.addClass("ui-btn " +
|
||||
(iconclass ? iconclass + " " : "") +
|
||||
(iconclass ? iconposClass(opts.iconpos) +
|
||||
" " : "") +
|
||||
this._themeClassFromOption("ui-btn-", opts.theme) + " " +
|
||||
(opts.mini ? "ui-mini " : ""));
|
||||
|
||||
//drop heading in before content
|
||||
ui.heading.insertBefore(ui.content);
|
||||
|
||||
this._handleExpandCollapse(this.options.collapsed);
|
||||
|
||||
return ui;
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
this._applyOptions(this.options);
|
||||
this._renderedOptions = this._getOptions(this.options);
|
||||
},
|
||||
|
||||
_applyOptions: function (options) {
|
||||
var isCollapsed, newTheme, oldTheme, hasCorners, hasIcon,
|
||||
elem = this.element,
|
||||
currentOpts = this._renderedOptions,
|
||||
ui = this._ui,
|
||||
anchor = ui.anchor,
|
||||
status = ui.status,
|
||||
opts = this._getOptions(options);
|
||||
|
||||
// First and foremost we need to make sure the collapsible is in the proper
|
||||
// state, in case somebody decided to change the collapsed option at the
|
||||
// same time as another option
|
||||
if (options.collapsed !== undefined) {
|
||||
this._handleExpandCollapse(options.collapsed);
|
||||
}
|
||||
|
||||
isCollapsed = elem.hasClass("ui-collapsible-collapsed");
|
||||
|
||||
// We only need to apply the cue text for the current state right away.
|
||||
// The cue text for the alternate state will be stored in the options
|
||||
// and applied the next time the collapsible's state is toggled
|
||||
if (isCollapsed) {
|
||||
if (opts.expandCueText !== undefined) {
|
||||
status.text(opts.expandCueText);
|
||||
}
|
||||
} else {
|
||||
if (opts.collapseCueText !== undefined) {
|
||||
status.text(opts.collapseCueText);
|
||||
}
|
||||
}
|
||||
|
||||
// Update icon
|
||||
|
||||
// Is it supposed to have an icon?
|
||||
hasIcon =
|
||||
|
||||
// If the collapsedIcon is being set, consult that
|
||||
(opts.collapsedIcon !== undefined ? opts.collapsedIcon !== false :
|
||||
|
||||
// Otherwise consult the existing option value
|
||||
currentOpts.collapsedIcon !== false);
|
||||
|
||||
|
||||
// If any icon-related options have changed, make sure the new icon
|
||||
// state is reflected by first removing all icon-related classes
|
||||
// reflecting the current state and then adding all icon-related
|
||||
// classes for the new state
|
||||
if (!(opts.iconpos === undefined &&
|
||||
opts.collapsedIcon === undefined &&
|
||||
opts.expandedIcon === undefined)) {
|
||||
|
||||
// Remove all current icon-related classes
|
||||
anchor.removeClass([iconposClass(currentOpts.iconpos)]
|
||||
.concat((currentOpts.expandedIcon ?
|
||||
["ui-icon-" + currentOpts.expandedIcon] : []))
|
||||
.concat((currentOpts.collapsedIcon ?
|
||||
["ui-icon-" + currentOpts.collapsedIcon] : []))
|
||||
.join(" "));
|
||||
|
||||
// Add new classes if an icon is supposed to be present
|
||||
if (hasIcon) {
|
||||
anchor.addClass(
|
||||
[iconposClass(opts.iconpos !== undefined ?
|
||||
opts.iconpos : currentOpts.iconpos)]
|
||||
.concat(isCollapsed ?
|
||||
["ui-icon-" + (opts.collapsedIcon !== undefined ?
|
||||
opts.collapsedIcon :
|
||||
currentOpts.collapsedIcon)] :
|
||||
["ui-icon-" + (opts.expandedIcon !== undefined ?
|
||||
opts.expandedIcon :
|
||||
currentOpts.expandedIcon)])
|
||||
.join(" "));
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.theme !== undefined) {
|
||||
oldTheme = this._themeClassFromOption("ui-btn-", currentOpts.theme);
|
||||
newTheme = this._themeClassFromOption("ui-btn-", opts.theme);
|
||||
anchor.removeClass(oldTheme).addClass(newTheme);
|
||||
}
|
||||
|
||||
if (opts.contentTheme !== undefined) {
|
||||
oldTheme = this._themeClassFromOption("ui-body-",
|
||||
currentOpts.contentTheme);
|
||||
newTheme = this._themeClassFromOption("ui-body-",
|
||||
opts.contentTheme);
|
||||
ui.content.removeClass(oldTheme).addClass(newTheme);
|
||||
}
|
||||
|
||||
if (opts.inset !== undefined) {
|
||||
elem.toggleClass("ui-collapsible-inset", opts.inset);
|
||||
hasCorners = !!(opts.inset && (opts.corners || currentOpts.corners));
|
||||
}
|
||||
|
||||
if (opts.corners !== undefined) {
|
||||
hasCorners = !!(opts.corners && (opts.inset || currentOpts.inset));
|
||||
}
|
||||
|
||||
if (hasCorners !== undefined) {
|
||||
elem.toggleClass("ui-corner-all", hasCorners);
|
||||
}
|
||||
|
||||
if (opts.mini !== undefined) {
|
||||
anchor.toggleClass("ui-mini", opts.mini);
|
||||
}
|
||||
},
|
||||
|
||||
_setOptions: function (options) {
|
||||
this._applyOptions(options);
|
||||
this._super(options);
|
||||
this._renderedOptions = this._getOptions(this.options);
|
||||
},
|
||||
|
||||
_handleExpandCollapse: function (isCollapse) {
|
||||
var opts = this._renderedOptions,
|
||||
ui = this._ui;
|
||||
|
||||
ui.status.text(isCollapse ? opts.expandCueText : opts.collapseCueText);
|
||||
ui.heading
|
||||
.toggleClass("ui-collapsible-heading-collapsed", isCollapse)
|
||||
.find("a").first()
|
||||
.toggleClass("ui-icon-" + opts.expandedIcon, !isCollapse)
|
||||
|
||||
// logic or cause same icon for expanded/collapsed state would remove the ui-icon-class
|
||||
.toggleClass("ui-icon-" + opts.collapsedIcon, (isCollapse || opts.expandedIcon === opts.collapsedIcon))
|
||||
.removeClass($.mobile.activeBtnClass);
|
||||
|
||||
this.element.toggleClass("ui-collapsible-collapsed", isCollapse);
|
||||
ui.content
|
||||
.toggleClass("ui-collapsible-content-collapsed", isCollapse)
|
||||
.attr("aria-hidden", isCollapse)
|
||||
.trigger("updatelayout");
|
||||
this.options.collapsed = isCollapse;
|
||||
this._trigger(isCollapse ? "collapse" : "expand");
|
||||
},
|
||||
|
||||
expand: function () {
|
||||
this._handleExpandCollapse(false);
|
||||
},
|
||||
|
||||
collapse: function () {
|
||||
this._handleExpandCollapse(true);
|
||||
},
|
||||
|
||||
_destroy: function () {
|
||||
var ui = this._ui,
|
||||
opts = this.options;
|
||||
|
||||
if (opts.enhanced) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ui.placeholder) {
|
||||
ui.originalHeading.insertBefore(ui.placeholder);
|
||||
ui.placeholder.remove();
|
||||
ui.heading.remove();
|
||||
} else {
|
||||
ui.status.remove();
|
||||
ui.heading
|
||||
.removeClass("ui-collapsible-heading ui-collapsible-heading-collapsed")
|
||||
.children()
|
||||
.contents()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
ui.anchor.contents().unwrap();
|
||||
ui.content.contents().unwrap();
|
||||
this.element
|
||||
.removeClass("ui-collapsible ui-collapsible-collapsed " +
|
||||
"ui-collapsible-themed-content ui-collapsible-inset ui-corner-all");
|
||||
}
|
||||
});
|
||||
|
||||
// Defaults to be used by all instances of collapsible if per-instance values
|
||||
// are unset or if nothing is specified by way of inheritance from an accordion.
|
||||
// Note that this hash does not contain options "collapsed" or "heading",
|
||||
// because those are not inheritable.
|
||||
$.mobile.collapsible.defaults = {
|
||||
expandCueText: " click to expand contents",
|
||||
collapseCueText: " click to collapse contents",
|
||||
collapsedIcon: "plus",
|
||||
contentTheme: "inherit",
|
||||
expandedIcon: "minus",
|
||||
iconpos: "left",
|
||||
inset: true,
|
||||
corners: true,
|
||||
theme: "inherit",
|
||||
mini: false
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
|
||||
});
|
|
@ -1,222 +1,246 @@
|
|||
(function ($, undefined) {
|
||||
define(['jqmwidget'], function () {
|
||||
|
||||
var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
|
||||
function noHiddenClass(elements) {
|
||||
var index,
|
||||
length = elements.length,
|
||||
result = [];
|
||||
(function ($, undefined) {
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
if (!elements[index].className.match(uiScreenHiddenRegex)) {
|
||||
result.push(elements[index]);
|
||||
var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
|
||||
function noHiddenClass(elements) {
|
||||
var index,
|
||||
length = elements.length,
|
||||
result = [];
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
if (!elements[index].className.match(uiScreenHiddenRegex)) {
|
||||
result.push(elements[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return $(result);
|
||||
}
|
||||
|
||||
return $(result);
|
||||
}
|
||||
$.mobile.behaviors.addFirstLastClasses = {
|
||||
_getVisibles: function ($els, create) {
|
||||
var visibles;
|
||||
|
||||
$.mobile.behaviors.addFirstLastClasses = {
|
||||
_getVisibles: function ($els, create) {
|
||||
var visibles;
|
||||
|
||||
if (create) {
|
||||
visibles = noHiddenClass($els);
|
||||
} else {
|
||||
visibles = $els.filter(":visible");
|
||||
if (visibles.length === 0) {
|
||||
if (create) {
|
||||
visibles = noHiddenClass($els);
|
||||
} else {
|
||||
visibles = $els.filter(":visible");
|
||||
if (visibles.length === 0) {
|
||||
visibles = noHiddenClass($els);
|
||||
}
|
||||
}
|
||||
|
||||
return visibles;
|
||||
},
|
||||
|
||||
_addFirstLastClasses: function ($els, $visibles, create) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
$visibles.eq(0).addClass("ui-first-child").end().last().addClass("ui-last-child");
|
||||
if (!create) {
|
||||
this.element.trigger("updatelayout");
|
||||
}
|
||||
},
|
||||
|
||||
_removeFirstLastClasses: function ($els) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
}
|
||||
};
|
||||
|
||||
return visibles;
|
||||
},
|
||||
})(jQuery);
|
||||
|
||||
_addFirstLastClasses: function ($els, $visibles, create) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
$visibles.eq(0).addClass("ui-first-child").end().last().addClass("ui-last-child");
|
||||
if (!create) {
|
||||
this.element.trigger("updatelayout");
|
||||
}
|
||||
},
|
||||
(function ($, undefined) {
|
||||
|
||||
function keepNativeSelector() {
|
||||
var keepNative = $.trim("[data-role='none']"),
|
||||
globalValue = $.trim($.mobile.keepNative),
|
||||
optionValue = $.trim("[data-role='none']"),
|
||||
|
||||
// Check if $.mobile.keepNative has changed from the factory default
|
||||
newDefault = "",
|
||||
|
||||
// If $.mobile.keepNative has not changed, use options.keepNativeDefault
|
||||
oldDefault = (newDefault === "" ? optionValue : "");
|
||||
|
||||
// Concatenate keepNative selectors from all sources where the value has
|
||||
// changed or, if nothing has changed, return the default
|
||||
return ((keepNative ? [keepNative] : [])
|
||||
.concat(newDefault ? [newDefault] : [])
|
||||
.concat(oldDefault ? [oldDefault] : [])
|
||||
.join(", "));
|
||||
|
||||
_removeFirstLastClasses: function ($els) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
$.widget("mobile.controlgroup", $.extend({
|
||||
options: {
|
||||
enhanced: false,
|
||||
theme: null,
|
||||
shadow: false,
|
||||
corners: true,
|
||||
excludeInvisible: true,
|
||||
type: "vertical",
|
||||
mini: false
|
||||
},
|
||||
|
||||
(function ($, undefined) {
|
||||
_create: function () {
|
||||
var elem = this.element,
|
||||
opts = this.options,
|
||||
keepNative = keepNativeSelector();
|
||||
|
||||
$.widget("mobile.controlgroup", $.extend({
|
||||
options: {
|
||||
enhanced: false,
|
||||
theme: null,
|
||||
shadow: false,
|
||||
corners: true,
|
||||
excludeInvisible: true,
|
||||
type: "vertical",
|
||||
mini: false
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
var elem = this.element,
|
||||
opts = this.options,
|
||||
keepNative = $.mobile.page.prototype.keepNativeSelector();
|
||||
|
||||
// Run buttonmarkup
|
||||
if ($.fn.buttonMarkup) {
|
||||
this.element
|
||||
.find($.fn.buttonMarkup.initSelector)
|
||||
.not(keepNative)
|
||||
.buttonMarkup();
|
||||
}
|
||||
// Enhance child widgets
|
||||
$.each(this._childWidgets, $.proxy(function (number, widgetName) {
|
||||
if ($.mobile[widgetName]) {
|
||||
// Run buttonmarkup
|
||||
if ($.fn.buttonMarkup) {
|
||||
this.element
|
||||
.find($.mobile[widgetName].initSelector)
|
||||
.not(keepNative)[widgetName]();
|
||||
.find($.fn.buttonMarkup.initSelector)
|
||||
.not(keepNative)
|
||||
.buttonMarkup();
|
||||
}
|
||||
}, this));
|
||||
// Enhance child widgets
|
||||
$.each(this._childWidgets, $.proxy(function (number, widgetName) {
|
||||
if ($.mobile[widgetName]) {
|
||||
this.element
|
||||
.find($.mobile[widgetName].initSelector)
|
||||
.not(keepNative)[widgetName]();
|
||||
}
|
||||
}, this));
|
||||
|
||||
$.extend(this, {
|
||||
_ui: null,
|
||||
_initialRefresh: true
|
||||
});
|
||||
$.extend(this, {
|
||||
_ui: null,
|
||||
_initialRefresh: true
|
||||
});
|
||||
|
||||
if (opts.enhanced) {
|
||||
this._ui = {
|
||||
groupLegend: elem.children(".ui-controlgroup-label").children(),
|
||||
childWrapper: elem.children(".ui-controlgroup-controls")
|
||||
};
|
||||
} else {
|
||||
this._ui = this._enhance();
|
||||
}
|
||||
if (opts.enhanced) {
|
||||
this._ui = {
|
||||
groupLegend: elem.children(".ui-controlgroup-label").children(),
|
||||
childWrapper: elem.children(".ui-controlgroup-controls")
|
||||
};
|
||||
} else {
|
||||
this._ui = this._enhance();
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
_childWidgets: ["checkboxradio", "selectmenu", "button"],
|
||||
_childWidgets: ["checkboxradio", "selectmenu", "button"],
|
||||
|
||||
_themeClassFromOption: function (value) {
|
||||
return (value ? (value === "none" ? "" : "ui-group-theme-" + value) : "");
|
||||
},
|
||||
_themeClassFromOption: function (value) {
|
||||
return (value ? (value === "none" ? "" : "ui-group-theme-" + value) : "");
|
||||
},
|
||||
|
||||
_enhance: function () {
|
||||
var elem = this.element,
|
||||
opts = this.options,
|
||||
ui = {
|
||||
groupLegend: elem.children("legend"),
|
||||
childWrapper: elem
|
||||
.addClass("ui-controlgroup " +
|
||||
"ui-controlgroup-" +
|
||||
(opts.type === "horizontal" ? "horizontal" : "vertical") + " " +
|
||||
this._themeClassFromOption(opts.theme) + " " +
|
||||
(opts.corners ? "ui-corner-all " : "") +
|
||||
(opts.mini ? "ui-mini " : ""))
|
||||
.wrapInner("<div " +
|
||||
"class='ui-controlgroup-controls " +
|
||||
(opts.shadow === true ? "ui-shadow" : "") + "'></div>")
|
||||
.children()
|
||||
};
|
||||
_enhance: function () {
|
||||
var elem = this.element,
|
||||
opts = this.options,
|
||||
ui = {
|
||||
groupLegend: elem.children("legend"),
|
||||
childWrapper: elem
|
||||
.addClass("ui-controlgroup " +
|
||||
"ui-controlgroup-" +
|
||||
(opts.type === "horizontal" ? "horizontal" : "vertical") + " " +
|
||||
this._themeClassFromOption(opts.theme) + " " +
|
||||
(opts.corners ? "ui-corner-all " : "") +
|
||||
(opts.mini ? "ui-mini " : ""))
|
||||
.wrapInner("<div " +
|
||||
"class='ui-controlgroup-controls " +
|
||||
(opts.shadow === true ? "ui-shadow" : "") + "'></div>")
|
||||
.children()
|
||||
};
|
||||
|
||||
if (ui.groupLegend.length > 0) {
|
||||
$("<div role='heading' class='ui-controlgroup-label'></div>")
|
||||
.append(ui.groupLegend)
|
||||
.prependTo(elem);
|
||||
}
|
||||
if (ui.groupLegend.length > 0) {
|
||||
$("<div role='heading' class='ui-controlgroup-label'></div>")
|
||||
.append(ui.groupLegend)
|
||||
.prependTo(elem);
|
||||
}
|
||||
|
||||
return ui;
|
||||
},
|
||||
return ui;
|
||||
},
|
||||
|
||||
_init: function () {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
_setOptions: function (options) {
|
||||
var callRefresh, returnValue,
|
||||
elem = this.element;
|
||||
|
||||
// Must have one of horizontal or vertical
|
||||
if (options.type !== undefined) {
|
||||
elem
|
||||
.removeClass("ui-controlgroup-horizontal ui-controlgroup-vertical")
|
||||
.addClass("ui-controlgroup-" + (options.type === "horizontal" ? "horizontal" : "vertical"));
|
||||
callRefresh = true;
|
||||
}
|
||||
|
||||
if (options.theme !== undefined) {
|
||||
elem
|
||||
.removeClass(this._themeClassFromOption(this.options.theme))
|
||||
.addClass(this._themeClassFromOption(options.theme));
|
||||
}
|
||||
|
||||
if (options.corners !== undefined) {
|
||||
elem.toggleClass("ui-corner-all", options.corners);
|
||||
}
|
||||
|
||||
if (options.mini !== undefined) {
|
||||
elem.toggleClass("ui-mini", options.mini);
|
||||
}
|
||||
|
||||
if (options.shadow !== undefined) {
|
||||
this._ui.childWrapper.toggleClass("ui-shadow", options.shadow);
|
||||
}
|
||||
|
||||
if (options.excludeInvisible !== undefined) {
|
||||
this.options.excludeInvisible = options.excludeInvisible;
|
||||
callRefresh = true;
|
||||
}
|
||||
|
||||
returnValue = this._super(options);
|
||||
|
||||
if (callRefresh) {
|
||||
_init: function () {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
_setOptions: function (options) {
|
||||
var callRefresh, returnValue,
|
||||
elem = this.element;
|
||||
|
||||
// Must have one of horizontal or vertical
|
||||
if (options.type !== undefined) {
|
||||
elem
|
||||
.removeClass("ui-controlgroup-horizontal ui-controlgroup-vertical")
|
||||
.addClass("ui-controlgroup-" + (options.type === "horizontal" ? "horizontal" : "vertical"));
|
||||
callRefresh = true;
|
||||
}
|
||||
|
||||
if (options.theme !== undefined) {
|
||||
elem
|
||||
.removeClass(this._themeClassFromOption(this.options.theme))
|
||||
.addClass(this._themeClassFromOption(options.theme));
|
||||
}
|
||||
|
||||
if (options.corners !== undefined) {
|
||||
elem.toggleClass("ui-corner-all", options.corners);
|
||||
}
|
||||
|
||||
if (options.mini !== undefined) {
|
||||
elem.toggleClass("ui-mini", options.mini);
|
||||
}
|
||||
|
||||
if (options.shadow !== undefined) {
|
||||
this._ui.childWrapper.toggleClass("ui-shadow", options.shadow);
|
||||
}
|
||||
|
||||
if (options.excludeInvisible !== undefined) {
|
||||
this.options.excludeInvisible = options.excludeInvisible;
|
||||
callRefresh = true;
|
||||
}
|
||||
|
||||
returnValue = this._super(options);
|
||||
|
||||
if (callRefresh) {
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
},
|
||||
|
||||
container: function () {
|
||||
return this._ui.childWrapper;
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
var $el = this.container(),
|
||||
els = $el.find(".ui-btn").not(".ui-slider-handle"),
|
||||
create = this._initialRefresh;
|
||||
if ($.mobile.checkboxradio) {
|
||||
$el.find(":mobile-checkboxradio").checkboxradio("refresh");
|
||||
}
|
||||
this._addFirstLastClasses(els,
|
||||
this.options.excludeInvisible ? this._getVisibles(els, create) : els,
|
||||
create);
|
||||
this._initialRefresh = false;
|
||||
},
|
||||
|
||||
// Caveat: If the legend is not the first child of the controlgroup at enhance
|
||||
// time, it will be after _destroy().
|
||||
_destroy: function () {
|
||||
var ui, buttons,
|
||||
opts = this.options;
|
||||
|
||||
if (opts.enhanced) {
|
||||
return this;
|
||||
}
|
||||
|
||||
ui = this._ui;
|
||||
buttons = this.element
|
||||
.removeClass("ui-controlgroup " +
|
||||
"ui-controlgroup-horizontal ui-controlgroup-vertical ui-corner-all ui-mini " +
|
||||
this._themeClassFromOption(opts.theme))
|
||||
.find(".ui-btn")
|
||||
.not(".ui-slider-handle");
|
||||
|
||||
this._removeFirstLastClasses(buttons);
|
||||
|
||||
ui.groupLegend.unwrap();
|
||||
ui.childWrapper.children().unwrap();
|
||||
}
|
||||
}, $.mobile.behaviors.addFirstLastClasses));
|
||||
|
||||
return returnValue;
|
||||
},
|
||||
})(jQuery);
|
||||
|
||||
container: function () {
|
||||
return this._ui.childWrapper;
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
var $el = this.container(),
|
||||
els = $el.find(".ui-btn").not(".ui-slider-handle"),
|
||||
create = this._initialRefresh;
|
||||
if ($.mobile.checkboxradio) {
|
||||
$el.find(":mobile-checkboxradio").checkboxradio("refresh");
|
||||
}
|
||||
this._addFirstLastClasses(els,
|
||||
this.options.excludeInvisible ? this._getVisibles(els, create) : els,
|
||||
create);
|
||||
this._initialRefresh = false;
|
||||
},
|
||||
|
||||
// Caveat: If the legend is not the first child of the controlgroup at enhance
|
||||
// time, it will be after _destroy().
|
||||
_destroy: function () {
|
||||
var ui, buttons,
|
||||
opts = this.options;
|
||||
|
||||
if (opts.enhanced) {
|
||||
return this;
|
||||
}
|
||||
|
||||
ui = this._ui;
|
||||
buttons = this.element
|
||||
.removeClass("ui-controlgroup " +
|
||||
"ui-controlgroup-horizontal ui-controlgroup-vertical ui-corner-all ui-mini " +
|
||||
this._themeClassFromOption(opts.theme))
|
||||
.find(".ui-btn")
|
||||
.not(".ui-slider-handle");
|
||||
|
||||
this._removeFirstLastClasses(buttons);
|
||||
|
||||
ui.groupLegend.unwrap();
|
||||
ui.childWrapper.children().unwrap();
|
||||
}
|
||||
}, $.mobile.behaviors.addFirstLastClasses));
|
||||
|
||||
})(jQuery);
|
||||
});
|
|
@ -1,251 +1,292 @@
|
|||
(function ($, undefined) {
|
||||
define(['jqmwidget'], function () {
|
||||
|
||||
var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
|
||||
function noHiddenClass(elements) {
|
||||
var index,
|
||||
length = elements.length,
|
||||
result = [];
|
||||
(function ($, window, undefined) {
|
||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
if (!elements[index].className.match(uiScreenHiddenRegex)) {
|
||||
result.push(elements[index]);
|
||||
$.extend($.mobile, {
|
||||
|
||||
// Namespace used framework-wide for data-attrs. Default is no namespace
|
||||
|
||||
// Retrieve an attribute from an element and perform some massaging of the value
|
||||
|
||||
getAttribute: function (element, key) {
|
||||
var data;
|
||||
|
||||
element = element.jquery ? element[0] : element;
|
||||
|
||||
if (element && element.getAttribute) {
|
||||
data = element.getAttribute("data-" + key);
|
||||
}
|
||||
|
||||
// Copied from core's src/data.js:dataAttr()
|
||||
// Convert from a string to a proper data type
|
||||
try {
|
||||
data = data === "true" ? true :
|
||||
data === "false" ? false :
|
||||
data === "null" ? null :
|
||||
// Only convert to a number if it doesn't change the string
|
||||
+data + "" === data ? +data :
|
||||
rbrace.test(data) ? JSON.parse(data) :
|
||||
data;
|
||||
} catch (err) { }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, this);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
|
||||
function noHiddenClass(elements) {
|
||||
var index,
|
||||
length = elements.length,
|
||||
result = [];
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
if (!elements[index].className.match(uiScreenHiddenRegex)) {
|
||||
result.push(elements[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return $(result);
|
||||
}
|
||||
|
||||
return $(result);
|
||||
}
|
||||
$.mobile.behaviors.addFirstLastClasses = {
|
||||
_getVisibles: function ($els, create) {
|
||||
var visibles;
|
||||
|
||||
$.mobile.behaviors.addFirstLastClasses = {
|
||||
_getVisibles: function ($els, create) {
|
||||
var visibles;
|
||||
|
||||
if (create) {
|
||||
visibles = noHiddenClass($els);
|
||||
} else {
|
||||
visibles = $els.filter(":visible");
|
||||
if (visibles.length === 0) {
|
||||
if (create) {
|
||||
visibles = noHiddenClass($els);
|
||||
}
|
||||
}
|
||||
|
||||
return visibles;
|
||||
},
|
||||
|
||||
_addFirstLastClasses: function ($els, $visibles, create) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
$visibles.eq(0).addClass("ui-first-child").end().last().addClass("ui-last-child");
|
||||
if (!create) {
|
||||
this.element.trigger("updatelayout");
|
||||
}
|
||||
},
|
||||
|
||||
_removeFirstLastClasses: function ($els) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
var getAttr = $.mobile.getAttribute;
|
||||
|
||||
$.widget("mobile.listview", $.extend({
|
||||
|
||||
options: {
|
||||
theme: null,
|
||||
countTheme: null, /* Deprecated in 1.4 */
|
||||
dividerTheme: null,
|
||||
icon: "carat-r",
|
||||
splitIcon: "carat-r",
|
||||
splitTheme: null,
|
||||
corners: true,
|
||||
shadow: true,
|
||||
inset: false
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
var t = this,
|
||||
listviewClasses = "";
|
||||
|
||||
listviewClasses += t.options.inset ? " ui-listview-inset" : "";
|
||||
|
||||
if (!!t.options.inset) {
|
||||
listviewClasses += t.options.corners ? " ui-corner-all" : "";
|
||||
listviewClasses += t.options.shadow ? " ui-shadow" : "";
|
||||
}
|
||||
|
||||
// create listview markup
|
||||
t.element.addClass(" ui-listview" + listviewClasses);
|
||||
|
||||
t.refresh(true);
|
||||
},
|
||||
|
||||
// TODO: Remove in 1.5
|
||||
_findFirstElementByTagName: function (ele, nextProp, lcName, ucName) {
|
||||
var dict = {};
|
||||
dict[lcName] = dict[ucName] = true;
|
||||
while (ele) {
|
||||
if (dict[ele.nodeName]) {
|
||||
return ele;
|
||||
}
|
||||
ele = ele[nextProp];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
// TODO: Remove in 1.5
|
||||
_addThumbClasses: function (containers) {
|
||||
var i, img, len = containers.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
img = $(this._findFirstElementByTagName(containers[i].firstChild, "nextSibling", "img", "IMG"));
|
||||
if (img.length) {
|
||||
$(this._findFirstElementByTagName(img[0].parentNode, "parentNode", "li", "LI")).addClass(img.hasClass("ui-li-icon") ? "ui-li-has-icon" : "ui-li-has-thumb");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_getChildrenByTagName: function (ele, lcName, ucName) {
|
||||
var results = [],
|
||||
dict = {};
|
||||
dict[lcName] = dict[ucName] = true;
|
||||
ele = ele.firstChild;
|
||||
while (ele) {
|
||||
if (dict[ele.nodeName]) {
|
||||
results.push(ele);
|
||||
}
|
||||
ele = ele.nextSibling;
|
||||
}
|
||||
return $(results);
|
||||
},
|
||||
|
||||
_beforeListviewRefresh: $.noop,
|
||||
_afterListviewRefresh: $.noop,
|
||||
|
||||
refresh: function (create) {
|
||||
var buttonClass, pos, numli, item, itemClass, itemTheme, itemIcon, icon, a,
|
||||
isDivider, startCount, newStartCount, value, last, splittheme, splitThemeClass, spliticon,
|
||||
altButtonClass, dividerTheme, li,
|
||||
o = this.options,
|
||||
$list = this.element,
|
||||
ol = !!$.nodeName($list[0], "ol"),
|
||||
start = $list.attr("start"),
|
||||
itemClassDict = {},
|
||||
countBubbles = $list.find(".ui-li-count"),
|
||||
countTheme = getAttr($list[0], "counttheme") || this.options.countTheme,
|
||||
countThemeClass = countTheme ? "ui-body-" + countTheme : "ui-body-inherit";
|
||||
|
||||
if (o.theme) {
|
||||
$list.addClass("ui-group-theme-" + o.theme);
|
||||
}
|
||||
|
||||
// Check if a start attribute has been set while taking a value of 0 into account
|
||||
if (ol && (start || start === 0)) {
|
||||
startCount = parseInt(start, 10) - 1;
|
||||
$list.css("counter-reset", "listnumbering " + startCount);
|
||||
}
|
||||
|
||||
this._beforeListviewRefresh();
|
||||
|
||||
li = this._getChildrenByTagName($list[0], "li", "LI");
|
||||
|
||||
for (pos = 0, numli = li.length; pos < numli; pos++) {
|
||||
item = li.eq(pos);
|
||||
itemClass = "";
|
||||
|
||||
if (create || item[0].className.search(/\bui-li-static\b|\bui-li-divider\b/) < 0) {
|
||||
a = this._getChildrenByTagName(item[0], "a", "A");
|
||||
isDivider = (getAttr(item[0], "role") === "list-divider");
|
||||
value = item.attr("value");
|
||||
itemTheme = getAttr(item[0], "theme");
|
||||
|
||||
if (a.length && a[0].className.search(/\bui-btn\b/) < 0 && !isDivider) {
|
||||
itemIcon = getAttr(item[0], "icon");
|
||||
icon = (itemIcon === false) ? false : (itemIcon || o.icon);
|
||||
|
||||
// TODO: Remove in 1.5 together with links.js (links.js / .ui-link deprecated in 1.4)
|
||||
a.removeClass("ui-link");
|
||||
|
||||
buttonClass = "ui-btn";
|
||||
|
||||
if (itemTheme) {
|
||||
buttonClass += " ui-btn-" + itemTheme;
|
||||
}
|
||||
|
||||
if (a.length > 1) {
|
||||
itemClass = "ui-li-has-alt";
|
||||
|
||||
last = a.last();
|
||||
splittheme = getAttr(last[0], "theme") || o.splitTheme || getAttr(item[0], "theme", true);
|
||||
splitThemeClass = splittheme ? " ui-btn-" + splittheme : "";
|
||||
spliticon = getAttr(last[0], "icon") || getAttr(item[0], "icon") || o.splitIcon;
|
||||
altButtonClass = "ui-btn ui-btn-icon-notext ui-icon-" + spliticon + splitThemeClass;
|
||||
|
||||
last
|
||||
.attr("title", $.trim(last.getEncodedText()))
|
||||
.addClass(altButtonClass)
|
||||
.empty();
|
||||
|
||||
// Reduce to the first anchor, because only the first gets the buttonClass
|
||||
a = a.first();
|
||||
} else if (icon) {
|
||||
buttonClass += " ui-btn-icon-right ui-icon-" + icon;
|
||||
}
|
||||
|
||||
// Apply buttonClass to the (first) anchor
|
||||
a.addClass(buttonClass);
|
||||
} else if (isDivider) {
|
||||
dividerTheme = (getAttr(item[0], "theme") || o.dividerTheme || o.theme);
|
||||
|
||||
itemClass = "ui-li-divider ui-bar-" + (dividerTheme ? dividerTheme : "inherit");
|
||||
|
||||
item.attr("role", "heading");
|
||||
} else if (a.length <= 0) {
|
||||
itemClass = "ui-li-static ui-body-" + (itemTheme ? itemTheme : "inherit");
|
||||
}
|
||||
if (ol && value) {
|
||||
newStartCount = parseInt(value, 10) - 1;
|
||||
|
||||
item.css("counter-reset", "listnumbering " + newStartCount);
|
||||
} else {
|
||||
visibles = $els.filter(":visible");
|
||||
if (visibles.length === 0) {
|
||||
visibles = noHiddenClass($els);
|
||||
}
|
||||
}
|
||||
|
||||
// Instead of setting item class directly on the list item
|
||||
// at this point in time, push the item into a dictionary
|
||||
// that tells us what class to set on it so we can do this after this
|
||||
// processing loop is finished.
|
||||
return visibles;
|
||||
},
|
||||
|
||||
if (!itemClassDict[itemClass]) {
|
||||
itemClassDict[itemClass] = [];
|
||||
_addFirstLastClasses: function ($els, $visibles, create) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
$visibles.eq(0).addClass("ui-first-child").end().last().addClass("ui-last-child");
|
||||
if (!create) {
|
||||
this.element.trigger("updatelayout");
|
||||
}
|
||||
},
|
||||
|
||||
_removeFirstLastClasses: function ($els) {
|
||||
$els.removeClass("ui-first-child ui-last-child");
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
var getAttr = $.mobile.getAttribute;
|
||||
|
||||
$.widget("mobile.listview", $.extend({
|
||||
|
||||
options: {
|
||||
theme: null,
|
||||
countTheme: null, /* Deprecated in 1.4 */
|
||||
dividerTheme: null,
|
||||
icon: "carat-r",
|
||||
splitIcon: "carat-r",
|
||||
splitTheme: null,
|
||||
corners: true,
|
||||
shadow: true,
|
||||
inset: false
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
var t = this,
|
||||
listviewClasses = "";
|
||||
|
||||
listviewClasses += t.options.inset ? " ui-listview-inset" : "";
|
||||
|
||||
if (!!t.options.inset) {
|
||||
listviewClasses += t.options.corners ? " ui-corner-all" : "";
|
||||
listviewClasses += t.options.shadow ? " ui-shadow" : "";
|
||||
}
|
||||
|
||||
itemClassDict[itemClass].push(item[0]);
|
||||
// create listview markup
|
||||
t.element.addClass(" ui-listview" + listviewClasses);
|
||||
|
||||
t.refresh(true);
|
||||
},
|
||||
|
||||
// TODO: Remove in 1.5
|
||||
_findFirstElementByTagName: function (ele, nextProp, lcName, ucName) {
|
||||
var dict = {};
|
||||
dict[lcName] = dict[ucName] = true;
|
||||
while (ele) {
|
||||
if (dict[ele.nodeName]) {
|
||||
return ele;
|
||||
}
|
||||
ele = ele[nextProp];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
// TODO: Remove in 1.5
|
||||
_addThumbClasses: function (containers) {
|
||||
var i, img, len = containers.length;
|
||||
for (i = 0; i < len; i++) {
|
||||
img = $(this._findFirstElementByTagName(containers[i].firstChild, "nextSibling", "img", "IMG"));
|
||||
if (img.length) {
|
||||
$(this._findFirstElementByTagName(img[0].parentNode, "parentNode", "li", "LI")).addClass(img.hasClass("ui-li-icon") ? "ui-li-has-icon" : "ui-li-has-thumb");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_getChildrenByTagName: function (ele, lcName, ucName) {
|
||||
var results = [],
|
||||
dict = {};
|
||||
dict[lcName] = dict[ucName] = true;
|
||||
ele = ele.firstChild;
|
||||
while (ele) {
|
||||
if (dict[ele.nodeName]) {
|
||||
results.push(ele);
|
||||
}
|
||||
ele = ele.nextSibling;
|
||||
}
|
||||
return $(results);
|
||||
},
|
||||
|
||||
_beforeListviewRefresh: $.noop,
|
||||
_afterListviewRefresh: $.noop,
|
||||
|
||||
refresh: function (create) {
|
||||
var buttonClass, pos, numli, item, itemClass, itemTheme, itemIcon, icon, a,
|
||||
isDivider, startCount, newStartCount, value, last, splittheme, splitThemeClass, spliticon,
|
||||
altButtonClass, dividerTheme, li,
|
||||
o = this.options,
|
||||
$list = this.element,
|
||||
ol = !!$.nodeName($list[0], "ol"),
|
||||
start = $list.attr("start"),
|
||||
itemClassDict = {},
|
||||
countBubbles = $list.find(".ui-li-count"),
|
||||
countTheme = getAttr($list[0], "counttheme") || this.options.countTheme,
|
||||
countThemeClass = countTheme ? "ui-body-" + countTheme : "ui-body-inherit";
|
||||
|
||||
if (o.theme) {
|
||||
$list.addClass("ui-group-theme-" + o.theme);
|
||||
}
|
||||
|
||||
// Check if a start attribute has been set while taking a value of 0 into account
|
||||
if (ol && (start || start === 0)) {
|
||||
startCount = parseInt(start, 10) - 1;
|
||||
$list.css("counter-reset", "listnumbering " + startCount);
|
||||
}
|
||||
|
||||
this._beforeListviewRefresh();
|
||||
|
||||
li = this._getChildrenByTagName($list[0], "li", "LI");
|
||||
|
||||
for (pos = 0, numli = li.length; pos < numli; pos++) {
|
||||
item = li.eq(pos);
|
||||
itemClass = "";
|
||||
|
||||
if (create || item[0].className.search(/\bui-li-static\b|\bui-li-divider\b/) < 0) {
|
||||
a = this._getChildrenByTagName(item[0], "a", "A");
|
||||
isDivider = (getAttr(item[0], "role") === "list-divider");
|
||||
value = item.attr("value");
|
||||
itemTheme = getAttr(item[0], "theme");
|
||||
|
||||
if (a.length && a[0].className.search(/\bui-btn\b/) < 0 && !isDivider) {
|
||||
itemIcon = getAttr(item[0], "icon");
|
||||
icon = (itemIcon === false) ? false : (itemIcon || o.icon);
|
||||
|
||||
// TODO: Remove in 1.5 together with links.js (links.js / .ui-link deprecated in 1.4)
|
||||
a.removeClass("ui-link");
|
||||
|
||||
buttonClass = "ui-btn";
|
||||
|
||||
if (itemTheme) {
|
||||
buttonClass += " ui-btn-" + itemTheme;
|
||||
}
|
||||
|
||||
if (a.length > 1) {
|
||||
itemClass = "ui-li-has-alt";
|
||||
|
||||
last = a.last();
|
||||
splittheme = getAttr(last[0], "theme") || o.splitTheme || getAttr(item[0], "theme", true);
|
||||
splitThemeClass = splittheme ? " ui-btn-" + splittheme : "";
|
||||
spliticon = getAttr(last[0], "icon") || getAttr(item[0], "icon") || o.splitIcon;
|
||||
altButtonClass = "ui-btn ui-btn-icon-notext ui-icon-" + spliticon + splitThemeClass;
|
||||
|
||||
last
|
||||
.attr("title", $.trim(last.text()))
|
||||
.addClass(altButtonClass)
|
||||
.empty();
|
||||
|
||||
// Reduce to the first anchor, because only the first gets the buttonClass
|
||||
a = a.first();
|
||||
} else if (icon) {
|
||||
buttonClass += " ui-btn-icon-right ui-icon-" + icon;
|
||||
}
|
||||
|
||||
// Apply buttonClass to the (first) anchor
|
||||
a.addClass(buttonClass);
|
||||
} else if (isDivider) {
|
||||
dividerTheme = (getAttr(item[0], "theme") || o.dividerTheme || o.theme);
|
||||
|
||||
itemClass = "ui-li-divider ui-bar-" + (dividerTheme ? dividerTheme : "inherit");
|
||||
|
||||
item.attr("role", "heading");
|
||||
} else if (a.length <= 0) {
|
||||
itemClass = "ui-li-static ui-body-" + (itemTheme ? itemTheme : "inherit");
|
||||
}
|
||||
if (ol && value) {
|
||||
newStartCount = parseInt(value, 10) - 1;
|
||||
|
||||
item.css("counter-reset", "listnumbering " + newStartCount);
|
||||
}
|
||||
}
|
||||
|
||||
// Instead of setting item class directly on the list item
|
||||
// at this point in time, push the item into a dictionary
|
||||
// that tells us what class to set on it so we can do this after this
|
||||
// processing loop is finished.
|
||||
|
||||
if (!itemClassDict[itemClass]) {
|
||||
itemClassDict[itemClass] = [];
|
||||
}
|
||||
|
||||
itemClassDict[itemClass].push(item[0]);
|
||||
}
|
||||
|
||||
// Set the appropriate listview item classes on each list item.
|
||||
// The main reason we didn't do this
|
||||
// in the for-loop above is because we can eliminate per-item function overhead
|
||||
// by calling addClass() and children() once or twice afterwards. This
|
||||
// can give us a significant boost on platforms like WP7.5.
|
||||
|
||||
for (itemClass in itemClassDict) {
|
||||
$(itemClassDict[itemClass]).addClass(itemClass);
|
||||
}
|
||||
|
||||
countBubbles.each(function () {
|
||||
$(this).closest("li").addClass("ui-li-has-count");
|
||||
});
|
||||
if (countThemeClass) {
|
||||
countBubbles.not("[class*='ui-body-']").addClass(countThemeClass);
|
||||
}
|
||||
|
||||
// Deprecated in 1.4. From 1.5 you have to add class ui-li-has-thumb or ui-li-has-icon to the LI.
|
||||
this._addThumbClasses(li);
|
||||
this._addThumbClasses(li.find(".ui-btn"));
|
||||
|
||||
this._afterListviewRefresh();
|
||||
|
||||
this._addFirstLastClasses(li, this._getVisibles(li, create), create);
|
||||
}
|
||||
}, $.mobile.behaviors.addFirstLastClasses));
|
||||
|
||||
// Set the appropriate listview item classes on each list item.
|
||||
// The main reason we didn't do this
|
||||
// in the for-loop above is because we can eliminate per-item function overhead
|
||||
// by calling addClass() and children() once or twice afterwards. This
|
||||
// can give us a significant boost on platforms like WP7.5.
|
||||
})(jQuery);
|
||||
|
||||
for (itemClass in itemClassDict) {
|
||||
$(itemClassDict[itemClass]).addClass(itemClass);
|
||||
}
|
||||
|
||||
countBubbles.each(function () {
|
||||
$(this).closest("li").addClass("ui-li-has-count");
|
||||
});
|
||||
if (countThemeClass) {
|
||||
countBubbles.not("[class*='ui-body-']").addClass(countThemeClass);
|
||||
}
|
||||
|
||||
// Deprecated in 1.4. From 1.5 you have to add class ui-li-has-thumb or ui-li-has-icon to the LI.
|
||||
this._addThumbClasses(li);
|
||||
this._addThumbClasses(li.find(".ui-btn"));
|
||||
|
||||
this._afterListviewRefresh();
|
||||
|
||||
this._addFirstLastClasses(li, this._getVisibles(li, create), create);
|
||||
}
|
||||
}, $.mobile.behaviors.addFirstLastClasses));
|
||||
|
||||
})(jQuery);
|
||||
});
|
|
@ -1,4 +1,16 @@
|
|||
/* Panel */
|
||||
/* preset breakpoint to switch to stacked grid styles below 35em (560px) */
|
||||
@media (max-width: 35em) {
|
||||
.ui-responsive > .ui-block-a,
|
||||
.ui-responsive > .ui-block-b,
|
||||
.ui-responsive > .ui-block-c,
|
||||
.ui-responsive > .ui-block-d,
|
||||
.ui-responsive > .ui-block-e {
|
||||
width: 100%;
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Panel */
|
||||
.ui-panel {
|
||||
width: 17em;
|
||||
min-height: 100%;
|
||||
|
|
|
@ -1,463 +1,531 @@
|
|||
(function ($, undefined) {
|
||||
define(['jqmwidget'], function () {
|
||||
|
||||
$.widget("mobile.panel", {
|
||||
options: {
|
||||
classes: {
|
||||
panel: "ui-panel",
|
||||
panelOpen: "ui-panel-open",
|
||||
panelClosed: "ui-panel-closed",
|
||||
panelFixed: "ui-panel-fixed",
|
||||
panelInner: "ui-panel-inner",
|
||||
modal: "ui-panel-dismiss",
|
||||
modalOpen: "ui-panel-dismiss-open",
|
||||
pageContainer: "ui-panel-page-container",
|
||||
pageWrapper: "ui-panel-wrapper",
|
||||
pageFixedToolbar: "ui-panel-fixed-toolbar",
|
||||
pageContentPrefix: "ui-panel-page-content", /* Used for wrapper and fixed toolbars position, display and open classes. */
|
||||
animate: "ui-panel-animate"
|
||||
(function ($, undefined) {
|
||||
var props = {
|
||||
"animation": {},
|
||||
"transition": {}
|
||||
},
|
||||
testElement = document.createElement("a"),
|
||||
vendorPrefixes = ["", "webkit-", "moz-", "o-"];
|
||||
|
||||
$.each(["animation", "transition"], function (i, test) {
|
||||
|
||||
// Get correct name for test
|
||||
var testName = (i === 0) ? test + "-" + "name" : test;
|
||||
|
||||
$.each(vendorPrefixes, function (j, prefix) {
|
||||
if (testElement.style[$.camelCase(prefix + testName)] !== undefined) {
|
||||
props[test]["prefix"] = prefix;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
// Set event and duration names for later use
|
||||
props[test]["duration"] =
|
||||
$.camelCase(props[test]["prefix"] + test + "-" + "duration");
|
||||
props[test]["event"] =
|
||||
$.camelCase(props[test]["prefix"] + test + "-" + "end");
|
||||
|
||||
// All lower case if not a vendor prop
|
||||
if (props[test]["prefix"] === "") {
|
||||
props[test]["event"] = props[test]["event"].toLowerCase();
|
||||
}
|
||||
});
|
||||
|
||||
// Remove the testElement
|
||||
$(testElement).remove();
|
||||
|
||||
// Animation complete callback
|
||||
$.fn.animationComplete = function (callback, type, fallbackTime) {
|
||||
var timer, duration,
|
||||
that = this,
|
||||
eventBinding = function () {
|
||||
|
||||
// Clear the timer so we don't call callback twice
|
||||
clearTimeout(timer);
|
||||
callback.apply(this, arguments);
|
||||
},
|
||||
animationType = (!type || type === "animation") ? "animation" : "transition";
|
||||
|
||||
// If a fallback time was not passed set one
|
||||
if (fallbackTime === undefined) {
|
||||
|
||||
// Make sure the was not bound to document before checking .css
|
||||
if ($(this).context !== document) {
|
||||
|
||||
// Parse the durration since its in second multiple by 1000 for milliseconds
|
||||
// Multiply by 3 to make sure we give the animation plenty of time.
|
||||
duration = parseFloat(
|
||||
$(this).css(props[animationType].duration)
|
||||
) * 3000;
|
||||
}
|
||||
|
||||
// If we could not read a duration use the default
|
||||
if (duration === 0 || duration === undefined || isNaN(duration)) {
|
||||
duration = $.fn.animationComplete.defaultDuration;
|
||||
}
|
||||
}
|
||||
|
||||
// Sets up the fallback if event never comes
|
||||
timer = setTimeout(function () {
|
||||
$(that).off(props[animationType].event, eventBinding);
|
||||
callback.apply(that);
|
||||
}, duration);
|
||||
|
||||
// Bind the event
|
||||
return $(this).one(props[animationType].event, eventBinding);
|
||||
};
|
||||
|
||||
// Allow default callback to be configured on mobileInit
|
||||
$.fn.animationComplete.defaultDuration = 1000;
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
$.widget("mobile.panel", {
|
||||
options: {
|
||||
animate: true,
|
||||
theme: null,
|
||||
position: "left",
|
||||
dismissible: true,
|
||||
display: "overlay", //accepts reveal, push, overlay
|
||||
swipeClose: true,
|
||||
positionFixed: true
|
||||
},
|
||||
animate: true,
|
||||
theme: null,
|
||||
position: "left",
|
||||
dismissible: true,
|
||||
display: "reveal", //accepts reveal, push, overlay
|
||||
swipeClose: true,
|
||||
positionFixed: false
|
||||
},
|
||||
|
||||
_parentPage: null,
|
||||
_page: null,
|
||||
_modal: null,
|
||||
_panelInner: null,
|
||||
_wrapper: null,
|
||||
_parentPage: null,
|
||||
_page: null,
|
||||
_modal: null,
|
||||
_panelInner: null,
|
||||
_wrapper: null,
|
||||
|
||||
_create: function () {
|
||||
var el = this.element,
|
||||
parentPage = el.closest(".ui-page, :jqmData(role='page')");
|
||||
_create: function () {
|
||||
var el = this.element,
|
||||
parentPage = el.closest(".ui-page, [data-role='page']");
|
||||
|
||||
// expose some private props to other methods
|
||||
$.extend(this, {
|
||||
_parentPage: (parentPage.length > 0) ? parentPage : false,
|
||||
_openedPage: null,
|
||||
_page: this._getPage,
|
||||
_panelInner: this._getPanelInner()
|
||||
});
|
||||
if (this.options.display !== "overlay") {
|
||||
this._getWrapper();
|
||||
}
|
||||
this._addPanelClasses();
|
||||
|
||||
// if animating, add the class to do so
|
||||
if ($.support.cssTransform3d && !!this.options.animate) {
|
||||
this.element.addClass(this.options.classes.animate);
|
||||
}
|
||||
|
||||
this._bindUpdateLayout();
|
||||
this._bindCloseEvents();
|
||||
this._bindLinkListeners();
|
||||
this._bindPageEvents();
|
||||
|
||||
if (!!this.options.dismissible) {
|
||||
this._createModal();
|
||||
}
|
||||
|
||||
this._bindSwipeEvents();
|
||||
},
|
||||
|
||||
_getPanelInner: function () {
|
||||
var panelInner = this.element[0].querySelector("." + this.options.classes.panelInner);
|
||||
if (!panelInner) {
|
||||
panelInner = this.element.children().wrapAll("<div class='" + this.options.classes.panelInner + "' />").parent();
|
||||
} else {
|
||||
panelInner = $(panelInner);
|
||||
}
|
||||
|
||||
return panelInner;
|
||||
},
|
||||
|
||||
_createModal: function () {
|
||||
var self = this,
|
||||
target = self._parentPage ? self._parentPage.parent() : self.element.parent();
|
||||
|
||||
self._modal = $("<div class='" + self.options.classes.modal + "'></div>")
|
||||
.on("mousedown", function () {
|
||||
self.close();
|
||||
})
|
||||
.appendTo(target);
|
||||
},
|
||||
|
||||
_getPage: function () {
|
||||
var page = this._openedPage || this._parentPage || $("." + $.mobile.activePageClass);
|
||||
|
||||
return page;
|
||||
},
|
||||
|
||||
_getWrapper: function () {
|
||||
var wrapper = this._page().find("." + this.options.classes.pageWrapper);
|
||||
if (wrapper.length === 0) {
|
||||
wrapper = this._page().children(".ui-header:not(.ui-header-fixed), .ui-content:not(.ui-popup), .ui-footer:not(.ui-footer-fixed)")
|
||||
.wrapAll("<div class='" + this.options.classes.pageWrapper + "'></div>")
|
||||
.parent();
|
||||
}
|
||||
|
||||
this._wrapper = wrapper;
|
||||
},
|
||||
|
||||
_getPosDisplayClasses: function (prefix) {
|
||||
return prefix + "-position-" + this.options.position + " " + prefix + "-display-" + this.options.display;
|
||||
},
|
||||
|
||||
_getPanelClasses: function () {
|
||||
var panelClasses = this.options.classes.panel +
|
||||
" " + this._getPosDisplayClasses(this.options.classes.panel) +
|
||||
" " + this.options.classes.panelClosed +
|
||||
" " + "ui-body-" + (this.options.theme ? this.options.theme : "inherit");
|
||||
|
||||
if (!!this.options.positionFixed) {
|
||||
panelClasses += " " + this.options.classes.panelFixed;
|
||||
}
|
||||
|
||||
return panelClasses;
|
||||
},
|
||||
|
||||
_addPanelClasses: function () {
|
||||
this.element.addClass(this._getPanelClasses());
|
||||
},
|
||||
|
||||
_handleCloseClick: function (event) {
|
||||
if (!event.isDefaultPrevented()) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
||||
_bindCloseEvents: function () {
|
||||
},
|
||||
|
||||
_positionPanel: function (scrollToTop) {
|
||||
var self = this,
|
||||
panelInnerHeight = self._panelInner.outerHeight(),
|
||||
expand = panelInnerHeight > $.mobile.getScreenHeight();
|
||||
|
||||
if (expand || !self.options.positionFixed) {
|
||||
if (expand) {
|
||||
self._unfixPanel();
|
||||
$.mobile.resetActivePageHeight(panelInnerHeight);
|
||||
// expose some private props to other methods
|
||||
$.extend(this, {
|
||||
_parentPage: (parentPage.length > 0) ? parentPage : false,
|
||||
_openedPage: null,
|
||||
_page: this._getPage,
|
||||
_panelInner: this._getPanelInner()
|
||||
});
|
||||
if (this.options.display !== "overlay") {
|
||||
this._getWrapper();
|
||||
}
|
||||
if (scrollToTop) {
|
||||
this.window[0].scrollTo(0, $.mobile.defaultHomeScroll);
|
||||
this._addPanelClasses();
|
||||
|
||||
// if animating, add the class to do so
|
||||
if (!!this.options.animate) {
|
||||
this.element.addClass("ui-panel-animate");
|
||||
}
|
||||
} else {
|
||||
self._fixPanel();
|
||||
}
|
||||
},
|
||||
|
||||
_bindFixListener: function () {
|
||||
this._on($(window), { "resize": "_positionPanel" });
|
||||
},
|
||||
this._bindUpdateLayout();
|
||||
this._bindCloseEvents();
|
||||
this._bindLinkListeners();
|
||||
this._bindPageEvents();
|
||||
|
||||
_unbindFixListener: function () {
|
||||
this._off($(window), "resize");
|
||||
},
|
||||
|
||||
_unfixPanel: function () {
|
||||
if (!!this.options.positionFixed && $.support.fixedPosition) {
|
||||
this.element.removeClass(this.options.classes.panelFixed);
|
||||
}
|
||||
},
|
||||
|
||||
_fixPanel: function () {
|
||||
if (!!this.options.positionFixed && $.support.fixedPosition) {
|
||||
this.element.addClass(this.options.classes.panelFixed);
|
||||
}
|
||||
},
|
||||
|
||||
_bindUpdateLayout: function () {
|
||||
var self = this;
|
||||
|
||||
self.element.on("updatelayout", function (/* e */) {
|
||||
if (self._open) {
|
||||
self._positionPanel();
|
||||
if (!!this.options.dismissible) {
|
||||
this._createModal();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_bindLinkListeners: function () {
|
||||
this._on("body", {
|
||||
"click a": "_handleClick"
|
||||
});
|
||||
this._bindSwipeEvents();
|
||||
},
|
||||
|
||||
},
|
||||
_getPanelInner: function () {
|
||||
var panelInner = this.element[0].querySelector("." + "ui-panel-inner");
|
||||
if (!panelInner) {
|
||||
panelInner = this.element.children().wrapAll("<div class='" + "ui-panel-inner" + "' />").parent();
|
||||
} else {
|
||||
panelInner = $(panelInner);
|
||||
}
|
||||
|
||||
_handleClick: function (e) {
|
||||
var link,
|
||||
panelId = this.element.attr("id");
|
||||
return panelInner;
|
||||
},
|
||||
|
||||
if (e.currentTarget.href.split("#")[1] === panelId && panelId !== undefined) {
|
||||
_createModal: function () {
|
||||
var self = this,
|
||||
target = self._parentPage ? self._parentPage.parent() : self.element.parent();
|
||||
|
||||
e.preventDefault();
|
||||
link = $(e.target);
|
||||
if (link.hasClass("ui-btn")) {
|
||||
link.addClass($.mobile.activeBtnClass);
|
||||
this.element.one("panelopen panelclose", function () {
|
||||
link.removeClass($.mobile.activeBtnClass);
|
||||
self._modal = $("<div class='" + "ui-panel-dismiss" + "'></div>")
|
||||
.on("mousedown", function () {
|
||||
self.close();
|
||||
})
|
||||
.appendTo(target);
|
||||
},
|
||||
|
||||
_getPage: function () {
|
||||
var page = this._openedPage || this._parentPage || $(".ui-page-active");
|
||||
|
||||
return page;
|
||||
},
|
||||
|
||||
_getWrapper: function () {
|
||||
var wrapper = this._page().find("." + "ui-panel-wrapper");
|
||||
if (wrapper.length === 0) {
|
||||
wrapper = this._page().children(".ui-header:not(.ui-header-fixed), .ui-content:not(.ui-popup), .ui-footer:not(.ui-footer-fixed)")
|
||||
.wrapAll("<div class='" + "ui-panel-wrapper" + "'></div>")
|
||||
.parent();
|
||||
}
|
||||
|
||||
this._wrapper = wrapper;
|
||||
},
|
||||
|
||||
_getPosDisplayClasses: function (prefix) {
|
||||
return prefix + "-position-right " + prefix + "-display-" + this.options.display;
|
||||
},
|
||||
|
||||
_getPanelClasses: function () {
|
||||
var panelClasses = "ui-panel" +
|
||||
" " + this._getPosDisplayClasses("ui-panel") +
|
||||
" " + "ui-panel-closed" +
|
||||
" " + "ui-body-" + (this.options.theme ? this.options.theme : "inherit");
|
||||
|
||||
if (!!this.options.positionFixed) {
|
||||
panelClasses += " " + "ui-panel-fixed";
|
||||
}
|
||||
|
||||
return panelClasses;
|
||||
},
|
||||
|
||||
_addPanelClasses: function () {
|
||||
this.element.addClass(this._getPanelClasses());
|
||||
},
|
||||
|
||||
_handleCloseClick: function (event) {
|
||||
if (!event.isDefaultPrevented()) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
||||
_bindCloseEvents: function () {
|
||||
},
|
||||
|
||||
_positionPanel: function (scrollToTop) {
|
||||
var self = this,
|
||||
panelInnerHeight = self._panelInner.outerHeight(),
|
||||
expand = panelInnerHeight > (window.innerHeight || $(window).height());
|
||||
|
||||
if (expand || !self.options.positionFixed) {
|
||||
if (expand) {
|
||||
self._unfixPanel();
|
||||
}
|
||||
if (scrollToTop) {
|
||||
this.window[0].scrollTo(0, $.mobile.defaultHomeScroll);
|
||||
}
|
||||
} else {
|
||||
self._fixPanel();
|
||||
}
|
||||
},
|
||||
|
||||
_bindFixListener: function () {
|
||||
this._on($(window), { "resize": "_positionPanel" });
|
||||
},
|
||||
|
||||
_unbindFixListener: function () {
|
||||
this._off($(window), "resize");
|
||||
},
|
||||
|
||||
_unfixPanel: function () {
|
||||
if (!!this.options.positionFixed) {
|
||||
this.element.removeClass("ui-panel-fixed");
|
||||
}
|
||||
},
|
||||
|
||||
_fixPanel: function () {
|
||||
if (!!this.options.positionFixed) {
|
||||
this.element.addClass("ui-panel-fixed");
|
||||
}
|
||||
},
|
||||
|
||||
_bindUpdateLayout: function () {
|
||||
var self = this;
|
||||
|
||||
self.element.on("updatelayout", function (/* e */) {
|
||||
if (self._open) {
|
||||
self._positionPanel();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_bindLinkListeners: function () {
|
||||
this._on("body", {
|
||||
"click a": "_handleClick"
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
_handleClick: function (e) {
|
||||
var link,
|
||||
panelId = this.element.attr("id");
|
||||
|
||||
if (e.currentTarget.href.split("#")[1] === panelId && panelId !== undefined) {
|
||||
|
||||
e.preventDefault();
|
||||
link = $(e.target);
|
||||
if (link.hasClass("ui-btn")) {
|
||||
link.addClass($.mobile.activeBtnClass);
|
||||
this.element.one("panelopen panelclose", function () {
|
||||
link.removeClass($.mobile.activeBtnClass);
|
||||
});
|
||||
}
|
||||
this.toggle();
|
||||
}
|
||||
},
|
||||
|
||||
_bindSwipeEvents: function () {
|
||||
var self = this,
|
||||
area = self._modal ? self.element.add(self._modal) : self.element;
|
||||
|
||||
// on swipe, close the panel
|
||||
if (!!self.options.swipeClose) {
|
||||
if (self.options.position === "left") {
|
||||
area.on("swipeleft.panel", function (/* e */) {
|
||||
self.close();
|
||||
});
|
||||
} else {
|
||||
area.on("swiperight.panel", function (/* e */) {
|
||||
self.close();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_bindPageEvents: function () {
|
||||
var self = this;
|
||||
|
||||
this.document
|
||||
// Close the panel if another panel on the page opens
|
||||
.on("panelbeforeopen", function (e) {
|
||||
if (self._open && e.target !== self.element[0]) {
|
||||
self.close();
|
||||
}
|
||||
})
|
||||
// On escape, close? might need to have a target check too...
|
||||
.on("keyup.panel", function (e) {
|
||||
if (e.keyCode === 27 && self._open) {
|
||||
self.close();
|
||||
}
|
||||
});
|
||||
if (!this._parentPage && this.options.display !== "overlay") {
|
||||
this._on(this.document, {
|
||||
"pageshow": function () {
|
||||
this._openedPage = null;
|
||||
this._getWrapper();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.toggle();
|
||||
}
|
||||
},
|
||||
|
||||
_bindSwipeEvents: function () {
|
||||
var self = this,
|
||||
area = self._modal ? self.element.add(self._modal) : self.element;
|
||||
|
||||
// on swipe, close the panel
|
||||
if (!!self.options.swipeClose) {
|
||||
if (self.options.position === "left") {
|
||||
area.on("swipeleft.panel", function (/* e */) {
|
||||
self.close();
|
||||
// Clean up open panels after page hide
|
||||
if (self._parentPage) {
|
||||
this.document.on("pagehide", "[data-role='page']", function () {
|
||||
if (self._open) {
|
||||
self.close(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
area.on("swiperight.panel", function (/* e */) {
|
||||
self.close();
|
||||
this.document.on("pagebeforehide", function () {
|
||||
if (self._open) {
|
||||
self.close(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
_bindPageEvents: function () {
|
||||
var self = this;
|
||||
// state storage of open or closed
|
||||
_open: false,
|
||||
_pageContentOpenClasses: null,
|
||||
_modalOpenClasses: null,
|
||||
|
||||
this.document
|
||||
// Close the panel if another panel on the page opens
|
||||
.on("panelbeforeopen", function (e) {
|
||||
if (self._open && e.target !== self.element[0]) {
|
||||
self.close();
|
||||
open: function (immediate) {
|
||||
if (!this._open) {
|
||||
var self = this,
|
||||
o = self.options,
|
||||
|
||||
_openPanel = function () {
|
||||
self._off(self.document, "panelclose");
|
||||
self._page().data("panel", "open");
|
||||
|
||||
if (!!o.animate && o.display !== "overlay") {
|
||||
self._wrapper.addClass("ui-panel-animate");
|
||||
}
|
||||
|
||||
if (!immediate && !!o.animate) {
|
||||
(self._wrapper || self.element)
|
||||
.animationComplete(complete, "transition");
|
||||
} else {
|
||||
setTimeout(complete, 0);
|
||||
}
|
||||
|
||||
if (o.theme && o.display !== "overlay") {
|
||||
self._page().parent()
|
||||
.addClass("ui-panel-page-container" + "-themed " + "ui-panel-page-container" + "-" + o.theme);
|
||||
}
|
||||
|
||||
self.element
|
||||
.removeClass("ui-panel-closed")
|
||||
.addClass("ui-panel-open");
|
||||
|
||||
self._positionPanel(true);
|
||||
|
||||
self._pageContentOpenClasses = self._getPosDisplayClasses("ui-panel-page-content");
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._page().parent().addClass("ui-panel-page-container");
|
||||
self._wrapper.addClass(self._pageContentOpenClasses);
|
||||
}
|
||||
|
||||
self._modalOpenClasses = self._getPosDisplayClasses("ui-panel-dismiss") + " " + "ui-panel-dismiss-open";
|
||||
if (self._modal) {
|
||||
self._modal
|
||||
.addClass(self._modalOpenClasses)
|
||||
.height(Math.max(self._modal.height(), self.document.height()));
|
||||
}
|
||||
},
|
||||
complete = function () {
|
||||
|
||||
// Bail if the panel was closed before the opening animation has completed
|
||||
if (!self._open) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._wrapper.addClass("ui-panel-page-content" + "-open");
|
||||
}
|
||||
|
||||
self._bindFixListener();
|
||||
|
||||
self._trigger("open");
|
||||
|
||||
self._openedPage = self._page();
|
||||
};
|
||||
|
||||
self._trigger("beforeopen");
|
||||
|
||||
if (self._page().data("panel") === "open") {
|
||||
self._on(self.document, {
|
||||
"panelclose": _openPanel
|
||||
});
|
||||
} else {
|
||||
_openPanel();
|
||||
}
|
||||
})
|
||||
// On escape, close? might need to have a target check too...
|
||||
.on("keyup.panel", function (e) {
|
||||
if (e.keyCode === 27 && self._open) {
|
||||
self.close();
|
||||
|
||||
self._open = true;
|
||||
}
|
||||
},
|
||||
|
||||
close: function (immediate) {
|
||||
if (this._open) {
|
||||
var self = this,
|
||||
o = this.options,
|
||||
|
||||
_closePanel = function () {
|
||||
|
||||
self.element.removeClass("ui-panel-open");
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._wrapper.removeClass(self._pageContentOpenClasses);
|
||||
}
|
||||
|
||||
if (!immediate && !!o.animate) {
|
||||
(self._wrapper || self.element)
|
||||
.animationComplete(complete, "transition");
|
||||
} else {
|
||||
setTimeout(complete, 0);
|
||||
}
|
||||
|
||||
if (self._modal) {
|
||||
self._modal
|
||||
.removeClass(self._modalOpenClasses)
|
||||
.height("");
|
||||
}
|
||||
},
|
||||
complete = function () {
|
||||
if (o.theme && o.display !== "overlay") {
|
||||
self._page().parent().removeClass("ui-panel-page-container" + "-themed " + "ui-panel-page-container" + "-" + o.theme);
|
||||
}
|
||||
|
||||
self.element.addClass("ui-panel-closed");
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._page().parent().removeClass("ui-panel-page-container");
|
||||
self._wrapper.removeClass("ui-panel-page-content" + "-open");
|
||||
}
|
||||
|
||||
if (!!o.animate && o.display !== "overlay") {
|
||||
self._wrapper.removeClass("ui-panel-animate");
|
||||
}
|
||||
|
||||
self._fixPanel();
|
||||
self._unbindFixListener();
|
||||
|
||||
self._page().removeData("panel");
|
||||
|
||||
self._trigger("close");
|
||||
|
||||
self._openedPage = null;
|
||||
};
|
||||
|
||||
self._trigger("beforeclose");
|
||||
|
||||
_closePanel();
|
||||
|
||||
self._open = false;
|
||||
}
|
||||
},
|
||||
|
||||
toggle: function () {
|
||||
this[this._open ? "close" : "open"]();
|
||||
},
|
||||
|
||||
_destroy: function () {
|
||||
var otherPanels,
|
||||
o = this.options,
|
||||
multiplePanels = ($("body > :mobile-panel").length + $.mobile.activePage.find(":mobile-panel").length) > 1;
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
|
||||
// remove the wrapper if not in use by another panel
|
||||
otherPanels = $("body > :mobile-panel").add($.mobile.activePage.find(":mobile-panel"));
|
||||
if (otherPanels.not(".ui-panel-display-overlay").not(this.element).length === 0) {
|
||||
this._wrapper.children().unwrap();
|
||||
}
|
||||
});
|
||||
if (!this._parentPage && this.options.display !== "overlay") {
|
||||
this._on(this.document, {
|
||||
"pageshow": function () {
|
||||
this._openedPage = null;
|
||||
this._getWrapper();
|
||||
|
||||
if (this._open) {
|
||||
|
||||
this._page().parent().removeClass("ui-panel-page-container");
|
||||
|
||||
if (o.theme) {
|
||||
this._page().parent().removeClass("ui-panel-page-container" + "-themed " + "ui-panel-page-container" + "-" + o.theme);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// Clean up open panels after page hide
|
||||
if (self._parentPage) {
|
||||
this.document.on("pagehide", ":jqmData(role='page')", function () {
|
||||
if (self._open) {
|
||||
self.close(true);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.document.on("pagebeforehide", function () {
|
||||
if (self._open) {
|
||||
self.close(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// state storage of open or closed
|
||||
_open: false,
|
||||
_pageContentOpenClasses: null,
|
||||
_modalOpenClasses: null,
|
||||
|
||||
open: function (immediate) {
|
||||
if (!this._open) {
|
||||
var self = this,
|
||||
o = self.options,
|
||||
|
||||
_openPanel = function () {
|
||||
self._off(self.document, "panelclose");
|
||||
self._page().jqmData("panel", "open");
|
||||
|
||||
if ($.support.cssTransform3d && !!o.animate && o.display !== "overlay") {
|
||||
self._wrapper.addClass(o.classes.animate);
|
||||
}
|
||||
|
||||
if (!immediate && $.support.cssTransform3d && !!o.animate) {
|
||||
(self._wrapper || self.element)
|
||||
.animationComplete(complete, "transition");
|
||||
} else {
|
||||
setTimeout(complete, 0);
|
||||
}
|
||||
|
||||
if (o.theme && o.display !== "overlay") {
|
||||
self._page().parent()
|
||||
.addClass(o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme);
|
||||
}
|
||||
|
||||
self.element
|
||||
.removeClass(o.classes.panelClosed)
|
||||
.addClass(o.classes.panelOpen);
|
||||
|
||||
self._positionPanel(true);
|
||||
|
||||
self._pageContentOpenClasses = self._getPosDisplayClasses(o.classes.pageContentPrefix);
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._page().parent().addClass(o.classes.pageContainer);
|
||||
self._wrapper.addClass(self._pageContentOpenClasses);
|
||||
}
|
||||
|
||||
self._modalOpenClasses = self._getPosDisplayClasses(o.classes.modal) + " " + o.classes.modalOpen;
|
||||
if (self._modal) {
|
||||
self._modal
|
||||
.addClass(self._modalOpenClasses)
|
||||
.height(Math.max(self._modal.height(), self.document.height()));
|
||||
}
|
||||
},
|
||||
complete = function () {
|
||||
|
||||
// Bail if the panel was closed before the opening animation has completed
|
||||
if (!self._open) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._wrapper.addClass(o.classes.pageContentPrefix + "-open");
|
||||
}
|
||||
|
||||
self._bindFixListener();
|
||||
|
||||
self._trigger("open");
|
||||
|
||||
self._openedPage = self._page();
|
||||
};
|
||||
|
||||
self._trigger("beforeopen");
|
||||
|
||||
if (self._page().jqmData("panel") === "open") {
|
||||
self._on(self.document, {
|
||||
"panelclose": _openPanel
|
||||
});
|
||||
} else {
|
||||
_openPanel();
|
||||
}
|
||||
|
||||
self._open = true;
|
||||
}
|
||||
},
|
||||
if (!multiplePanels) {
|
||||
|
||||
close: function (immediate) {
|
||||
if (this._open) {
|
||||
var self = this,
|
||||
o = this.options,
|
||||
this.document.off("panelopen panelclose");
|
||||
|
||||
_closePanel = function () {
|
||||
|
||||
self.element.removeClass(o.classes.panelOpen);
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._wrapper.removeClass(self._pageContentOpenClasses);
|
||||
}
|
||||
|
||||
if (!immediate && $.support.cssTransform3d && !!o.animate) {
|
||||
(self._wrapper || self.element)
|
||||
.animationComplete(complete, "transition");
|
||||
} else {
|
||||
setTimeout(complete, 0);
|
||||
}
|
||||
|
||||
if (self._modal) {
|
||||
self._modal
|
||||
.removeClass(self._modalOpenClasses)
|
||||
.height("");
|
||||
}
|
||||
},
|
||||
complete = function () {
|
||||
if (o.theme && o.display !== "overlay") {
|
||||
self._page().parent().removeClass(o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme);
|
||||
}
|
||||
|
||||
self.element.addClass(o.classes.panelClosed);
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
self._page().parent().removeClass(o.classes.pageContainer);
|
||||
self._wrapper.removeClass(o.classes.pageContentPrefix + "-open");
|
||||
}
|
||||
|
||||
if ($.support.cssTransform3d && !!o.animate && o.display !== "overlay") {
|
||||
self._wrapper.removeClass(o.classes.animate);
|
||||
}
|
||||
|
||||
self._fixPanel();
|
||||
self._unbindFixListener();
|
||||
$.mobile.resetActivePageHeight();
|
||||
|
||||
self._page().jqmRemoveData("panel");
|
||||
|
||||
self._trigger("close");
|
||||
|
||||
self._openedPage = null;
|
||||
};
|
||||
|
||||
self._trigger("beforeclose");
|
||||
|
||||
_closePanel();
|
||||
|
||||
self._open = false;
|
||||
}
|
||||
},
|
||||
|
||||
toggle: function () {
|
||||
this[this._open ? "close" : "open"]();
|
||||
},
|
||||
|
||||
_destroy: function () {
|
||||
var otherPanels,
|
||||
o = this.options,
|
||||
multiplePanels = ($("body > :mobile-panel").length + $.mobile.activePage.find(":mobile-panel").length) > 1;
|
||||
|
||||
if (o.display !== "overlay") {
|
||||
|
||||
// remove the wrapper if not in use by another panel
|
||||
otherPanels = $("body > :mobile-panel").add($.mobile.activePage.find(":mobile-panel"));
|
||||
if (otherPanels.not(".ui-panel-display-overlay").not(this.element).length === 0) {
|
||||
this._wrapper.children().unwrap();
|
||||
}
|
||||
|
||||
if (this._open) {
|
||||
this._page().removeData("panel");
|
||||
}
|
||||
|
||||
this._page().parent().removeClass(o.classes.pageContainer);
|
||||
this._panelInner.children().unwrap();
|
||||
|
||||
if (o.theme) {
|
||||
this._page().parent().removeClass(o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme);
|
||||
}
|
||||
this.element
|
||||
.removeClass([this._getPanelClasses(), "ui-panel-open", "ui-panel-animate"].join(" "))
|
||||
.off("swipeleft.panel swiperight.panel")
|
||||
.off("panelbeforeopen")
|
||||
.off("panelhide")
|
||||
.off("keyup.panel")
|
||||
.off("updatelayout");
|
||||
|
||||
if (this._modal) {
|
||||
this._modal.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!multiplePanels) {
|
||||
})(jQuery);
|
||||
|
||||
this.document.off("panelopen panelclose");
|
||||
|
||||
}
|
||||
|
||||
if (this._open) {
|
||||
this._page().jqmRemoveData("panel");
|
||||
}
|
||||
|
||||
this._panelInner.children().unwrap();
|
||||
|
||||
this.element
|
||||
.removeClass([this._getPanelClasses(), o.classes.panelOpen, o.classes.animate].join(" "))
|
||||
.off("swipeleft.panel swiperight.panel")
|
||||
.off("panelbeforeopen")
|
||||
.off("panelhide")
|
||||
.off("keyup.panel")
|
||||
.off("updatelayout");
|
||||
|
||||
if (this._modal) {
|
||||
this._modal.remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
});
|
|
@ -411,6 +411,19 @@
|
|||
|
||||
|
||||
|
||||
/* Corner styling for dialogs and popups */
|
||||
.ui-corner-all > .ui-content:first-child {
|
||||
-webkit-border-top-left-radius: inherit;
|
||||
border-top-left-radius: inherit;
|
||||
-webkit-border-top-right-radius: inherit;
|
||||
border-top-right-radius: inherit;
|
||||
}
|
||||
.ui-corner-all > .ui-content:last-child {
|
||||
-webkit-border-bottom-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
-webkit-border-bottom-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
|
||||
/* Popup arrow */
|
||||
|
@ -420,3 +433,9 @@
|
|||
top: .6em /*{global-radii-blocks}*/;
|
||||
bottom: .6em /*{global-radii-blocks}*/;
|
||||
}
|
||||
|
||||
|
||||
/* Used for hiding elements by the filterable widget. You can also use this class to hide list items or buttons in controlgroups; this ensures correct corner styling. */
|
||||
.ui-screen-hidden {
|
||||
display: none !important;
|
||||
}
|
2468
dashboard-ui/thirdparty/jquerymobile-1.4.5/jqm.popup.js
vendored
2468
dashboard-ui/thirdparty/jquerymobile-1.4.5/jqm.popup.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -1,4 +1,608 @@
|
|||
(function ($, undefined) {
|
||||
(function () {
|
||||
|
||||
if (jQuery.widget) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*!
|
||||
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
(function ($, undefined) {
|
||||
|
||||
var uuid = 0,
|
||||
slice = Array.prototype.slice,
|
||||
_cleanData = $.cleanData;
|
||||
$.cleanData = function (elems) {
|
||||
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
|
||||
try {
|
||||
$(elem).triggerHandler("remove");
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch (e) { }
|
||||
}
|
||||
_cleanData(elems);
|
||||
};
|
||||
|
||||
$.widget = function (name, base, prototype) {
|
||||
var fullName, existingConstructor, constructor, basePrototype,
|
||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||
proxiedPrototype = {},
|
||||
namespace = name.split(".")[0];
|
||||
|
||||
name = name.split(".")[1];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if (!prototype) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[":"][fullName.toLowerCase()] = function (elem) {
|
||||
return !!$.data(elem, fullName);
|
||||
};
|
||||
|
||||
$[namespace] = $[namespace] || {};
|
||||
existingConstructor = $[namespace][name];
|
||||
constructor = $[namespace][name] = function (options, element) {
|
||||
// allow instantiation without "new" keyword
|
||||
if (!this._createWidget) {
|
||||
return new constructor(options, element);
|
||||
}
|
||||
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
// must use "new" keyword (the code above always passes args)
|
||||
if (arguments.length) {
|
||||
this._createWidget(options, element);
|
||||
}
|
||||
};
|
||||
// extend with the existing constructor to carry over any static properties
|
||||
$.extend(constructor, existingConstructor, {
|
||||
version: prototype.version,
|
||||
// copy the object used to create the prototype in case we need to
|
||||
// redefine the widget later
|
||||
_proto: $.extend({}, prototype),
|
||||
// track widgets that inherit from this widget in case this widget is
|
||||
// redefined after a widget inherits from it
|
||||
_childConstructors: []
|
||||
});
|
||||
|
||||
basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
basePrototype.options = $.widget.extend({}, basePrototype.options);
|
||||
$.each(prototype, function (prop, value) {
|
||||
if (!$.isFunction(value)) {
|
||||
proxiedPrototype[prop] = value;
|
||||
return;
|
||||
}
|
||||
proxiedPrototype[prop] = (function () {
|
||||
var _super = function () {
|
||||
return base.prototype[prop].apply(this, arguments);
|
||||
},
|
||||
_superApply = function (args) {
|
||||
return base.prototype[prop].apply(this, args);
|
||||
};
|
||||
return function () {
|
||||
var __super = this._super,
|
||||
__superApply = this._superApply,
|
||||
returnValue;
|
||||
|
||||
this._super = _super;
|
||||
this._superApply = _superApply;
|
||||
|
||||
returnValue = value.apply(this, arguments);
|
||||
|
||||
this._super = __super;
|
||||
this._superApply = __superApply;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
})();
|
||||
});
|
||||
constructor.prototype = $.widget.extend(basePrototype, {
|
||||
// TODO: remove support for widgetEventPrefix
|
||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||
// don't prefix for widgets that aren't DOM-based
|
||||
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
||||
}, proxiedPrototype, {
|
||||
constructor: constructor,
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetFullName: fullName
|
||||
});
|
||||
|
||||
// If this widget is being redefined then we need to find all widgets that
|
||||
// are inheriting from it and redefine all of them so that they inherit from
|
||||
// the new version of this widget. We're essentially trying to replace one
|
||||
// level in the prototype chain.
|
||||
if (existingConstructor) {
|
||||
$.each(existingConstructor._childConstructors, function (i, child) {
|
||||
var childPrototype = child.prototype;
|
||||
|
||||
// redefine the child widget using the same prototype that was
|
||||
// originally used, but inherit from the new version of the base
|
||||
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
|
||||
});
|
||||
// remove the list of existing child constructors from the old constructor
|
||||
// so the old child constructors can be garbage collected
|
||||
delete existingConstructor._childConstructors;
|
||||
} else {
|
||||
base._childConstructors.push(constructor);
|
||||
}
|
||||
|
||||
$.widget.bridge(name, constructor);
|
||||
|
||||
return constructor;
|
||||
};
|
||||
|
||||
$.widget.extend = function (target) {
|
||||
var input = slice.call(arguments, 1),
|
||||
inputIndex = 0,
|
||||
inputLength = input.length,
|
||||
key,
|
||||
value;
|
||||
for (; inputIndex < inputLength; inputIndex++) {
|
||||
for (key in input[inputIndex]) {
|
||||
value = input[inputIndex][key];
|
||||
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
|
||||
// Clone objects
|
||||
if ($.isPlainObject(value)) {
|
||||
target[key] = $.isPlainObject(target[key]) ?
|
||||
$.widget.extend({}, target[key], value) :
|
||||
// Don't extend strings, arrays, etc. with objects
|
||||
$.widget.extend({}, value);
|
||||
// Copy everything else by reference
|
||||
} else {
|
||||
target[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
$.widget.bridge = function (name, object) {
|
||||
|
||||
var fullName = object.prototype.widgetFullName || name;
|
||||
$.fn[name] = function (options) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = slice.call(arguments, 1),
|
||||
returnValue = this;
|
||||
|
||||
// allow multiple hashes to be passed on init
|
||||
options = !isMethodCall && args.length ?
|
||||
$.widget.extend.apply(null, [options].concat(args)) :
|
||||
options;
|
||||
|
||||
if (isMethodCall) {
|
||||
this.each(function () {
|
||||
var methodValue,
|
||||
instance = $.data(this, fullName);
|
||||
if (options === "instance") {
|
||||
returnValue = instance;
|
||||
return false;
|
||||
}
|
||||
if (!instance) {
|
||||
return $.error("cannot call methods on " + name + " prior to initialization; " +
|
||||
"attempted to call method '" + options + "'");
|
||||
}
|
||||
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
|
||||
return $.error("no such method '" + options + "' for " + name + " widget instance");
|
||||
}
|
||||
methodValue = instance[options].apply(instance, args);
|
||||
if (methodValue !== instance && methodValue !== undefined) {
|
||||
returnValue = methodValue && methodValue.jquery ?
|
||||
returnValue.pushStack(methodValue.get()) :
|
||||
methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.each(function () {
|
||||
var instance = $.data(this, fullName);
|
||||
if (instance) {
|
||||
instance.option(options || {})._init();
|
||||
} else {
|
||||
$.data(this, fullName, new object(options, this));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function ( /* options, element */) { };
|
||||
$.Widget._childConstructors = [];
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
defaultElement: "<div>",
|
||||
options: {
|
||||
disabled: false,
|
||||
|
||||
// callbacks
|
||||
create: null
|
||||
},
|
||||
_createWidget: function (options, element) {
|
||||
element = $(element || this.defaultElement || this)[0];
|
||||
this.element = $(element);
|
||||
this.uuid = uuid++;
|
||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||
this.options = $.widget.extend({},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options);
|
||||
|
||||
this.bindings = $();
|
||||
this.hoverable = $();
|
||||
this.focusable = $();
|
||||
|
||||
if (element !== this) {
|
||||
$.data(element, this.widgetFullName, this);
|
||||
this._on(true, this.element, {
|
||||
remove: function (event) {
|
||||
if (event.target === element) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.document = $(element.style ?
|
||||
// element within the document
|
||||
element.ownerDocument :
|
||||
// element is window or document
|
||||
element.document || element);
|
||||
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
|
||||
}
|
||||
|
||||
this._create();
|
||||
this._trigger("create", null, this._getCreateEventData());
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: $.noop,
|
||||
_getCreateEventData: $.noop,
|
||||
_create: $.noop,
|
||||
_init: $.noop,
|
||||
|
||||
destroy: function () {
|
||||
this._destroy();
|
||||
// we can probably remove the unbind calls in 2.0
|
||||
// all event bindings should go through this._on()
|
||||
this.element
|
||||
.unbind(this.eventNamespace)
|
||||
.removeData(this.widgetFullName)
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
.removeData($.camelCase(this.widgetFullName));
|
||||
this.widget()
|
||||
.unbind(this.eventNamespace)
|
||||
.removeAttr("aria-disabled")
|
||||
.removeClass(
|
||||
this.widgetFullName + "-disabled " +
|
||||
"ui-state-disabled");
|
||||
|
||||
// clean up events and states
|
||||
this.bindings.unbind(this.eventNamespace);
|
||||
this.hoverable.removeClass("ui-state-hover");
|
||||
this.focusable.removeClass("ui-state-focus");
|
||||
},
|
||||
_destroy: $.noop,
|
||||
|
||||
widget: function () {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function (key, value) {
|
||||
var options = key,
|
||||
parts,
|
||||
curOption,
|
||||
i;
|
||||
|
||||
if (arguments.length === 0) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.widget.extend({}, this.options);
|
||||
}
|
||||
|
||||
if (typeof key === "string") {
|
||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||
options = {};
|
||||
parts = key.split(".");
|
||||
key = parts.shift();
|
||||
if (parts.length) {
|
||||
curOption = options[key] = $.widget.extend({}, this.options[key]);
|
||||
for (i = 0; i < parts.length - 1; i++) {
|
||||
curOption[parts[i]] = curOption[parts[i]] || {};
|
||||
curOption = curOption[parts[i]];
|
||||
}
|
||||
key = parts.pop();
|
||||
if (value === undefined) {
|
||||
return curOption[key] === undefined ? null : curOption[key];
|
||||
}
|
||||
curOption[key] = value;
|
||||
} else {
|
||||
if (value === undefined) {
|
||||
return this.options[key] === undefined ? null : this.options[key];
|
||||
}
|
||||
options[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._setOptions(options);
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function (options) {
|
||||
var key;
|
||||
|
||||
for (key in options) {
|
||||
this._setOption(key, options[key]);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function (key, value) {
|
||||
this.options[key] = value;
|
||||
|
||||
if (key === "disabled") {
|
||||
this.widget()
|
||||
.toggleClass(this.widgetFullName + "-disabled", !!value);
|
||||
this.hoverable.removeClass("ui-state-hover");
|
||||
this.focusable.removeClass("ui-state-focus");
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
return this._setOptions({ disabled: false });
|
||||
},
|
||||
disable: function () {
|
||||
return this._setOptions({ disabled: true });
|
||||
},
|
||||
|
||||
_on: function (suppressDisabledCheck, element, handlers) {
|
||||
var delegateElement,
|
||||
instance = this;
|
||||
|
||||
// no suppressDisabledCheck flag, shuffle arguments
|
||||
if (typeof suppressDisabledCheck !== "boolean") {
|
||||
handlers = element;
|
||||
element = suppressDisabledCheck;
|
||||
suppressDisabledCheck = false;
|
||||
}
|
||||
|
||||
// no element argument, shuffle and use this.element
|
||||
if (!handlers) {
|
||||
handlers = element;
|
||||
element = this.element;
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
// accept selectors, DOM elements
|
||||
element = delegateElement = $(element);
|
||||
this.bindings = this.bindings.add(element);
|
||||
}
|
||||
|
||||
$.each(handlers, function (event, handler) {
|
||||
function handlerProxy() {
|
||||
// allow widgets to customize the disabled handling
|
||||
// - disabled as an array instead of boolean
|
||||
// - disabled class as method for disabling individual parts
|
||||
if (!suppressDisabledCheck &&
|
||||
(instance.options.disabled === true ||
|
||||
$(this).hasClass("ui-state-disabled"))) {
|
||||
return;
|
||||
}
|
||||
return (typeof handler === "string" ? instance[handler] : handler)
|
||||
.apply(instance, arguments);
|
||||
}
|
||||
|
||||
// copy the guid so direct unbinding works
|
||||
if (typeof handler !== "string") {
|
||||
handlerProxy.guid = handler.guid =
|
||||
handler.guid || handlerProxy.guid || $.guid++;
|
||||
}
|
||||
|
||||
var match = event.match(/^(\w+)\s*(.*)$/),
|
||||
eventName = match[1] + instance.eventNamespace,
|
||||
selector = match[2];
|
||||
if (selector) {
|
||||
delegateElement.delegate(selector, eventName, handlerProxy);
|
||||
} else {
|
||||
element.bind(eventName, handlerProxy);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_off: function (element, eventName) {
|
||||
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
|
||||
element.unbind(eventName).undelegate(eventName);
|
||||
},
|
||||
|
||||
_trigger: function (type, event, data) {
|
||||
var prop, orig,
|
||||
callback = this.options[type];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event(event);
|
||||
event.type = (type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[0];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if (orig) {
|
||||
for (prop in orig) {
|
||||
if (!(prop in event)) {
|
||||
event[prop] = orig[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element[0].dispatchEvent(new CustomEvent(event.type, {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
data: data,
|
||||
originalEvent: event
|
||||
}
|
||||
}));
|
||||
|
||||
//this.element.trigger(event, data);
|
||||
return !($.isFunction(callback) &&
|
||||
callback.apply(this.element[0], [event].concat(data)) === false ||
|
||||
event.isDefaultPrevented());
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
$.extend($.Widget.prototype, {
|
||||
_getCreateOptions: function () {
|
||||
|
||||
var option, value,
|
||||
elem = this.element[0],
|
||||
options = {};
|
||||
|
||||
//
|
||||
if (!this.element.data("defaults")) {
|
||||
for (option in this.options) {
|
||||
|
||||
value = this.element.data(option);
|
||||
|
||||
if (value != null) {
|
||||
options[option] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
|
||||
var originalWidget = $.widget
|
||||
|
||||
$.widget = (function (orig) {
|
||||
return function () {
|
||||
var constructor = orig.apply(this, arguments),
|
||||
name = constructor.prototype.widgetName;
|
||||
|
||||
constructor.initSelector = ((constructor.prototype.initSelector !== undefined) ?
|
||||
constructor.prototype.initSelector : "*[data-role='" + name + "']:not([data-role='none'])");
|
||||
|
||||
$.mobile.widgets[name] = constructor;
|
||||
|
||||
return constructor;
|
||||
};
|
||||
})($.widget);
|
||||
|
||||
// Make sure $.widget still has bridge and extend methods
|
||||
$.extend($.widget, originalWidget);
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
})();
|
||||
|
||||
(function ($, window, undefined) {
|
||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
||||
|
||||
$.extend($.mobile, {
|
||||
|
||||
// Namespace used framework-wide for data-attrs. Default is no namespace
|
||||
|
||||
// Retrieve an attribute from an element and perform some massaging of the value
|
||||
|
||||
getAttribute: function (element, key) {
|
||||
var data;
|
||||
|
||||
element = element.jquery ? element[0] : element;
|
||||
|
||||
if (element && element.getAttribute) {
|
||||
data = element.getAttribute("data-" + key);
|
||||
}
|
||||
|
||||
// Copied from core's src/data.js:dataAttr()
|
||||
// Convert from a string to a proper data type
|
||||
try {
|
||||
data = data === "true" ? true :
|
||||
data === "false" ? false :
|
||||
data === "null" ? null :
|
||||
// Only convert to a number if it doesn't change the string
|
||||
+data + "" === data ? +data :
|
||||
rbrace.test(data) ? JSON.parse(data) :
|
||||
data;
|
||||
} catch (err) { }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, this);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
/*!
|
||||
* jQuery UI Core c0ab71056b936627e8a7821f03c044aec6280a40
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/category/ui-core/
|
||||
*/
|
||||
(function ($, undefined) {
|
||||
|
||||
// $.ui might exist from components with no dependencies, e.g., $.ui.position
|
||||
$.ui = $.ui || {};
|
||||
|
||||
$.extend($.ui, {
|
||||
version: "c0ab71056b936627e8a7821f03c044aec6280a40",
|
||||
|
||||
keyCode: {
|
||||
BACKSPACE: 8,
|
||||
COMMA: 188,
|
||||
DELETE: 46,
|
||||
DOWN: 40,
|
||||
END: 35,
|
||||
ENTER: 13,
|
||||
ESCAPE: 27,
|
||||
HOME: 36,
|
||||
LEFT: 37,
|
||||
PAGE_DOWN: 34,
|
||||
PAGE_UP: 33,
|
||||
PERIOD: 190,
|
||||
RIGHT: 39,
|
||||
SPACE: 32,
|
||||
TAB: 9,
|
||||
UP: 38
|
||||
}
|
||||
});
|
||||
|
||||
// deprecated
|
||||
$.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());
|
||||
|
||||
})(jQuery);
|
||||
|
||||
$.widget("mobile.slider", $.extend({
|
||||
initSelector: "input[type='range']:not([data-role='none'])",
|
||||
|
@ -20,11 +624,11 @@
|
|||
control = this.element,
|
||||
trackTheme = this.options.trackTheme || $.mobile.getAttribute(control[0], "theme"),
|
||||
trackThemeClass = trackTheme ? " ui-bar-" + trackTheme : " ui-bar-inherit",
|
||||
cornerClass = (this.options.corners || control.jqmData("corners")) ? " ui-corner-all" : "",
|
||||
miniClass = (this.options.mini || control.jqmData("mini")) ? " ui-mini" : "",
|
||||
cornerClass = (this.options.corners || control.data("corners")) ? " ui-corner-all" : "",
|
||||
miniClass = (this.options.mini || control.data("mini")) ? " ui-mini" : "",
|
||||
cType = control[0].nodeName.toLowerCase(),
|
||||
isToggleSwitch = (cType === "select"),
|
||||
isRangeslider = control.parent().is(":jqmData(role='rangeslider')"),
|
||||
isRangeslider = control.parent().is("[data-role='rangeslider']"),
|
||||
selectClass = (isToggleSwitch) ? "ui-slider-switch" : "",
|
||||
controlID = control.attr("id"),
|
||||
$label = $("[for='" + controlID + "']"),
|
||||
|
@ -230,14 +834,14 @@
|
|||
|
||||
// In all cases prevent the default and mark the handle as active
|
||||
switch (event.keyCode) {
|
||||
case $.mobile.keyCode.HOME:
|
||||
case $.mobile.keyCode.END:
|
||||
case $.mobile.keyCode.PAGE_UP:
|
||||
case $.mobile.keyCode.PAGE_DOWN:
|
||||
case $.mobile.keyCode.UP:
|
||||
case $.mobile.keyCode.RIGHT:
|
||||
case $.mobile.keyCode.DOWN:
|
||||
case $.mobile.keyCode.LEFT:
|
||||
case $.ui.keyCode.HOME:
|
||||
case $.ui.keyCode.END:
|
||||
case $.ui.keyCode.PAGE_UP:
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
case $.ui.keyCode.UP:
|
||||
case $.ui.keyCode.RIGHT:
|
||||
case $.ui.keyCode.DOWN:
|
||||
case $.ui.keyCode.LEFT:
|
||||
event.preventDefault();
|
||||
|
||||
if (!this._keySliding) {
|
||||
|
@ -250,20 +854,20 @@
|
|||
|
||||
// move the slider according to the keypress
|
||||
switch (event.keyCode) {
|
||||
case $.mobile.keyCode.HOME:
|
||||
case $.ui.keyCode.HOME:
|
||||
this.refresh(this.min);
|
||||
break;
|
||||
case $.mobile.keyCode.END:
|
||||
case $.ui.keyCode.END:
|
||||
this.refresh(this.max);
|
||||
break;
|
||||
case $.mobile.keyCode.PAGE_UP:
|
||||
case $.mobile.keyCode.UP:
|
||||
case $.mobile.keyCode.RIGHT:
|
||||
case $.ui.keyCode.PAGE_UP:
|
||||
case $.ui.keyCode.UP:
|
||||
case $.ui.keyCode.RIGHT:
|
||||
this.refresh(index + this.step);
|
||||
break;
|
||||
case $.mobile.keyCode.PAGE_DOWN:
|
||||
case $.mobile.keyCode.DOWN:
|
||||
case $.mobile.keyCode.LEFT:
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
case $.ui.keyCode.DOWN:
|
||||
case $.ui.keyCode.LEFT:
|
||||
this.refresh(index - this.step);
|
||||
break;
|
||||
}
|
||||
|
@ -475,9 +1079,9 @@
|
|||
|
||||
this.handle[0].setAttribute("aria-valuenow", isInput ? newval : optionElements.eq(newval).attr("value"));
|
||||
|
||||
this.handle[0].setAttribute("aria-valuetext", isInput ? newval : optionElements.eq(newval).getEncodedText());
|
||||
this.handle[0].setAttribute("aria-valuetext", isInput ? newval : optionElements.eq(newval).text());
|
||||
|
||||
this.handle[0].setAttribute("title", isInput ? newval : optionElements.eq(newval).getEncodedText());
|
||||
this.handle[0].setAttribute("title", isInput ? newval : optionElements.eq(newval).text());
|
||||
|
||||
if (this.valuebg) {
|
||||
this.valuebg.css("width", percent + "%");
|
||||
|
|
|
@ -1,4 +1,59 @@
|
|||
.ui-table {
|
||||
.ui-block-a,
|
||||
.ui-block-b,
|
||||
.ui-block-c,
|
||||
.ui-block-d,
|
||||
.ui-block-e {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
float: left;
|
||||
min-height: 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* force new row */
|
||||
.ui-block-a {
|
||||
clear: left;
|
||||
}
|
||||
li.ui-block-a,
|
||||
li.ui-block-b,
|
||||
li.ui-block-c,
|
||||
li.ui-block-d,
|
||||
li.ui-block-e {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
/* No margin in grids for 100% width button elements until we can use max-width: fill-available; */
|
||||
[class*="ui-block-"] > button.ui-btn {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
[class*="ui-block-"] > .ui-btn,
|
||||
[class*="ui-block-"] > .ui-select,
|
||||
[class*="ui-block-"] > .ui-checkbox,
|
||||
[class*="ui-block-"] > .ui-radio,
|
||||
[class*="ui-block-"] > button.ui-btn-inline,
|
||||
[class*="ui-block-"] > button.ui-btn-icon-notext {
|
||||
margin-right: .3125em;
|
||||
margin-left: .3125em;
|
||||
}
|
||||
|
||||
/* preset breakpoint to switch to stacked grid styles below 35em (560px) */
|
||||
@media (max-width: 35em) {
|
||||
.ui-responsive > .ui-block-a,
|
||||
.ui-responsive > .ui-block-b,
|
||||
.ui-responsive > .ui-block-c,
|
||||
.ui-responsive > .ui-block-d,
|
||||
.ui-responsive > .ui-block-e {
|
||||
width: 100%;
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
|
||||
.ui-table {
|
||||
border: 0;
|
||||
border-collapse: collapse;
|
||||
padding: 0;
|
||||
|
|
|
@ -1,16 +1,574 @@
|
|||
(function ($, undefined) {
|
||||
(function () {
|
||||
|
||||
if (jQuery.widget) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*!
|
||||
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
(function ($, undefined) {
|
||||
|
||||
var uuid = 0,
|
||||
slice = Array.prototype.slice,
|
||||
_cleanData = $.cleanData;
|
||||
$.cleanData = function (elems) {
|
||||
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
|
||||
try {
|
||||
$(elem).triggerHandler("remove");
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch (e) { }
|
||||
}
|
||||
_cleanData(elems);
|
||||
};
|
||||
|
||||
$.widget = function (name, base, prototype) {
|
||||
var fullName, existingConstructor, constructor, basePrototype,
|
||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||
proxiedPrototype = {},
|
||||
namespace = name.split(".")[0];
|
||||
|
||||
name = name.split(".")[1];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if (!prototype) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[":"][fullName.toLowerCase()] = function (elem) {
|
||||
return !!$.data(elem, fullName);
|
||||
};
|
||||
|
||||
$[namespace] = $[namespace] || {};
|
||||
existingConstructor = $[namespace][name];
|
||||
constructor = $[namespace][name] = function (options, element) {
|
||||
// allow instantiation without "new" keyword
|
||||
if (!this._createWidget) {
|
||||
return new constructor(options, element);
|
||||
}
|
||||
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
// must use "new" keyword (the code above always passes args)
|
||||
if (arguments.length) {
|
||||
this._createWidget(options, element);
|
||||
}
|
||||
};
|
||||
// extend with the existing constructor to carry over any static properties
|
||||
$.extend(constructor, existingConstructor, {
|
||||
version: prototype.version,
|
||||
// copy the object used to create the prototype in case we need to
|
||||
// redefine the widget later
|
||||
_proto: $.extend({}, prototype),
|
||||
// track widgets that inherit from this widget in case this widget is
|
||||
// redefined after a widget inherits from it
|
||||
_childConstructors: []
|
||||
});
|
||||
|
||||
basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
basePrototype.options = $.widget.extend({}, basePrototype.options);
|
||||
$.each(prototype, function (prop, value) {
|
||||
if (!$.isFunction(value)) {
|
||||
proxiedPrototype[prop] = value;
|
||||
return;
|
||||
}
|
||||
proxiedPrototype[prop] = (function () {
|
||||
var _super = function () {
|
||||
return base.prototype[prop].apply(this, arguments);
|
||||
},
|
||||
_superApply = function (args) {
|
||||
return base.prototype[prop].apply(this, args);
|
||||
};
|
||||
return function () {
|
||||
var __super = this._super,
|
||||
__superApply = this._superApply,
|
||||
returnValue;
|
||||
|
||||
this._super = _super;
|
||||
this._superApply = _superApply;
|
||||
|
||||
returnValue = value.apply(this, arguments);
|
||||
|
||||
this._super = __super;
|
||||
this._superApply = __superApply;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
})();
|
||||
});
|
||||
constructor.prototype = $.widget.extend(basePrototype, {
|
||||
// TODO: remove support for widgetEventPrefix
|
||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||
// don't prefix for widgets that aren't DOM-based
|
||||
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
||||
}, proxiedPrototype, {
|
||||
constructor: constructor,
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetFullName: fullName
|
||||
});
|
||||
|
||||
// If this widget is being redefined then we need to find all widgets that
|
||||
// are inheriting from it and redefine all of them so that they inherit from
|
||||
// the new version of this widget. We're essentially trying to replace one
|
||||
// level in the prototype chain.
|
||||
if (existingConstructor) {
|
||||
$.each(existingConstructor._childConstructors, function (i, child) {
|
||||
var childPrototype = child.prototype;
|
||||
|
||||
// redefine the child widget using the same prototype that was
|
||||
// originally used, but inherit from the new version of the base
|
||||
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
|
||||
});
|
||||
// remove the list of existing child constructors from the old constructor
|
||||
// so the old child constructors can be garbage collected
|
||||
delete existingConstructor._childConstructors;
|
||||
} else {
|
||||
base._childConstructors.push(constructor);
|
||||
}
|
||||
|
||||
$.widget.bridge(name, constructor);
|
||||
|
||||
return constructor;
|
||||
};
|
||||
|
||||
$.widget.extend = function (target) {
|
||||
var input = slice.call(arguments, 1),
|
||||
inputIndex = 0,
|
||||
inputLength = input.length,
|
||||
key,
|
||||
value;
|
||||
for (; inputIndex < inputLength; inputIndex++) {
|
||||
for (key in input[inputIndex]) {
|
||||
value = input[inputIndex][key];
|
||||
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
|
||||
// Clone objects
|
||||
if ($.isPlainObject(value)) {
|
||||
target[key] = $.isPlainObject(target[key]) ?
|
||||
$.widget.extend({}, target[key], value) :
|
||||
// Don't extend strings, arrays, etc. with objects
|
||||
$.widget.extend({}, value);
|
||||
// Copy everything else by reference
|
||||
} else {
|
||||
target[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
$.widget.bridge = function (name, object) {
|
||||
|
||||
var fullName = object.prototype.widgetFullName || name;
|
||||
$.fn[name] = function (options) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = slice.call(arguments, 1),
|
||||
returnValue = this;
|
||||
|
||||
// allow multiple hashes to be passed on init
|
||||
options = !isMethodCall && args.length ?
|
||||
$.widget.extend.apply(null, [options].concat(args)) :
|
||||
options;
|
||||
|
||||
if (isMethodCall) {
|
||||
this.each(function () {
|
||||
var methodValue,
|
||||
instance = $.data(this, fullName);
|
||||
if (options === "instance") {
|
||||
returnValue = instance;
|
||||
return false;
|
||||
}
|
||||
if (!instance) {
|
||||
return $.error("cannot call methods on " + name + " prior to initialization; " +
|
||||
"attempted to call method '" + options + "'");
|
||||
}
|
||||
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
|
||||
return $.error("no such method '" + options + "' for " + name + " widget instance");
|
||||
}
|
||||
methodValue = instance[options].apply(instance, args);
|
||||
if (methodValue !== instance && methodValue !== undefined) {
|
||||
returnValue = methodValue && methodValue.jquery ?
|
||||
returnValue.pushStack(methodValue.get()) :
|
||||
methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.each(function () {
|
||||
var instance = $.data(this, fullName);
|
||||
if (instance) {
|
||||
instance.option(options || {})._init();
|
||||
} else {
|
||||
$.data(this, fullName, new object(options, this));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function ( /* options, element */) { };
|
||||
$.Widget._childConstructors = [];
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
defaultElement: "<div>",
|
||||
options: {
|
||||
disabled: false,
|
||||
|
||||
// callbacks
|
||||
create: null
|
||||
},
|
||||
_createWidget: function (options, element) {
|
||||
element = $(element || this.defaultElement || this)[0];
|
||||
this.element = $(element);
|
||||
this.uuid = uuid++;
|
||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||
this.options = $.widget.extend({},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options);
|
||||
|
||||
this.bindings = $();
|
||||
this.hoverable = $();
|
||||
this.focusable = $();
|
||||
|
||||
if (element !== this) {
|
||||
$.data(element, this.widgetFullName, this);
|
||||
this._on(true, this.element, {
|
||||
remove: function (event) {
|
||||
if (event.target === element) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.document = $(element.style ?
|
||||
// element within the document
|
||||
element.ownerDocument :
|
||||
// element is window or document
|
||||
element.document || element);
|
||||
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
|
||||
}
|
||||
|
||||
this._create();
|
||||
this._trigger("create", null, this._getCreateEventData());
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: $.noop,
|
||||
_getCreateEventData: $.noop,
|
||||
_create: $.noop,
|
||||
_init: $.noop,
|
||||
|
||||
destroy: function () {
|
||||
this._destroy();
|
||||
// we can probably remove the unbind calls in 2.0
|
||||
// all event bindings should go through this._on()
|
||||
this.element
|
||||
.unbind(this.eventNamespace)
|
||||
.removeData(this.widgetFullName)
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
.removeData($.camelCase(this.widgetFullName));
|
||||
this.widget()
|
||||
.unbind(this.eventNamespace)
|
||||
.removeAttr("aria-disabled")
|
||||
.removeClass(
|
||||
this.widgetFullName + "-disabled " +
|
||||
"ui-state-disabled");
|
||||
|
||||
// clean up events and states
|
||||
this.bindings.unbind(this.eventNamespace);
|
||||
this.hoverable.removeClass("ui-state-hover");
|
||||
this.focusable.removeClass("ui-state-focus");
|
||||
},
|
||||
_destroy: $.noop,
|
||||
|
||||
widget: function () {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function (key, value) {
|
||||
var options = key,
|
||||
parts,
|
||||
curOption,
|
||||
i;
|
||||
|
||||
if (arguments.length === 0) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.widget.extend({}, this.options);
|
||||
}
|
||||
|
||||
if (typeof key === "string") {
|
||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||
options = {};
|
||||
parts = key.split(".");
|
||||
key = parts.shift();
|
||||
if (parts.length) {
|
||||
curOption = options[key] = $.widget.extend({}, this.options[key]);
|
||||
for (i = 0; i < parts.length - 1; i++) {
|
||||
curOption[parts[i]] = curOption[parts[i]] || {};
|
||||
curOption = curOption[parts[i]];
|
||||
}
|
||||
key = parts.pop();
|
||||
if (value === undefined) {
|
||||
return curOption[key] === undefined ? null : curOption[key];
|
||||
}
|
||||
curOption[key] = value;
|
||||
} else {
|
||||
if (value === undefined) {
|
||||
return this.options[key] === undefined ? null : this.options[key];
|
||||
}
|
||||
options[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._setOptions(options);
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function (options) {
|
||||
var key;
|
||||
|
||||
for (key in options) {
|
||||
this._setOption(key, options[key]);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function (key, value) {
|
||||
this.options[key] = value;
|
||||
|
||||
if (key === "disabled") {
|
||||
this.widget()
|
||||
.toggleClass(this.widgetFullName + "-disabled", !!value);
|
||||
this.hoverable.removeClass("ui-state-hover");
|
||||
this.focusable.removeClass("ui-state-focus");
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
return this._setOptions({ disabled: false });
|
||||
},
|
||||
disable: function () {
|
||||
return this._setOptions({ disabled: true });
|
||||
},
|
||||
|
||||
_on: function (suppressDisabledCheck, element, handlers) {
|
||||
var delegateElement,
|
||||
instance = this;
|
||||
|
||||
// no suppressDisabledCheck flag, shuffle arguments
|
||||
if (typeof suppressDisabledCheck !== "boolean") {
|
||||
handlers = element;
|
||||
element = suppressDisabledCheck;
|
||||
suppressDisabledCheck = false;
|
||||
}
|
||||
|
||||
// no element argument, shuffle and use this.element
|
||||
if (!handlers) {
|
||||
handlers = element;
|
||||
element = this.element;
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
// accept selectors, DOM elements
|
||||
element = delegateElement = $(element);
|
||||
this.bindings = this.bindings.add(element);
|
||||
}
|
||||
|
||||
$.each(handlers, function (event, handler) {
|
||||
function handlerProxy() {
|
||||
// allow widgets to customize the disabled handling
|
||||
// - disabled as an array instead of boolean
|
||||
// - disabled class as method for disabling individual parts
|
||||
if (!suppressDisabledCheck &&
|
||||
(instance.options.disabled === true ||
|
||||
$(this).hasClass("ui-state-disabled"))) {
|
||||
return;
|
||||
}
|
||||
return (typeof handler === "string" ? instance[handler] : handler)
|
||||
.apply(instance, arguments);
|
||||
}
|
||||
|
||||
// copy the guid so direct unbinding works
|
||||
if (typeof handler !== "string") {
|
||||
handlerProxy.guid = handler.guid =
|
||||
handler.guid || handlerProxy.guid || $.guid++;
|
||||
}
|
||||
|
||||
var match = event.match(/^(\w+)\s*(.*)$/),
|
||||
eventName = match[1] + instance.eventNamespace,
|
||||
selector = match[2];
|
||||
if (selector) {
|
||||
delegateElement.delegate(selector, eventName, handlerProxy);
|
||||
} else {
|
||||
element.bind(eventName, handlerProxy);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_off: function (element, eventName) {
|
||||
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
|
||||
element.unbind(eventName).undelegate(eventName);
|
||||
},
|
||||
|
||||
_trigger: function (type, event, data) {
|
||||
var prop, orig,
|
||||
callback = this.options[type];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event(event);
|
||||
event.type = (type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[0];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if (orig) {
|
||||
for (prop in orig) {
|
||||
if (!(prop in event)) {
|
||||
event[prop] = orig[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element[0].dispatchEvent(new CustomEvent(event.type, {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
data: data,
|
||||
originalEvent: event
|
||||
}
|
||||
}));
|
||||
|
||||
//this.element.trigger(event, data);
|
||||
return !($.isFunction(callback) &&
|
||||
callback.apply(this.element[0], [event].concat(data)) === false ||
|
||||
event.isDefaultPrevented());
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
$.extend($.Widget.prototype, {
|
||||
_getCreateOptions: function () {
|
||||
|
||||
var option, value,
|
||||
elem = this.element[0],
|
||||
options = {};
|
||||
|
||||
//
|
||||
if (!this.element.data("defaults")) {
|
||||
for (option in this.options) {
|
||||
|
||||
value = this.element.data(option);
|
||||
|
||||
if (value != null) {
|
||||
options[option] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
|
||||
var originalWidget = $.widget
|
||||
|
||||
$.widget = (function (orig) {
|
||||
return function () {
|
||||
var constructor = orig.apply(this, arguments),
|
||||
name = constructor.prototype.widgetName;
|
||||
|
||||
constructor.initSelector = ((constructor.prototype.initSelector !== undefined) ?
|
||||
constructor.prototype.initSelector : "*[data-role='" + name + "']:not([data-role='none'])");
|
||||
|
||||
$.mobile.widgets[name] = constructor;
|
||||
|
||||
return constructor;
|
||||
};
|
||||
})($.widget);
|
||||
|
||||
// Make sure $.widget still has bridge and extend methods
|
||||
$.extend($.widget, originalWidget);
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
})();
|
||||
|
||||
(function ($, window, undefined) {
|
||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
||||
|
||||
$.extend($.mobile, {
|
||||
|
||||
// Namespace used framework-wide for data-attrs. Default is no namespace
|
||||
|
||||
// Retrieve an attribute from an element and perform some massaging of the value
|
||||
|
||||
getAttribute: function (element, key) {
|
||||
var data;
|
||||
|
||||
element = element.jquery ? element[0] : element;
|
||||
|
||||
if (element && element.getAttribute) {
|
||||
data = element.getAttribute("data-" + key);
|
||||
}
|
||||
|
||||
// Copied from core's src/data.js:dataAttr()
|
||||
// Convert from a string to a proper data type
|
||||
try {
|
||||
data = data === "true" ? true :
|
||||
data === "false" ? false :
|
||||
data === "null" ? null :
|
||||
// Only convert to a number if it doesn't change the string
|
||||
+data + "" === data ? +data :
|
||||
rbrace.test(data) ? JSON.parse(data) :
|
||||
data;
|
||||
} catch (err) { }
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, this);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
$.widget("mobile.table", {
|
||||
options: {
|
||||
classes: {
|
||||
table: "ui-table"
|
||||
},
|
||||
enhanced: false
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
if (!this.options.enhanced) {
|
||||
this.element.addClass(this.options.classes.table);
|
||||
this.element.addClass("ui-table");
|
||||
}
|
||||
|
||||
// extend here, assign on refresh > _setHeaders
|
||||
|
@ -58,7 +616,7 @@
|
|||
selector = ":nth-child(" + (columnCount + 1) + ")",
|
||||
j;
|
||||
|
||||
this.setAttribute("data-" + $.mobile.ns + "colstart", columnCount + 1);
|
||||
this.setAttribute("data-colstart", columnCount + 1);
|
||||
|
||||
if (span) {
|
||||
for (j = 0; j < span - 1; j++) {
|
||||
|
@ -69,7 +627,7 @@
|
|||
|
||||
// Store "cells" data on header as a reference to all cells in the
|
||||
// same column as this TH
|
||||
$(this).jqmData("cells", table.find("tr").not(trs.eq(0)).not(this).children(selector));
|
||||
$(this).data("cells", table.find("tr").not(trs.eq(0)).not(this).children(selector));
|
||||
|
||||
columnCount++;
|
||||
});
|
||||
|
@ -84,11 +642,7 @@
|
|||
|
||||
$.widget("mobile.table", $.mobile.table, {
|
||||
options: {
|
||||
mode: "reflow",
|
||||
classes: $.extend($.mobile.table.prototype.options.classes, {
|
||||
reflowTable: "ui-table-reflow",
|
||||
cellLabels: "ui-table-cell-label"
|
||||
})
|
||||
mode: "reflow"
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
|
@ -100,7 +654,7 @@
|
|||
}
|
||||
|
||||
if (!this.options.enhanced) {
|
||||
this.element.addClass(this.options.classes.reflowTable);
|
||||
this.element.addClass("ui-table-reflow");
|
||||
|
||||
this._updateReflow();
|
||||
}
|
||||
|
@ -127,7 +681,7 @@
|
|||
|
||||
// get headers in reverse order so that top-level headers are appended last
|
||||
$(table.allHeaders.get().reverse()).each(function () {
|
||||
var cells = $(this).jqmData("cells"),
|
||||
var cells = $(this).data("cells"),
|
||||
colstart = $.mobile.getAttribute(this, "colstart"),
|
||||
hierarchyClass = cells.not(this).filter("thead th").length && " ui-table-cell-label-top",
|
||||
contents = $(this).clone().contents(),
|
||||
|
@ -144,9 +698,9 @@
|
|||
}
|
||||
|
||||
table._addLabels(cells.filter(filter),
|
||||
opts.classes.cellLabels + hierarchyClass, contents);
|
||||
"ui-table-cell-label" + hierarchyClass, contents);
|
||||
} else {
|
||||
table._addLabels(cells, opts.classes.cellLabels, contents);
|
||||
table._addLabels(cells, "ui-table-cell-label", contents);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
523
dashboard-ui/thirdparty/jquerymobile-1.4.5/jqm.widget.js
vendored
Normal file
523
dashboard-ui/thirdparty/jquerymobile-1.4.5/jqm.widget.js
vendored
Normal file
|
@ -0,0 +1,523 @@
|
|||
(function () {
|
||||
|
||||
if (jQuery.widget) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*!
|
||||
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
|
||||
* http://jqueryui.com
|
||||
*
|
||||
* Copyright 2013 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
(function ($, undefined) {
|
||||
|
||||
var uuid = 0,
|
||||
slice = Array.prototype.slice,
|
||||
_cleanData = $.cleanData;
|
||||
$.cleanData = function (elems) {
|
||||
for (var i = 0, elem; (elem = elems[i]) != null; i++) {
|
||||
try {
|
||||
$(elem).triggerHandler("remove");
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch (e) { }
|
||||
}
|
||||
_cleanData(elems);
|
||||
};
|
||||
|
||||
$.widget = function (name, base, prototype) {
|
||||
var fullName, existingConstructor, constructor, basePrototype,
|
||||
// proxiedPrototype allows the provided prototype to remain unmodified
|
||||
// so that it can be used as a mixin for multiple widgets (#8876)
|
||||
proxiedPrototype = {},
|
||||
namespace = name.split(".")[0];
|
||||
|
||||
name = name.split(".")[1];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if (!prototype) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[":"][fullName.toLowerCase()] = function (elem) {
|
||||
return !!$.data(elem, fullName);
|
||||
};
|
||||
|
||||
$[namespace] = $[namespace] || {};
|
||||
existingConstructor = $[namespace][name];
|
||||
constructor = $[namespace][name] = function (options, element) {
|
||||
// allow instantiation without "new" keyword
|
||||
if (!this._createWidget) {
|
||||
return new constructor(options, element);
|
||||
}
|
||||
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
// must use "new" keyword (the code above always passes args)
|
||||
if (arguments.length) {
|
||||
this._createWidget(options, element);
|
||||
}
|
||||
};
|
||||
// extend with the existing constructor to carry over any static properties
|
||||
$.extend(constructor, existingConstructor, {
|
||||
version: prototype.version,
|
||||
// copy the object used to create the prototype in case we need to
|
||||
// redefine the widget later
|
||||
_proto: $.extend({}, prototype),
|
||||
// track widgets that inherit from this widget in case this widget is
|
||||
// redefined after a widget inherits from it
|
||||
_childConstructors: []
|
||||
});
|
||||
|
||||
basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
basePrototype.options = $.widget.extend({}, basePrototype.options);
|
||||
$.each(prototype, function (prop, value) {
|
||||
if (!$.isFunction(value)) {
|
||||
proxiedPrototype[prop] = value;
|
||||
return;
|
||||
}
|
||||
proxiedPrototype[prop] = (function () {
|
||||
var _super = function () {
|
||||
return base.prototype[prop].apply(this, arguments);
|
||||
},
|
||||
_superApply = function (args) {
|
||||
return base.prototype[prop].apply(this, args);
|
||||
};
|
||||
return function () {
|
||||
var __super = this._super,
|
||||
__superApply = this._superApply,
|
||||
returnValue;
|
||||
|
||||
this._super = _super;
|
||||
this._superApply = _superApply;
|
||||
|
||||
returnValue = value.apply(this, arguments);
|
||||
|
||||
this._super = __super;
|
||||
this._superApply = __superApply;
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
})();
|
||||
});
|
||||
constructor.prototype = $.widget.extend(basePrototype, {
|
||||
// TODO: remove support for widgetEventPrefix
|
||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||
// don't prefix for widgets that aren't DOM-based
|
||||
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
||||
}, proxiedPrototype, {
|
||||
constructor: constructor,
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetFullName: fullName
|
||||
});
|
||||
|
||||
// If this widget is being redefined then we need to find all widgets that
|
||||
// are inheriting from it and redefine all of them so that they inherit from
|
||||
// the new version of this widget. We're essentially trying to replace one
|
||||
// level in the prototype chain.
|
||||
if (existingConstructor) {
|
||||
$.each(existingConstructor._childConstructors, function (i, child) {
|
||||
var childPrototype = child.prototype;
|
||||
|
||||
// redefine the child widget using the same prototype that was
|
||||
// originally used, but inherit from the new version of the base
|
||||
$.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto);
|
||||
});
|
||||
// remove the list of existing child constructors from the old constructor
|
||||
// so the old child constructors can be garbage collected
|
||||
delete existingConstructor._childConstructors;
|
||||
} else {
|
||||
base._childConstructors.push(constructor);
|
||||
}
|
||||
|
||||
$.widget.bridge(name, constructor);
|
||||
|
||||
return constructor;
|
||||
};
|
||||
|
||||
$.widget.extend = function (target) {
|
||||
var input = slice.call(arguments, 1),
|
||||
inputIndex = 0,
|
||||
inputLength = input.length,
|
||||
key,
|
||||
value;
|
||||
for (; inputIndex < inputLength; inputIndex++) {
|
||||
for (key in input[inputIndex]) {
|
||||
value = input[inputIndex][key];
|
||||
if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {
|
||||
// Clone objects
|
||||
if ($.isPlainObject(value)) {
|
||||
target[key] = $.isPlainObject(target[key]) ?
|
||||
$.widget.extend({}, target[key], value) :
|
||||
// Don't extend strings, arrays, etc. with objects
|
||||
$.widget.extend({}, value);
|
||||
// Copy everything else by reference
|
||||
} else {
|
||||
target[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
};
|
||||
|
||||
$.widget.bridge = function (name, object) {
|
||||
|
||||
var fullName = object.prototype.widgetFullName || name;
|
||||
$.fn[name] = function (options) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = slice.call(arguments, 1),
|
||||
returnValue = this;
|
||||
|
||||
// allow multiple hashes to be passed on init
|
||||
options = !isMethodCall && args.length ?
|
||||
$.widget.extend.apply(null, [options].concat(args)) :
|
||||
options;
|
||||
|
||||
if (isMethodCall) {
|
||||
this.each(function () {
|
||||
var methodValue,
|
||||
instance = $.data(this, fullName);
|
||||
if (options === "instance") {
|
||||
returnValue = instance;
|
||||
return false;
|
||||
}
|
||||
if (!instance) {
|
||||
return $.error("cannot call methods on " + name + " prior to initialization; " +
|
||||
"attempted to call method '" + options + "'");
|
||||
}
|
||||
if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
|
||||
return $.error("no such method '" + options + "' for " + name + " widget instance");
|
||||
}
|
||||
methodValue = instance[options].apply(instance, args);
|
||||
if (methodValue !== instance && methodValue !== undefined) {
|
||||
returnValue = methodValue && methodValue.jquery ?
|
||||
returnValue.pushStack(methodValue.get()) :
|
||||
methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.each(function () {
|
||||
var instance = $.data(this, fullName);
|
||||
if (instance) {
|
||||
instance.option(options || {})._init();
|
||||
} else {
|
||||
$.data(this, fullName, new object(options, this));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function ( /* options, element */) { };
|
||||
$.Widget._childConstructors = [];
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
defaultElement: "<div>",
|
||||
options: {
|
||||
disabled: false,
|
||||
|
||||
// callbacks
|
||||
create: null
|
||||
},
|
||||
_createWidget: function (options, element) {
|
||||
element = $(element || this.defaultElement || this)[0];
|
||||
this.element = $(element);
|
||||
this.uuid = uuid++;
|
||||
this.eventNamespace = "." + this.widgetName + this.uuid;
|
||||
this.options = $.widget.extend({},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options);
|
||||
|
||||
this.bindings = $();
|
||||
this.hoverable = $();
|
||||
this.focusable = $();
|
||||
|
||||
if (element !== this) {
|
||||
$.data(element, this.widgetFullName, this);
|
||||
this._on(true, this.element, {
|
||||
remove: function (event) {
|
||||
if (event.target === element) {
|
||||
this.destroy();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.document = $(element.style ?
|
||||
// element within the document
|
||||
element.ownerDocument :
|
||||
// element is window or document
|
||||
element.document || element);
|
||||
this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
|
||||
}
|
||||
|
||||
this._create();
|
||||
this._trigger("create", null, this._getCreateEventData());
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: $.noop,
|
||||
_getCreateEventData: $.noop,
|
||||
_create: $.noop,
|
||||
_init: $.noop,
|
||||
|
||||
destroy: function () {
|
||||
this._destroy();
|
||||
// we can probably remove the unbind calls in 2.0
|
||||
// all event bindings should go through this._on()
|
||||
this.element
|
||||
.unbind(this.eventNamespace)
|
||||
.removeData(this.widgetFullName)
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
.removeData($.camelCase(this.widgetFullName));
|
||||
this.widget()
|
||||
.unbind(this.eventNamespace)
|
||||
.removeAttr("aria-disabled")
|
||||
.removeClass(
|
||||
this.widgetFullName + "-disabled " +
|
||||
"ui-state-disabled");
|
||||
|
||||
// clean up events and states
|
||||
this.bindings.unbind(this.eventNamespace);
|
||||
this.hoverable.removeClass("ui-state-hover");
|
||||
this.focusable.removeClass("ui-state-focus");
|
||||
},
|
||||
_destroy: $.noop,
|
||||
|
||||
widget: function () {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function (key, value) {
|
||||
var options = key,
|
||||
parts,
|
||||
curOption,
|
||||
i;
|
||||
|
||||
if (arguments.length === 0) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.widget.extend({}, this.options);
|
||||
}
|
||||
|
||||
if (typeof key === "string") {
|
||||
// handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
|
||||
options = {};
|
||||
parts = key.split(".");
|
||||
key = parts.shift();
|
||||
if (parts.length) {
|
||||
curOption = options[key] = $.widget.extend({}, this.options[key]);
|
||||
for (i = 0; i < parts.length - 1; i++) {
|
||||
curOption[parts[i]] = curOption[parts[i]] || {};
|
||||
curOption = curOption[parts[i]];
|
||||
}
|
||||
key = parts.pop();
|
||||
if (value === undefined) {
|
||||
return curOption[key] === undefined ? null : curOption[key];
|
||||
}
|
||||
curOption[key] = value;
|
||||
} else {
|
||||
if (value === undefined) {
|
||||
return this.options[key] === undefined ? null : this.options[key];
|
||||
}
|
||||
options[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
this._setOptions(options);
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function (options) {
|
||||
var key;
|
||||
|
||||
for (key in options) {
|
||||
this._setOption(key, options[key]);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function (key, value) {
|
||||
this.options[key] = value;
|
||||
|
||||
if (key === "disabled") {
|
||||
this.widget()
|
||||
.toggleClass(this.widgetFullName + "-disabled", !!value);
|
||||
this.hoverable.removeClass("ui-state-hover");
|
||||
this.focusable.removeClass("ui-state-focus");
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
return this._setOptions({ disabled: false });
|
||||
},
|
||||
disable: function () {
|
||||
return this._setOptions({ disabled: true });
|
||||
},
|
||||
|
||||
_on: function (suppressDisabledCheck, element, handlers) {
|
||||
var delegateElement,
|
||||
instance = this;
|
||||
|
||||
// no suppressDisabledCheck flag, shuffle arguments
|
||||
if (typeof suppressDisabledCheck !== "boolean") {
|
||||
handlers = element;
|
||||
element = suppressDisabledCheck;
|
||||
suppressDisabledCheck = false;
|
||||
}
|
||||
|
||||
// no element argument, shuffle and use this.element
|
||||
if (!handlers) {
|
||||
handlers = element;
|
||||
element = this.element;
|
||||
delegateElement = this.widget();
|
||||
} else {
|
||||
// accept selectors, DOM elements
|
||||
element = delegateElement = $(element);
|
||||
this.bindings = this.bindings.add(element);
|
||||
}
|
||||
|
||||
$.each(handlers, function (event, handler) {
|
||||
function handlerProxy() {
|
||||
// allow widgets to customize the disabled handling
|
||||
// - disabled as an array instead of boolean
|
||||
// - disabled class as method for disabling individual parts
|
||||
if (!suppressDisabledCheck &&
|
||||
(instance.options.disabled === true ||
|
||||
$(this).hasClass("ui-state-disabled"))) {
|
||||
return;
|
||||
}
|
||||
return (typeof handler === "string" ? instance[handler] : handler)
|
||||
.apply(instance, arguments);
|
||||
}
|
||||
|
||||
// copy the guid so direct unbinding works
|
||||
if (typeof handler !== "string") {
|
||||
handlerProxy.guid = handler.guid =
|
||||
handler.guid || handlerProxy.guid || $.guid++;
|
||||
}
|
||||
|
||||
var match = event.match(/^(\w+)\s*(.*)$/),
|
||||
eventName = match[1] + instance.eventNamespace,
|
||||
selector = match[2];
|
||||
if (selector) {
|
||||
delegateElement.delegate(selector, eventName, handlerProxy);
|
||||
} else {
|
||||
element.bind(eventName, handlerProxy);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_off: function (element, eventName) {
|
||||
eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace;
|
||||
element.unbind(eventName).undelegate(eventName);
|
||||
},
|
||||
|
||||
_trigger: function (type, event, data) {
|
||||
var prop, orig,
|
||||
callback = this.options[type];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event(event);
|
||||
event.type = (type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[0];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if (orig) {
|
||||
for (prop in orig) {
|
||||
if (!(prop in event)) {
|
||||
event[prop] = orig[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element[0].dispatchEvent(new CustomEvent(event.type, {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
data: data,
|
||||
originalEvent: event
|
||||
}
|
||||
}));
|
||||
|
||||
//this.element.trigger(event, data);
|
||||
return !($.isFunction(callback) &&
|
||||
callback.apply(this.element[0], [event].concat(data)) === false ||
|
||||
event.isDefaultPrevented());
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
$.extend($.Widget.prototype, {
|
||||
_getCreateOptions: function () {
|
||||
|
||||
var option, value,
|
||||
elem = this.element[0],
|
||||
options = {};
|
||||
|
||||
//
|
||||
if (!this.element.data("defaults")) {
|
||||
for (option in this.options) {
|
||||
|
||||
value = this.element.data(option);
|
||||
|
||||
if (value != null) {
|
||||
options[option] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
(function ($, undefined) {
|
||||
|
||||
|
||||
var originalWidget = $.widget
|
||||
|
||||
$.widget = (function (orig) {
|
||||
return function () {
|
||||
var constructor = orig.apply(this, arguments),
|
||||
name = constructor.prototype.widgetName;
|
||||
|
||||
constructor.initSelector = ((constructor.prototype.initSelector !== undefined) ?
|
||||
constructor.prototype.initSelector : "*[data-role='" + name + "']:not([data-role='none'])");
|
||||
|
||||
$.mobile.widgets[name] = constructor;
|
||||
|
||||
return constructor;
|
||||
};
|
||||
})($.widget);
|
||||
|
||||
// Make sure $.widget still has bridge and extend methods
|
||||
$.extend($.widget, originalWidget);
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
})();
|
File diff suppressed because it is too large
Load diff
|
@ -1,507 +0,0 @@
|
|||
/*
|
||||
* jQuery Mobile v1.4.5
|
||||
* http://jquerymobile.com
|
||||
*
|
||||
* Copyright 2010, 2014 jQuery Foundation, Inc. and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
*/
|
||||
|
||||
.ui-mobile fieldset,
|
||||
.ui-page {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.ui-mobile a img,
|
||||
.ui-mobile fieldset {
|
||||
border-width: 0;
|
||||
}
|
||||
/* Fixes for fieldset issues on IE10 and FF (see #6077) */
|
||||
.ui-mobile fieldset {
|
||||
min-width: 0;
|
||||
}
|
||||
@-moz-document url-prefix() {
|
||||
.ui-mobile fieldset {
|
||||
display: table-column;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
/* Viewport */
|
||||
.ui-mobile-viewport {
|
||||
margin: 0;
|
||||
overflow-x: visible;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust:none;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
/* Issue #2066 */
|
||||
body.ui-mobile-viewport,
|
||||
div.ui-mobile-viewport {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
/* "page" containers - full-screen views, one should always be in view post-pageload */
|
||||
.ui-mobile [data-role=page],
|
||||
.ui-mobile [data-role=dialog],
|
||||
.ui-page {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
position: absolute;
|
||||
display: none;
|
||||
border: 0;
|
||||
}
|
||||
.ui-page {
|
||||
/*position: static !important;*/
|
||||
}
|
||||
/* On ios4, setting focus on the page element causes flashing during transitions when there is an outline, so we turn off outlines */
|
||||
.ui-page {
|
||||
outline: none;
|
||||
}
|
||||
.ui-mobile .ui-page-active {
|
||||
display: block;
|
||||
overflow: visible;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
@media screen and (orientation: portrait) {
|
||||
.ui-mobile .ui-page {
|
||||
min-height: 420px;
|
||||
}
|
||||
}
|
||||
@media screen and (orientation: landscape) {
|
||||
.ui-mobile .ui-page {
|
||||
min-height: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fouc */
|
||||
.ui-mobile-rendering > * {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* Headers, content panels */
|
||||
.ui-bar,
|
||||
.ui-body {
|
||||
position: relative;
|
||||
padding: .4em 1em;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.ui-bar h1,
|
||||
.ui-bar h2,
|
||||
.ui-bar h3,
|
||||
.ui-bar h4,
|
||||
.ui-bar h5,
|
||||
.ui-bar h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
display: inline-block;
|
||||
}
|
||||
.ui-content {
|
||||
border-width: 0;
|
||||
overflow: visible;
|
||||
overflow-x: hidden;
|
||||
padding: 1em;
|
||||
}
|
||||
/* Corner styling for dialogs and popups */
|
||||
.ui-corner-all > .ui-content:first-child {
|
||||
-webkit-border-top-left-radius: inherit;
|
||||
border-top-left-radius: inherit;
|
||||
-webkit-border-top-right-radius: inherit;
|
||||
border-top-right-radius: inherit;
|
||||
}
|
||||
.ui-corner-all > .ui-content:last-child {
|
||||
-webkit-border-bottom-left-radius: inherit;
|
||||
border-bottom-left-radius: inherit;
|
||||
-webkit-border-bottom-right-radius: inherit;
|
||||
border-bottom-right-radius: inherit;
|
||||
}
|
||||
|
||||
/* Buttons and icons */
|
||||
.ui-btn {
|
||||
font-size: 16px;
|
||||
margin: .5em 0;
|
||||
padding: .7em 1em;
|
||||
display: block;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.ui-btn-icon-notext {
|
||||
padding: 0;
|
||||
width: 1.75em;
|
||||
height: 1.75em;
|
||||
text-indent: -9999px;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
.ui-mini {
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.ui-mini .ui-btn {
|
||||
font-size: inherit;
|
||||
}
|
||||
.ui-mini.ui-btn-icon-notext,
|
||||
.ui-mini .ui-btn-icon-notext {
|
||||
font-size: 16px;
|
||||
padding: 0;
|
||||
}
|
||||
.ui-btn-inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-right: .625em;
|
||||
}
|
||||
.ui-btn-icon-left {
|
||||
padding-left: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-right {
|
||||
padding-right: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-top {
|
||||
padding-top: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-bottom {
|
||||
padding-bottom: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-left:after,
|
||||
.ui-btn-icon-right:after,
|
||||
.ui-btn-icon-top:after,
|
||||
.ui-btn-icon-bottom:after,
|
||||
.ui-btn-icon-notext:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
.ui-btn-icon-notext:after,
|
||||
.ui-btn-icon-left:after,
|
||||
.ui-btn-icon-right:after {
|
||||
top: 50%;
|
||||
margin-top: -11px;
|
||||
}
|
||||
.ui-btn-icon-left:after {
|
||||
left: .5625em;
|
||||
}
|
||||
.ui-btn-icon-right:after {
|
||||
right: .5625em;
|
||||
}
|
||||
.ui-mini.ui-btn-icon-left:after,
|
||||
.ui-mini .ui-btn-icon-left:after {
|
||||
left: .37em;
|
||||
}
|
||||
.ui-mini.ui-btn-icon-right:after,
|
||||
.ui-mini .ui-btn-icon-right:after {
|
||||
right: .37em;
|
||||
}
|
||||
.ui-btn-icon-notext:after,
|
||||
.ui-btn-icon-top:after,
|
||||
.ui-btn-icon-bottom:after {
|
||||
left: 50%;
|
||||
margin-left: -11px;
|
||||
}
|
||||
.ui-btn-icon-top:after {
|
||||
top: .5625em;
|
||||
}
|
||||
.ui-btn-icon-bottom:after {
|
||||
top: auto;
|
||||
bottom: .5625em;
|
||||
}
|
||||
/* Buttons in header position classes */
|
||||
.ui-btn-left > [class*="ui-"],
|
||||
.ui-btn-right > [class*="ui-"] {
|
||||
margin: 0;
|
||||
}
|
||||
.ui-btn-left,
|
||||
.ui-btn-right {
|
||||
position: absolute;
|
||||
top: .24em;
|
||||
}
|
||||
.ui-btn-left {
|
||||
left: .4em;
|
||||
}
|
||||
.ui-btn-right {
|
||||
right: .4em;
|
||||
}
|
||||
.ui-btn-icon-notext.ui-btn-left {
|
||||
top: .3125em;
|
||||
left: .3125em;
|
||||
}
|
||||
.ui-btn-icon-notext.ui-btn-right {
|
||||
top: .3125em;
|
||||
right: .3125em;
|
||||
}
|
||||
|
||||
/* Button elements */
|
||||
button.ui-btn,
|
||||
.ui-controlgroup-controls button.ui-btn-icon-notext {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
width: 100%;
|
||||
}
|
||||
button.ui-btn-inline {
|
||||
width: auto;
|
||||
}
|
||||
/* Firefox adds a 1px border in a button element. We negate this to make sure they have the same height as other buttons in controlgroups. */
|
||||
button.ui-btn::-moz-focus-inner {
|
||||
border: 0;
|
||||
}
|
||||
button.ui-btn-icon-notext,
|
||||
.ui-controlgroup-horizontal .ui-controlgroup-controls button.ui-btn {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
width: 1.75em;
|
||||
}
|
||||
|
||||
/* Form labels */
|
||||
.ui-mobile label,
|
||||
.ui-controlgroup-label {
|
||||
display: block;
|
||||
margin: 0 0 .4em;
|
||||
}
|
||||
|
||||
/* Accessible content hiding */
|
||||
/* ui-hide-label deprecated in 1.4. TODO: Remove in 1.5 */
|
||||
.ui-hide-label > label,
|
||||
.ui-hide-label .ui-controlgroup-label,
|
||||
.ui-hide-label .ui-rangeslider label,
|
||||
.ui-hidden-accessible {
|
||||
position: absolute !important;
|
||||
height: 1px;
|
||||
width: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(1px,1px,1px,1px);
|
||||
}
|
||||
|
||||
/* Used for hiding elements by the filterable widget. You can also use this class to hide list items or buttons in controlgroups; this ensures correct corner styling. */
|
||||
.ui-screen-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
/* content configurations. */
|
||||
.ui-grid-a,
|
||||
.ui-grid-b,
|
||||
.ui-grid-c,
|
||||
.ui-grid-d,
|
||||
.ui-grid-solo {
|
||||
overflow: hidden;
|
||||
}
|
||||
.ui-block-a,
|
||||
.ui-block-b,
|
||||
.ui-block-c,
|
||||
.ui-block-d,
|
||||
.ui-block-e {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
float: left;
|
||||
min-height: 1px;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/* force new row */
|
||||
.ui-block-a {
|
||||
clear: left;
|
||||
}
|
||||
ul.ui-grid-a,
|
||||
ul.ui-grid-b,
|
||||
ul.ui-grid-c,
|
||||
ul.ui-grid-d,
|
||||
ul.ui-grid-solo,
|
||||
li.ui-block-a,
|
||||
li.ui-block-b,
|
||||
li.ui-block-c,
|
||||
li.ui-block-d,
|
||||
li.ui-block-e {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
/* No margin in grids for 100% width button elements until we can use max-width: fill-available; */
|
||||
[class*="ui-block-"] > button.ui-btn {
|
||||
margin-right: 0;
|
||||
margin-left: 0;
|
||||
}
|
||||
[class*="ui-block-"] > .ui-btn,
|
||||
[class*="ui-block-"] > .ui-select,
|
||||
[class*="ui-block-"] > .ui-checkbox,
|
||||
[class*="ui-block-"] > .ui-radio,
|
||||
[class*="ui-block-"] > button.ui-btn-inline,
|
||||
[class*="ui-block-"] > button.ui-btn-icon-notext {
|
||||
margin-right: .3125em;
|
||||
margin-left: .3125em;
|
||||
}
|
||||
|
||||
.ui-grid-a > .ui-block-a,
|
||||
.ui-grid-a > .ui-block-b {
|
||||
/* width: 49.95%; IE7 */
|
||||
/* margin-right: -.5px; BB5 */
|
||||
width: 50%;
|
||||
}
|
||||
.ui-grid-b > .ui-block-a,
|
||||
.ui-grid-b > .ui-block-b,
|
||||
.ui-grid-b > .ui-block-c {
|
||||
/* width: 33.25%; IE7 */
|
||||
/* margin-right: -.5px; BB5 */
|
||||
width: 33.333%;
|
||||
}
|
||||
.ui-grid-c > .ui-block-a,
|
||||
.ui-grid-c > .ui-block-b,
|
||||
.ui-grid-c > .ui-block-c,
|
||||
.ui-grid-c > .ui-block-d {
|
||||
/* width: 24.925%; IE7 */
|
||||
/* margin-right: -.5px; BB5 */
|
||||
width: 25%;
|
||||
}
|
||||
.ui-grid-d > .ui-block-a,
|
||||
.ui-grid-d > .ui-block-b,
|
||||
.ui-grid-d > .ui-block-c,
|
||||
.ui-grid-d > .ui-block-d,
|
||||
.ui-grid-d > .ui-block-e {
|
||||
/* width: 19.925%; IE7 */
|
||||
width: 20%;
|
||||
}
|
||||
.ui-grid-solo > .ui-block-a {
|
||||
width: 100%;
|
||||
float: none;
|
||||
}
|
||||
|
||||
/* preset breakpoint to switch to stacked grid styles below 35em (560px) */
|
||||
@media (max-width: 35em) {
|
||||
.ui-responsive > .ui-block-a,
|
||||
.ui-responsive > .ui-block-b,
|
||||
.ui-responsive > .ui-block-c,
|
||||
.ui-responsive > .ui-block-d,
|
||||
.ui-responsive > .ui-block-e {
|
||||
width: 100%;
|
||||
float: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Transitions originally inspired by those from jQtouch, nice work, folks */
|
||||
.ui-mobile-viewport-transitioning,
|
||||
.ui-mobile-viewport-transitioning .ui-page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.ui-page-pre-in {
|
||||
opacity: 0;
|
||||
}
|
||||
.in {
|
||||
-webkit-animation-timing-function: ease-out;
|
||||
-webkit-animation-duration: 350ms;
|
||||
-moz-animation-timing-function: ease-out;
|
||||
-moz-animation-duration: 350ms;
|
||||
animation-timing-function: ease-out;
|
||||
animation-duration: 350ms;
|
||||
}
|
||||
.out {
|
||||
-webkit-animation-timing-function: ease-in;
|
||||
-webkit-animation-duration: 225ms;
|
||||
-moz-animation-timing-function: ease-in;
|
||||
-moz-animation-duration: 225ms;
|
||||
animation-timing-function: ease-in;
|
||||
animation-duration: 225ms;
|
||||
}
|
||||
|
||||
|
||||
@-webkit-keyframes fadein {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
@-moz-keyframes fadein {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
@keyframes fadein {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeout {
|
||||
from { opacity: 1; }
|
||||
to { opacity: 0; }
|
||||
}
|
||||
@-moz-keyframes fadeout {
|
||||
from { opacity: 1; }
|
||||
to { opacity: 0; }
|
||||
}
|
||||
@keyframes fadeout {
|
||||
from { opacity: 1; }
|
||||
to { opacity: 0; }
|
||||
}
|
||||
|
||||
.fade.out {
|
||||
opacity: 0;
|
||||
-webkit-animation-duration: 125ms;
|
||||
-webkit-animation-name: fadeout;
|
||||
-moz-animation-duration: 125ms;
|
||||
-moz-animation-name: fadeout;
|
||||
animation-duration: 125ms;
|
||||
animation-name: fadeout;
|
||||
}
|
||||
|
||||
.fade.in {
|
||||
opacity: 1;
|
||||
-webkit-animation-duration: 225ms;
|
||||
-webkit-animation-name: fadein;
|
||||
-moz-animation-duration: 225ms;
|
||||
-moz-animation-name: fadein;
|
||||
animation-duration: 225ms;
|
||||
animation-name: fadein;
|
||||
}
|
||||
|
||||
/* Hide the native input element */
|
||||
.ui-input-btn input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
-webkit-border-radius: inherit;
|
||||
border-radius: inherit;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
cursor: pointer;
|
||||
background: #fff;
|
||||
background: rgba(255,255,255,0);
|
||||
filter: Alpha(Opacity=0);
|
||||
opacity: .1;
|
||||
font-size: 1px;
|
||||
text-indent: -9999px;
|
||||
z-index: 2;
|
||||
}
|
||||
/* Fixes IE/WP filter alpha opacity bugs */
|
||||
.ui-input-btn.ui-state-disabled input {
|
||||
position: absolute !important;
|
||||
height: 1px;
|
||||
width: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(1px,1px,1px,1px);
|
||||
}
|
|
@ -78,25 +78,6 @@ label.ui-btn {
|
|||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
/* Shadow
|
||||
-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.ui-shadow {
|
||||
-webkit-box-shadow: 0 1px 3px /*{global-box-shadow-size}*/ rgba(0,0,0,.15) /*{global-box-shadow-color}*/;
|
||||
-moz-box-shadow: 0 1px 3px /*{global-box-shadow-size}*/ rgba(0,0,0,.15) /*{global-box-shadow-color}*/;
|
||||
box-shadow: 0 1px 3px /*{global-box-shadow-size}*/ rgba(0,0,0,.15) /*{global-box-shadow-color}*/;
|
||||
}
|
||||
.ui-shadow-inset {
|
||||
-webkit-box-shadow: inset 0 1px 3px /*{global-box-shadow-size}*/ rgba(0,0,0,.2) /*{global-box-shadow-color}*/;
|
||||
-moz-box-shadow: inset 0 1px 3px /*{global-box-shadow-size}*/ rgba(0,0,0,.2) /*{global-box-shadow-color}*/;
|
||||
box-shadow: inset 0 1px 3px /*{global-box-shadow-size}*/ rgba(0,0,0,.2) /*{global-box-shadow-color}*/;
|
||||
}
|
||||
.ui-overlay-shadow {
|
||||
-webkit-box-shadow: 0 0 12px rgba(0,0,0,.6);
|
||||
-moz-box-shadow: 0 0 12px rgba(0,0,0,.6);
|
||||
box-shadow: 0 0 12px rgba(0,0,0,.6);
|
||||
}
|
||||
|
||||
/* Icons
|
||||
-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -130,14 +111,6 @@ html .ui-alt-icon .ui-radio-off:after {
|
|||
background-color: transparent;
|
||||
}
|
||||
|
||||
/* Icon shadow */
|
||||
.ui-shadow-icon.ui-btn:after,
|
||||
.ui-shadow-icon .ui-btn:after {
|
||||
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,.3) /*{global-icon-shadow}*/;
|
||||
-moz-box-shadow: 0 1px 0 rgba(255,255,255,.3) /*{global-icon-shadow}*/;
|
||||
box-shadow: 0 1px 0 rgba(255,255,255,.3) /*{global-icon-shadow}*/;
|
||||
}
|
||||
|
||||
/* Checkbox and radio */
|
||||
.ui-btn.ui-checkbox-off:after,
|
||||
.ui-btn.ui-checkbox-on:after,
|
||||
|
@ -303,24 +276,6 @@ html body .ui-group-theme-a .ui-radio-on:after,
|
|||
border-color: #3388cc /*{a-active-background-color}*/;
|
||||
}
|
||||
|
||||
/* Focus */
|
||||
.ui-page-theme-a .ui-btn:focus,
|
||||
html .ui-bar-a .ui-btn:focus,
|
||||
html .ui-body-a .ui-btn:focus,
|
||||
html body .ui-group-theme-a .ui-btn:focus,
|
||||
html head + body .ui-btn.ui-btn-a:focus,
|
||||
/* Focus buttons and text inputs with div wrap */
|
||||
.ui-page-theme-a .ui-focus,
|
||||
html .ui-bar-a .ui-focus,
|
||||
html .ui-body-a .ui-focus,
|
||||
html body .ui-group-theme-a .ui-focus,
|
||||
html head + body .ui-btn-a.ui-focus,
|
||||
html head + body .ui-body-a.ui-focus {
|
||||
-webkit-box-shadow: 0 0 12px #3388cc /*{a-active-background-color}*/;
|
||||
-moz-box-shadow: 0 0 12px #3388cc /*{a-active-background-color}*/;
|
||||
box-shadow: 0 0 12px #3388cc /*{a-active-background-color}*/;
|
||||
}
|
||||
|
||||
/* B
|
||||
-----------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -435,20 +390,263 @@ html body .ui-group-theme-b .ui-radio-on:after,
|
|||
border-color: #22aadd /*{b-active-background-color}*/;
|
||||
}
|
||||
|
||||
/* Focus */
|
||||
.ui-page-theme-b .ui-btn:focus,
|
||||
html .ui-bar-b .ui-btn:focus,
|
||||
html .ui-body-b .ui-btn:focus,
|
||||
html body .ui-group-theme-b .ui-btn:focus,
|
||||
html head + body .ui-btn.ui-btn-b:focus,
|
||||
/* Focus buttons and text inputs with div wrap */
|
||||
.ui-page-theme-b .ui-focus,
|
||||
html .ui-bar-b .ui-focus,
|
||||
html .ui-body-b .ui-focus,
|
||||
html body .ui-group-theme-b .ui-focus,
|
||||
html head + body .ui-btn-b.ui-focus,
|
||||
html head + body .ui-body-b.ui-focus {
|
||||
-webkit-box-shadow: 0 0 12px #22aadd /*{b-active-background-color}*/;
|
||||
-moz-box-shadow: 0 0 12px #22aadd /*{b-active-background-color}*/;
|
||||
box-shadow: 0 0 12px #22aadd /*{b-active-background-color}*/;
|
||||
/*
|
||||
* jQuery Mobile v1.4.5
|
||||
* http://jquerymobile.com
|
||||
*
|
||||
* Copyright 2010, 2014 jQuery Foundation, Inc. and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
*/
|
||||
|
||||
.ui-mobile fieldset,
|
||||
.ui-page {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.ui-mobile a img,
|
||||
.ui-mobile fieldset {
|
||||
border-width: 0;
|
||||
}
|
||||
/* Fixes for fieldset issues on IE10 and FF (see #6077) */
|
||||
.ui-mobile fieldset {
|
||||
min-width: 0;
|
||||
}
|
||||
@-moz-document url-prefix() {
|
||||
.ui-mobile fieldset {
|
||||
display: table-column;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
/* Viewport */
|
||||
.ui-mobile-viewport {
|
||||
margin: 0;
|
||||
overflow-x: visible;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust:none;
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
/* Issue #2066 */
|
||||
body.ui-mobile-viewport,
|
||||
div.ui-mobile-viewport {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
/* "page" containers - full-screen views, one should always be in view post-pageload */
|
||||
.ui-mobile [data-role=page],
|
||||
.ui-mobile [data-role=dialog],
|
||||
.ui-page {
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
position: absolute;
|
||||
display: none;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/* On ios4, setting focus on the page element causes flashing during transitions when there is an outline, so we turn off outlines */
|
||||
.ui-page {
|
||||
outline: none;
|
||||
}
|
||||
.ui-mobile .ui-page-active {
|
||||
display: block;
|
||||
overflow: visible;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
@media screen and (orientation: portrait) {
|
||||
.ui-mobile .ui-page {
|
||||
min-height: 420px;
|
||||
}
|
||||
}
|
||||
@media screen and (orientation: landscape) {
|
||||
.ui-mobile .ui-page {
|
||||
min-height: 300px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fouc */
|
||||
.ui-mobile-rendering > * {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* Headers, content panels */
|
||||
.ui-bar,
|
||||
.ui-body {
|
||||
position: relative;
|
||||
padding: .4em 1em;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
clear: both;
|
||||
}
|
||||
.ui-bar h1,
|
||||
.ui-bar h2,
|
||||
.ui-bar h3,
|
||||
.ui-bar h4,
|
||||
.ui-bar h5,
|
||||
.ui-bar h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-size: 1em;
|
||||
display: inline-block;
|
||||
}
|
||||
.ui-content {
|
||||
border-width: 0;
|
||||
overflow: visible;
|
||||
overflow-x: hidden;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
/* Buttons and icons */
|
||||
.ui-btn {
|
||||
font-size: 16px;
|
||||
margin: .5em 0;
|
||||
padding: .7em 1em;
|
||||
display: block;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.ui-btn-icon-notext {
|
||||
padding: 0;
|
||||
width: 1.75em;
|
||||
height: 1.75em;
|
||||
text-indent: -9999px;
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
.ui-mini {
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.ui-mini .ui-btn {
|
||||
font-size: inherit;
|
||||
}
|
||||
.ui-mini.ui-btn-icon-notext,
|
||||
.ui-mini .ui-btn-icon-notext {
|
||||
font-size: 16px;
|
||||
padding: 0;
|
||||
}
|
||||
.ui-btn-inline {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin-right: .625em;
|
||||
}
|
||||
.ui-btn-icon-left {
|
||||
padding-left: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-right {
|
||||
padding-right: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-top {
|
||||
padding-top: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-bottom {
|
||||
padding-bottom: 2.5em;
|
||||
}
|
||||
.ui-btn-icon-left:after,
|
||||
.ui-btn-icon-right:after,
|
||||
.ui-btn-icon-top:after,
|
||||
.ui-btn-icon-bottom:after,
|
||||
.ui-btn-icon-notext:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
.ui-btn-icon-notext:after,
|
||||
.ui-btn-icon-left:after,
|
||||
.ui-btn-icon-right:after {
|
||||
top: 50%;
|
||||
margin-top: -11px;
|
||||
}
|
||||
.ui-btn-icon-left:after {
|
||||
left: .5625em;
|
||||
}
|
||||
.ui-btn-icon-right:after {
|
||||
right: .5625em;
|
||||
}
|
||||
.ui-mini.ui-btn-icon-left:after,
|
||||
.ui-mini .ui-btn-icon-left:after {
|
||||
left: .37em;
|
||||
}
|
||||
.ui-mini.ui-btn-icon-right:after,
|
||||
.ui-mini .ui-btn-icon-right:after {
|
||||
right: .37em;
|
||||
}
|
||||
.ui-btn-icon-notext:after,
|
||||
.ui-btn-icon-top:after,
|
||||
.ui-btn-icon-bottom:after {
|
||||
left: 50%;
|
||||
margin-left: -11px;
|
||||
}
|
||||
.ui-btn-icon-top:after {
|
||||
top: .5625em;
|
||||
}
|
||||
.ui-btn-icon-bottom:after {
|
||||
top: auto;
|
||||
bottom: .5625em;
|
||||
}
|
||||
/* Buttons in header position classes */
|
||||
.ui-btn-left > [class*="ui-"],
|
||||
.ui-btn-right > [class*="ui-"] {
|
||||
margin: 0;
|
||||
}
|
||||
.ui-btn-left,
|
||||
.ui-btn-right {
|
||||
position: absolute;
|
||||
top: .24em;
|
||||
}
|
||||
.ui-btn-left {
|
||||
left: .4em;
|
||||
}
|
||||
.ui-btn-right {
|
||||
right: .4em;
|
||||
}
|
||||
.ui-btn-icon-notext.ui-btn-left {
|
||||
top: .3125em;
|
||||
left: .3125em;
|
||||
}
|
||||
.ui-btn-icon-notext.ui-btn-right {
|
||||
top: .3125em;
|
||||
right: .3125em;
|
||||
}
|
||||
|
||||
/* Button elements */
|
||||
button.ui-btn,
|
||||
.ui-controlgroup-controls button.ui-btn-icon-notext {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
width: 100%;
|
||||
}
|
||||
button.ui-btn-inline {
|
||||
width: auto;
|
||||
}
|
||||
/* Firefox adds a 1px border in a button element. We negate this to make sure they have the same height as other buttons in controlgroups. */
|
||||
button.ui-btn::-moz-focus-inner {
|
||||
border: 0;
|
||||
}
|
||||
button.ui-btn-icon-notext,
|
||||
.ui-controlgroup-horizontal .ui-controlgroup-controls button.ui-btn {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
width: 1.75em;
|
||||
}
|
||||
|
||||
/* Form labels */
|
||||
.ui-mobile label,
|
||||
.ui-controlgroup-label {
|
||||
display: block;
|
||||
margin: 0 0 .4em;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue