add homepage

This commit is contained in:
Drew Harwell 2017-04-29 21:54:46 -05:00
parent a420d94229
commit 126c3a602f
4 changed files with 37 additions and 3 deletions

View File

@ -132,5 +132,5 @@ function isoDateToEnglish(d){
var months = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];
return months[Number(dt[1])] +' '+dt[2]+ ', '+dt[0];
return months[Number(dt[1])-1] +' '+dt[2]+ ', '+dt[0];
}

View File

@ -6,5 +6,9 @@
"pug": "^2.0.0-beta.12",
"request": "^2.81.0",
"serve-static": "^1.12.2"
},
"main":"index.js",
"scripts":{
"start":"node index.js"
}
}

View File

@ -3,6 +3,7 @@ body {
background-color: #22272a;
font-family: Roboto, sans-serif;
color: #eee;
overflow-x:hidden;
}
* {
margin: 0;

View File

@ -1,5 +1,34 @@
<html><head></head><body>
Example:
<h4>Example:</h4>
<label>Instance URL:<input type="text" id="urlin" placeholder="octodon.social"></input></label><br>
<label>Username:<input type="text" id="usernamein" placeholder="fenwick67"></input></label><br>
<label>Width(px):<input type="text" id="width" value="400"></input></label><br>
<label>Height(px):<input type="text" id="height" value="800"></input></label><br>
<iframe sandbox src="/api/feed?url=https%3A%2F%2Foctodon.social%2Fusers%2Ffenwick67.atom"></iframe>
<button onclick="genUrl()" value="generate">Generate</button>
<br>
<br>
<label>Use this markup in your HTML: <input id="result" placeholder="result will go here"></input>
<br>
<h4>Preview</h4>
<iframe width="400" height="800" id="frame" sandbox src=""></iframe>
<script>
function genUrl(){
//https://octodon.social/users/fenwick67.atom
function val(id){
return document.getElementById(id).value;
}
var inUrl = 'http://' + val('urlin') + '/users/'+val('usernamein')+'.atom';
var iframeUrl = 'http://'+ window.location.hostname +((window.location.port && window.location.port!=80)?(':'+window.location.port):'') +"/api/feed?url="+encodeURIComponent(inUrl);
document.getElementById('result').value = '<iframe sandbox width="'+val('width')+'" height="'+val('height')+'" src="'+iframeUrl+'"></iframe>';
var iframe = document.getElementById('frame');
iframe.src = iframeUrl;
iframe.width = val('width');
iframe.height = val('height');
}
</script>
</body></html>