-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of local working copy
- Loading branch information
Showing
5 changed files
with
165 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# dqpt | ||
Deque Page Transitions | ||
# dqpt.js | ||
Deque Page Transitions, a plugin to force smooth page transitions through XHR requests. Based on jQuery. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>Bar</title> | ||
</head> | ||
<body> | ||
<nav> | ||
<ul> | ||
<li><a href="index.html" class="dqPT">Home</a></li> | ||
<li><a href="foo.html" class="dqPT">Page Foo</a></li> | ||
<li><a href="bar.html" class="dqPT">Page Bar</a></li> | ||
</ul> | ||
</nav> | ||
<main class=""> | ||
<div id="dqptContainer" > | ||
<h1>Bar</h1> | ||
<h2>This is page Bar showing</h2> | ||
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. </p> | ||
</div> | ||
</main> | ||
|
||
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> | ||
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.12.0.min.js"><\/script>')</script> | ||
|
||
<script src="dqpt.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
$(document).ready(function() { | ||
|
||
var dqptLink; | ||
var dqptXhrRequest; | ||
var dqptContainer; | ||
|
||
var dqptTransitionSpeed = 200; | ||
|
||
var urlToLoad; | ||
var current = document.location; | ||
var currentURL = current.href; | ||
var title = document.title; | ||
|
||
dqptContainer = $('#dqptContainer'); | ||
|
||
function dqptresetScrollPosition() { | ||
window.scrollTo(0,0); | ||
} | ||
|
||
function dqpterror(e, jqxhr) {} | ||
|
||
function dqptInitLinks() { | ||
dqptLink = $('.dqPT'); | ||
dqptLink.off('click'); | ||
dqptLink.on('click', function(event) { | ||
event.preventDefault(); | ||
urlToLoad = this.href; | ||
if (current.href == this.href) { | ||
return; | ||
} else { | ||
history.pushState(urlToLoad, title, urlToLoad); | ||
dqptContainer.fadeOut(dqptTransitionSpeed, function(){ | ||
dqptXhrRequest(urlToLoad); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
function dqptBeforeSend() {} | ||
|
||
function dqptSuccess() {} | ||
|
||
function dqptProcessData(data) { | ||
var content = $('#dqptContainer', data); | ||
$('#dqptContainer').html(content); | ||
var newTitle = $(data).filter('title').text(); | ||
document.title = newTitle; | ||
dqptInitLinks(); | ||
dqptresetScrollPosition(); | ||
dqptContainer.fadeIn(); | ||
} | ||
|
||
var dqptXhrRequest = function(urlToLoad) { | ||
$.ajax({ | ||
type: "GET", | ||
cache: false, | ||
url: urlToLoad, | ||
dataType: "html", | ||
contentType: "text/html", | ||
beforeSend: dqptBeforeSend, | ||
success: dqptProcessData, | ||
error: dqpterror | ||
}); | ||
}; | ||
|
||
window.onpopstate = function(event) { | ||
urlToLoad = event.state; | ||
dqptXhrRequest(urlToLoad); | ||
} | ||
|
||
dqptInitLinks(); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>Foo</title> | ||
</head> | ||
<body> | ||
<nav> | ||
<ul> | ||
<li><a href="index.html" class="dqPT">Home</a></li> | ||
<li><a href="foo.html" class="dqPT">Page Foo</a></li> | ||
<li><a href="bar.html" class="dqPT">Page Bar</a></li> | ||
</ul> | ||
</nav> | ||
<main> | ||
<div id="dqptContainer" > | ||
<h1>Foo</h1> | ||
<h2>This is page Foo showing</h2> | ||
<p>One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me?" he thought. It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls. A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer. Gregor then turned to look out the window at the dull weather. Drops of rain could be heard hitting the pane, which made him feel quite sad. "How about if I sleep a little bit longer and forget all this nonsense", he thought, but that was something he was unable to do because he was used to sleeping on his right, and in his present state couldn't get into that position. However hard he threw himself onto his right, he always rolled back to where he was. He must have tried it a hundred times, shut his eyes so that he wouldn't have to look at the floundering legs, and only stopped when he began to feel a mild, dull pain there that he had never felt before. "Oh, God", he thought, "what a strenuous career it is that I've chosen! Travelling day in and day out. Doing business like this takes much more effort than doing your own business at home, and on top of that there's the curse of travelling, worries about making train connections, bad and irregular food, contact with different people all the time so that you can never get to know anyone or become friendly with them. It can all go to Hell!"</p> | ||
</div> | ||
</main> | ||
|
||
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> | ||
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.12.0.min.js"><\/script>')</script> | ||
|
||
<script src="dqpt.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="x-ua-compatible" content="ie=edge"> | ||
<title>Hompage</title> | ||
</head> | ||
<body> | ||
<nav> | ||
<ul> | ||
<li><a href="index.html" class="dqPT">Home</a></li> | ||
<li><a href="foo.html" class="dqPT">Page Foo</a></li> | ||
<li><a href="bar.html" class="dqPT">Page Bar</a></li> | ||
</ul> | ||
</nav> | ||
<main> | ||
<div id="dqptContainer" > | ||
<h1>Home</h1> | ||
<h2>Home sweet home</h2> | ||
<p>This is the Homepage, now navigate some!</p> | ||
</div> | ||
</main> | ||
|
||
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> | ||
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.12.0.min.js"><\/script>')</script> | ||
|
||
<script src="dqpt.js"></script> | ||
|
||
</body> | ||
</html> |