search_hash_tag.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php include ('header.php'); ?>
  2. <main id="main">
  3. <?php include dirname(__FILE__).('/widgets/search_header.php'); ?>
  4. <div class="article_wrap">
  5. <aside class="left_column">
  6. <?php include dirname(__FILE__).('/widgets/side_who_to_follow.php'); ?>
  7. <?php include dirname(__FILE__).('/widgets/side_footer.php'); ?>
  8. </aside>
  9. <article class="center_column">
  10. <header class="timeline_header">
  11. <ul class="header_items">
  12. <li class="item toots view">
  13. </li>
  14. </ul>
  15. </header>
  16. <div id="js-stream_update">
  17. <button>
  18. <?=_('View ')?> <span></span><?=_(' new Toots')?>
  19. </button>
  20. </div>
  21. <ul id="js-timeline" class="timeline">
  22. </ul>
  23. <footer id="js-timeline_footer" class="timeline_footer">
  24. <i class="fa fa-spin fa-circle-o-notch" aria-hidden="true"></i>
  25. </footer>
  26. </article>
  27. <aside class="right_column"></aside>
  28. </div>
  29. </main>
  30. <script>
  31. current_file = location.pathname+location.search;
  32. <?php if(isset($_GET['q'])) { ?>
  33. $(function() {
  34. var query = "<?= htmlspecialchars((string)filter_input(INPUT_GET, 'q'), ENT_QUOTES) ?>";
  35. if(query[0] == "@") {
  36. window.location.href = "/search/users?q="+query.substr(1);
  37. }
  38. else {
  39. if(query[0] == "#") {
  40. query = query.substr(1);
  41. }
  42. if(query.length > 0) {
  43. current_search_history.push(query);
  44. if(current_search_history.length > 99) {
  45. current_search_history.shift();
  46. }
  47. localStorage.current_search_history = JSON.stringify(current_search_history);
  48. $('#main > .article_wrap > .center_column > .timeline_header > .header_items > .item').text("#"+query);
  49. $('#js-header_title_box > h1').text(query);
  50. $('title').text('#'+query+' - Halcyon Search');
  51. $('#js-search_nav_toots').toggleClass('view');
  52. $('#js-search_nav_toots a ').attr('href','/search'+location.search);
  53. $('#js-search_nav_peoples a ').attr('href','/search/users'+location.search)
  54. if(localStorage.getItem("setting_search_filter") === "all") {
  55. setTimeline("timelines/tag/"+query);
  56. }
  57. else if(localStorage.getItem("setting_search_filter") === "local") {
  58. setTimeline("timelines/tag/"+query,[{name:"local",data:"true"}]);
  59. }
  60. replace_emoji();
  61. }
  62. else {
  63. history.back();
  64. }
  65. }
  66. });
  67. <?php } else { ?>
  68. window.location.href = "/";
  69. <?php } ?>
  70. </script>
  71. <?php include ('footer.php'); ?>