-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathengine.js
More file actions
90 lines (80 loc) · 2.7 KB
/
Copy pathengine.js
File metadata and controls
90 lines (80 loc) · 2.7 KB
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
/*
contentDeliveryEngine.js Copyright (C) 2017 Anıl Yarkın Yücel - GNU General Public License v3.0
http://sheptang.com/software/contentDeliveryEngine/
*/
// SETUP BEGINS
//id of the container div to load pages in
var javaScriptContainer="#jContainer";
//id of the homepage link div
var homelink="#homelink";
//name of the default index file (generally "index.php" or "index.html", under folder pages; e.g.: page1, page2)
var defaultIndex="index.php";
//name of the homepage file
var homepageFile="main.php";
// SETUP ENDS
$(document).ready(function(){
jQuery.fx.off=true;
if(window.location.hash){
var hashURL=window.location.hash;
var pathnameURL=window.location.pathname;
var paramSplit=hashURL.split("?");
var hash=paramSplit[0];
var params="?"+paramSplit[1];
var croppedHash=hash.substring(1);
var newURL=pathnameURL+croppedHash;
jQuery.fx.off=false;
if(paramSplit[1]=="" || paramSplit[1]==null){
$(javaScriptContainer).hide("fade",100,function(){
$(javaScriptContainer).empty().load(newURL+"/"+defaultIndex,function(){
$.getScript("func.js");
});
$(javaScriptContainer).show("fade",150);
});
history.pushState("","New URL: "+newURL, newURL);
}else{
$(javaScriptContainer).hide("fade",100,function(){
$(javaScriptContainer).empty().load(newURL+"/"+defaultIndex+params,function(){
$.getScript("func.js");
});
$(javaScriptContainer).show("fade",150);
});
history.pushState("","New URL: "+newURL+params, newURL+params);
}
}else if(!window.location.hash && window.location.pathname=="/"){
jQuery.fx.off=false;
$(javaScriptContainer).hide("fade",100,function(){
$(javaScriptContainer).empty().load(homepageFile,function(){
$.getScript("func.js");
});
$(javaScriptContainer).show("fade",150);
});
}
$("#navContainer .nav").click(function(){
jQuery.fx.off=false;
$(window.opera ? 'html' : 'html, body').animate({
scrollTop: 0
},500);
href=$(this).attr("href");
$(javaScriptContainer).hide("fade",100,function(){
$(javaScriptContainer).empty().load(href,function(){
$.getScript("func.js");
});
$(javaScriptContainer).show("fade",150);
});
history.pushState("","New URL: "+href,href);
});
$(homelink).click(function(){
jQuery.fx.off=false;
$(window.opera ? 'html' : 'html, body').animate({
scrollTop: 0
},500);
$(javaScriptContainer).hide("fade",100,function(){
$(javaScriptContainer).empty().load("/"+homepageFile,function(){
$.getScript("func.js");
});
$(javaScriptContainer).show("fade",150);
});
history.pushState("","New URL: "+"/","/");
});
});
// REST OF THE JAVASCRIPT CAN BE WRITTEN UNDER func.js