More work on polls and themes
This commit is contained in:
parent
f59049c3c2
commit
2c7a8e1da4
21
css/post.txt
Normal file
21
css/post.txt
Normal file
@ -0,0 +1,21 @@
|
||||
<div class='element'>
|
||||
<div class='avatar' style='background-image:url(:avatar:) :style:'></div>
|
||||
<div class='post' id=':id:' pid=':pid:'>
|
||||
<div id='a:id:' class='ancestors'>:ancestors:</div>
|
||||
<div class='postHeader'>
|
||||
<span style='margin:5px; display:block; float:left; line-height:30px;'><img src=':avatar:' width=30 class='mobile' style='vertical-align:middle; border-radius:30px'> :name: :rt: </span>
|
||||
<span style="margin-top:12px; margin-right:10px; float:right; display:block;">
|
||||
<span class='postMenu fontello'><div style='display:none; z-index:99; width:130px; position: absolute; top: 15px; right: -1px;' class='menu'>:menu:</div></span>
|
||||
</span>
|
||||
</div>
|
||||
:spoiler:
|
||||
<div class='media' style='text-align:center;'>:media:</div>
|
||||
<div class='postbody'><div class='content' style='margin-bottom:5px;'>
|
||||
:replyto: :text:
|
||||
</div></div>
|
||||
<div class='post_footer'>:footer:</DIV>
|
||||
<div class='post_notes'>:notes:</DIV>
|
||||
<div id=':id:' class='replies_container'><noscript>:form:</noscript>:descendants:</div>
|
||||
</div>
|
||||
<script type='application/json' id='data-:id:'>:json:</script>
|
||||
</div>
|
@ -284,7 +284,7 @@ function render_reply($item) {
|
||||
$unlisted = "";
|
||||
$direct = "";
|
||||
|
||||
$reply['date'] = "<a class='ldr' style='text-decoration:none;' target='_blank' href='?thread=" . $item['id'] . "&instance=$srv" . "'>" . time_elapsed_string($item['created_at']) . "</a> - <span class='fontello'>" . $$item['visibility'] . "</span>";
|
||||
$reply['date'] = "<a class='ldr postAge' id='".strtotime($item['created_at'])."' style='text-decoration:none;' target='_blank' href='?thread=" . $item['id'] . "&instance=$srv" . "'>" . time_elapsed_string($item['created_at']) . "</a> - <span class='fontello'>" . $$item['visibility'] . "</span>";
|
||||
|
||||
$reply['media'] = "";
|
||||
if (!empty($item['media_attachments'])) {
|
||||
|
@ -424,6 +424,11 @@ function newPosts() {
|
||||
};
|
||||
|
||||
window.setInterval(function() {
|
||||
var timestamp;
|
||||
$('.postAge').each(function(a){
|
||||
timestamp = $(this).attr('id');
|
||||
$(this).html(timeSince(timestamp)+' ago');
|
||||
});
|
||||
newPosts();
|
||||
}, 25000);
|
||||
|
||||
@ -477,3 +482,37 @@ function themecheck(name){
|
||||
$('#customtheme').css("display","none");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function timeSince(date) {
|
||||
/* https://stackoverflow.com/questions/3177836/how-to-format-time-since-xxx-e-g-4-minutes-ago-similar-to-stack-exchange-site */
|
||||
|
||||
var seconds = Math.floor((new Date() - (date*1000)) / 1000);
|
||||
|
||||
var interval = Math.floor(seconds / 31536000);
|
||||
|
||||
if (interval >= 1) {
|
||||
return interval + " years";
|
||||
}
|
||||
interval = Math.floor(seconds / 2592000);
|
||||
if (interval >= 1) {
|
||||
return interval + " months";
|
||||
}
|
||||
interval = Math.floor(seconds / 604800);
|
||||
if (interval >= 1) {
|
||||
return interval + " weeks";
|
||||
}
|
||||
interval = Math.floor(seconds / 86400);
|
||||
if (interval >= 1) {
|
||||
return interval + " days";
|
||||
}
|
||||
interval = Math.floor(seconds / 3600);
|
||||
if (interval >= 1) {
|
||||
return interval + " hours";
|
||||
}
|
||||
interval = Math.floor(seconds / 60);
|
||||
if (interval >= 1) {
|
||||
return interval + " minutes";
|
||||
}
|
||||
return Math.floor(seconds) + " seconds";
|
||||
}
|
@ -292,7 +292,7 @@ if ((!isset($thread[0]['id']) && !empty($thread)) || !is_array($thread)) {
|
||||
|
||||
/* the code of the post footer (date, visibility and like/reblog buttons */
|
||||
$post['footer'] = "<div style='float:left;'>
|
||||
<a style='text-decoration:none;' class='ldr' target='_blank' href='?thread=" . $elem['id'] . "&instance=$srv" . "' title='".gmdate("d/m/y H:i", strtotime($elem['created_at']))."'>" .time_elapsed_string($elem['created_at']) . "</a> - <span class='fontello'>" . $$elem['visibility'] . " </span>
|
||||
<a style='text-decoration:none;' class='ldr postAge' id='".strtotime($elem['created_at'])."' target='_blank' href='?thread=" . $elem['id'] . "&instance=$srv" . "' title='".gmdate("d/m/y H:i", strtotime($elem['created_at']))."'>" .time_elapsed_string($elem['created_at']) . "</a> - <span class='fontello'>" . $$elem['visibility'] . " </span>
|
||||
</div>
|
||||
<div class='post_buttons' id='" . $elem['id'] . "'>
|
||||
" . ($logedin ? "<div class='felem'><a onClick='return false' class='replyform' href='?thread=" . $elem['id'] . "' style='font-family:fontello; vertical-align:middle;' alt='reply'></a></div>" : "") . "
|
||||
|
Loading…
Reference in New Issue
Block a user