You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.8 KiB
81 lines
2.8 KiB
{% extends "base.html" %} |
|
{% block script %} |
|
<script> |
|
function run() { |
|
/* |
|
var encurl = JSON.parse(); |
|
journalmarks_decrypturl(encurl).then(function (url) { |
|
document.getElementById('url').href = url.url; |
|
document.getElementById('url').innerText = url.url; |
|
document.getElementById('url').click(); |
|
}); |
|
*/ |
|
journalmarks_loadkey().then(function() { |
|
return post_object('{{ url_for('journalmarks.overview_get_journalmarks') }}', {}); |
|
}).then(function(jms) { |
|
var decrs = []; |
|
jms.forEach(function(j) { |
|
var p = document.getElementById('prototype'); |
|
var n = p.cloneNode(true); |
|
n.id = 'journalmark_' + j.tag; |
|
var created = new Date(j.created); |
|
console.log(created); |
|
n.getElementsByClassName('date')[0].innerText = created.getDate().toString() + '.' + (created.getMonth()+1).toString() + '.' + created.getFullYear().toString(); |
|
n.getElementsByClassName('tag')[0].innerText = j.tag; |
|
n.getElementsByClassName('tag')[0].href = '/' + j.tag; |
|
n.getElementsByClassName('url')[0].innerText = 'decrypting...'; |
|
document.getElementById('journalmarks').appendChild(n); |
|
decrs.push(journalmarks_decrypturl(j.content).then(function(url) { |
|
n.getElementsByClassName('url')[0].href = url.url; |
|
n.getElementsByClassName('url')[0].innerText = url.url; |
|
if(url.hasOwnProperty('comment')) |
|
n.getElementsByClassName('comment')[0].innerText = url.comment; |
|
}).catch(function(error) { |
|
console.log(error); |
|
n.getElementsByClassName('url')[0].innerText = 'unable to decrypt url'; |
|
})); |
|
}); |
|
return Promise.all(decrs); |
|
}).catch(function(error) { |
|
console.log(error); |
|
//deleteKey(); |
|
//window.location.href = '{{ url_for('journalmarks.login') }}'; |
|
}); |
|
} |
|
|
|
if (document.readyState!='loading') run(); |
|
else if (document.addEventListener) document.addEventListener('DOMContentLoaded', run); |
|
else document.attachEvent('onreadystatechange', function(){ |
|
if (document.readyState=='complete') run(); |
|
}); |
|
</script> |
|
<style> |
|
#prototype { |
|
display: none; |
|
} |
|
#journalmarks p { |
|
margin: 1em; |
|
padding: 1em; |
|
border: 1px solid grey; |
|
} |
|
#back-to-welcome { |
|
text-align: center; |
|
} |
|
</style> |
|
{% endblock %} |
|
{% block body %} |
|
<h1>Journalmarks Overview</h1> |
|
|
|
<p id="back-to-welcome"> |
|
<a href="{{ url_for('journalmarks.index') }}">Back to welcome page</a> |
|
</p> |
|
|
|
<div id="journalmarks"> |
|
<p id="prototype"> |
|
Tag: <a class="tag" href=""></a><br> |
|
URL: <a class="url" rel="noreferrer" href=""></a><br> |
|
Comment: <span class="comment"></span><br> |
|
Created: <span class="date"></span> |
|
</p> |
|
</div> |
|
{% endblock %}
|
|
|