mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 06:30:07 +01:00
Frontend search works alright I guess
This commit is contained in:
parent
985bc39a60
commit
f67016fb82
7 changed files with 169 additions and 133 deletions
|
@ -48,6 +48,7 @@ server {
|
|||
rewrite ^/embed/(.*)$ /paste.php?embed&id=$1 last;
|
||||
rewrite ^/report /report.php last;
|
||||
rewrite ^/event /event.php last;
|
||||
rewrite ^/rules /rules.php last;
|
||||
|
||||
location ~* \.(jpg|jpeg|png|gif|ico|css|js) {
|
||||
add_header "Cache-Control" "public";
|
||||
|
@ -66,7 +67,7 @@ server {
|
|||
}
|
||||
|
||||
# Deny directories that should not be publicly accessible.
|
||||
location ~ (/doc|/tmp|/includes|/config|/.git|/.ht|/js|/node_modules).* {
|
||||
location ~ (/doc|/tmp|/includes|/config|/.git|/.ht|/js|/node_modules|/composer).* {
|
||||
deny all;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ whenReady(() => {
|
|||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const myParam = urlParams.get('q');
|
||||
const apiUrl = myParam !== null ? '/api/ajax_pastes.php?q=' + myParam : '/api/ajax_pastes.php';
|
||||
const apiUrl = /* myParam !== null ? '/api/ajax_pastes.php?q=' + myParam : */ '/api/ajax_pastes.php';
|
||||
|
||||
const table = new DataTable(document.getElementById('archive'), {
|
||||
ajaxCallback: (resolve) => {
|
||||
|
@ -28,7 +28,7 @@ whenReady(() => {
|
|||
tagColorClass = 'is-info';
|
||||
}
|
||||
|
||||
return `<a href="/tags/${tagData.slug}">
|
||||
return `<a href="/archive?q=${tagData.slug}">
|
||||
<span class="tag ${tagColorClass}">${escape(tagData.name)}</span>
|
||||
</a>`;
|
||||
}).join('');
|
||||
|
@ -38,7 +38,22 @@ whenReady(() => {
|
|||
<td><a href="/user/${escape(rowData.author)}">${escape(rowData.author)}</a></td>
|
||||
<td>${tags}</td>
|
||||
</tr>`;
|
||||
}
|
||||
},
|
||||
filterCallback: (datum, query) => {
|
||||
if (datum.title.indexOf(query) !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* this is inefficient */
|
||||
for (const tag of datum.tags) {
|
||||
if (tag.name.toLowerCase() === query.toLowerCase()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
preFilter: myParam
|
||||
});
|
||||
table.attach();
|
||||
});
|
|
@ -1,6 +1,5 @@
|
|||
import { makeEl, clearEl } from "./dom";
|
||||
|
||||
|
||||
class SimplePaginator {
|
||||
constructor(element) {
|
||||
this.element = element;
|
||||
|
@ -78,6 +77,7 @@ class DataTable {
|
|||
|
||||
this.ajaxCallback = options.ajaxCallback;
|
||||
this.data = [];
|
||||
this.unfilteredData = [];
|
||||
|
||||
this.totalRecords = -1;
|
||||
this.perPage = 20;
|
||||
|
@ -85,9 +85,23 @@ class DataTable {
|
|||
|
||||
this.paginator = new SimplePaginator(this.container.querySelector('.paginator'));
|
||||
|
||||
this.filterCallback = options.filterCallback;
|
||||
}
|
||||
|
||||
attach() {
|
||||
this.filterField = this.container.querySelector('input.search');
|
||||
if (this.filterField && this.filterCallback) {
|
||||
this.filterField.addEventListener('keyup', evt => {
|
||||
if (evt.target) {
|
||||
this._updateFilter(evt.target.value);
|
||||
}
|
||||
});
|
||||
|
||||
if (this.options.preFilter) {
|
||||
this.filterField.value = this.options.preFilter;
|
||||
}
|
||||
}
|
||||
|
||||
this.paginator.attach(this._updatePage.bind(this));
|
||||
this._loadEntries();
|
||||
}
|
||||
|
@ -95,12 +109,15 @@ class DataTable {
|
|||
/* Load the requested data from the server, and when done, update the DOM. */
|
||||
_loadEntries() {
|
||||
new Promise(this.ajaxCallback)
|
||||
.then(this._updateEntries.bind(this));
|
||||
.then(data => {
|
||||
this.unfilteredData = data.data;
|
||||
this._updateFilter(this.options.preFilter);
|
||||
});
|
||||
}
|
||||
|
||||
/* Update the DOM to reflect the current state of the data we have loaded */
|
||||
_updateEntries(data) {
|
||||
this.data = data.data;
|
||||
this.data = data;
|
||||
this.totalRecords = this.data.length;
|
||||
|
||||
const bodyElement = this.element.querySelector('tbody');
|
||||
|
@ -123,7 +140,25 @@ class DataTable {
|
|||
_updatePage(n) {
|
||||
this.currentPage = n;
|
||||
this.paginator.update(this.totalRecords, this.perPage, this.currentPage);
|
||||
this._updateEntries({data: this.data});
|
||||
this._updateEntries(this.data);
|
||||
}
|
||||
|
||||
_updateFilter(query) {
|
||||
/* clearing the query */
|
||||
if (query === null || query === '') {
|
||||
this._updateEntries(this.unfilteredData);
|
||||
return;
|
||||
}
|
||||
|
||||
let data = [];
|
||||
for (const datum of this.unfilteredData) {
|
||||
if (this.filterCallback(datum, query)) {
|
||||
data.push(datum);
|
||||
}
|
||||
}
|
||||
|
||||
this._updatePage(0)
|
||||
this._updateEntries(data);
|
||||
}
|
||||
|
||||
_updateSort(field, direction) {
|
||||
|
|
|
@ -1,27 +1,3 @@
|
|||
<script>
|
||||
/*$(document).ready(function () {
|
||||
$("#archive").dataTable({
|
||||
rowReorder: {selector: 'td:nth-child(2)'},
|
||||
responsive: true,
|
||||
processing: true,
|
||||
language: {processing: ''},
|
||||
autoWidth: false,
|
||||
ajax: "api/ajax_pastes.php",
|
||||
initComplete: function () {
|
||||
var search = new URLSearchParams(window.location.search);
|
||||
var query = search.get('q');
|
||||
if (query) {
|
||||
$("#archive_filter input")
|
||||
.val(query)
|
||||
.trigger("input");
|
||||
}
|
||||
}
|
||||
})
|
||||
});*/
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.paginator > a {
|
||||
margin: 0.25rem;
|
||||
|
@ -41,13 +17,18 @@
|
|||
<div class="bd-lead">
|
||||
<article class="message is-info">
|
||||
<div class="message-body">
|
||||
There are <strong><?php echo $total_untagged ?></strong> pastes that still need to be tagged.
|
||||
There are <strong><?= $total_untagged ?></strong> pastes that still need to be tagged.
|
||||
</div>
|
||||
</article>
|
||||
<?php if ($site_is_private): ?>
|
||||
<h1 class="title is-5">This pastebin is private.</h1>
|
||||
<?php else: ?>
|
||||
<h1 class="title is-4">Pastes Archive</h1>
|
||||
<div class="table_filterer">
|
||||
<label><i class="fa fa-search"></i>
|
||||
<input class="search" type="search" name="search" placeholder="Filter..."/>
|
||||
</label>
|
||||
</div>
|
||||
<table id="archive" class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -74,7 +55,4 @@
|
|||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script>
|
||||
|
||||
</script>
|
||||
</main>
|
|
@ -250,8 +250,8 @@ $flashes = getFlashes();
|
|||
<div class="columns">
|
||||
<div class="column">
|
||||
<ul>
|
||||
<li><a href="/page/rules" target="_blank">Site Rules</a></li>
|
||||
<li><a href="/page/privacy" target="_blank">Privacy Policy</a></li>
|
||||
<li><a href="/rules" target="_blank">Site Rules</a></li>
|
||||
<li><a href="/privacy" target="_blank">Privacy Policy</a></li>
|
||||
<li><a href="mailto:admin@ponepaste.org">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -203,4 +203,31 @@ button.button--no-style {
|
|||
|
||||
.paginator__button--selected {
|
||||
background-color: #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
.table_filterer {
|
||||
color: #fff;
|
||||
background: #3298dc;
|
||||
padding: 10px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.table_filterer input {
|
||||
margin-left: .5em;
|
||||
height: 34px;
|
||||
border-radius: 3px;
|
||||
padding-left: 10px;
|
||||
font-size: 14px;
|
||||
font-family: arial,sans-serif;
|
||||
font-weight: 400;
|
||||
background: #fff;
|
||||
border: 1px solid #bdc4c9;
|
||||
width: 80%;
|
||||
box-shadow: inset 0 1px 0 #f1f0f1;
|
||||
}
|
||||
|
||||
.rules h2 {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 1rem;
|
||||
color: black;
|
||||
}
|
||||
|
|
|
@ -5,116 +5,96 @@
|
|||
<div class="bd-duo">
|
||||
<div class="bd-lead">
|
||||
<!-- Start Row -->
|
||||
<div class="row">
|
||||
<div class="row rules">
|
||||
<!-- Start Panel -->
|
||||
<h1 class="title is-4">Rules</h1>
|
||||
<h2>1. Keep pastes/greens relevant to MLP.</h2>
|
||||
|
||||
<h1>Rules</h1>
|
||||
|
||||
<h1><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">1. Keep pastes/greens relevant to mlp pony.</span></span>
|
||||
</h1>
|
||||
|
||||
<ul>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">The paste <u>must have recognizable show characters</u>, mlp universe influnces (AU allowed) or/and Links to mlp content (eg. youtube, /mlp/.)</span></span>
|
||||
<ul class="rules">
|
||||
<li class="rule">
|
||||
The paste <u>must</u> have recognizable show characters, MLP universe influences (AU allowed) and/or links to MLP content (eg. YouTube, /mlp/, pony boorus.)
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Pony drama pastes are allowed, but must not contain any dox (information revealing an internet users real identity. Or call to harm said users in anyway.)</span></span>
|
||||
<li class="rule">
|
||||
Pony drama pastes are allowed, but must not contain any "dox" (information revealing an internet user's real identity), or any call to harm a real life person in any way.
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Storing code for pony related projects is allowed. For anything else use Pastebin.</span></span>
|
||||
<li class="rule">
|
||||
Storing code for pony related projects is allowed. For anything else, choose another pastebin.
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Storing archived greentext/prose is allowed if they are already publicly available. Please credit original author in title or the start of text, if possible. </span></span>
|
||||
<li class="rule">
|
||||
Storing archived greentext/prose is allowed if the content is already publicly available. Please credit the original author in the title and/or the start of the paste, if possible.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2> </h2>
|
||||
<h2>2. Do not post links to illegal content</h2>
|
||||
<ul class="rules">
|
||||
<li class="rule">
|
||||
Links to photographs or videos depicting human minors in a pornographic, sexually suggestive, or violent manner.
|
||||
</li>
|
||||
<li class="rule">
|
||||
Actual photographs or videos of sadistic gore or animal cruelty (Art, as in rendered drawing, is allowed)
|
||||
</li>
|
||||
<li class="rule">
|
||||
Do not post stories containing explicit sexual situations involving real underage humans.
|
||||
</li>
|
||||
<li class="rule">
|
||||
Pastes containing or linking calls to violence, harm, or terrorist threats to the real world <u>will be removed and the account banned/removed.</u>
|
||||
</li>
|
||||
<li class="rule">
|
||||
<u>Unless stated what it is in the title and paste</u>, pastes containing link dumps to file upload sites or Tor (.onion) sites will be removed.
|
||||
The moderation does not know what the files are, and does not have time to verify them.
|
||||
</li>
|
||||
<li class="rule">Pastes containing calls to download and/or link to copyrighted material will be removed if excessively posted and/or reported by the copyright holder.</li>
|
||||
</ul>
|
||||
|
||||
<h2><span style="font-family:arial,helvetica,sans-serif"><span
|
||||
style="color:rgb(0, 0, 0)">2. </span><a
|
||||
href="https://twibooru.org/pages/rules#4" id="4"
|
||||
style="color: rgb(176, 153, 221); box-sizing: border-box; cursor: pointer; text-decoration-line: none; transition: transform 1s ease 0s, -webkit-transform 1s ease 0s; background-color: transparent;"><span
|
||||
style="color:rgb(0, 0, 0)">Do not upload links to illegal content</span></a></span>
|
||||
</h2>
|
||||
<h2>3. Do not abuse site functionality</h2>
|
||||
|
||||
<ul>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Links to photographs or videos depicting human minors in a pornographic, sexually suggestive, or violent manner.</span></span>
|
||||
<ul class="rules">
|
||||
<li class="rule">
|
||||
You are permitted to have multiple accounts for purposes of archiving or for personal privacy - for example, if you use multiple names.
|
||||
If you are archiving someone else's content, please do not create an account under their name. Instead, use <code>{name}-ARCHIVE</code>.
|
||||
</li class="rule">
|
||||
<li class="rule">You may not use multiple accounts for the purposes of evading bans.</li>
|
||||
<li class="rule"><u>Do not spam. </u>While we do understand shitposting is part of chan culture, please do not go overboard. At least put a paste expiry time.
|
||||
We reserve the right to remove shitposts during database clean up.</li>
|
||||
<li class="rule">Do not abuse the report function. This means crying to get your greentext taken down. You posted it to a public domain (eg 4chan), it belongs to the internet now.</li>
|
||||
<li class="rule">If you think someone is violating a rule, submit a report instead of otherwise calling them out (such as on /mlp/).
|
||||
Don't submit false reports or report pastes you do not like. Don't like it, don't read it. (Unless it breaks any other rules listed here.)</li>
|
||||
</ul>
|
||||
|
||||
<h2>4. Keep this place tidy</h2>
|
||||
|
||||
<ul class="rules">
|
||||
<li class="rule">Keep pastes titles sensible and accurate.</li>
|
||||
<li class="rule">Again, do not spam or excessively shitpost.</li>
|
||||
</ul>
|
||||
|
||||
<h2>5. Using Pastedown</h2>
|
||||
|
||||
<ul class="rules">
|
||||
<li class="rule">Embedded images must not contain explicit images. Non-embed links are fine. </li>
|
||||
<li class="rule">No non pony related images,</li>
|
||||
<li class="rule">
|
||||
No embedded photographs or videos depicting human minors in a pornographic, sexually suggestive, or violent manner.
|
||||
This will result in an instant ban.
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Actual photographs or videos of sadistic gore or animal cruelty (Art, as in rendered drawing, is allowed)</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Do not post storys containing explict sexual situations involving real underage humans.</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Pastes containing or linking calls to voilence, harm, or terrorist threats to the real world <u>will be removed and the account banned/removed.</u></span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Links to the darkweb (.onion) will result in the paste being<u> instantly removed without warning,</u> the links themselves may be legal, but as the links themselves are encrypted we do not have the time to verify each link. </span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)"><u>Unless stated what it is in the title and paste</u>, pastes containing link dumps to file upload sites will be removed. Again, we do not know what the files are and we do not have to time to verfity them.</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Pastes containing calls to download and/or link to copyrighted material will be removed. </span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Pastes containing calls to report copyrighted material on a third party site is allowed. Together, we can help win the war against piracy and protect copyrighted </span></span><span
|
||||
style="color:rgb(0, 0, 0); font-family:arial,helvetica,sans-serif">material.</span>
|
||||
<li class="rule">
|
||||
No foalcon, lolicon or any underage cartoon characters depicted in a sexual or nude situation.
|
||||
</li class="rule">
|
||||
<li class="rule">
|
||||
Links go through a whitelist system, thus some links will be blocked. If you believe your link should be whitelisted, please email the administrators.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2> </h2>
|
||||
<h2> </h2>
|
||||
|
||||
<h2><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">3. Do not abuse site functionality </span></span>
|
||||
</h2>
|
||||
<h2>N. Rules are not exhaustive</h2>
|
||||
|
||||
<ul>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">You are permitted to have multiple accounts for purposes of archiving or for personal privacy, for example, you use multiple names. (Please do not name your account the writefags names you are archiving. please use, [name-ARCHIVE])</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">You may not use multiple accounts for the purposes of evading bans.</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)"><u>Do not spam. </u>While we do understand shitposting is part of chan culture, please do not go overboard. At least put a paste expirery time. We do reserve the right to remove shitposts during database clean up. </span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Do not abuse the report function. This means crying to get your greentext taken down. You posted it to a public domain (eg 4chan), it belongs to the internet now. </span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">If you think someone is violating a rule, submit a report instead of otherwise calling them out (such as on /mlp/). Don’t submit false reports or report greentexts you do not like. Don't like it, don't read it. (Unless it breaks any rules listed here)</span></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2> </h2>
|
||||
|
||||
<h2><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">4. Keep this place tidy</span></span>
|
||||
</h2>
|
||||
|
||||
<ul>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Keep pastes titles sensible and accurate.</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Again, do not spam.</span></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2> </h2>
|
||||
|
||||
<p><span style="font-size:18px"><span style="font-family:arial,helvetica,sans-serif"><span
|
||||
style="color:rgb(0, 0, 0)">5. Using Pastedown</span></span></span></p>
|
||||
|
||||
<ul>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Embedded* images must not contain explict images. Lewd is fine.
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">No non pony related images,
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">No real pictures of animal genitals. Being from documentry or educational source included.
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Embedded photographs or videos depicting human minors in a pornographic, sexually suggestive, or violent manner. This will end in an instant ban.</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">No foalcon, lolicon or any underaged cartoon characters depicted in a sexual situation. This includes nudity.</span></span>
|
||||
</li>
|
||||
<li><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">Links go through a whitelist system. Thus some links will be blocked. If you belived your link should be whitelisted please email us.</span></span><span
|
||||
style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)"> </span></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2> </h2>
|
||||
|
||||
<h2><span style="font-family:arial,helvetica,sans-serif"><span style="color:rgb(0, 0, 0)">N. Rules are not exhaustive</span></span>
|
||||
</h2>
|
||||
|
||||
<p><span style="font-size:12px"><span style="font-family:arial,helvetica,sans-serif"><span
|
||||
style="color:rgb(0, 0, 0)">There may always be situations or actions that were not accounted for in the above rules, or that may be unique or extraordinary in their circumstances. All enforcement of the rules, as well as the decision as to whether something is or is not acceptable, is ultimately left up to the discretion of the site's staff. </span></span><span
|
||||
style="color:rgb(44, 53, 60); font-family:source sans pro,helvetica neue,helvetica,roboto,arial,sans-serif">There are no real rules about moderation — enjoy your ban.</span></span>
|
||||
<p>There may always be situations or actions that were not accounted for in the above rules, or that may be unique or extraordinary in their circumstances.
|
||||
All enforcement of the rules, as well as the decision as to whether something is or is not acceptable, is ultimately left up to the discretion of the site's staff.
|
||||
<span style="color:rgb(44, 53, 60); font-family:source sans pro,helvetica neue,helvetica,roboto,arial,sans-serif">There are no real rules about moderation — enjoy your ban.
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
|
Loading…
Add table
Reference in a new issue