Browse Source

added button to remove a random title from titles page

main
Simon Bowie 2 years ago
parent
commit
6c10f8ea48
2 changed files with 13 additions and 3 deletions
  1. +1
    -1
      site/public/search.php
  2. +12
    -2
      site/public/titles.php

+ 1
- 1
site/public/search.php View File

<script> <script>
let text = "<?php echo $_POST["search"]; ?>"; let text = "<?php echo $_POST["search"]; ?>";
upperText = text.toUpperCase(); upperText = text.toUpperCase();
result = "<span style='color:green'>" + upperText + "</span>";
result = "<span style='color:orange'>" + upperText + "</span>";
const collection = document.getElementsByClassName("search_term"); const collection = document.getElementsByClassName("search_term");
for (let i = 0; i < collection.length; i++) { for (let i = 0; i < collection.length; i++) {
collection[i].innerHTML = result; collection[i].innerHTML = result;

+ 12
- 2
site/public/titles.php View File

<body> <body>


<div class="container"> <div class="container">

<button class="float-end btn btn-danger" onclick="removeRandomTitle()">-</button>
<?php <?php


foreach ($random_titles as $record_array): foreach ($random_titles as $record_array):
foreach ($record_array as $id => $title): foreach ($record_array as $id => $title):
?> ?>
<a href="id_search.php?id=<? echo $id; ?>&core=all"> <a href="id_search.php?id=<? echo $id; ?>&core=all">
<span class="title">
<? <?
echo $title;
echo $title;
?> ?>
</span>
</a> </a>

<? <?
endforeach; endforeach;
?> ?>
endforeach; endforeach;
?> ?>
</div> </div>
<script>
function removeRandomTitle() {
var elts = document.getElementsByClassName("title");
var RandomSpan = elts[Math.floor(Math.random() * elts.length)];
RandomSpan.innerHTML = "";
}
</script>
</body> </body>
</html> </html>

Loading…
Cancel
Save