-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.jssm.config.js
80 lines (62 loc) · 1.99 KB
/
jquery.jssm.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
jssm.settings.blankurl = '../blank.html';
jssm.settings.basetitle = 'JSSM Test';
jssm.settings.titleseparator = ' : ';
jssm.functions.pageload = function (hash) {
if (hash) {
jssm.functions.load(hash);
} else {
$('.wrapper').fadeIn(500);
}
}
jssm.functions.beforeload = function (hash) {
}
jssm.functions.load = function (hash) {
$.get('/'+jssm.getCurrentPath()+hash, function(response) {
/* Process the response, light edition. */
/* Set page title based upon the response. */
var regextitle = new RegExp('<title>([^<]*)<\/title>');
var matches = regextitle.exec(response);
jssm.setTitle(jssm.buildTitle(matches[1]));
/* Make sure the browser history list shows the correct title. */
window.location.replace(window.location);
/* Get the new content. */
var inside = response.substring(response.indexOf('<body>') + 6, response.indexOf('</body>'));
/* Fade in time. */
$('.wrapper').queue(function () {
$(this).html($(inside).filter('div.wrapper').html());
$('a', this).jssm('click');
$('form', this).jssm('submit');
$(this).fadeIn(500);
$(this).dequeue();
});
//
// /* Add CSS to the page based upon the response. */
// $('link', response).each(function(i) {
// var css = document.createElement("link");
// css.setAttribute('rel', 'stylesheet');
// css.setAttribute('type', 'text/css');
// css.setAttribute('href', $(this).attr('href'));
// document.getElementsByTagName('head')[0].appendChild(css);
// });
//
// /* Add page content based upon the response. */
// $('#wrapper').html($('body', response).text()).fadeIn(500);
//
// /* Add scripts to the page based upon the response. */
// $('script', response).each(function(i) {
// $.globalEval($(this).text());
// });
});
}
jssm.functions.afterload = function (hash) {
}
jssm.functions.beforeunload = function (hash) {
}
jssm.functions.unload = function (hash) {
$('.wrapper').queue(function () {
$(this).fadeOut(500);
$(this).dequeue();
});
}
jssm.functions.afterunload = function (hash) {
}