1
0
Fork 0
mirror of https://github.com/SunRed/haste-server.git synced 2025-09-06 05:20:14 +02:00

Huge refactor, switched to express

This commit is contained in:
zneix 2020-08-26 04:54:58 +02:00
parent 06315a91a8
commit c585e3b815
22 changed files with 813 additions and 406 deletions

View file

@ -14,23 +14,23 @@
<meta name="robots" content="noindex,nofollow"/>
<script type="text/javascript">
var app = null;
let app = null;
// Handle pops
var handlePop = function(evt) {
var path = evt.target.location.pathname;
if (path === '/') { app.newDocument(true); }
let handlePop = function(evt){
let path = evt.target.location.pathname;
if (path == '/') { app.newDocument(true); }
else { app.loadDocument(path.substring(1, path.length)); }
};
// Set up the pop state to handle loads, skipping the first load
// to make chrome behave like others:
// http://code.google.com/p/chromium/issues/detail?id=63040
setTimeout(function() {
window.onpopstate = function(evt) {
setTimeout(function(){
window.onpopstate = function(evt){
try { handlePop(evt); } catch(err) { /* not loaded yet */ }
};
}, 1000);
// Construct app and load initial path
$(function() {
$(function(){
app = new haste('hastebin', { twitter: true });
handlePop({ target: window });
});