Add favicon, restructure JS
parent
463c2680da
commit
8d7ea49b6d
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel=icon href="/favicon.png">
|
||||
<title>WebButt | About</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 425 B |
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel=icon href="/favicon.png">
|
||||
<title>WebButt</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -16,19 +17,7 @@
|
|||
</nav>
|
||||
|
||||
<h1>WebButt</h1>
|
||||
<p>A small test SSB application written in Rust and Javascript</p>
|
||||
|
||||
<div id="profile">
|
||||
<h2 id="username"></h2>
|
||||
<p id="description"></p>
|
||||
<code id="pubkey"></code>
|
||||
</div>
|
||||
|
||||
<script src="zepto.js"></script>
|
||||
<script>
|
||||
import { whoami } from '/ssb.js';
|
||||
whoami();
|
||||
</script>
|
||||
<noscript>
|
||||
<p>Sorry, but this app requires JS to function :/</p>
|
||||
</noscript>
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<link rel=icon href="/favicon.png">
|
||||
<title>WebButt | Profile</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -40,6 +41,44 @@
|
|||
<script src="zepto.js"></script>
|
||||
<script type="text/javascript" src="//simonwaldherr.github.io/micromarkdown.js/dist/micromarkdown.min.js"></script>
|
||||
<script src="ssb.js"></script>
|
||||
<script>
|
||||
whoami()
|
||||
window.addEventListener( "load", function () {
|
||||
function sendData() {
|
||||
const XHR = new XMLHttpRequest();
|
||||
|
||||
// Bind the FormData object and the form element
|
||||
const FD = new FormData( form );
|
||||
|
||||
// Define what happens on successful data submission
|
||||
XHR.addEventListener( "load", function(event) {
|
||||
alert( event.target.responseText );
|
||||
} );
|
||||
|
||||
// Define what happens in case of error
|
||||
XHR.addEventListener( "error", function( event ) {
|
||||
alert( 'Oops! Something went wrong.' );
|
||||
} );
|
||||
|
||||
// Set up our request
|
||||
XHR.open( "POST", "/api/update" );
|
||||
|
||||
// The data sent is what the user provided in the form
|
||||
XHR.send( FD );
|
||||
}
|
||||
|
||||
// Access the form element...
|
||||
const form = document.getElementById( "profileForm" );
|
||||
|
||||
// ...and take over its submit event.
|
||||
form.addEventListener( "submit", function ( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
sendData();
|
||||
whoami();
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
<noscript>
|
||||
<p>Sorry, but this app requires JS to function :/</p>
|
||||
</noscript>
|
||||
|
|
|
@ -8,42 +8,13 @@ function whoami() {
|
|||
})
|
||||
}
|
||||
|
||||
whoami()
|
||||
|
||||
window.addEventListener( "load", function () {
|
||||
function sendData() {
|
||||
const XHR = new XMLHttpRequest();
|
||||
|
||||
// Bind the FormData object and the form element
|
||||
const FD = new FormData( form );
|
||||
|
||||
// Define what happens on successful data submission
|
||||
XHR.addEventListener( "load", function(event) {
|
||||
alert( event.target.responseText );
|
||||
} );
|
||||
|
||||
// Define what happens in case of error
|
||||
XHR.addEventListener( "error", function( event ) {
|
||||
alert( 'Oops! Something went wrong.' );
|
||||
} );
|
||||
|
||||
// Set up our request
|
||||
XHR.open( "POST", "/api/update" );
|
||||
|
||||
// The data sent is what the user provided in the form
|
||||
XHR.send( FD );
|
||||
}
|
||||
|
||||
// Access the form element...
|
||||
const form = document.getElementById( "profileForm" );
|
||||
|
||||
// ...and take over its submit event.
|
||||
form.addEventListener( "submit", function ( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
sendData();
|
||||
whoami();
|
||||
} );
|
||||
} );
|
||||
|
||||
function feed() {
|
||||
$.get("/api/posts", function(response){
|
||||
response.posts.forEach(createPost)
|
||||
})
|
||||
}
|
||||
|
||||
function createPost(value, index, array) {
|
||||
console.log(value)
|
||||
$("#messages").append('<h3>'+value.author+'</h3><p><i>'+value.timestamp+'</p></i>')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue