Skip to content

Commit 598b8fa

Browse files
committed
Update jQuery mobile
1 parent b6b5cef commit 598b8fa

File tree

246 files changed

+124690
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+124690
-0
lines changed

js/jquery/jquery.mobile/demos/_assets/css/jqm-demos.css

Lines changed: 1065 additions & 0 deletions
Large diffs are not rendered by default.
545 Bytes
489 Bytes
599 Bytes
545 Bytes
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Created by Joseph Wain (see http://penandthink.com) at and probably downloaded from http://glyphish.com
2+
3+
This work is licensed under the Creative Commons Attribution 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
4+
5+
You are free to share it and to remix it remix under the following conditions:
6+
7+
* You must attribute the work in the manner specified by the author (SEE BELOW).
8+
* For any reuse or distribution, you must make clear to others the license terms of this work.
9+
* The above conditions can be waived if you get permission from the copyright holder (send me an email!).
10+
11+
ATTRIBUTION -- a note reading "icons by Joseph Wain / glyphish.com" or similar, plus a link back to glyphish.com from your app's website, is the preferred form of attribution. Also acceptable would be, like, a link from within your iPhone application, or from the iTunes store page, but those aren't as useful to other people. If none of these work for you, please contact [email protected] and we can work something out.
12+
13+
USE WITHOUT ATTRIBUTION -- If attribution is not possible, workable or desirable for your application, contact [email protected] for commercial non-attributed licensing terms.
609 Bytes
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(function( $, undefined ) {
2+
$( document ).on( "mobileinit", function(){
3+
$.widget( "mobile.listview", $.mobile.listview, {
4+
options: {
5+
theme: null,
6+
countTheme: "c",
7+
headerTheme: "b",
8+
dividerTheme: "b",
9+
icon: "arrow-r",
10+
splitIcon: "arrow-r",
11+
splitTheme: "b",
12+
corners: true,
13+
shadow: true,
14+
inset: false,
15+
initSelector: ":jqmData(role='listview')",
16+
globalNav: false
17+
},
18+
_create: function(){
19+
this._super();
20+
if ( this.options.globalNav ){
21+
this._globalnav();
22+
}
23+
},
24+
_globalnav: function(){
25+
var base = $( "base" ).attr( "href" ).split('demos')[0],
26+
base = base.split('index.html')[0] + this.options.globalNav + "/";
27+
28+
this.element.find( "a" ).each(function() {
29+
var href = base + $( this ).attr( "href" );
30+
$( this ).attr( "href", href );
31+
});
32+
}
33+
});
34+
});
35+
})( jQuery );
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
(function( $, undefined ) {
2+
//special click handling to make widget work remove after nav changes in 1.4
3+
var href,
4+
ele = "";
5+
$( document ).on( "click", "a", function( e ) {
6+
href = $( this ).attr( "href" );
7+
var hash = $.mobile.path.parseUrl( href );
8+
if( typeof href !== "undefined" && hash !== "" && href !== href.replace( hash,"" ) && hash.search( "/" ) !== -1 ){
9+
//remove the hash from the link to allow normal loading of the page.
10+
var newHref = href.replace( hash,"" );
11+
$( this ).attr( "href", newHref );
12+
}
13+
ele = $( this );
14+
});
15+
$( document ).on( "pagebeforechange", function( e, f ){
16+
f.originalHref = href;
17+
});
18+
$( document ).on("pagebeforechange", function( e,f ){
19+
var hash = $.mobile.path.parseUrl(f.toPage).hash,
20+
hashEl, hashElInPage;
21+
22+
try {
23+
hashEl = $( hash );
24+
} catch( e ) {
25+
hashEl = $();
26+
}
27+
28+
try {
29+
hashElInPage = $( ".ui-page-active " + hash );
30+
} catch( e ) {
31+
hashElInPage = $();
32+
}
33+
34+
if( typeof hash !== "undefined" &&
35+
hash.search( "/" ) === -1 &&
36+
hash !== "" &&
37+
hashEl.length > 0 &&
38+
!hashEl.hasClass( "ui-page" ) &&
39+
hashEl.data('role') !== "page" &&
40+
!hashElInPage.hasClass( "ui-panel" ) &&
41+
!hashElInPage.hasClass( "ui-popup" ) ) {
42+
//scroll to the id
43+
var pos = hashEl.offset().top;
44+
$.mobile.silentScroll( pos );
45+
$.mobile.navigate( hash, '', true );
46+
} else if( typeof f.toPage !== "object" &&
47+
hash !== "" &&
48+
$.mobile.path.parseUrl( href ).hash !== "" &&
49+
!hashEl.hasClass( "ui-page" ) && hashEl.attr('data-role') !== "page" &&
50+
!hashElInPage.hasClass( "ui-panel" ) &&
51+
!hashElInPage.hasClass( "ui-popup" ) ) {
52+
$( ele ).attr( "href", href );
53+
$.mobile.document.one( "pagechange", function() {
54+
if( typeof hash !== "undefined" &&
55+
hash.search( "/" ) === -1 &&
56+
hash !== "" &&
57+
hashEl.length > 0 &&
58+
hashElInPage.length > 0 &&
59+
!hashEl.hasClass( "ui-page" ) &&
60+
hashEl.data('role') !== "page" &&
61+
!hashElInPage.hasClass( "ui-panel" ) &&
62+
!hashElInPage.hasClass( "ui-popup" ) ) {
63+
hash = $.mobile.path.parseUrl( href ).hash;
64+
var pos = hashElInPage.offset().top;
65+
$.mobile.silentScroll( pos );
66+
}
67+
} );
68+
}
69+
});
70+
$( document ).on( "mobileinit", function(){
71+
hash = window.location.hash;
72+
$.mobile.document.one( "pageshow", function(){
73+
var hashEl, hashElInPage;
74+
75+
try {
76+
hashEl = $( hash );
77+
} catch( e ) {
78+
hashEl = $();
79+
}
80+
81+
try {
82+
hashElInPage = $( ".ui-page-active " + hash );
83+
} catch( e ) {
84+
hashElInPage = $();
85+
}
86+
87+
if( hash !== "" &&
88+
hashEl.length > 0 &&
89+
hashElInPage.length > 0 &&
90+
hashEl.attr('data-role') !== "page" &&
91+
!hashEl.hasClass( "ui-page" ) &&
92+
!hashElInPage.hasClass( "ui-panel" ) &&
93+
!hashElInPage.hasClass( "ui-popup" ) &&
94+
!hashEl.is( "body" ) ){
95+
var pos = hashElInPage.offset().top;
96+
setTimeout( function(){
97+
$.mobile.silentScroll( pos );
98+
}, 100 );
99+
}
100+
});
101+
});
102+
//h2 widget
103+
$( document ).on( "mobileinit", function(){
104+
$.widget( "mobile.h2linker", $.mobile.widget, {
105+
options:{
106+
initSelector: ":jqmData(quicklinks='true')"
107+
},
108+
109+
_create:function(){
110+
var self = this,
111+
bodyid = "ui-page-top",
112+
panel = "<div data-role='panel' class='jqm-nav-panel jqm-quicklink-panel' data-position='right' data-display='overlay' data-theme='c'><ul data-role='listview' data-inset='false' data-theme='d' data-divider-theme='d' data-icon='false' class='jqm-list'><li data-role='list-divider'>Jump to section</li></ul></div>",
113+
first = true,
114+
h2dictionary = new Object();
115+
if(typeof $("body").attr("id") === "undefined"){
116+
$("body").attr("id",bodyid);
117+
} else {
118+
bodyid = $("body").attr("id");
119+
}
120+
this.element.find("div.jqm-content>h2").each(function(){
121+
var id, text = $(this).text();
122+
123+
if(typeof $(this).attr("id") === "undefined"){
124+
id = text.replace(/[^\.a-z0-9:_-]+/gi,"");
125+
$(this).attr( "id", id );
126+
} else {
127+
id = $(this).attr("id");
128+
}
129+
130+
h2dictionary[id] = text;
131+
if(!first){
132+
$(this).before( "<a href='#" + bodyid + "' class='jqm-deeplink ui-link'>Return to top<span class='ui-icon ui-icon-arrow-u'>&nbsp;</span></a>");
133+
} else {
134+
$(this).before("<a href='#' data-ajax='false' class='jqm-deeplink ui-link jqm-open-quicklink-panel'>Jump to section<span class='ui-icon ui-icon-bars'>&nbsp;</span></a>");
135+
}
136+
first = false;
137+
});
138+
this._on(".jqm-open-quicklink-panel", {
139+
"click": function(){
140+
$(".ui-page-active .jqm-quicklink-panel").panel("open");
141+
return false;
142+
}
143+
});
144+
this._on( document, {
145+
"pagebeforechange": function(){
146+
this.element.find(".jqm-quicklink-panel").panel("close");
147+
this.element.find(".jqm-quicklink-panel .ui-btn-active").removeClass("ui-btn-active");
148+
}
149+
});
150+
if( $(h2dictionary).length > 0 ){
151+
this.element.prepend(panel)
152+
this.element.find(".jqm-quicklink-panel").panel().find("ul").listview();
153+
}
154+
$.each(h2dictionary,function(id,text){
155+
self.element.find(".jqm-quicklink-panel ul").append("<li><a href='#"+id+"'>"+text+"</a></li>");
156+
});
157+
self.element.find(".jqm-quicklink-panel ul").listview("refresh");
158+
159+
160+
}
161+
});
162+
});
163+
$( document ).bind( "pagecreate create", function( e ) {
164+
var initselector = $.mobile.h2linker.prototype.options.initSelector;
165+
if($(e.target).data("quicklinks")){
166+
$(e.target).h2linker();
167+
}
168+
});
169+
})( jQuery );
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
$type = 'text/javascript';
3+
$files = array(
4+
'jqm-demos.js',
5+
'view-source.js',
6+
'h2widget.js',
7+
'globalnav.js'
8+
);
9+
10+
require_once('../../../combine.html');

0 commit comments

Comments
 (0)