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 13:38:56 -05:00

37 lines
1.4 KiB
HTML

<html><head>
<title>Mastofeed - embeddable Mastodon feeds</title>
</head>
<body>
<h4>Example:</h4>
<label>Instance URL:<input type="text" id="urlin" placeholder="octodon.social"></label><br>
<label>Username:<input type="text" id="usernamein" placeholder="fenwick67"></label><br>
<label>Width(px):<input type="text" id="width" value="400"></label><br>
<label>Height(px):<input type="text" id="height" value="800"></label><br>
<button onclick="genUrl()" value="generate">Generate</button>
<br>
<br>
<label>Use this markup in your HTML: <input id="result" placeholder="result will go here">
<br>
<h4>Preview</h4>
<iframe width="0" height="0" id="frame" sandbox="allow-top-navigation" src=""></iframe>
<script>
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);
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>