This commit is contained in:
2024-12-20 06:04:35 +03:00
parent 0f779b7ebf
commit d630370039
267 changed files with 34950 additions and 11 deletions
@@ -0,0 +1,6 @@
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?section=$1 [L,QSA]
@@ -0,0 +1 @@
Put this files (index.php, .htaccess) into root folder of HTTP server.
@@ -0,0 +1,95 @@
<!DOCTYPE html><html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/yeikos/jquery.history/jquery.history.js"></script>
<script>
$(function() {
var type;
$.history.on('load change', function(event, url, type) {
if (event.type === 'change' || (event.type === 'load' && type === 'hash'))
request(url);
}).listen();
type = $.history.type();
if (type === 'hash' && location.pathname.length > 1) {
// /pathname -> /#/pathname
location.href = '/#' + location.pathname;
} else if (type === 'pathname' && location.hash.substr(1, 1) === '/') {
// /#/pathname -> /pathname
location.href = location.hash.substr(1);
}
// dom listener
$('body').on('click', 'a', function(event) {
var url = $(this).attr('href');
$.history.push(url);
request(url);
event.preventDefault();
});
// request
function request(url) {
$('#output').text(url);
}
});
</script>
</head>
<body>
<div>time: <?php echo time(); ?></div>
<ul>
<li><a href="/one">one</a></li>
<li><a href="/two">two</a></li>
<li><a href="/three">three</a></li>
<li><a href="/four">four</a></li>
</ul>
<div id="output">
<?php
echo isset($_GET['section']) ? htmlspecialchars('/' . $_GET['section']) : '';
?>
</div>
</body>
</html>