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

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

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

@@ -27,6 +27,8 @@ $random_titles = ten_random_titles($core);
<body>

<div class="container">

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

foreach ($random_titles as $record_array):
@@ -37,11 +39,12 @@ foreach ($random_titles as $record_array):
foreach ($record_array as $id => $title):
?>
<a href="id_search.php?id=<? echo $id; ?>&core=all">
<span class="title">
<?
echo $title;
echo $title;
?>
</span>
</a>

<?
endforeach;
?>
@@ -54,5 +57,12 @@ foreach ($random_titles as $record_array):
endforeach;
?>
</div>
<script>
function removeRandomTitle() {
var elts = document.getElementsByClassName("title");
var RandomSpan = elts[Math.floor(Math.random() * elts.length)];
RandomSpan.innerHTML = "";
}
</script>
</body>
</html>

Loading…
Cancel
Save