forked from coollog/yale17
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.js
119 lines (113 loc) · 3.06 KB
/
page.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
var pageid = { // CaSe-SeNsItIvE!
0: "home",
1: "forum",
2: "meet",
3: "classDB",
4: "calendar",
5: "resources",
6: "wall",
7: "confessions"
};
$('#panels').ready(function() { // Automatically generate code for panels
var html = '';
for (var i in pageid) {
if (i > 0){
html += '<div class="panel" id="p' + i + '"><div class="insidepanel"></div></div>';
}
}
$('#panels').html(html);
});
$('.dockcontainer').ready(function() { // Automatically generate code for dock items
var html = '', pname;
for (var i in pageid) {
pname = pageid[i];
html += '<a class="dockitem" id="d' + i + '"><span>' + pname.charAt(0).toUpperCase() + pname.slice(1) + '</span><img src="gfx/dock/' + pname + '.png" /></a>';
}
$('.dockcontainer').html(html);
});
var curpage = 0;
function extractInt(str) {
return str.match(/\d+/)[0];
}
$(document).ready(function() {
// Initialize
$('#screen').hide();
$('.panel').hide();
$("#loading").loading("loadStop");
// Handle panel animations and loading
$('.dockitem').click( function() {
var id = extractInt($(this).attr('id'));
if (curpage > 0) {
$('#p' + curpage).animate({top: $(window).height()}, 1000, function() {
$(this).hide(); $(this).children().html('');
});
var pid = $('#p' + curpage);
pid.children().html('');
//pid.hide("slide", { direction: "down" }, 1000);
if (id == 0 || curpage == id) {
$('#screen').fadeOut(800);
$(this).css("opacity", "1");
$('a.dockitem').animate({color: "#ffffff"}, 1000);
}
}
var newpage = 0;
if (id > 0 && curpage != id) {
var pid = $('#p' + id);
pid.css('top', $(window).height());
if (curpage > 0) {
pid.delay(1000);
} else {
pid.delay(50);
$('a.dockitem').animate({color: "#000000"}, 1000);
$('#screen').fadeIn(800);
}
pid.children().html('<h2>Loading...</h2>');
/*pid.show("slide", { direction: "down" }, 1000);
$.get("p" + pageid[id] + ".php", function(data){
pid.children().html(data);
});*/
pid.show().animate({top: '0px'}, 1000, function() {
$.get("p" + pageid[id] + ".php", function(data){
pid.children().html(data);
});
});
newpage = id;
}
curpage = newpage;
} );
$('#screen').click( function() {$('#d0').click()});
// Browser check
$('#browser').ready( function() {
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
var isFirefox = typeof InstallTrigger !== 'undefined';
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
var isChrome = !!window.chrome && !isOpera;
var isIE = document.documentMode;
if (isIE || isOpera) {
$('#browser').show();
}
} );
$('#browser').click( function() {
$(this).fadeOut(800);
} );
// Dock
$('#dock').Fisheye( {
maxWidth: 90,
items: 'a',
itemsText: 'span',
container: '.dockcontainer',
itemWidth: 60,
proximity: 40,
alignment : 'left',
valign: 'bottom',
halign : 'center'
} )
$('.dockcontainer').hover( function() {
$(this).css("opacity", "1");
}, function() {
if (curpage > 0) {
$(this).css("opacity", "0.2");
}
}
);
} );