Skip to content

Commit ae1cd73

Browse files
Demos: changed class to jqm-deeplink, cleane up jqm-demos.js
1 parent 5a622d1 commit ae1cd73

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

docs/demos/_assets/css/jqm-demos.css

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ body, .jqm-demos {
193193
opacity: .6;
194194
}
195195

196-
/* Sections link */
197-
.jqm-content a.jqm-sections-link {
196+
/* Deeplinks */
197+
.jqm-content a.jqm-deeplink {
198198
font-family: 'Open Sans', sans-serif;
199199
font-weight: 300;
200200
display: block;
@@ -206,18 +206,18 @@ body, .jqm-demos {
206206
text-decoration: none;
207207
float:right;
208208
}
209-
.jqm-content p.jqm-intro + a.jqm-sections-link {
209+
.jqm-content p.jqm-intro + a.jqm-deeplink {
210210
text-align: left;
211211
}
212-
.jqm-content a.jqm-sections-link span {
212+
.jqm-content a.jqm-deeplink span {
213213
width: 18px;
214214
display: inline-block;
215215
margin-top: 1px;
216216
margin-left: 10px;
217217
float: right;
218218
opacity: .5;
219219
}
220-
.jqm-content p.jqm-intro + a.jqm-sections-link span {
220+
.jqm-content p.jqm-intro + a.jqm-deeplink span {
221221
float: right;
222222
margin-left: 10px;
223223
}
@@ -226,7 +226,6 @@ body, .jqm-demos {
226226
}
227227

228228

229-
230229
/* Demo view source */
231230
.jqm-content div[data-demo-html="true"] {
232231
border-top: 1px solid rgba(0,0,0,.08);

docs/demos/_assets/js/jqm-demos.js

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
1+
// Turn off AJAX for local file browsing
2+
if ( location.protocol.substr(0,4) === 'file' ||
3+
location.protocol.substr(0,11) === '*-extension' ||
4+
location.protocol.substr(0,6) === 'widget' ) {
5+
6+
// Start with links with only the trailing slash and that aren't external links
7+
var fixLinks = function() {
8+
$( "a[href$='/'], a[href='.'], a[href='..']" ).not( "[rel='external']" ).each( function() {
9+
this.href = $( this ).attr( "href" ).replace( /\/$/, "" ) + "/index.html";
10+
});
11+
};
12+
13+
// Fix the links for the initial page
14+
$( fixLinks );
15+
16+
// Fix the links for subsequent ajax page loads
17+
$( document ).on( 'pagecreate', fixLinks );
18+
19+
// Check to see if ajax can be used. This does a quick ajax request and blocks the page until its done
20+
$.ajax({
21+
url: '.',
22+
async: false,
23+
isLocal: true
24+
}).error(function() {
25+
// Ajax doesn't work so turn it off
26+
$( document ).on( "mobileinit", function() {
27+
$.mobile.ajaxEnabled = false;
28+
29+
var message = $( '<div>' , {
30+
'class': "ui-footer ui-bar-e",
31+
style: "overflow: auto; padding:10px 15px;",
32+
'data-ajax-warning': true
33+
});
34+
35+
message
36+
.append( "<h3>Note: Navigation may not work if viewed locally</h3>" )
37+
.append( "<p>The AJAX-based navigation used throughout the jQuery Mobile docs may need to be viewed on a web server to work in certain browsers. If you see an error message when you click a link, try a different browser or <a href='https://github.com/jquery/jquery-mobile/wiki/Downloadable-Docs-Help'>view help</a>.</p>" );
38+
39+
$( document ).on( "pagecreate", function( event ) {
40+
$( event.target ).append( message );
41+
});
42+
});
43+
});
44+
}
45+
46+
147
// display the version of jQM
2-
$(document).on( "pageinit", function() {
48+
$( document ).on( "pageinit", function() {
349
var version = $.mobile.version || "dev",
450
words = version.split( "-" ),
551
ver = words[0],
@@ -18,48 +64,3 @@ $(document).on( "pageinit", function() {
1864

1965
$( "p.jqm-version" ).html( html );
2066
});
21-
22-
// Turn off AJAX for local file browsing
23-
if ( location.protocol.substr(0,4) === 'file' ||
24-
location.protocol.substr(0,11) === '*-extension' ||
25-
location.protocol.substr(0,6) === 'widget' ) {
26-
27-
// Start with links with only the trailing slash and that aren't external links
28-
var fixLinks = function() {
29-
$( "a[href$='/'], a[href='.'], a[href='..']" ).not( "[rel='external']" ).each( function() {
30-
this.href = $( this ).attr( "href" ).replace( /\/$/, "" ) + "/index.html";
31-
});
32-
};
33-
34-
// Fix the links for the initial page
35-
$(fixLinks);
36-
37-
// Fix the links for subsequent ajax page loads
38-
$(document).on( 'pagecreate', fixLinks );
39-
40-
// Check to see if ajax can be used. This does a quick ajax request and blocks the page until its done
41-
$.ajax({
42-
url: '.',
43-
async: false,
44-
isLocal: true
45-
}).error(function() {
46-
// Ajax doesn't work so turn it off
47-
$( document ).on( "mobileinit", function() {
48-
$.mobile.ajaxEnabled = false;
49-
50-
var message = $( '<div>' , {
51-
'class': "ui-footer ui-bar-e",
52-
style: "overflow: auto; padding:10px 15px;",
53-
'data-ajax-warning': true
54-
});
55-
56-
message
57-
.append( "<h3>Note: Navigation may not work if viewed locally</h3>" )
58-
.append( "<p>The AJAX-based navigation used throughout the jQuery Mobile docs may need to be viewed on a web server to work in certain browsers. If you see an error message when you click a link, try a different browser or <a href='https://github.com/jquery/jquery-mobile/wiki/Downloadable-Docs-Help'>view help</a>.</p>" );
59-
60-
$( document ).on( "pagecreate", function( event ) {
61-
$( event.target ).append( message );
62-
});
63-
});
64-
});
65-
}

0 commit comments

Comments
 (0)