This repository has been archived on 2023-05-27. You can view files and clone it, but cannot push or open issues or pull requests.
fedifeed/static/index.html
2017-04-30 15:46:35 -05:00

50 lines
1.9 KiB
HTML

<html><head>
<title>Mastofeed - embeddable Mastodon feeds</title>
</head>
<body>
<h1>Mastofeed</h1>
<h4>Embedded Mastodon feeds for blogs etc.</h4>
<a href="https://github.com/fenwick67/mastofeed">Fork on Github</a><br>
<br><hr><br>
<form action="javascript:genUrl()">
<label>Instance URL:<input required type="text" id="urlin" placeholder="octodon.social"></label><br>
<label>Username:<input required type="text" id="usernamein" placeholder="fenwick67"></label><br>
<label>Width(px):<input required type="number" id="width" value="400"></label><br>
<label>Height(px):<input required type="number" id="height" value="800"></label><br>
<label>UI scale (percent):<input required type="number" id="size" value="100"></label><br>
<label>theme:
<select id="theme">
<option value="dark">dark</option>
<option value="light">light</option>
</select>
</label><br>
<button value="generate">Generate</button>
</form>
<br>
<br>
<label>Use this markup in your HTML: <br><textarea id="result" placeholder="result will go here"></textarea></label>
<br>
<h4>Live Preview:</h4>
<iframe width="0" height="0" id="frame" sandbox="allow-top-navigation" src=""></iframe>
<script>
window.genUrl = function genUrl(){
function val(id){
return document.getElementById(id).value;
}
var inUrl = 'https://' + val('urlin') + '/users/'+val('usernamein')+'.atom';
var iframeUrl = window.location.protocol + '//'+ window.location.hostname +((window.location.port && window.location.port!=80)?(':'+window.location.port):'') +"/api/feed?url="+encodeURIComponent(inUrl)+"&theme="+val('theme')+'&size='+val('size');
document.getElementById('result').value = '<iframe sandbox="allow-top-navigation" 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>