1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

trim jquery mobile

This commit is contained in:
Luke Pulverenti 2015-11-27 12:46:58 -05:00
parent 316fce063a
commit 301fd258bb
35 changed files with 359 additions and 661 deletions

View file

@ -39,6 +39,6 @@
"commit": "cec8e49744a1e18b14a711eea77e201bb70de544" "commit": "cec8e49744a1e18b14a711eea77e201bb70de544"
}, },
"_source": "git://github.com/desandro/doc-ready.git", "_source": "git://github.com/desandro/doc-ready.git",
"_target": "1.0.x", "_target": "~1.0.4",
"_originalSource": "doc-ready" "_originalSource": "doc-ready"
} }

View file

@ -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"
} }

View file

@ -26,14 +26,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"main": "iron-meta.html", "main": "iron-meta.html",
"homepage": "https://github.com/PolymerElements/iron-meta", "homepage": "https://github.com/polymerelements/iron-meta",
"_release": "1.1.1", "_release": "1.1.1",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.1.1", "tag": "v1.1.1",
"commit": "e171ee234b482219c9514e6f9551df48ef48bd9f" "commit": "e171ee234b482219c9514e6f9551df48ef48bd9f"
}, },
"_source": "git://github.com/PolymerElements/iron-meta.git", "_source": "git://github.com/polymerelements/iron-meta.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-meta" "_originalSource": "polymerelements/iron-meta"
} }

View file

@ -223,7 +223,7 @@
$('.alphabetPicker', page).alphaValue(query.NameStartsWith); $('.alphabetPicker', page).alphaValue(query.NameStartsWith);
} }
$(document).on('pageinit', "#channelItemsPage", function () { pageIdOn.on('pageinit', "channelItemsPage", function () {
var page = this; var page = this;
@ -261,7 +261,9 @@
reloadItems(page); reloadItems(page);
}); });
}).on('pagebeforeshow', "#channelItemsPage", function () { });
pageIdOn('pagebeforeshow', "channelItemsPage", function () {
var page = this; var page = this;
reloadFeatures(page); reloadFeatures(page);

View file

@ -70,7 +70,7 @@
} }
} }
$(document).on('pageinit', "#channelsPage", function () { pageIdOn.on('pageinit', "channelsPage", function () {
var page = this; var page = this;
@ -79,8 +79,8 @@
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'channels.html'); LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'channels.html');
$(pages).on('tabchange', function () { pages.addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(e.target.selected));
}); });
}); });

View file

@ -21,13 +21,13 @@
} }
} }
$(document).on('pageinit', "#channelsPage", function () { pageIdOn('pageinit', "channelsPage", function () {
var page = this; var page = this;
var pages = page.querySelector('neon-animated-pages'); var pages = page.querySelector('neon-animated-pages');
$(pages).on('tabchange', function () { pages.addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(e.target.selected));
}); });
}); });

View file

@ -266,11 +266,11 @@
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'index.html'); LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'index.html');
$(pages).on('tabchange', function () { pages.addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(e.target.selected));
}); });
Events.on(page.querySelector('.btnTakeTour'), 'click', function () { page.querySelector('.btnTakeTour').addEventListener('click', function () {
takeTour(page, Dashboard.getCurrentUserId()); takeTour(page, Dashboard.getCurrentUserId());
}); });
@ -301,7 +301,7 @@
var page = $($.mobile.activePage)[0]; var page = $($.mobile.activePage)[0];
var pages = page.querySelector('neon-animated-pages'); var pages = page.querySelector('neon-animated-pages');
$(pages).trigger('tabchange'); pages.dispatchEvent(new CustomEvent("tabchange", {}));
} }
} }

View file

@ -1945,31 +1945,31 @@
}); });
} }
$(document).on('pageinit', "#itemDetailPage", function () { pageIdOn('pageinit', "itemDetailPage", function() {
var page = this; var page = this;
$('.btnPlay', page).on('click', function () { $('.btnPlay', page).on('click', function() {
playCurrentItem(this); playCurrentItem(this);
}); });
$('.btnPlayTrailer', page).on('click', function () { $('.btnPlayTrailer', page).on('click', function() {
playTrailer(page); playTrailer(page);
}); });
$('.btnSplitVersions', page).on('click', function () { $('.btnSplitVersions', page).on('click', function() {
splitVersions(page); splitVersions(page);
}); });
$('.btnSync', page).on('click', function () { $('.btnSync', page).on('click', function() {
SyncManager.showMenu({ SyncManager.showMenu({
items: [currentItem] items: [currentItem]
}); });
}); });
$('.btnRecord,.btnFloatingRecord', page).on('click', function () { $('.btnRecord,.btnFloatingRecord', page).on('click', function() {
var id = getParameterByName('id'); var id = getParameterByName('id');
@ -1977,48 +1977,48 @@
}); });
$('.btnCancelRecording', page).on('click', function () { $('.btnCancelRecording', page).on('click', function() {
deleteTimer(page, currentItem.TimerId); deleteTimer(page, currentItem.TimerId);
}); });
$('.btnMoreCommands', page).on('click', function () { $('.btnMoreCommands', page).on('click', function() {
var button = this; var button = this;
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().done(function(user) {
LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user)); LibraryBrowser.showMoreCommands(button, currentItem.Id, LibraryBrowser.getMoreCommands(currentItem, user));
}); });
}); });
$('.childrenItemsContainer', page).on('playallfromhere', function (e, index) { $('.childrenItemsContainer', page).on('playallfromhere', function(e, index) {
LibraryBrowser.playAllFromHere(_childrenItemsFunction, index); LibraryBrowser.playAllFromHere(_childrenItemsFunction, index);
}).on('queueallfromhere', function (e, index) { }).on('queueallfromhere', function(e, index) {
LibraryBrowser.queueAllFromHere(_childrenItemsFunction, index); LibraryBrowser.queueAllFromHere(_childrenItemsFunction, index);
}); });
$(page).on("click", ".moreScenes", function () { $(page).on("click", ".moreScenes", function() {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().done(function(user) {
renderScenes(page, currentItem, user); renderScenes(page, currentItem, user);
}); });
}).on("click", ".morePeople", function () { }).on("click", ".morePeople", function() {
renderCast(page, currentItem, getContext(currentItem)); renderCast(page, currentItem, getContext(currentItem));
}).on("click", ".moreSpecials", function () { }).on("click", ".moreSpecials", function() {
Dashboard.getCurrentUser().done(function (user) { Dashboard.getCurrentUser().done(function(user) {
renderSpecials(page, currentItem, user); renderSpecials(page, currentItem, user);
}); });
}).on("click", ".moreCriticReviews", function () { }).on("click", ".moreCriticReviews", function() {
renderCriticReviews(page, currentItem); renderCriticReviews(page, currentItem);
}); });
@ -2028,7 +2028,9 @@
// btnMore[i].icon = AppInfo.moreIcon; // btnMore[i].icon = AppInfo.moreIcon;
//} //}
}).on('pagebeforeshow', "#itemDetailPage", function () { });
pageIdOn('pagebeforeshow', "itemDetailPage", function() {
var page = this; var page = this;
@ -2038,7 +2040,10 @@
Events.on(LibraryBrowser, 'itemdeleting', onItemDeleted); Events.on(LibraryBrowser, 'itemdeleting', onItemDeleted);
}).on('pagebeforehide', "#itemDetailPage", function () { });
pageIdOn('pagebeforehide', "itemDetailPage", function () {
Events.off(LibraryBrowser, 'itemdeleting', onItemDeleted); Events.off(LibraryBrowser, 'itemdeleting', onItemDeleted);

View file

@ -236,7 +236,7 @@
} }
} }
$(document).on('pageinit', "#itemListPage", function () { pageIdOn('pageinit', "itemListPage", function () {
var page = this; var page = this;
@ -276,7 +276,9 @@
$(page).on('click', '.mediaItem', onListItemClick); $(page).on('click', '.mediaItem', onListItemClick);
}).on('pagebeforeshow', "#itemListPage", function () { });
pageIdOn('pagebeforeshow', "itemListPage", function () {
var page = this; var page = this;
@ -284,7 +286,9 @@
updateFilterControls(page); updateFilterControls(page);
LibraryMenu.setBackButtonVisible(getParameterByName('context')); LibraryMenu.setBackButtonVisible(getParameterByName('context'));
}).on('pagebeforehide', "#itemListPage", function () { });
pageIdOn('pagebeforehide', "itemListPage", function () {
currentItem = null; currentItem = null;

View file

@ -264,7 +264,7 @@
var delay = LibraryBrowser.animatePaperTabs() || !tabs.noSlide ? 500 : 0; var delay = LibraryBrowser.animatePaperTabs() || !tabs.noSlide ? 500 : 0;
setTimeout(function () { setTimeout(function () {
$(pgs).trigger('tabchange'); pgs.dispatchEvent(new CustomEvent("tabchange", {}));
}, delay); }, delay);
}); });
@ -361,7 +361,7 @@
return; return;
} }
} }
Events.trigger(pages, 'tabchange'); pages.dispatchEvent(new CustomEvent("tabchange", {}));
} }
}, },

View file

@ -1208,6 +1208,7 @@
MediaController.instantMix(itemId); MediaController.instantMix(itemId);
} }
e.stopPropagation();
e.preventDefault(); e.preventDefault();
return false; return false;
} }

View file

@ -52,7 +52,7 @@
ImageLoader.lazyChildren(document.querySelector('.viewMenuBar')); ImageLoader.lazyChildren(document.querySelector('.viewMenuBar'));
Events.trigger(document, 'headercreated'); document.dispatchEvent(new CustomEvent("headercreated", {}));
bindMenuEvents(); bindMenuEvents();
} }

View file

@ -85,7 +85,7 @@
}); });
} }
$(document).on('pagebeforeshow', "#liveTvItemsPage", function () { pageIdOn('pagebeforeshow', "liveTvItemsPage", function () {
query.ParentId = LibraryMenu.getTopParentId(); query.ParentId = LibraryMenu.getTopParentId();

View file

@ -191,7 +191,7 @@
}); });
} }
$(document).on('pageinit', "#liveTvSuggestedPage", function () { pageIdOn('pageinit', "liveTvSuggestedPage", function () {
var page = this; var page = this;
@ -200,8 +200,8 @@
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'livetv.html'); LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, 'livetv.html');
$(pages).on('tabchange', function () { pages.addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(e.target.selected));
}); });
}); });

View file

@ -1012,17 +1012,21 @@
showPlayerSelection(); showPlayerSelection();
} }
$(document).on('headercreated', function () { document.addEventListener('headercreated', function () {
$('.btnCast').off('click', onCastButtonClicked).on('click', onCastButtonClicked); $('.btnCast').off('click', onCastButtonClicked).on('click', onCastButtonClicked);
}).on('pagebeforeshow', ".page", function () { });
pageClassOn('pagebeforeshow', "page", function () {
var page = this; var page = this;
currentDisplayInfo = null; currentDisplayInfo = null;
}).on('displayingitem', ".libraryPage", function (e, info) { });
pageClassOn('displayingitem', "libraryPage", function (e, info) {
currentDisplayInfo = info; currentDisplayInfo = info;

View file

@ -880,9 +880,9 @@
var itemVideo = document.querySelector('.itemVideo'); var itemVideo = document.querySelector('.itemVideo');
if (itemVideo) { if (itemVideo) {
//Events.on(itemVideo, 'mousemove', onMouseMove); //Events.on(itemVideo, 'mousemove', onMouseMove);
Events.on(itemVideo, 'keydown', idleHandler); itemVideo.addEventListener('keydown', idleHandler);
Events.on(itemVideo, 'scroll', idleHandler); itemVideo.addEventListener('scroll', idleHandler);
Events.on(itemVideo, 'mousedown', idleHandler); itemVideo.addEventListener('mousedown', idleHandler);
idleHandler(); idleHandler();
} }
} }
@ -914,9 +914,9 @@
var itemVideo = document.querySelector('.itemVideo'); var itemVideo = document.querySelector('.itemVideo');
if (itemVideo) { if (itemVideo) {
//Events.off(itemVideo, 'mousemove', onMouseMove); //Events.off(itemVideo, 'mousemove', onMouseMove);
Events.off(itemVideo, 'keydown', idleHandler); itemVideo.removeEventListener('keydown', idleHandler);
Events.off(itemVideo, 'scroll', idleHandler); itemVideo.removeEventListener('scroll', idleHandler);
Events.off(itemVideo, 'mousedown', idleHandler); itemVideo.removeEventListener('mousedown', idleHandler);
} }
} }

View file

@ -202,21 +202,23 @@
}); });
} }
$(document).on('pageinit', "#boxsetsPage", function () { pageIdOn('pageinit', 'boxsetsPage', function () {
var page = this; var page = this;
var content = page; var content = page;
initPage(content); initPage(content);
}).on('pagebeforeshow', "#boxsetsPage", function () { });
pageIdOn('pagebeforeshow', 'boxsetsPage', function () {
var page = this; var page = this;
var content = page; var content = page;
reloadItems(content); reloadItems(content);
}); });
window.MoviesPage = window.MoviesPage || {}; window.MoviesPage = window.MoviesPage || {};

View file

@ -340,8 +340,8 @@
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl); LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl);
$(pages).on('tabchange', function () { pages.addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(e.target.selected));
}); });
}); });
@ -383,7 +383,7 @@
var page = $($.mobile.activePage)[0]; var page = $($.mobile.activePage)[0];
var pages = page.querySelector('neon-animated-pages'); var pages = page.querySelector('neon-animated-pages');
$(pages).trigger('tabchange'); pages.dispatchEvent(new CustomEvent("tabchange", {}));
} }
} }

View file

@ -302,8 +302,8 @@
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl); LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl);
$(pages).on('tabchange', function () { pages.addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(e.target.selected));
}); });
}).on('pageshow', "#musicRecommendedPage", function () { }).on('pageshow', "#musicRecommendedPage", function () {

View file

@ -178,7 +178,7 @@
$(apiClient).off("websocketmessage", onWebSocketMessage).on("websocketmessage", onWebSocketMessage); $(apiClient).off("websocketmessage", onWebSocketMessage).on("websocketmessage", onWebSocketMessage);
} }
$(document).on('headercreated', function (e, apiClient) { document.addEventListener('headercreated', function () {
$('.btnNotifications').on('click', function () { $('.btnNotifications').on('click', function () {
Dashboard.navigate('notificationlist.html'); Dashboard.navigate('notificationlist.html');
}); });

View file

@ -201,7 +201,7 @@
} }
} }
$(document).on('pageinit', "#photosPage", function () { pageIdOn('pageinit', "photosPage", function () {
var page = this; var page = this;
@ -215,8 +215,8 @@
LibraryBrowser.configurePaperLibraryTabs(page, tabs, page.querySelector('neon-animated-pages'), baseUrl); LibraryBrowser.configurePaperLibraryTabs(page, tabs, page.querySelector('neon-animated-pages'), baseUrl);
$(page.querySelector('neon-animated-pages')).on('tabchange', function () { page.querySelector('neon-animated-pages').addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(e.target.selected));
}); });
$(page).on('click', '.mediaItem', onListItemClick); $(page).on('click', '.mediaItem', onListItemClick);

View file

@ -162,7 +162,7 @@
}); });
} }
$(document).on('pagebeforeshow', "#playlistsPage", function () { pageIdOn('pagebeforeshow', "playlistsPage", function () {
var page = this; var page = this;
reloadItems(page); reloadItems(page);

View file

@ -217,7 +217,7 @@
$(document).on('pagecontainerbeforehide', closeSearchResults); $(document).on('pagecontainerbeforehide', closeSearchResults);
$(document).on('headercreated', function () { document.addEventListener('headercreated', function () {
bindSearchEvents(); bindSearchEvents();
}); });

View file

@ -161,13 +161,15 @@
}); });
} }
$(document).on('pageinit', "#secondaryItemsPage", function () { pageIdOn('pageinit', "secondaryItemsPage", function () {
var page = this; var page = this;
$(page).on('click', '.mediaItem', onListItemClick); $(page).on('click', '.mediaItem', onListItemClick);
}).on('pagebeforeshow', "#secondaryItemsPage", function () { });
pageIdOn('pagebeforeshow', "secondaryItemsPage", function () {
var page = this; var page = this;

View file

@ -12,12 +12,17 @@
cache: false cache: false
}); });
} }
$.support.cors = true;
function onOneDocumentClick() {
document.removeEventListener('click', onOneDocumentClick);
WebNotifications.requestPermission();
}
document.addEventListener('click', onOneDocumentClick);
})(); })();
$.support.cors = true;
$(document).one('click', WebNotifications.requestPermission);
var Dashboard = { var Dashboard = {
jQueryMobileInit: function () { jQueryMobileInit: function () {
@ -2226,8 +2231,6 @@ var AppInfo = {};
}); });
define("jqmpanel", ["thirdparty/jquerymobile-1.4.5/jqm.panel"], function () { define("jqmpanel", ["thirdparty/jquerymobile-1.4.5/jqm.panel"], function () {
$.mobile.panel.prototype.options.classes.modalOpen = "largePanelModalOpen ui-panel-dismiss-open";
$.mobile.panel.prototype.options.classes.panel = "largePanel ui-panel";
Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.panel.css'); Dashboard.importCss('thirdparty/jquerymobile-1.4.5/jqm.panel.css');
return {}; return {};

View file

@ -270,7 +270,7 @@
LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl); LibraryBrowser.configurePaperLibraryTabs(page, tabs, pages, baseUrl);
$(pages).on('tabchange', function () { pages.addEventListener('tabchange', function (e) {
loadTab(page, parseInt(this.selected)); loadTab(page, parseInt(this.selected));
}); });
}); });
@ -313,7 +313,7 @@
var page = $($.mobile.activePage)[0]; var page = $($.mobile.activePage)[0];
var pages = page.querySelector('neon-animated-pages'); var pages = page.querySelector('neon-animated-pages');
$(pages).trigger('tabchange'); pages.dispatchEvent(new CustomEvent("tabchange", {}));
} }
} }

View file

@ -1,21 +0,0 @@
removed:
text input clear
flip
flow
pop
slide
slidedown
slidefade
slideup
turn
nojs
listview auto-dividers
listview hide-dividers
zoom handling
ios orientation
grid layouts
accordions
filterable
tabs
toolbars:fixed
selects: custom menus

View file

@ -22,8 +22,8 @@
var input = this.element, var input = this.element,
o = this.options, o = this.options,
inheritAttr = function (input, dataAttr) { inheritAttr = function (input, dataAttr) {
return input.jqmData(dataAttr) || return input.data(dataAttr) ||
input.closest("form, fieldset").jqmData(dataAttr); input.closest("form, fieldset").data(dataAttr);
}, },
label = this.options.enhanced ? label = this.options.enhanced ?
{ {
@ -44,7 +44,7 @@
} }
o.iconpos = inheritAttr(input, "iconpos") || o.iconpos = inheritAttr(input, "iconpos") ||
label.element.attr("data-" + $.mobile.ns + "iconpos") || o.iconpos, label.element.attr("data-iconpos") || o.iconpos,
// Establish options // Establish options
o.mini = inheritAttr(input, "mini") || o.mini; o.mini = inheritAttr(input, "mini") || o.mini;
@ -183,7 +183,7 @@
_cacheVals: function () { _cacheVals: function () {
this._getInputSet().each(function () { this._getInputSet().each(function () {
$(this).attr("data-" + $.mobile.ns + "cacheVal", this.checked); $(this).attr("data-cacheVal", this.checked);
}); });
}, },
@ -272,7 +272,7 @@
return ((controlgroupWidget ? controlgroupWidget.options.type : return ((controlgroupWidget ? controlgroupWidget.options.type :
// ... otherwise decide based on the "type" data attribute. // ... otherwise decide based on the "type" data attribute.
controlgroup.attr("data-" + $.mobile.ns + "type")) !== "horizontal"); controlgroup.attr("data-type")) !== "horizontal");
} }
} }

View file

@ -1,4 +1,41 @@
(function ($, undefined) { (function ($, window, undefined) {
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
$.extend($.mobile, {
// Namespace used framework-wide for data-attrs. Default is no namespace
// Retrieve an attribute from an element and perform some massaging of the value
getAttribute: function (element, key) {
var data;
element = element.jquery ? element[0] : element;
if (element && element.getAttribute) {
data = element.getAttribute("data-" + key);
}
// Copied from core's src/data.js:dataAttr()
// Convert from a string to a proper data type
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test(data) ? JSON.parse(data) :
data;
} catch (err) { }
return data;
}
});
})(jQuery, this);
(function ($, undefined) {
var rInitialLetter = /([A-Z])/g, var rInitialLetter = /([A-Z])/g,

View file

@ -1,4 +1,41 @@
(function ($, undefined) { (function ($, window, undefined) {
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
$.extend($.mobile, {
// Namespace used framework-wide for data-attrs. Default is no namespace
// Retrieve an attribute from an element and perform some massaging of the value
getAttribute: function (element, key) {
var data;
element = element.jquery ? element[0] : element;
if (element && element.getAttribute) {
data = element.getAttribute("data-" + key);
}
// Copied from core's src/data.js:dataAttr()
// Convert from a string to a proper data type
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test(data) ? JSON.parse(data) :
data;
} catch (err) { }
return data;
}
});
})(jQuery, this);
(function ($, undefined) {
var uiScreenHiddenRegex = /\bui-screen-hidden\b/; var uiScreenHiddenRegex = /\bui-screen-hidden\b/;
function noHiddenClass(elements) { function noHiddenClass(elements) {

View file

@ -82,27 +82,13 @@
$.widget("mobile.panel", { $.widget("mobile.panel", {
options: { options: {
classes: {
panel: "ui-panel",
panelOpen: "ui-panel-open",
panelClosed: "ui-panel-closed",
panelFixed: "ui-panel-fixed",
panelInner: "ui-panel-inner",
modal: "ui-panel-dismiss",
modalOpen: "ui-panel-dismiss-open",
pageContainer: "ui-panel-page-container",
pageWrapper: "ui-panel-wrapper",
pageFixedToolbar: "ui-panel-fixed-toolbar",
pageContentPrefix: "ui-panel-page-content", /* Used for wrapper and fixed toolbars position, display and open classes. */
animate: "ui-panel-animate"
},
animate: true, animate: true,
theme: null, theme: null,
position: "left", position: "left",
dismissible: true, dismissible: true,
display: "reveal", //accepts reveal, push, overlay display: "overlay", //accepts reveal, push, overlay
swipeClose: true, swipeClose: true,
positionFixed: false positionFixed: true
}, },
_parentPage: null, _parentPage: null,
@ -129,7 +115,7 @@
// if animating, add the class to do so // if animating, add the class to do so
if (!!this.options.animate) { if (!!this.options.animate) {
this.element.addClass(this.options.classes.animate); this.element.addClass("ui-panel-animate");
} }
this._bindUpdateLayout(); this._bindUpdateLayout();
@ -145,9 +131,9 @@
}, },
_getPanelInner: function () { _getPanelInner: function () {
var panelInner = this.element[0].querySelector("." + this.options.classes.panelInner); var panelInner = this.element[0].querySelector("." + "ui-panel-inner");
if (!panelInner) { if (!panelInner) {
panelInner = this.element.children().wrapAll("<div class='" + this.options.classes.panelInner + "' />").parent(); panelInner = this.element.children().wrapAll("<div class='" + "ui-panel-inner" + "' />").parent();
} else { } else {
panelInner = $(panelInner); panelInner = $(panelInner);
} }
@ -159,7 +145,7 @@
var self = this, var self = this,
target = self._parentPage ? self._parentPage.parent() : self.element.parent(); target = self._parentPage ? self._parentPage.parent() : self.element.parent();
self._modal = $("<div class='" + self.options.classes.modal + "'></div>") self._modal = $("<div class='" + "ui-panel-dismiss" + "'></div>")
.on("mousedown", function () { .on("mousedown", function () {
self.close(); self.close();
}) })
@ -167,16 +153,16 @@
}, },
_getPage: function () { _getPage: function () {
var page = this._openedPage || this._parentPage || $("." + $.mobile.activePageClass); var page = this._openedPage || this._parentPage || $(".ui-page-active");
return page; return page;
}, },
_getWrapper: function () { _getWrapper: function () {
var wrapper = this._page().find("." + this.options.classes.pageWrapper); var wrapper = this._page().find("." + "ui-panel-wrapper");
if (wrapper.length === 0) { if (wrapper.length === 0) {
wrapper = this._page().children(".ui-header:not(.ui-header-fixed), .ui-content:not(.ui-popup), .ui-footer:not(.ui-footer-fixed)") wrapper = this._page().children(".ui-header:not(.ui-header-fixed), .ui-content:not(.ui-popup), .ui-footer:not(.ui-footer-fixed)")
.wrapAll("<div class='" + this.options.classes.pageWrapper + "'></div>") .wrapAll("<div class='" + "ui-panel-wrapper" + "'></div>")
.parent(); .parent();
} }
@ -184,17 +170,17 @@
}, },
_getPosDisplayClasses: function (prefix) { _getPosDisplayClasses: function (prefix) {
return prefix + "-position-" + this.options.position + " " + prefix + "-display-" + this.options.display; return prefix + "-position-right " + prefix + "-display-" + this.options.display;
}, },
_getPanelClasses: function () { _getPanelClasses: function () {
var panelClasses = this.options.classes.panel + var panelClasses = "ui-panel" +
" " + this._getPosDisplayClasses(this.options.classes.panel) + " " + this._getPosDisplayClasses("ui-panel") +
" " + this.options.classes.panelClosed + " " + "ui-panel-closed" +
" " + "ui-body-" + (this.options.theme ? this.options.theme : "inherit"); " " + "ui-body-" + (this.options.theme ? this.options.theme : "inherit");
if (!!this.options.positionFixed) { if (!!this.options.positionFixed) {
panelClasses += " " + this.options.classes.panelFixed; panelClasses += " " + "ui-panel-fixed";
} }
return panelClasses; return panelClasses;
@ -239,14 +225,14 @@
}, },
_unfixPanel: function () { _unfixPanel: function () {
if (!!this.options.positionFixed && $.support.fixedPosition) { if (!!this.options.positionFixed) {
this.element.removeClass(this.options.classes.panelFixed); this.element.removeClass("ui-panel-fixed");
} }
}, },
_fixPanel: function () { _fixPanel: function () {
if (!!this.options.positionFixed && $.support.fixedPosition) { if (!!this.options.positionFixed) {
this.element.addClass(this.options.classes.panelFixed); this.element.addClass("ui-panel-fixed");
} }
}, },
@ -355,10 +341,10 @@
_openPanel = function () { _openPanel = function () {
self._off(self.document, "panelclose"); self._off(self.document, "panelclose");
self._page().jqmData("panel", "open"); self._page().data("panel", "open");
if (!!o.animate && o.display !== "overlay") { if (!!o.animate && o.display !== "overlay") {
self._wrapper.addClass(o.classes.animate); self._wrapper.addClass("ui-panel-animate");
} }
if (!immediate && !!o.animate) { if (!immediate && !!o.animate) {
@ -370,23 +356,23 @@
if (o.theme && o.display !== "overlay") { if (o.theme && o.display !== "overlay") {
self._page().parent() self._page().parent()
.addClass(o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme); .addClass("ui-panel-page-container" + "-themed " + "ui-panel-page-container" + "-" + o.theme);
} }
self.element self.element
.removeClass(o.classes.panelClosed) .removeClass("ui-panel-closed")
.addClass(o.classes.panelOpen); .addClass("ui-panel-open");
self._positionPanel(true); self._positionPanel(true);
self._pageContentOpenClasses = self._getPosDisplayClasses(o.classes.pageContentPrefix); self._pageContentOpenClasses = self._getPosDisplayClasses("ui-panel-page-content");
if (o.display !== "overlay") { if (o.display !== "overlay") {
self._page().parent().addClass(o.classes.pageContainer); self._page().parent().addClass("ui-panel-page-container");
self._wrapper.addClass(self._pageContentOpenClasses); self._wrapper.addClass(self._pageContentOpenClasses);
} }
self._modalOpenClasses = self._getPosDisplayClasses(o.classes.modal) + " " + o.classes.modalOpen; self._modalOpenClasses = self._getPosDisplayClasses("ui-panel-dismiss") + " " + "ui-panel-dismiss-open";
if (self._modal) { if (self._modal) {
self._modal self._modal
.addClass(self._modalOpenClasses) .addClass(self._modalOpenClasses)
@ -401,7 +387,7 @@
} }
if (o.display !== "overlay") { if (o.display !== "overlay") {
self._wrapper.addClass(o.classes.pageContentPrefix + "-open"); self._wrapper.addClass("ui-panel-page-content" + "-open");
} }
self._bindFixListener(); self._bindFixListener();
@ -413,7 +399,7 @@
self._trigger("beforeopen"); self._trigger("beforeopen");
if (self._page().jqmData("panel") === "open") { if (self._page().data("panel") === "open") {
self._on(self.document, { self._on(self.document, {
"panelclose": _openPanel "panelclose": _openPanel
}); });
@ -432,7 +418,7 @@
_closePanel = function () { _closePanel = function () {
self.element.removeClass(o.classes.panelOpen); self.element.removeClass("ui-panel-open");
if (o.display !== "overlay") { if (o.display !== "overlay") {
self._wrapper.removeClass(self._pageContentOpenClasses); self._wrapper.removeClass(self._pageContentOpenClasses);
@ -453,24 +439,24 @@
}, },
complete = function () { complete = function () {
if (o.theme && o.display !== "overlay") { if (o.theme && o.display !== "overlay") {
self._page().parent().removeClass(o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme); self._page().parent().removeClass("ui-panel-page-container" + "-themed " + "ui-panel-page-container" + "-" + o.theme);
} }
self.element.addClass(o.classes.panelClosed); self.element.addClass("ui-panel-closed");
if (o.display !== "overlay") { if (o.display !== "overlay") {
self._page().parent().removeClass(o.classes.pageContainer); self._page().parent().removeClass("ui-panel-page-container");
self._wrapper.removeClass(o.classes.pageContentPrefix + "-open"); self._wrapper.removeClass("ui-panel-page-content" + "-open");
} }
if (!!o.animate && o.display !== "overlay") { if (!!o.animate && o.display !== "overlay") {
self._wrapper.removeClass(o.classes.animate); self._wrapper.removeClass("ui-panel-animate");
} }
self._fixPanel(); self._fixPanel();
self._unbindFixListener(); self._unbindFixListener();
self._page().jqmRemoveData("panel"); self._page().removeData("panel");
self._trigger("close"); self._trigger("close");
@ -504,10 +490,10 @@
if (this._open) { if (this._open) {
this._page().parent().removeClass(o.classes.pageContainer); this._page().parent().removeClass("ui-panel-page-container");
if (o.theme) { if (o.theme) {
this._page().parent().removeClass(o.classes.pageContainer + "-themed " + o.classes.pageContainer + "-" + o.theme); this._page().parent().removeClass("ui-panel-page-container" + "-themed " + "ui-panel-page-container" + "-" + o.theme);
} }
} }
} }
@ -519,13 +505,13 @@
} }
if (this._open) { if (this._open) {
this._page().jqmRemoveData("panel"); this._page().removeData("panel");
} }
this._panelInner.children().unwrap(); this._panelInner.children().unwrap();
this.element this.element
.removeClass([this._getPanelClasses(), o.classes.panelOpen, o.classes.animate].join(" ")) .removeClass([this._getPanelClasses(), "ui-panel-open", "ui-panel-animate"].join(" "))
.off("swipeleft.panel swiperight.panel") .off("swipeleft.panel swiperight.panel")
.off("panelbeforeopen") .off("panelbeforeopen")
.off("panelhide") .off("panelhide")

View file

@ -894,7 +894,7 @@
if (typeof data.toPage === "string") { if (typeof data.toPage === "string") {
parsedDst = data.toPage; parsedDst = data.toPage;
} else { } else {
parsedDst = data.toPage.jqmData("url"); parsedDst = data.toPage.data("url");
} }
parsedDst = $.mobile.path.parseUrl(parsedDst); parsedDst = $.mobile.path.parseUrl(parsedDst);
toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash; toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash;
@ -1030,8 +1030,8 @@
popup.popup("open", { popup.popup("open", {
x: offset.left + $link.outerWidth() / 2, x: offset.left + $link.outerWidth() / 2,
y: offset.top + $link.outerHeight() / 2, y: offset.top + $link.outerHeight() / 2,
transition: $link.jqmData("transition"), transition: $link.data("transition"),
positionTo: $link.jqmData("position-to") positionTo: $link.data("position-to")
}); });
} }
@ -1042,7 +1042,7 @@
}; };
// TODO move inside _create // TODO move inside _create
$.mobile.document.on("pagebeforechange", function (theEvent, data) { $(document).on("pagebeforechange", function (theEvent, data) {
if (data.options.role === "popup") { if (data.options.role === "popup") {
$.mobile.popup.handleLink(data.options.link); $.mobile.popup.handleLink(data.options.link);
theEvent.preventDefault(); theEvent.preventDefault();

View file

@ -1,4 +1,41 @@
(function ($, undefined) { (function ($, window, undefined) {
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
$.extend($.mobile, {
// Namespace used framework-wide for data-attrs. Default is no namespace
// Retrieve an attribute from an element and perform some massaging of the value
getAttribute: function (element, key) {
var data;
element = element.jquery ? element[0] : element;
if (element && element.getAttribute) {
data = element.getAttribute("data-" + key);
}
// Copied from core's src/data.js:dataAttr()
// Convert from a string to a proper data type
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test(data) ? JSON.parse(data) :
data;
} catch (err) { }
return data;
}
});
})(jQuery, this);
(function ($, undefined) {
/*! /*!
* jQuery UI Core c0ab71056b936627e8a7821f03c044aec6280a40 * jQuery UI Core c0ab71056b936627e8a7821f03c044aec6280a40
@ -63,8 +100,8 @@
control = this.element, control = this.element,
trackTheme = this.options.trackTheme || $.mobile.getAttribute(control[0], "theme"), trackTheme = this.options.trackTheme || $.mobile.getAttribute(control[0], "theme"),
trackThemeClass = trackTheme ? " ui-bar-" + trackTheme : " ui-bar-inherit", trackThemeClass = trackTheme ? " ui-bar-" + trackTheme : " ui-bar-inherit",
cornerClass = (this.options.corners || control.jqmData("corners")) ? " ui-corner-all" : "", cornerClass = (this.options.corners || control.data("corners")) ? " ui-corner-all" : "",
miniClass = (this.options.mini || control.jqmData("mini")) ? " ui-mini" : "", miniClass = (this.options.mini || control.data("mini")) ? " ui-mini" : "",
cType = control[0].nodeName.toLowerCase(), cType = control[0].nodeName.toLowerCase(),
isToggleSwitch = (cType === "select"), isToggleSwitch = (cType === "select"),
isRangeslider = control.parent().is(":jqmData(role='rangeslider')"), isRangeslider = control.parent().is(":jqmData(role='rangeslider')"),

View file

@ -1,16 +1,50 @@
(function ($, undefined) { (function ($, window, undefined) {
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/;
$.extend($.mobile, {
// Namespace used framework-wide for data-attrs. Default is no namespace
// Retrieve an attribute from an element and perform some massaging of the value
getAttribute: function (element, key) {
var data;
element = element.jquery ? element[0] : element;
if (element && element.getAttribute) {
data = element.getAttribute("data-" + key);
}
// Copied from core's src/data.js:dataAttr()
// Convert from a string to a proper data type
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test(data) ? JSON.parse(data) :
data;
} catch (err) { }
return data;
}
});
})(jQuery, this);
(function ($, undefined) {
$.widget("mobile.table", { $.widget("mobile.table", {
options: { options: {
classes: {
table: "ui-table"
},
enhanced: false enhanced: false
}, },
_create: function () { _create: function () {
if (!this.options.enhanced) { if (!this.options.enhanced) {
this.element.addClass(this.options.classes.table); this.element.addClass("ui-table");
} }
// extend here, assign on refresh > _setHeaders // extend here, assign on refresh > _setHeaders
@ -58,7 +92,7 @@
selector = ":nth-child(" + (columnCount + 1) + ")", selector = ":nth-child(" + (columnCount + 1) + ")",
j; j;
this.setAttribute("data-" + $.mobile.ns + "colstart", columnCount + 1); this.setAttribute("data-colstart", columnCount + 1);
if (span) { if (span) {
for (j = 0; j < span - 1; j++) { for (j = 0; j < span - 1; j++) {
@ -69,7 +103,7 @@
// Store "cells" data on header as a reference to all cells in the // Store "cells" data on header as a reference to all cells in the
// same column as this TH // same column as this TH
$(this).jqmData("cells", table.find("tr").not(trs.eq(0)).not(this).children(selector)); $(this).data("cells", table.find("tr").not(trs.eq(0)).not(this).children(selector));
columnCount++; columnCount++;
}); });
@ -84,11 +118,7 @@
$.widget("mobile.table", $.mobile.table, { $.widget("mobile.table", $.mobile.table, {
options: { options: {
mode: "reflow", mode: "reflow"
classes: $.extend($.mobile.table.prototype.options.classes, {
reflowTable: "ui-table-reflow",
cellLabels: "ui-table-cell-label"
})
}, },
_create: function () { _create: function () {
@ -100,7 +130,7 @@
} }
if (!this.options.enhanced) { if (!this.options.enhanced) {
this.element.addClass(this.options.classes.reflowTable); this.element.addClass("ui-table-reflow");
this._updateReflow(); this._updateReflow();
} }
@ -127,7 +157,7 @@
// get headers in reverse order so that top-level headers are appended last // get headers in reverse order so that top-level headers are appended last
$(table.allHeaders.get().reverse()).each(function () { $(table.allHeaders.get().reverse()).each(function () {
var cells = $(this).jqmData("cells"), var cells = $(this).data("cells"),
colstart = $.mobile.getAttribute(this, "colstart"), colstart = $.mobile.getAttribute(this, "colstart"),
hierarchyClass = cells.not(this).filter("thead th").length && " ui-table-cell-label-top", hierarchyClass = cells.not(this).filter("thead th").length && " ui-table-cell-label-top",
contents = $(this).clone().contents(), contents = $(this).clone().contents(),
@ -144,9 +174,9 @@
} }
table._addLabels(cells.filter(filter), table._addLabels(cells.filter(filter),
opts.classes.cellLabels + hierarchyClass, contents); "ui-table-cell-label" + hierarchyClass, contents);
} else { } else {
table._addLabels(cells, opts.classes.cellLabels, contents); table._addLabels(cells, "ui-table-cell-label", contents);
} }
} }

View file

@ -20,84 +20,6 @@
* http://benalman.com/about/license/ * http://benalman.com/about/license/
*/ */
// Script: jQuery hashchange event
//
// *Version: 1.3, Last updated: 7/21/2010*
//
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
// GitHub - http://github.com/cowboy/jquery-hashchange/
// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped)
//
// About: License
//
// Copyright (c) 2010 "Cowboy" Ben Alman,
// Dual licensed under the MIT and GPL licenses.
// http://benalman.com/about/license/
//
// About: Examples
//
// These working examples, complete with fully commented code, illustrate a few
// ways in which this plugin can be used.
//
// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/
//
// About: Support and Testing
//
// Information about what version or versions of jQuery this plugin has been
// tested with, what browsers it has been tested in, and where the unit tests
// reside (so you can test it yourself).
//
// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5,
// Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
//
// About: Known issues
//
// While this jQuery hashchange event implementation is quite stable and
// robust, there are a few unfortunate browser bugs surrounding expected
// hashchange event-based behaviors, independent of any JavaScript
// window.onhashchange abstraction. See the following examples for more
// information:
//
// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
//
// Also note that should a browser natively support the window.onhashchange
// event, but not report that it does, the fallback polling loop will be used.
//
// About: Release History
//
// 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more
// "removable" for mobile-only development. Added IE6/7 document.title
// support. Attempted to make Iframe as hidden as possible by using
// techniques from http://www.paciellogroup.com/blog/?p=604. Added
// support for the "shortcut" format $(window).hashchange( fn ) and
// $(window).hashchange() like jQuery provides for built-in events.
// Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and
// lowered its default value to 50. Added <jQuery.fn.hashchange.domain>
// and <jQuery.fn.hashchange.src> properties plus document-domain.html
// file to address access denied issues when setting document.domain in
// IE6/7.
// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin
// from a page on another domain would cause an error in Safari 4. Also,
// IE6/7 Iframe is now inserted after the body (this actually works),
// which prevents the page from scrolling when the event is first bound.
// Event can also now be bound before DOM ready, but it won't be usable
// before then in IE6/7.
// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
// where browser version is incorrectly reported as 8.0, despite
// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
// window.onhashchange functionality into a separate plugin for users
// who want just the basic event & back button support, without all the
// extra awesomeness that BBQ provides. This plugin will be included as
// part of jQuery BBQ, but also be available separately.
(function ($, window, undefined) { (function ($, window, undefined) {
// Reused string. // Reused string.
@ -138,119 +60,16 @@
})(jQuery, this); })(jQuery, this);
(function ($, window, undefined) { // default the property to remove dependency on assignment in init module
$.extend($.mobile, { jQuery.mobile.pageContainer = $();
// Version of the jQuery Mobile Framework
version: "1.4.5",
hideUrlBar: true,
// Deprecated in 1.4 remove in 1.5
// Class assigned to page currently in view, and during transitions
activePageClass: "ui-page-active",
// disable the alteration of the dynamic base tag or links in the case
// that a dynamic base tag isn't supported
dynamicBaseEnabled: true,
// default the property to remove dependency on assignment in init module
pageContainer: $(),
dialogHashKey: "&ui-state=dialog"
});
})(jQuery, this);
(function ($, window, undefined) { (function ($, window, undefined) {
var nsNormalizeDict = {}, var oldFind = $.find,
oldFind = $.find,
rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
jqmDataRE = /:jqmData\(([^)]*)\)/g; jqmDataRE = /:jqmData\(([^)]*)\)/g;
$.extend($.mobile, {
// Namespace used framework-wide for data-attrs. Default is no namespace
ns: "",
// Retrieve an attribute from an element and perform some massaging of the value
getAttribute: function (element, key) {
var data;
element = element.jquery ? element[0] : element;
if (element && element.getAttribute) {
data = element.getAttribute("data-" + $.mobile.ns + key);
}
// Copied from core's src/data.js:dataAttr()
// Convert from a string to a proper data type
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test(data) ? JSON.parse(data) :
data;
} catch (err) { }
return data;
},
// Expose our cache for testing purposes.
nsNormalizeDict: nsNormalizeDict,
// Take a data attribute property, prepend the namespace
// and then camel case the attribute string. Add the result
// to our nsNormalizeDict so we don't have to do this again.
nsNormalize: function (prop) {
return nsNormalizeDict[prop] ||
(nsNormalizeDict[prop] = $.camelCase($.mobile.ns + prop));
}
});
// Mobile version of data and removeData and hasData methods
// ensures all data is set and retrieved using jQuery Mobile's data namespace
$.fn.jqmData = function (prop, value) {
var result;
if (typeof prop !== "undefined") {
if (prop) {
prop = $.mobile.nsNormalize(prop);
}
// undefined is permitted as an explicit input for the second param
// in this case it returns the value and does not set it to undefined
if (arguments.length < 2 || value === undefined) {
result = this.data(prop);
} else {
result = this.data(prop, value);
}
}
return result;
};
$.jqmData = function (elem, prop, value) {
var result;
if (typeof prop !== "undefined") {
result = $.data(elem, prop ? $.mobile.nsNormalize(prop) : prop, value);
}
return result;
};
$.fn.jqmRemoveData = function (prop) {
return this.removeData($.mobile.nsNormalize(prop));
};
$.jqmRemoveData = function (elem, prop) {
return $.removeData(elem, $.mobile.nsNormalize(prop));
};
$.find = function (selector, context, ret, extra) { $.find = function (selector, context, ret, extra) {
if (selector.indexOf(":jqmData") > -1) { if (selector.indexOf(":jqmData") > -1) {
selector = selector.replace(jqmDataRE, "[data-" + ($.mobile.ns || "") + "$1]"); selector = selector.replace(jqmDataRE, "[data-$1]");
} }
return oldFind.call(this, selector, context, ret, extra); return oldFind.call(this, selector, context, ret, extra);
@ -276,9 +95,6 @@
} }
$.extend($.mobile, { $.extend($.mobile, {
// define the window and the document objects
window: $(window),
document: $(document),
// Place to store various widget extensions // Place to store various widget extensions
behaviors: {}, behaviors: {},
@ -291,7 +107,7 @@
var url = (page ? page.getAttribute("data-url") : null), var url = (page ? page.getAttribute("data-url") : null),
base = $.mobile.path.documentBase.hrefNoHash; base = $.mobile.path.documentBase.hrefNoHash;
if (!$.mobile.dynamicBaseEnabled || !url || !$.mobile.path.isPath(url)) { if (!url || !$.mobile.path.isPath(url)) {
url = base; url = base;
} }
@ -342,68 +158,7 @@
})(jQuery, this); })(jQuery, this);
(function ($, undefined) { (function ($, undefined) {
var $win = $(window), self;
// thx Modernizr
function propExists(prop) {
var uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1),
props = (prop + " " + vendors.join(uc_prop + " ") + uc_prop).split(" "),
v;
for (v in props) {
if (fbCSS[props[v]] !== undefined) {
return true;
}
}
}
var fakeBody = $("<body>").prependTo("html"),
fbCSS = fakeBody[0].style,
vendors = ["Webkit", "Moz", "O"],
webos = "palmGetResource" in window, //only used to rule out scrollTop
operamini = window.operamini && ({}).toString.call(window.operamini) === "[object OperaMini]";
// Test for dynamic-updating base tag support ( allows us to avoid href,src attr rewriting )
function baseTagTest() {
var fauxBase = location.protocol + "//" + location.host + location.pathname + "ui-dir/",
base = $("head base"),
fauxEle = null,
href = "",
link, rebase;
if (!base.length) {
base = fauxEle = $("<base>", { "href": fauxBase }).appendTo("head");
} else {
href = base.attr("href");
}
link = $("<a href='testurl' />").prependTo(fakeBody);
rebase = link[0].href;
base[0].href = href || location.pathname;
if (fauxEle) {
fauxEle.remove();
}
return rebase.indexOf(fauxBase) === 0;
}
$.extend($.support, {
cssPseudoElement: !!propExists("content"),
touchOverflow: !!propExists("overflowScrolling"),
fixedPosition: true,
scrollTop: ("pageXOffset" in window ||
"scrollTop" in document.documentElement ||
"scrollTop" in fakeBody[0]) && !webos && !operamini,
dynamicBaseTag: baseTagTest()
});
fakeBody.remove();
})(jQuery);
(function ($, undefined) {
var $win = $.mobile.window, self;
$.event.special.navigate = self = { $.event.special.navigate = self = {
bound: false, bound: false,
@ -944,9 +699,10 @@
options = {}; options = {};
// //
if (!$.mobile.getAttribute(elem, "defaults")) { if (!this.element.data("defaults")) {
for (option in this.options) { for (option in this.options) {
value = $.mobile.getAttribute(elem, option.replace(rcapitals, replaceFunction));
value = this.element.data(option);
if (value != null) { if (value != null) {
options[option] = value; options[option] = value;
@ -983,7 +739,7 @@
$.extend($.widget, originalWidget); $.extend($.widget, originalWidget);
// For backcompat remove in 1.5 // For backcompat remove in 1.5
$.mobile.document.on("create", function (event) { $(document).on("create", function (event) {
$(event.target).enhanceWithin(); $(event.target).enhanceWithin();
}); });
@ -1020,13 +776,13 @@
}, },
_enhance: function () { _enhance: function () {
var attrPrefix = "data-" + $.mobile.ns, var attrPrefix = "data-",
self = this; self = this;
var element = this.element[0]; var element = this.element[0];
if (this.options.role) { if (this.options.role) {
element.setAttribute("data-" + $.mobile.ns + "role", this.options.role); element.setAttribute("data-role", this.options.role);
} }
element.setAttribute("tabindex", "0"); element.setAttribute("tabindex", "0");
@ -1038,7 +794,7 @@
for (var i = 0, length = contents.length; i < length; i++) { for (var i = 0, length = contents.length; i < length; i++) {
var content = contents[i]; var content = contents[i];
var theme = content.getAttribute(attrPrefix + "theme") || undefined; var theme = content.getAttribute(attrPrefix + "theme") || undefined;
self.options.contentTheme = theme || self.options.contentTheme || (self.options.dialog && self.options.theme) || (self.element.jqmData("role") === "dialog" && self.options.theme); self.options.contentTheme = theme || self.options.contentTheme || (self.options.dialog && self.options.theme) || (self.element.data("role") === "dialog" && self.options.theme);
content.classList.add("ui-content"); content.classList.add("ui-content");
if (self.options.contentTheme) { if (self.options.contentTheme) {
content.classList.add("ui-body-" + (self.options.contentTheme)); content.classList.add("ui-body-" + (self.options.contentTheme));
@ -1058,7 +814,7 @@
} }
if (o.contentTheme !== undefined) { if (o.contentTheme !== undefined) {
var elems = elem.querySelectorAll("*[data-" + $.mobile.ns + "='content']"); var elems = elem.querySelectorAll("*[data-" + "" + "='content']");
for (var i = 0, length = elems.length; i < length; i++) { for (var i = 0, length = elems.length; i < length; i++) {
var el = elems[i]; var el = elems[i];
el.classList.remove("ui-body-" + this.options.contentTheme); el.classList.remove("ui-body-" + this.options.contentTheme);
@ -1084,7 +840,7 @@
(function ($, undefined) { (function ($, undefined) {
var path, $base, dialogHashKey = "&ui-state=dialog"; var path, $base;
$.mobile.path = path = { $.mobile.path = path = {
uiStateKey: "&ui-state", uiStateKey: "&ui-state",
@ -1285,11 +1041,10 @@
// For embedded pages, remove the dialog hash key as in getFilePath(), // For embedded pages, remove the dialog hash key as in getFilePath(),
// and remove otherwise the Data Url won't match the id of the embedded Page. // and remove otherwise the Data Url won't match the id of the embedded Page.
result = u.hash result = u.hash
.split(dialogHashKey)[0]
.replace(/^#/, "") .replace(/^#/, "")
.replace(/\?.*$/, ""); .replace(/\?.*$/, "");
} else if (path.isSameDomain(u, this.documentBase)) { } else if (path.isSameDomain(u, this.documentBase)) {
result = u.hrefNoHash.replace(this.documentBase.domain, "").split(dialogHashKey)[0]; result = u.hrefNoHash.replace(this.documentBase.domain, "");
} }
return window.decodeURIComponent(result); return window.decodeURIComponent(result);
@ -1330,7 +1085,7 @@
//remove the preceding hash, any query params, and dialog notations //remove the preceding hash, any query params, and dialog notations
cleanHash: function (hash) { cleanHash: function (hash) {
return path.stripHash(hash.replace(/\?.*$/, "").replace(dialogHashKey, "")); return path.stripHash(hash.replace(/\?.*$/, ""));
}, },
isHashValid: function (hash) { isHashValid: function (hash) {
@ -1452,12 +1207,6 @@
return (hasHash ? "#" : "") + hash.replace(/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g, "\\$1"); return (hasHash ? "#" : "") + hash.replace(/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g, "\\$1");
}, },
// return the substring of a filepath before the dialogHashKey, for making a server
// request
getFilePath: function (path) {
return path && path.split(dialogHashKey)[0];
},
// check if the specified url refers to the first page in the main // check if the specified url refers to the first page in the main
// application document. // application document.
isFirstPageUrl: function (url) { isFirstPageUrl: function (url) {
@ -1641,7 +1390,7 @@
this.history = history; this.history = history;
this.ignoreInitialHashChange = true; this.ignoreInitialHashChange = true;
$.mobile.window.bind({ $(window).bind({
"popstate.history": $.proxy(this.popstate, this) "popstate.history": $.proxy(this.popstate, this)
}); });
}; };
@ -1756,7 +1505,7 @@
// caught that was triggered by the hash setting above. // caught that was triggered by the hash setting above.
if (!noEvents) { if (!noEvents) {
this.ignorePopState = true; this.ignorePopState = true;
$.mobile.window.trigger(popstateEvent); $(window).window.trigger(popstateEvent);
} }
// record the history entry so that the information can be included // record the history entry so that the information can be included
@ -1869,56 +1618,6 @@
$.mobile.navigate.history.add(loc.href, { hash: loc.hash }); $.mobile.navigate.history.add(loc.href, { hash: loc.hash });
})(jQuery); })(jQuery);
(function ($, undefined) {
// existing base tag?
var baseElement = document.querySelector('head base');
if (!baseElement) {
baseElement = $("<base>", { href: $.mobile.path.documentBase.hrefNoHash }).prependTo($("head"));
baseElement = baseElement[0];
}
// base element management, defined depending on dynamic base tag support
// TODO move to external widget
var base = {
// define base element, for use in routing asset urls that are referenced
// in Ajax-requested markup
element: baseElement,
linkSelector: "*[src], link[href], a[rel='external'], *[data-ajax='false'], a[target]",
// set the generated BASE element's href to a new page's base path
set: function (href) {
// we should do nothing if the user wants to manage their url base
// manually
if (!$.mobile.dynamicBaseEnabled) {
return;
}
// we should use the base tag if we can manipulate it dynamically
if ($.support.dynamicBaseTag) {
base.element.setAttribute("href",
$.mobile.path.makeUrlAbsolute(href, $.mobile.path.documentBase));
}
},
rewrite: function (href, page) {
},
// set the generated BASE element's href to a new page's base path
reset: function (/* href */) {
base.element.setAttribute("href", $.mobile.path.documentBase.hrefNoSearch);
}
};
$.mobile.base = base;
})(jQuery);
(function ($, undefined) { (function ($, undefined) {
var pageCache = {}; var pageCache = {};
@ -2037,45 +1736,6 @@
return (entry && entry.transition) || defaultTransition; return (entry && entry.transition) || defaultTransition;
}, },
_handleDialog: function (changePageOptions, data) {
var to, active, activeContent = this.getActivePage();
// If current active page is not a dialog skip the dialog and continue
// in the same direction
// Note: The dialog widget is deprecated as of 1.4.0 and will be removed in 1.5.0.
// Thus, as of 1.5.0 activeContent.data( "mobile-dialog" ) will always evaluate to
// falsy, so the second condition in the if-statement below can be removed altogether.
if (activeContent && !activeContent.data("mobile-dialog")) {
// determine if we're heading forward or backward and continue
// accordingly past the current dialog
if (data.direction === "back") {
this.back();
} else {
this.forward();
}
// prevent changePage call
return false;
} else {
// if the current active page is a dialog and we're navigating
// to a dialog use the dialog objected saved in the stack
to = data.pageUrl;
active = this._getActiveHistory();
// make sure to set the role, transition and reversal
// as most of this is lost by the domCache cleaning
$.extend(changePageOptions, {
role: active.role,
transition: this._transitionFromHistory(
data.direction,
changePageOptions.transition),
reverse: data.direction === "back"
});
}
return to;
},
_handleNavigate: function (url, data) { _handleNavigate: function (url, data) {
//find first page via hash //find first page via hash
// TODO stripping the hash twice with handleUrl // TODO stripping the hash twice with handleUrl
@ -2099,20 +1759,6 @@
transition: transition transition: transition
}); });
// TODO move to _handleDestination ?
// If this isn't the first page, if the current url is a dialog hash
// key, and the initial destination isn't equal to the current target
// page, use the special dialog handling
if (history.activeIndex > 0 &&
to.indexOf($.mobile.dialogHashKey) > -1) {
to = this._handleDialog(changePageOptions, data);
if (to === false) {
return;
}
}
this._changeContent(this._handleDestination(to), changePageOptions); this._changeContent(this._handleDestination(to), changePageOptions);
}, },
@ -2120,10 +1766,6 @@
$.mobile.changePage(to, opts); $.mobile.changePage(to, opts);
}, },
_getBase: function () {
return $.mobile.base;
},
_enhance: function (content, role) { _enhance: function (content, role) {
// TODO consider supporting a custom callback, and passing in // TODO consider supporting a custom callback, and passing in
// the settings which includes the role // the settings which includes the role
@ -2143,24 +1785,26 @@
_find: function (absUrl) { _find: function (absUrl) {
// TODO consider supporting a custom callback // TODO consider supporting a custom callback
var fileUrl = this._createFileUrl(absUrl), var fileUrl = absUrl,
dataUrl = this._createDataUrl(absUrl), dataUrl = this._createDataUrl(absUrl),
page, initialContent = this._getInitialContent(); page, initialContent = this._getInitialContent();
// Check to see if the page already exists in the DOM. // Check to see if the page already exists in the DOM.
// NOTE do _not_ use the :jqmData pseudo selector because parenthesis // NOTE do _not_ use the :jqmData pseudo selector because parenthesis
// are a valid url char and it breaks on the first occurence // are a valid url char and it breaks on the first occurence
page = this.element page = this.element[0].querySelector("[data-url='" + $.mobile.path.hashToSelector(dataUrl) + "']");
.children("[data-url='" + $.mobile.path.hashToSelector(dataUrl) + "']");
// If we failed to find the page, check to see if the url is a // If we failed to find the page, check to see if the url is a
// reference to an embedded page. If so, it may have been dynamically // reference to an embedded page. If so, it may have been dynamically
// injected by a developer, in which case it would be lacking a // injected by a developer, in which case it would be lacking a
// data-url attribute and in need of enhancement. // data-url attribute and in need of enhancement.
if (page.length === 0 && dataUrl && !$.mobile.path.isPath(dataUrl)) { if (!page && dataUrl && !$.mobile.path.isPath(dataUrl)) {
page = this.element.children($.mobile.path.hashToSelector("#" + dataUrl)) page = this.element[0].querySelector($.mobile.path.hashToSelector("#" + dataUrl));
.attr("data-url", dataUrl)
.jqmData("url", dataUrl); if (page) {
$(page).attr("data-url", dataUrl)
.data("url", dataUrl);
}
} }
// If we failed to find a page in the DOM, check the URL to see if it // If we failed to find a page in the DOM, check the URL to see if it
@ -2169,14 +1813,14 @@
// apps are pruning the first page from the DOM for various reasons. // apps are pruning the first page from the DOM for various reasons.
// We check for this case here because we don't want a first-page with // We check for this case here because we don't want a first-page with
// an id falling through to the non-existent embedded page error case. // an id falling through to the non-existent embedded page error case.
if (page.length === 0 && if (!page &&
$.mobile.path.isFirstPageUrl(fileUrl) && $.mobile.path.isFirstPageUrl(fileUrl) &&
initialContent && initialContent &&
initialContent.parent().length) { initialContent.parent().length) {
page = $(initialContent); page = initialContent;
} }
return page; return page ? $(page) : $();
}, },
_parse: function (html, fileUrl) { _parse: function (html, fileUrl) {
@ -2206,28 +1850,20 @@
_setLoadedTitle: function (page, html) { _setLoadedTitle: function (page, html) {
//page title regexp //page title regexp
if (!page.jqmData("title")) { if (!page.data("title")) {
var newPageTitle = html.match(/<title[^>]*>([^<]*)/) && RegExp.$1; var newPageTitle = html.match(/<title[^>]*>([^<]*)/) && RegExp.$1;
if (newPageTitle) { if (newPageTitle) {
page.jqmData("title", newPageTitle); page.data("title", newPageTitle);
} }
} }
}, },
_isRewritableBaseTag: function () {
return $.mobile.dynamicBaseEnabled && !$.support.dynamicBaseTag;
},
_createDataUrl: function (absoluteUrl) { _createDataUrl: function (absoluteUrl) {
return $.mobile.path.convertUrlToDataUrl(absoluteUrl); return $.mobile.path.convertUrlToDataUrl(absoluteUrl);
}, },
_createFileUrl: function (absoluteUrl) {
return $.mobile.path.getFilePath(absoluteUrl);
},
_triggerWithDeprecated: function (name, data, page) { _triggerWithDeprecated: function (name, data, page) {
var deprecatedEvent = $.Event("page" + name), var deprecatedEvent = $.Event("page" + name),
newEvent = $.Event(this.widgetName + name); newEvent = $.Event(this.widgetName + name);
@ -2258,7 +1894,7 @@
// could be abstracted out as a group // could be abstracted out as a group
_loadSuccess: function (absUrl, triggerData, settings, deferred) { _loadSuccess: function (absUrl, triggerData, settings, deferred) {
var fileUrl = this._createFileUrl(absUrl); var fileUrl = absUrl;
var currentSelf = this; var currentSelf = this;
return function (html, wasCached) { return function (html, wasCached) {
@ -2272,11 +1908,6 @@
} }
} }
//dont update the base tag if we are prefetching
if (settings.prefetch === undefined) {
currentSelf._getBase().set(fileUrl);
}
var contentElem = currentSelf._parse(html, fileUrl); var contentElem = currentSelf._parse(html, fileUrl);
var content = $(contentElem); var content = $(contentElem);
@ -2289,11 +1920,6 @@
triggerData.toPage = content; triggerData.toPage = content;
// rewrite src and href attrs to use a base url if the base tag won't work
if (currentSelf._isRewritableBaseTag() && content) {
currentSelf._getBase().rewrite(fileUrl, content);
}
var dependencies = contentElem.getAttribute('data-require'); var dependencies = contentElem.getAttribute('data-require');
dependencies = dependencies ? dependencies.split(',') : null; dependencies = dependencies ? dependencies.split(',') : null;
@ -2365,7 +1991,7 @@
// The absolute version of the URL minus any dialog/subcontent params. // The absolute version of the URL minus any dialog/subcontent params.
// In otherwords the real URL of the content to be loaded. // In otherwords the real URL of the content to be loaded.
fileUrl = this._createFileUrl(absUrl); fileUrl = absUrl;
// The version of the Url actually stored in the data-url attribute of // The version of the Url actually stored in the data-url attribute of
// the content. For embedded content, it is just the id of the page. For // the content. For embedded content, it is just the id of the page. For
@ -2385,10 +2011,6 @@
return deferred.promise(); return deferred.promise();
} }
// Reset base to the default document base
// TODO figure out why we doe this
this._getBase().reset();
// If the content we are interested in is already in the DOM, // If the content we are interested in is already in the DOM,
// and the caller did not indicate that we should force a // and the caller did not indicate that we should force a
// reload of the file, we are done. Resolve the deferrred so that // reload of the file, we are done. Resolve the deferrred so that
@ -2397,12 +2019,6 @@
this._enhance(content, settings.role); this._enhance(content, settings.role);
deferred.resolve(absUrl, settings, content); deferred.resolve(absUrl, settings, content);
//if we are reloading the content make sure we update
// the base if its not a prefetch
if (!settings.prefetch) {
this._getBase().set(url);
}
return deferred.promise(); return deferred.promise();
} }
@ -2416,12 +2032,6 @@
options: settings options: settings
}; };
// Reset base to the default document base.
// only reset if we are not prefetching
if (settings.prefetch === undefined) {
this._getBase().reset();
}
var successFn = this._loadSuccess(absUrl, triggerData, settings, deferred); var successFn = this._loadSuccess(absUrl, triggerData, settings, deferred);
var cachedResult = pageCache[absUrl.split('?')[0]]; var cachedResult = pageCache[absUrl.split('?')[0]];
if (cachedResult) { if (cachedResult) {
@ -2572,7 +2182,7 @@
transition: function (toPage, triggerData, settings) { transition: function (toPage, triggerData, settings) {
var fromPage, url, pageUrl, fileUrl, var fromPage, url, pageUrl, fileUrl,
active, activeIsInitialPage, active, activeIsInitialPage,
historyDir, pageTitle, isDialog, historyDir, pageTitle,
alreadyThere, newPageTitle, alreadyThere, newPageTitle,
params; params;
@ -2590,19 +2200,16 @@
// internal state and then trigger a transition to the page. // internal state and then trigger a transition to the page.
fromPage = settings.fromPage; fromPage = settings.fromPage;
url = (settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl)) || url = (settings.dataUrl && $.mobile.path.convertUrlToDataUrl(settings.dataUrl)) ||
toPage.jqmData("url"); toPage.data("url");
// The pageUrl var is usually the same as url, except when url is obscured // The pageUrl var is usually the same as url, except when url is obscured
// as a dialog url. pageUrl always contains the file path // as a dialog url. pageUrl always contains the file path
pageUrl = url; pageUrl = url;
fileUrl = $.mobile.path.getFilePath(url); fileUrl = url;
active = $.mobile.navigate.history.getActive(); active = $.mobile.navigate.history.getActive();
activeIsInitialPage = $.mobile.navigate.history.activeIndex === 0; activeIsInitialPage = $.mobile.navigate.history.activeIndex === 0;
historyDir = 0; historyDir = 0;
pageTitle = document.title; pageTitle = document.title;
isDialog = (settings.role === "dialog" ||
toPage.jqmData("role") === "dialog") &&
toPage.jqmData("dialog") !== true;
// By default, we prevent changePage requests when the fromPage and toPage // By default, we prevent changePage requests when the fromPage and toPage
// are the same element, but folks that generate content // are the same element, but folks that generate content
@ -2644,52 +2251,15 @@
// if so, do not add a new history entry and do not change the hash either // if so, do not add a new history entry and do not change the hash either
alreadyThere = false; alreadyThere = false;
// If we're displaying the page as a dialog, we don't want the url
// for the dialog content to be used in the hash. Instead, we want
// to append the dialogHashKey to the url of the current page.
if (isDialog && active) {
// on the initial page load active.url is undefined and in that case
// should be an empty string. Moving the undefined -> empty string back
// into urlHistory.addNew seemed imprudent given undefined better
// represents the url state
// If we are at a place in history that once belonged to a dialog, reuse
// this state without adding to urlHistory and without modifying the
// hash. However, if a dialog is already displayed at this point, and
// we're about to display another dialog, then we must add another hash
// and history entry on top so that one may navigate back to the
// original dialog
if (active.url &&
active.url.indexOf($.mobile.dialogHashKey) > -1 &&
this.activePage &&
!this.activePage.hasClass("ui-dialog") &&
$.mobile.navigate.history.activeIndex > 0) {
settings.changeHash = false;
alreadyThere = true;
}
// Normally, we tack on a dialog hash key, but if this is the location
// of a stale dialog, we reuse the URL from the entry
url = (active.url || "");
// account for absolute urls instead of just relative urls use as hashes
if (!alreadyThere && url.indexOf("#") > -1) {
url += $.mobile.dialogHashKey;
} else {
url += "#" + $.mobile.dialogHashKey;
}
}
// if title element wasn't found, try the page div data attr too // if title element wasn't found, try the page div data attr too
// If this is a deep-link or a reload ( active === undefined ) then just // If this is a deep-link or a reload ( active === undefined ) then just
// use pageTitle // use pageTitle
newPageTitle = (!active) ? pageTitle : toPage.jqmData("title"); newPageTitle = (!active) ? pageTitle : toPage.data("title");
if (!!newPageTitle && pageTitle === document.title) { if (!!newPageTitle && pageTitle === document.title) {
pageTitle = newPageTitle; pageTitle = newPageTitle;
} }
if (!toPage.jqmData("title")) { if (!toPage.data("title")) {
toPage.jqmData("title", pageTitle); toPage.data("title", pageTitle);
} }
//add page to history stack if it's not back or forward //add page to history stack if it's not back or forward
@ -2861,12 +2431,12 @@
} }
//use ajax //use ajax
reverse = $link.jqmData("direction") === "reverse" || reverse = $link.data("direction") === "reverse" ||
// deprecated - remove by 1.0 // deprecated - remove by 1.0
$link.jqmData("back"); $link.data("back");
//this may need to be more specific as we use data-rel more //this may need to be more specific as we use data-rel more
role = link.getAttribute("data-" + $.mobile.ns + "rel") || undefined; role = link.getAttribute("data-rel") || undefined;
$.mobile.changePage(href, { reverse: reverse, role: role, link: $link }); $.mobile.changePage(href, { reverse: reverse, role: role, link: $link });
event.preventDefault(); event.preventDefault();
@ -2934,8 +2504,8 @@
var $this = $(this); var $this = $(this);
// unless the data url is already set set it to the pathname // unless the data url is already set set it to the pathname
if (!$this[0].getAttribute("data-" + $.mobile.ns + "url")) { if (!$this[0].getAttribute("data-url")) {
$this.attr("data-" + $.mobile.ns + "url", $this.attr("id") || $this.attr("data-url", $this.attr("id") ||
path.convertUrlToDataUrl(theLocation.pathname + theLocation.search)); path.convertUrlToDataUrl(theLocation.pathname + theLocation.search));
} }
}); });
@ -2957,8 +2527,7 @@
// Remember, however, that the hash can also be a path! // Remember, however, that the hash can also be a path!
if (!($.mobile.path.isHashValid(location.hash) && if (!($.mobile.path.isHashValid(location.hash) &&
($(hashPage).is("[data-role='page']") || ($(hashPage).is("[data-role='page']") ||
$.mobile.path.isPath(hash) || $.mobile.path.isPath(hash)))) {
hash === $.mobile.dialogHashKey))) {
// make sure to set initial popstate state if it exists // make sure to set initial popstate state if it exists
// so that navigation back to the initial page works properly // so that navigation back to the initial page works properly