Clean up some of the view.php JS

This commit is contained in:
Floorb 2021-08-20 16:38:04 -04:00
parent bfc803ddc7
commit de4ad5d12e

View file

@ -2,7 +2,7 @@
<link rel="stylesheet" href="theme/bulma/css/bulma-tagsinput.min.css"/>
<script src="theme/bulma/js/bulma-tagsinput.min.js"></script>
<script>
function setupTagsInput() {
function setupTagsInput() {
const tagsInput = document.getElementById('tags-with-source');
new BulmaTagsInput(tagsInput, {
allowDuplicates: false,
@ -34,6 +34,8 @@ function setupTagsInput() {
});
}
});
preloaderFadeOutInit();
}
if (document.readyState !== 'loading') {
@ -41,8 +43,7 @@ function setupTagsInput() {
} else {
document.addEventListener('DOMContentLoaded', setupTagsInput);
}
</script>
<script>
function openreport() {
var x = document.getElementById("panel");
if (x.style.display === "none") {
@ -60,42 +61,18 @@ function setupTagsInput() {
x.style.display = "none";
}
}
</script>
<script>
function preloaderFadeOutInit() {
$('.preloader').fadeOut('slow');
$('main').attr('id', '');
}
// Window load function
jQuery(window).on('load', function () {
(function ($) {
preloaderFadeOutInit();
})(jQuery);
});
function preloaderFadeOutInit() {
document.querySelector('main').classList.remove('stop-scrolling');
document.querySelector('.preloader').classList.add('preloader-hidden');
}
</script>
<?php if ($using_highlighter): ?>
<link rel="stylesheet" href="/vendor/scrivo/highlight.php/styles/default.css" />
<?php endif; ?>
<?php
/*
* Paste <https://github.com/jordansamuel/PASTE> - Bulma theme
* Theme by wsehl <github.com/wsehl> (January, 2021)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License in GPL.txt for more details.
*/
$protocol = paste_protocol();
$bg = array('/img/loader.gif', '/img/loader2.gif', '/img/loader3.gif'); // array of filenames
$i = rand(0, count($bg) - 1); // generate random number size of the array
$selectedloader = "$bg[$i]"; // set variable equal to which random filename was chosen
?>
@ -110,19 +87,24 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
width: 100%;
height: 100vh;
z-index: 99999999;
background-image: url('<?php echo $selectedloader; ?>'); /* your icon gif file path */
background-image: url('<?= $selectedloader ?>'); /* your icon gif file path */
background-repeat: no-repeat;
background-color: #FFF;
background-position: center;
}
#stop-scrolling {
height: 100% !important;
overflow: hidden !important;
.preloader-hidden {
visibility: hidden;
opacity: 0;
transition: visibility 0s 1.25s, opacity 1.25s linear;
}
.stop-scrolling {
height: 100%;
overflow: hidden;
}
</style>
<main class="bd-main" id="stop-scrolling">
<main class="bd-main stop-scrolling">
<div class="preloader"></div>
<div class="bd-side-background"></div>
<div class="bd-main-container container">
@ -130,7 +112,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<div class="bd-lead">
<div class="content panel">
<article class="message is-danger" id="panel" style="display: none;">
<div class="message-header" style="margin-bottom: 0px;">
<div class="message-header" style="margin-bottom: 0;">
<p style="margin-bottom: 1px;">Report Paste</p>
<button class="delete" onclick="closereport()" aria-label="delete"></button>
</div>
@ -163,8 +145,6 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
id="report" value="Report Paste"/>
</div>
</div>
</form>
</div>
</div>
</article>
@ -268,7 +248,8 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<div id="paste" style="line-height:1!important;">
<div class="<?= pp_html_escape($paste['code']) ?>">
<ol>
<?php foreach ($lines as $num => $line): ?>
<?php foreach ($lines as $num => $line):
$line = trim($line); ?>
<li class="<?= $num == 0 ? 'li1 ln-xtra' : 'li1' ?>" id="<?= $num + 1 ?>">
<div class="de1"><?= $line === '' ? '&nbsp;' : $line ?></div>
</li>
@ -329,9 +310,9 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<p class="control has-icons-left">
<input type="text" class="input" name="title"
placeholder="<?= $paste['title'] ?>"
value="<?= $paste['title'] ?>">
value="<?= $paste['title'] ?>" />
<span class="icon is-small is-left">
<i class="fa fa-font"></i></a>
<i class="fa fa-font"></i>
</span>
</p>
</div>
@ -456,7 +437,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<div class="columns">
<div class="column">
<input type="text" class="input" name="pass" id="pass" value=""
placeholder="<?php echo $lang['pwopt']; ?>">
placeholder="<?php echo $lang['pwopt']; ?>" />
</div>
</div>
</div>
@ -490,10 +471,6 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
value="<?php echo $lang['editpaste']; ?>"/>
<?php
} ?>
<?php
//Fork function not working
// <input class="button is-info" type="submit" name="submit" id="submit"
//value="<?php echo $lang['forkpaste'];"/> ?>
</div>
<br/>
</nav>
@ -509,9 +486,6 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
</div>
</div>
</div>
</div>
</div>
</main>
<script>