2023-06-01 15:14:17 -04:00
|
|
|
<?php
|
|
|
|
// This is cancer. I'm sorry.
|
|
|
|
function outputPasteCard($paste) {
|
|
|
|
echo '<div class="column is-half">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-content">
|
|
|
|
<div class="media">
|
|
|
|
<div class="media-content" style="overflow: hidden">
|
|
|
|
<p class="title is-5">
|
|
|
|
<a href="' . urlForPaste($paste) . '">' . pp_html_escape($paste->title) . '</a>
|
|
|
|
</p>
|
|
|
|
<p class="subtitle is-6">
|
|
|
|
<a href="' . urlForMember($paste->user) . '">' . pp_html_escape($paste->user->username) . '</a>
|
|
|
|
<br>
|
|
|
|
<time datetime="' . $paste->created_at . '">' . friendlyDateDifference(date_create(), date_create($paste->created_at)) . '</time>
|
|
|
|
</p>' .
|
|
|
|
($paste->tags->isNotEmpty() ? tagsToHtml($paste->tags) : '<span class="tag is-warning">no tags</span>') . '
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div></div>';
|
|
|
|
}
|
|
|
|
?>
|
2021-07-10 19:18:17 +01:00
|
|
|
<main class="bd-main">
|
2021-07-12 09:03:02 -04:00
|
|
|
<!-- START CONTAINER -->
|
|
|
|
<div class="bd-side-background"></div>
|
|
|
|
<div class="bd-main-container container">
|
|
|
|
<div class="bd-duo">
|
|
|
|
<div class="bd-lead">
|
|
|
|
<!-- Start Row -->
|
|
|
|
<div class="row">
|
|
|
|
<section class="section">
|
|
|
|
<div class="tabs">
|
|
|
|
<ul class="tabs-menu">
|
|
|
|
<li class="is-active" data-target="first-tab"><a>Popular</a></li>
|
2023-06-01 15:14:17 -04:00
|
|
|
<li data-target="second-tab"><a>Month's Pop</a></li>
|
2021-07-12 09:03:02 -04:00
|
|
|
<li data-target="third-tab"><a>New</a></li>
|
|
|
|
<li data-target="forth-tab"><a>Updated</a></li>
|
|
|
|
<li data-target="fifth-tab"><a>Random</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<!-- Start Panel -->
|
2021-07-11 20:34:11 +01:00
|
|
|
|
2021-07-12 09:03:02 -04:00
|
|
|
<!-- Pop Pastes -->
|
|
|
|
<div class="tab-content" id="first-tab">
|
|
|
|
<div class="panel panel-default">
|
2021-08-26 05:35:21 -04:00
|
|
|
<h1 class="title is-4">Popular Pastes</h1>
|
2021-07-13 13:32:28 -04:00
|
|
|
<div class="columns is-multiline">
|
|
|
|
<?php foreach ($popular_pastes as $paste): ?>
|
2023-06-01 15:14:17 -04:00
|
|
|
<?php outputPasteCard($paste); ?>
|
2021-07-13 13:32:28 -04:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- mPop Pastes -->
|
|
|
|
<div class="tab-content" id="second-tab">
|
|
|
|
<div class="panel panel-default">
|
2021-08-26 05:35:21 -04:00
|
|
|
<h1 class="title is-4">This month's popular pastes</h1>
|
2021-07-13 13:32:28 -04:00
|
|
|
<div class="columns is-multiline">
|
|
|
|
<?php foreach ($monthly_popular_pastes as $paste): ?>
|
2023-06-01 15:14:17 -04:00
|
|
|
<?php outputPasteCard($paste); ?>
|
2021-07-13 13:32:28 -04:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- New Pastes -->
|
|
|
|
<div class="tab-content" id="third-tab">
|
|
|
|
<div class="panel panel-default">
|
2021-08-26 05:35:21 -04:00
|
|
|
<h1 class="title is-4">New Pastes</h1>
|
2021-07-13 13:32:28 -04:00
|
|
|
<div class="columns is-multiline">
|
|
|
|
<?php foreach ($recent_pastes as $paste): ?>
|
2023-06-01 15:14:17 -04:00
|
|
|
<?php outputPasteCard($paste); ?>
|
2021-07-13 13:32:28 -04:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Updated Pastes -->
|
|
|
|
<div class="tab-content" id="forth-tab">
|
|
|
|
<div class="panel panel-default">
|
2021-08-26 05:35:21 -04:00
|
|
|
<h1 class="title is-4">Recently Updated Pastes</h1>
|
2021-07-13 13:32:28 -04:00
|
|
|
<div class="columns is-multiline">
|
|
|
|
<?php foreach ($updated_pastes as $paste): ?>
|
2023-06-01 15:14:17 -04:00
|
|
|
<?php outputPasteCard($paste); ?>
|
2021-07-13 13:32:28 -04:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-13 13:32:28 -04:00
|
|
|
|
|
|
|
<!-- Random Pastes -->
|
2021-07-12 09:03:02 -04:00
|
|
|
<div class="tab-content" id="fifth-tab">
|
|
|
|
<div class="panel panel-default">
|
2021-08-26 05:35:21 -04:00
|
|
|
<h1 class="title is-4">Random Pastes</h1>
|
2021-07-13 13:32:28 -04:00
|
|
|
<div class="columns is-multiline">
|
|
|
|
<?php foreach ($random_pastes as $paste): ?>
|
2023-06-01 15:14:17 -04:00
|
|
|
<?php outputPasteCard($paste); ?>
|
2021-07-13 13:32:28 -04:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</div>
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-08-26 05:58:37 -04:00
|
|
|
</section>
|
2021-07-12 09:03:02 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-07-13 13:32:28 -04:00
|
|
|
</div>
|
2021-07-11 20:34:11 +01:00
|
|
|
</main>
|
2021-07-10 19:18:17 +01:00
|
|
|
<script>
|
2021-07-12 09:03:02 -04:00
|
|
|
const tabSystem = {
|
|
|
|
init() {
|
|
|
|
document.querySelectorAll('.tabs-menu').forEach(tabMenu => {
|
2021-09-02 08:55:14 -04:00
|
|
|
Array.from(tabMenu.children).forEach(child => {
|
2021-07-12 09:03:02 -04:00
|
|
|
child.addEventListener('click', () => {
|
|
|
|
tabSystem.toggle(child.dataset.target);
|
|
|
|
});
|
|
|
|
if (child.className.includes('is-active')) {
|
|
|
|
tabSystem.toggle(child.dataset.target);
|
|
|
|
}
|
2021-07-10 19:18:17 +01:00
|
|
|
});
|
|
|
|
});
|
2021-07-12 09:03:02 -04:00
|
|
|
},
|
|
|
|
toggle(targetId) {
|
|
|
|
document.querySelectorAll('.tab-content').forEach(contentElement => {
|
|
|
|
contentElement.style.display = contentElement.id === targetId ? 'block' : 'none';
|
|
|
|
document.querySelector(`[data-target="${contentElement.id}"]`).classList[contentElement.id === targetId ? 'add' : 'remove']('is-active');
|
|
|
|
})
|
|
|
|
},
|
|
|
|
};
|
|
|
|
// use it
|
|
|
|
tabSystem.init()
|
2021-07-10 19:18:17 +01:00
|
|
|
</script>
|