mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
animate now playing bar
This commit is contained in:
parent
4a80f8d99b
commit
7dd1eedf26
21 changed files with 3722 additions and 6204 deletions
|
@ -30,6 +30,6 @@
|
||||||
"commit": "14d2ca3df97da64c820829a8310f9198fbafbcfa"
|
"commit": "14d2ca3df97da64c820829a8310f9198fbafbcfa"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/desandro/eventie.git",
|
"_source": "git://github.com/desandro/eventie.git",
|
||||||
"_target": "~1.0.3",
|
"_target": "^1",
|
||||||
"_originalSource": "eventie"
|
"_originalSource": "eventie"
|
||||||
}
|
}
|
|
@ -32,14 +32,14 @@
|
||||||
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
"iron-test-helpers": "PolymerElements/iron-test-helpers#^1.0.0"
|
||||||
},
|
},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"homepage": "https://github.com/polymerelements/paper-ripple",
|
"homepage": "https://github.com/PolymerElements/paper-ripple",
|
||||||
"_release": "1.0.5",
|
"_release": "1.0.5",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.0.5",
|
"tag": "v1.0.5",
|
||||||
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
"commit": "d72e7a9a8ab518b901ed18dde492df3b87a93be5"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/polymerelements/paper-ripple.git",
|
"_source": "git://github.com/PolymerElements/paper-ripple.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
"_originalSource": "polymerelements/paper-ripple"
|
"_originalSource": "PolymerElements/paper-ripple"
|
||||||
}
|
}
|
80
dashboard-ui/components/requirecss.js
Normal file
80
dashboard-ui/components/requirecss.js
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
define(function () {
|
||||||
|
var requireCss = {};
|
||||||
|
|
||||||
|
requireCss.normalize = function (name, normalize) {
|
||||||
|
if (name.substr(name.length - 4, 4) == '.css')
|
||||||
|
name = name.substr(0, name.length - 4);
|
||||||
|
|
||||||
|
return normalize(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
var importedCss = [];
|
||||||
|
|
||||||
|
function isLoaded(url) {
|
||||||
|
return importedCss.indexOf(url) != -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeFromLoadHistory(url) {
|
||||||
|
|
||||||
|
url = url.toLowerCase();
|
||||||
|
|
||||||
|
importedCss = importedCss.filter(function (c) {
|
||||||
|
return url.indexOf(c.toLowerCase()) == -1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
requireCss.load = function (cssId, req, load, config) {
|
||||||
|
|
||||||
|
// Somehow if the url starts with /css, require will get all screwed up since this extension is also called css
|
||||||
|
cssId = cssId.replace('js/requirecss', 'css');
|
||||||
|
var url = cssId + '.css';
|
||||||
|
|
||||||
|
var packageName = '';
|
||||||
|
|
||||||
|
// TODO: handle any value before the #
|
||||||
|
if (url.indexOf('theme#') != -1) {
|
||||||
|
url = url.replace('theme#', '');
|
||||||
|
packageName = 'theme';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url.indexOf('http') != 0 && url.indexOf('file:') != 0) {
|
||||||
|
url = config.baseUrl + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isLoaded(url)) {
|
||||||
|
importedCss.push(url);
|
||||||
|
|
||||||
|
var link = document.createElement('link');
|
||||||
|
|
||||||
|
if (packageName) {
|
||||||
|
link.setAttribute('data-package', packageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
link.setAttribute('rel', 'stylesheet');
|
||||||
|
link.setAttribute('type', 'text/css');
|
||||||
|
link.onload = load;
|
||||||
|
link.setAttribute('href', url + "?" + config.urlArgs);
|
||||||
|
document.head.appendChild(link);
|
||||||
|
} else {
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.requireCss = {
|
||||||
|
unloadPackage: function (packageName) {
|
||||||
|
|
||||||
|
// Todo: unload css here
|
||||||
|
var stylesheets = document.head.querySelectorAll("link[data-package='" + packageName + "']");
|
||||||
|
for (var i = 0, length = stylesheets.length; i < length; i++) {
|
||||||
|
|
||||||
|
var stylesheet = stylesheets[i];
|
||||||
|
|
||||||
|
Logger.log('Unloading stylesheet: ' + stylesheet.href);
|
||||||
|
stylesheet.parentNode.removeChild(stylesheet);
|
||||||
|
removeFromLoadHistory(stylesheet.href);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return requireCss;
|
||||||
|
});
|
|
@ -64,7 +64,9 @@
|
||||||
background-color: rgba(26,26,26,.94);
|
background-color: rgba(26,26,26,.94);
|
||||||
border-top: 1px solid #444;
|
border-top: 1px solid #444;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
/*box-shadow: 0 0 8px rgba(255,255,255,.4);*/
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hiddenNowPlayingBar .nowPlayingBar {
|
.hiddenNowPlayingBar .nowPlayingBar {
|
||||||
|
@ -91,10 +93,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.nowPlayingBarInfoContainer {
|
.nowPlayingBarInfoContainer {
|
||||||
vertical-align: middle;
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nowPlayingImage {
|
.nowPlayingImage {
|
||||||
|
@ -166,9 +164,11 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
position: relative;
|
|
||||||
/* Need this to make sure it's on top of nowPlayingBarPositionContainer so that buttons are fully clickable */
|
/* Need this to make sure it's on top of nowPlayingBarPositionContainer so that buttons are fully clickable */
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nowPlayingBarPositionContainer {
|
.nowPlayingBarPositionContainer {
|
||||||
|
@ -210,10 +210,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.nowPlayingBarRight {
|
.nowPlayingBarRight {
|
||||||
position: absolute;
|
position: relative;
|
||||||
bottom: 12px;
|
margin: 0 1em 0 auto;
|
||||||
right: 10px;
|
|
||||||
vertical-align: middle;
|
|
||||||
/* Need this to make sure it's on top of nowPlayingBarPositionContainer so that buttons are fully clickable */
|
/* Need this to make sure it's on top of nowPlayingBarPositionContainer so that buttons are fully clickable */
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
@ -255,18 +253,14 @@
|
||||||
.nowPlayingBar .playlistButton {
|
.nowPlayingBar .playlistButton {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nowPlayingBarRight {
|
|
||||||
bottom: 18px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 800px) {
|
@media all and (max-width: 800px) {
|
||||||
|
|
||||||
.nowPlayingBarCurrentTime {
|
.nowPlayingBarCurrentTime {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
top: 12px;
|
top: 22px;
|
||||||
right: 130px;
|
right: 140px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,10 +268,6 @@
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nowPlayingBarRight {
|
|
||||||
bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nowPlayingBar, .nowPlayingImage img {
|
.nowPlayingBar, .nowPlayingImage img {
|
||||||
height: 70px;
|
height: 70px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,16 @@
|
||||||
// positionTo
|
// positionTo
|
||||||
// showCancel
|
// showCancel
|
||||||
// title
|
// title
|
||||||
var id = 'dlg' + new Date().getTime();
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
var style = "";
|
|
||||||
|
|
||||||
var windowHeight = $(window).height();
|
var windowHeight = $(window).height();
|
||||||
|
var pos;
|
||||||
|
|
||||||
// If the window height is under a certain amount, don't bother trying to position
|
// If the window height is under a certain amount, don't bother trying to position
|
||||||
// based on an element.
|
// based on an element.
|
||||||
if (options.positionTo && windowHeight >= 540) {
|
if (options.positionTo && windowHeight >= 540) {
|
||||||
|
|
||||||
var pos = $(options.positionTo).offset();
|
pos = $(options.positionTo).offset();
|
||||||
|
|
||||||
pos.top += $(options.positionTo).innerHeight() / 2;
|
pos.top += $(options.positionTo).innerHeight() / 2;
|
||||||
pos.left += $(options.positionTo).innerWidth() / 2;
|
pos.left += $(options.positionTo).innerWidth() / 2;
|
||||||
|
@ -41,12 +39,8 @@
|
||||||
// Do some boundary checking
|
// Do some boundary checking
|
||||||
pos.top = Math.max(pos.top, 0);
|
pos.top = Math.max(pos.top, 0);
|
||||||
pos.left = Math.max(pos.left, 0);
|
pos.left = Math.max(pos.left, 0);
|
||||||
|
|
||||||
style += 'position:fixed;top:' + pos.top + 'px;left:' + pos.left + 'px';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<paper-dialog id="' + id + '" with-backdrop style="' + style + '">';
|
|
||||||
|
|
||||||
if (options.title) {
|
if (options.title) {
|
||||||
html += '<h2>';
|
html += '<h2>';
|
||||||
html += options.title;
|
html += options.title;
|
||||||
|
@ -93,12 +87,16 @@
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</paper-dialog>';
|
var dlg = document.createElement('paper-dialog');
|
||||||
|
dlg.setAttribute('with-backdrop', 'with-backdrop');
|
||||||
|
dlg.innerHTML = html;
|
||||||
|
|
||||||
$(document.body).append(html);
|
if (pos) {
|
||||||
|
dlg.style.position = 'fixed';
|
||||||
setTimeout(function () {
|
dlg.style.left = pos.left + 'px';
|
||||||
var dlg = document.getElementById(id);
|
dlg.style.top = pos.top + 'px';
|
||||||
|
}
|
||||||
|
document.body.appendChild(dlg);
|
||||||
|
|
||||||
// The animations flicker in IE and Firefox (probably wherever the polyfill is used)
|
// The animations flicker in IE and Firefox (probably wherever the polyfill is used)
|
||||||
if (browserInfo.chrome) {
|
if (browserInfo.chrome) {
|
||||||
|
@ -118,11 +116,13 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
dlg.open();
|
dlg.open();
|
||||||
|
}, 10);
|
||||||
|
|
||||||
// Has to be assigned a z-index after the call to .open()
|
// Has to be assigned a z-index after the call to .open()
|
||||||
$(dlg).on('iron-overlay-closed', function () {
|
dlg.addEventListener('iron-overlay-closed', function () {
|
||||||
$(this).remove();
|
dlg.parentNode.removeChild(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Seeing an issue in some non-chrome browsers where this is requiring a double click
|
// Seeing an issue in some non-chrome browsers where this is requiring a double click
|
||||||
|
@ -143,7 +143,6 @@
|
||||||
|
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
}, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.ActionSheetElement = {
|
window.ActionSheetElement = {
|
||||||
|
|
|
@ -849,9 +849,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
requirejs(["thirdparty/cast_sender"], function () {
|
requirejs(["https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"], initializeChromecast);
|
||||||
|
|
||||||
initializeChromecast();
|
|
||||||
});
|
|
||||||
|
|
||||||
})(window, window.chrome, console);
|
})(window, window.chrome, console);
|
|
@ -2793,6 +2793,24 @@
|
||||||
dlg.entryAnimation = 'fade-in-animation';
|
dlg.entryAnimation = 'fade-in-animation';
|
||||||
dlg.exitAnimation = 'fade-out-animation';
|
dlg.exitAnimation = 'fade-out-animation';
|
||||||
|
|
||||||
|
// The animations flicker in IE and Firefox (probably wherever the polyfill is used)
|
||||||
|
if (browserInfo.chrome) {
|
||||||
|
dlg.animationConfig = {
|
||||||
|
// scale up
|
||||||
|
'entry': {
|
||||||
|
name: 'scale-up-animation',
|
||||||
|
node: dlg,
|
||||||
|
timing: { duration: 160, easing: 'ease-out' }
|
||||||
|
},
|
||||||
|
// fade out
|
||||||
|
'exit': {
|
||||||
|
name: 'fade-out-animation',
|
||||||
|
node: dlg,
|
||||||
|
timing: { duration: 200, easing: 'ease-in' }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
// There seems to be a bug with this in safari causing it to immediately roll up to 0 height
|
// There seems to be a bug with this in safari causing it to immediately roll up to 0 height
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
function slideDown(elem, iterations) {
|
function slideDown(elem, iterations) {
|
||||||
|
|
||||||
|
requestAnimationFrame(function () {
|
||||||
var keyframes = [
|
var keyframes = [
|
||||||
{ height: '100%', offset: 0 },
|
{ height: '100%', offset: 0 },
|
||||||
{ height: '0', display: 'none', offset: 1 }];
|
{ height: '0', display: 'none', offset: 1 }];
|
||||||
|
@ -31,17 +32,20 @@
|
||||||
elem.animate(keyframes, timing).onfinish = function () {
|
elem.animate(keyframes, timing).onfinish = function () {
|
||||||
elem.style.display = 'none';
|
elem.style.display = 'none';
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function slideUp(elem, iterations) {
|
function slideUp(elem, iterations) {
|
||||||
|
|
||||||
|
requestAnimationFrame(function () {
|
||||||
elem.style.display = 'block';
|
elem.style.display = 'block';
|
||||||
|
|
||||||
var keyframes = [
|
var keyframes = [
|
||||||
{ height: '0', offset: 0 },
|
{ height: '0', offset: 0 },
|
||||||
{ height: '100%', offset: 1 }];
|
{ height: '100%', offset: 1 }];
|
||||||
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
|
var timing = { duration: 300, iterations: iterations, fill: 'forwards', easing: 'ease-out' };
|
||||||
return elem.animate(keyframes, timing);
|
elem.animate(keyframes, timing);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOverlayHtml(item, currentUser, card, commands) {
|
function getOverlayHtml(item, currentUser, card, commands) {
|
||||||
|
|
|
@ -690,10 +690,8 @@
|
||||||
|
|
||||||
function ensureVideoPlayerElements() {
|
function ensureVideoPlayerElements() {
|
||||||
|
|
||||||
Dashboard.importCss('css/mediaplayer-video.css');
|
// TODO: remove dependency on nowplayingbar
|
||||||
|
require(['css!/css/nowplayingbar.css', 'css!/css/mediaplayer-video.css']);
|
||||||
// TODO: remove dependency on this file
|
|
||||||
Dashboard.importCss('css/nowplayingbar.css');
|
|
||||||
|
|
||||||
var html = '<div id="mediaPlayer" style="display: none;">';
|
var html = '<div id="mediaPlayer" style="display: none;">';
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
// add return false because on iOS clicking the bar often ends up clicking the content underneath.
|
html += '<div class="nowPlayingBar hide">';
|
||||||
html += '<div class="nowPlayingBar" style="display:none;">';
|
|
||||||
|
|
||||||
html += '<div class="nowPlayingBarPositionContainer">';
|
html += '<div class="nowPlayingBarPositionContainer">';
|
||||||
html += '<paper-slider pin step=".1" min="0" max="100" value="0" class="nowPlayingBarPositionSlider"></paper-slider>';
|
html += '<paper-slider pin step=".1" min="0" max="100" value="0" class="nowPlayingBarPositionSlider"></paper-slider>';
|
||||||
|
@ -71,6 +70,58 @@
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isSlidUp;
|
||||||
|
var height;
|
||||||
|
|
||||||
|
function getHeight(elem) {
|
||||||
|
|
||||||
|
if (!height) {
|
||||||
|
height = elem.offsetHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
return height + 'px';
|
||||||
|
return '80px';
|
||||||
|
}
|
||||||
|
|
||||||
|
function slideDown(elem) {
|
||||||
|
|
||||||
|
if (!isSlidUp) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSlidUp = false;
|
||||||
|
|
||||||
|
requestAnimationFrame(function () {
|
||||||
|
var keyframes = [
|
||||||
|
{ height: getHeight(elem), offset: 0 },
|
||||||
|
{ height: '0', display: 'none', offset: 1 }];
|
||||||
|
var timing = { duration: 200, iterations: 1, fill: 'both', easing: 'ease-out' };
|
||||||
|
elem.animate(keyframes, timing).onfinish = function () {
|
||||||
|
elem.classList.add('hide');
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function slideUp(elem) {
|
||||||
|
|
||||||
|
if (isSlidUp) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isSlidUp = true;
|
||||||
|
|
||||||
|
requestAnimationFrame(function () {
|
||||||
|
|
||||||
|
elem.classList.remove('hide');
|
||||||
|
|
||||||
|
var keyframes = [
|
||||||
|
{ height: '0', offset: 0 },
|
||||||
|
{ height: getHeight(elem), offset: 1 }];
|
||||||
|
var timing = { duration: 200, iterations: 1, fill: 'both', easing: 'ease-out' };
|
||||||
|
elem.animate(keyframes, timing);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function bindEvents(elem) {
|
function bindEvents(elem) {
|
||||||
|
|
||||||
currentTimeElement = $('.nowPlayingBarCurrentTime', elem);
|
currentTimeElement = $('.nowPlayingBarCurrentTime', elem);
|
||||||
|
@ -193,26 +244,36 @@
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var nowPlayingBarElement;
|
||||||
function getNowPlayingBar() {
|
function getNowPlayingBar() {
|
||||||
|
|
||||||
var elem = document.querySelector('.nowPlayingBar');
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
if (elem) {
|
if (nowPlayingBarElement) {
|
||||||
return elem;
|
resolve(nowPlayingBarElement);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.importCss('css/nowplayingbar.css');
|
require(['css!/css/nowplayingbar.css'], function () {
|
||||||
|
|
||||||
elem = $(getNowPlayingBarHtml()).appendTo(document.body)[0];
|
nowPlayingBarElement = document.querySelector('.nowPlayingBar');
|
||||||
|
|
||||||
|
if (nowPlayingBarElement) {
|
||||||
|
resolve(nowPlayingBarElement);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
nowPlayingBarElement = $(getNowPlayingBarHtml()).appendTo(document.body)[0];
|
||||||
|
|
||||||
if ((browserInfo.safari || !AppInfo.isNativeApp) && browserInfo.mobile) {
|
if ((browserInfo.safari || !AppInfo.isNativeApp) && browserInfo.mobile) {
|
||||||
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
|
// Not handled well here. The wrong elements receive events, bar doesn't update quickly enough, etc.
|
||||||
elem.classList.add('noMediaProgress');
|
nowPlayingBarElement.classList.add('noMediaProgress');
|
||||||
}
|
}
|
||||||
|
|
||||||
bindEvents(elem);
|
bindEvents(nowPlayingBarElement);
|
||||||
|
resolve(nowPlayingBarElement);
|
||||||
return elem;
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showButton(button) {
|
function showButton(button) {
|
||||||
|
@ -227,13 +288,25 @@
|
||||||
|
|
||||||
function updatePlayerState(event, state) {
|
function updatePlayerState(event, state) {
|
||||||
|
|
||||||
if (state.NowPlayingItem) {
|
if (!state.NowPlayingItem) {
|
||||||
showNowPlayingBar();
|
|
||||||
} else {
|
|
||||||
hideNowPlayingBar();
|
hideNowPlayingBar();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nowPlayingBarElement) {
|
||||||
|
updatePlayerStateInternal(event, state);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getNowPlayingBar().then(function () {
|
||||||
|
updatePlayerStateInternal(event, state);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePlayerStateInternal(event, state) {
|
||||||
|
|
||||||
|
showNowPlayingBar();
|
||||||
|
|
||||||
if (event.type == 'positionchange') {
|
if (event.type == 'positionchange') {
|
||||||
// Try to avoid hammering the document with changes
|
// Try to avoid hammering the document with changes
|
||||||
var now = new Date().getTime();
|
var now = new Date().getTime();
|
||||||
|
@ -246,10 +319,6 @@
|
||||||
|
|
||||||
lastPlayerState = state;
|
lastPlayerState = state;
|
||||||
|
|
||||||
if (!muteButton) {
|
|
||||||
getNowPlayingBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
var playerInfo = MediaController.getPlayerInfo();
|
var playerInfo = MediaController.getPlayerInfo();
|
||||||
|
|
||||||
var playState = state.PlayState || {};
|
var playState = state.PlayState || {};
|
||||||
|
@ -306,10 +375,6 @@
|
||||||
|
|
||||||
playerInfo = playerInfo || MediaController.getPlayerInfo();
|
playerInfo = playerInfo || MediaController.getPlayerInfo();
|
||||||
|
|
||||||
if (!muteButton) {
|
|
||||||
getNowPlayingBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
var playState = state.PlayState || {};
|
var playState = state.PlayState || {};
|
||||||
var supportedCommands = playerInfo.supportedCommands;
|
var supportedCommands = playerInfo.supportedCommands;
|
||||||
|
|
||||||
|
@ -478,9 +543,7 @@
|
||||||
|
|
||||||
function showNowPlayingBar() {
|
function showNowPlayingBar() {
|
||||||
|
|
||||||
var nowPlayingBar = getNowPlayingBar();
|
getNowPlayingBar().then(slideUp);
|
||||||
|
|
||||||
$(nowPlayingBar).show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideNowPlayingBar() {
|
function hideNowPlayingBar() {
|
||||||
|
@ -491,7 +554,7 @@
|
||||||
// Don't call getNowPlayingBar here because we don't want to end up creating it just to hide it
|
// Don't call getNowPlayingBar here because we don't want to end up creating it just to hide it
|
||||||
var elem = document.getElementsByClassName('nowPlayingBar')[0];
|
var elem = document.getElementsByClassName('nowPlayingBar')[0];
|
||||||
if (elem) {
|
if (elem) {
|
||||||
elem.style.display = 'none';
|
slideDown(elem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,7 +601,9 @@
|
||||||
|
|
||||||
var player = this;
|
var player = this;
|
||||||
|
|
||||||
player.getPlayerState().then(function (state) {
|
Promise.all([player.getPlayerState(), getNowPlayingBar()]).then(function (responses) {
|
||||||
|
|
||||||
|
var state = responses[0];
|
||||||
|
|
||||||
if (player.isDefaultPlayer && state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
|
if (player.isDefaultPlayer && state.NowPlayingItem && state.NowPlayingItem.MediaType == 'Video') {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -168,11 +168,15 @@
|
||||||
|
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('HeaderSyncRequiresSupporterMembership') + '<br/><p><a href="http://emby.media/premiere" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a></p>',
|
message: Globalize.translate('HeaderSyncRequiresSupporterMembership') + '<br/><p><a href="http://emby.media/premiere" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a></p>',
|
||||||
title: Globalize.translate('HeaderSync')
|
title: Globalize.translate('HeaderSync'),
|
||||||
|
callback: function () {
|
||||||
|
deferred.reject();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}, function () {
|
}, function () {
|
||||||
|
|
||||||
|
deferred.reject();
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
|
|
|
@ -1906,6 +1906,11 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
requirejs.config({
|
requirejs.config({
|
||||||
|
map: {
|
||||||
|
'*': {
|
||||||
|
'css': 'components/requirecss'
|
||||||
|
}
|
||||||
|
},
|
||||||
urlArgs: urlArgs,
|
urlArgs: urlArgs,
|
||||||
|
|
||||||
paths: paths
|
paths: paths
|
||||||
|
@ -2004,6 +2009,10 @@ var AppInfo = {};
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
define("jqmwidget", ["thirdparty/jquerymobile-1.4.5/jqm.widget"], function () {
|
||||||
|
return {};
|
||||||
|
});
|
||||||
|
|
||||||
define("jqmslider", ["thirdparty/jquerymobile-1.4.5/jqm.slider"], function () {
|
define("jqmslider", ["thirdparty/jquerymobile-1.4.5/jqm.slider"], function () {
|
||||||
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.slider.css');
|
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.slider.css');
|
||||||
return {};
|
return {};
|
||||||
|
@ -2029,16 +2038,9 @@ var AppInfo = {};
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
||||||
define("jqmcheckbox", ["jqmicons", "thirdparty/jquerymobile-1.4.5/jqm.checkbox"], function () {
|
define("jqmcheckbox", ["jqmicons", "thirdparty/jquerymobile-1.4.5/jqm.checkbox", 'css!thirdparty/jquerymobile-1.4.5/jqm.checkbox.css']);
|
||||||
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.checkbox.css');
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
|
|
||||||
define("jqmpanel", ["thirdparty/jquerymobile-1.4.5/jqm.panel"], function () {
|
define("jqmpanel", ["thirdparty/jquerymobile-1.4.5/jqm.panel", 'css!thirdparty/jquerymobile-1.4.5/jqm.panel.css']);
|
||||||
|
|
||||||
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.panel.css');
|
|
||||||
return {};
|
|
||||||
});
|
|
||||||
|
|
||||||
define("hammer", ["bower_components/hammerjs/hammer.min"], function (Hammer) {
|
define("hammer", ["bower_components/hammerjs/hammer.min"], function (Hammer) {
|
||||||
return Hammer;
|
return Hammer;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
var currentDialogOptions;
|
var currentDialogOptions;
|
||||||
|
|
||||||
function submitJob(panel, userId, syncOptions, form) {
|
function submitJob(dlg, userId, syncOptions, form) {
|
||||||
|
|
||||||
if (!userId) {
|
if (!userId) {
|
||||||
throw new Error('userId cannot be null');
|
throw new Error('userId cannot be null');
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
||||||
panel.panel('close');
|
PaperDialogHelper.close(dlg);
|
||||||
$(window.SyncManager).trigger('jobsubmit');
|
$(window.SyncManager).trigger('jobsubmit');
|
||||||
Dashboard.alert(Globalize.translate('MessageSyncJobCreated'));
|
Dashboard.alert(Globalize.translate('MessageSyncJobCreated'));
|
||||||
});
|
});
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
|
|
||||||
function showSyncMenu(options) {
|
function showSyncMenu(options) {
|
||||||
|
|
||||||
requirejs(["scripts/registrationservices", "jqmcollapsible", "jqmpanel"], function () {
|
requirejs(["scripts/registrationservices"], function () {
|
||||||
RegistrationServices.validateFeature('sync').then(function () {
|
RegistrationServices.validateFeature('sync').then(function () {
|
||||||
showSyncMenuInternal(options);
|
showSyncMenuInternal(options);
|
||||||
});
|
});
|
||||||
|
@ -205,6 +205,8 @@
|
||||||
|
|
||||||
function showSyncMenuInternal(options) {
|
function showSyncMenuInternal(options) {
|
||||||
|
|
||||||
|
require(['components/paperdialoghelper'], function () {
|
||||||
|
|
||||||
var userId = Dashboard.getCurrentUserId();
|
var userId = Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
var dialogOptionsQuery = {
|
var dialogOptionsQuery = {
|
||||||
|
@ -221,11 +223,19 @@
|
||||||
|
|
||||||
currentDialogOptions = dialogOptions;
|
currentDialogOptions = dialogOptions;
|
||||||
|
|
||||||
var html = '<div data-role="panel" data-position="right" data-display="overlay" class="syncPanel" data-position-fixed="true" data-theme="a">';
|
var dlg = PaperDialogHelper.createDialog({
|
||||||
|
size: 'small',
|
||||||
|
theme: 'a'
|
||||||
|
});
|
||||||
|
|
||||||
|
var html = '';
|
||||||
|
html += '<h2 class="dialogHeader">';
|
||||||
|
html += '<paper-fab icon="arrow-back" mini class="btnCancel"></paper-fab>';
|
||||||
|
html += '</h2>';
|
||||||
|
|
||||||
html += '<div>';
|
html += '<div>';
|
||||||
|
|
||||||
html += '<form class="formSubmitSyncRequest">';
|
html += '<form class="formSubmitSyncRequest" style="margin: auto;">';
|
||||||
|
|
||||||
html += '<div style="margin:1em 0 1.5em;">';
|
html += '<div style="margin:1em 0 1.5em;">';
|
||||||
html += '<h1 style="margin: 0;display:inline-block;vertical-align:middle;">' + Globalize.translate('SyncMedia') + '</h1>';
|
html += '<h1 style="margin: 0;display:inline-block;vertical-align:middle;">' + Globalize.translate('SyncMedia') + '</h1>';
|
||||||
|
@ -241,28 +251,35 @@
|
||||||
|
|
||||||
html += '</form>';
|
html += '</form>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
$(document.body).append(html);
|
dlg.innerHTML = html;
|
||||||
|
document.body.appendChild(dlg);
|
||||||
|
|
||||||
var elem = $('.syncPanel').panel({}).trigger('create').panel("open").on("panelclose", function () {
|
// Has to be assigned a z-index after the call to .open()
|
||||||
$(this).off("panelclose").remove();
|
dlg.addEventListener('iron-overlay-closed', function (e) {
|
||||||
|
dlg.parentNode.removeChild(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('form', elem).on('submit', function () {
|
PaperDialogHelper.openWithHash(dlg, 'syncjob');
|
||||||
|
|
||||||
submitJob(elem, userId, options, this);
|
$('form', dlg).on('submit', function () {
|
||||||
|
|
||||||
|
submitJob(dlg, userId, options, this);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.btnCancel').on('click', function () {
|
||||||
|
PaperDialogHelper.close(dlg);
|
||||||
|
});
|
||||||
|
|
||||||
renderForm({
|
renderForm({
|
||||||
elem: $('.formFields', elem),
|
elem: $('.formFields', dlg),
|
||||||
dialogOptions: dialogOptions,
|
dialogOptions: dialogOptions,
|
||||||
dialogOptionsFn: getTargetDialogOptionsFn(dialogOptionsQuery)
|
dialogOptionsFn: getTargetDialogOptionsFn(dialogOptionsQuery)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['jqmicons']);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTargetDialogOptionsFn(query) {
|
function getTargetDialogOptionsFn(query) {
|
||||||
|
|
57
dashboard-ui/thirdparty/cast_sender.js
vendored
57
dashboard-ui/thirdparty/cast_sender.js
vendored
|
@ -1,57 +0,0 @@
|
||||||
(function () {
|
|
||||||
|
|
||||||
// This script produces errors in older versions of safari
|
|
||||||
|
|
||||||
if ((navigator.userAgent || '').toLowerCase().indexOf('chrome') == -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var chrome = window.chrome || {};
|
|
||||||
chrome.cast = chrome.cast || {};
|
|
||||||
chrome.cast.media = chrome.cast.media || {};
|
|
||||||
chrome.cast.ApiBootstrap_ = function () {
|
|
||||||
};
|
|
||||||
chrome.cast.ApiBootstrap_.EXTENSION_IDS = ["boadgeojelhgndaghljhdicfkmllpafd", "dliochdbjfkdbacpmhlcpmleaejidimm", "hfaagokkkhdbgiakmmlclaapfelnkoah", "fmfcbgogabcbclcofgocippekhfcmgfj", "enhhojjnijigcajfphajepfemndkmdlo"];
|
|
||||||
chrome.cast.ApiBootstrap_.findInstalledExtension_ = function (callback) {
|
|
||||||
chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(0, callback);
|
|
||||||
};
|
|
||||||
chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_ = function (index, callback) {
|
|
||||||
index == chrome.cast.ApiBootstrap_.EXTENSION_IDS.length ? callback(null) : chrome.cast.ApiBootstrap_.isExtensionInstalled_(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index], function (installed) {
|
|
||||||
installed ? callback(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index]) : chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(index + 1, callback);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
chrome.cast.ApiBootstrap_.getCastSenderUrl_ = function (extensionId) {
|
|
||||||
return "chrome-extension://" + extensionId + "/cast_sender.js";
|
|
||||||
};
|
|
||||||
chrome.cast.ApiBootstrap_.isExtensionInstalled_ = function (extensionId, callback) {
|
|
||||||
var xmlhttp = new XMLHttpRequest;
|
|
||||||
xmlhttp.onreadystatechange = function () {
|
|
||||||
4 == xmlhttp.readyState && 200 == xmlhttp.status && callback(!0);
|
|
||||||
};
|
|
||||||
xmlhttp.onerror = function () {
|
|
||||||
callback(!1);
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Throws an error in other browsers
|
|
||||||
xmlhttp.open("GET", chrome.cast.ApiBootstrap_.getCastSenderUrl_(extensionId), !0);
|
|
||||||
xmlhttp.send();
|
|
||||||
} catch (ex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
chrome.cast.ApiBootstrap_.findInstalledExtension_(function (extensionId) {
|
|
||||||
if (extensionId) {
|
|
||||||
console.log("Found cast extension: " + extensionId);
|
|
||||||
chrome.cast.extensionId = extensionId;
|
|
||||||
var apiScript = document.createElement("script");
|
|
||||||
apiScript.src = chrome.cast.ApiBootstrap_.getCastSenderUrl_(extensionId);
|
|
||||||
(document.head || document.documentElement).appendChild(apiScript);
|
|
||||||
} else {
|
|
||||||
var msg = "No cast extension found";
|
|
||||||
console.log(msg);
|
|
||||||
var callback = window.__onGCastApiAvailable;
|
|
||||||
callback && "function" == typeof callback && callback(!1, msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})();
|
|
|
@ -1,526 +1,4 @@
|
||||||
(function () {
|
define(['jqmwidget'], 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);
|
|
||||||
|
|
||||||
|
|
||||||
})();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "checkboxradio" plugin
|
* "checkboxradio" plugin
|
||||||
|
@ -872,3 +350,5 @@
|
||||||
}, $.mobile.behaviors.formReset));
|
}, $.mobile.behaviors.formReset));
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
});
|
|
@ -1,526 +1,4 @@
|
||||||
(function () {
|
define(['jqmwidget'], 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) {
|
(function ($, window, undefined) {
|
||||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
||||||
|
@ -907,3 +385,4 @@
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
});
|
|
@ -1,526 +1,4 @@
|
||||||
(function () {
|
define(['jqmwidget'], 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 ($, undefined) {
|
(function ($, undefined) {
|
||||||
|
|
||||||
|
@ -764,3 +242,5 @@
|
||||||
}, $.mobile.behaviors.addFirstLastClasses));
|
}, $.mobile.behaviors.addFirstLastClasses));
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
});
|
|
@ -1,526 +1,4 @@
|
||||||
(function () {
|
define(['jqmwidget'], 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) {
|
(function ($, window, undefined) {
|
||||||
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
|
||||||
|
@ -810,3 +288,5 @@
|
||||||
}, $.mobile.behaviors.addFirstLastClasses));
|
}, $.mobile.behaviors.addFirstLastClasses));
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
});
|
|
@ -1,526 +1,4 @@
|
||||||
(function () {
|
define(['jqmwidget'], 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 ($, undefined) {
|
(function ($, undefined) {
|
||||||
var props = {
|
var props = {
|
||||||
|
@ -1049,3 +527,5 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
});
|
|
@ -1,526 +1,4 @@
|
||||||
(function () {
|
define(['jqmwidget'], 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 ($, undefined) {
|
(function ($, undefined) {
|
||||||
var props = {
|
var props = {
|
||||||
|
@ -1803,3 +1281,4 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
});
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
Loading…
Add table
Add a link
Reference in a new issue