|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
-
- # @name: titles.php
- # @version: 0.1
- # @creation_date: 2021-09-24
- # @license: The MIT License <https://opensource.org/licenses/MIT>
- # @author: Simon Bowie <ad7588@coventry.ac.uk>
- # @purpose: Displays ten random titles
-
- include '../solr.php';
-
- $core = 'all';
- $random_titles = ten_random_titles($core);
- $additional_titles = ten_random_titles($core);
-
- ?>
-
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Performing Patents Otherwise: Archival conversations with 320.000 clothing inventions</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
- <link rel="stylesheet" type="text/css" href="css/style.css">
- </head>
- <body>
-
- <div class="container">
-
- <button class="float-end btn btn-danger" onclick="removeRandomTitle()">-</button>
- <button class="float-end btn btn-danger" onclick="addRandomTitle()">+</button>
-
- <?php
-
- 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;
- ?>
- </span>
- </a>
- <?
- endforeach;
- ?>
-
- <br><br>
-
- <hr>
-
- <?php
- endforeach;
- ?>
-
- </div>
- <script>
-
- var titles = <?php echo json_encode($additional_titles); ?>;
-
- x = 0;
-
- function addRandomTitle(){
- var record_array = titles[x];
- let title = "";
- for (const id in record_array) {
- title += record_array[id];
- document.querySelector('.container').innerHTML += "<a href='id_search.php?id=" + id + "&core=all'><span class='title'>" + title + "</span></a><br><br><hr>";
- x++;
- }
- }
-
- function removeRandomTitle() {
- var elts = document.getElementsByClassName("title");
- var RandomSpan = elts[Math.floor(Math.random() * elts.length)];
- RandomSpan.innerHTML = "";
- }
- </script>
- </body>
- </html>
|