A simple pastebin you can run on any server with Apache and PHP.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

textfiles.html 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. $filename = $_GET['f'];
  3. $stylesheet = "textfiles.css";
  4. $stylesheet_href = $stylesheet . "?v=" . filemtime($stylesheet);
  5. ?>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <link href='https://your.web.site/FontAwesome.css' type='text/css' rel='stylesheet' />
  10. <link href='<?php echo $stylesheet_href; ?>' type='text/css' rel='stylesheet' />
  11. <script type='text/javascript' src='textfiles.js'></script>
  12. </head>
  13. <body>
  14. <div class='compensator'>
  15. </div>
  16. <pre>
  17. <?php echo htmlentities(file_get_contents($filename)); ?>
  18. </pre>
  19. <div id='ui-elements-container'>
  20. <div id='controls'>
  21. <div class='buttons'>
  22. <button
  23. type='button'
  24. class='button copy-raw-link'
  25. title='Copy raw link to clipboard [k]'
  26. data-label='Raw link'
  27. data-main-action='copyRawLinkButtonClicked'
  28. data-success-message='Raw file URL copied to clipboard.'
  29. accesskey='k'
  30. >&#xf121;</button>
  31. <a
  32. class='button raw'
  33. title='View raw file [r]'
  34. data-label='View raw'
  35. accesskey='r'
  36. href='<?php echo str_replace('.txt', '', $filename); ?>/raw'
  37. >&#xf036;</a>
  38. <button
  39. type='button'
  40. class='button copy-text'
  41. title='Copy text to clipboard [c]'
  42. data-label='Copy text'
  43. data-main-action='copyTextButtonClicked'
  44. data-success-message='Text copied to clipboard.'
  45. accesskey='c'
  46. >&#xf0c5;</button>
  47. <button
  48. type='button'
  49. class='button copy-link'
  50. title='Copy link to clipboard [l]'
  51. data-label='Copy link'
  52. data-main-action='copyLinkButtonClicked'
  53. data-success-message='URL copied to clipboard.'
  54. accesskey='l'
  55. >&#xf0c1;</button>
  56. </div>
  57. <span class='message'></span>
  58. </div>
  59. <textarea id='scratchpad'></textarea>
  60. </div>
  61. </body>
  62. <script type='text/javascript'>
  63. copyLinkButtonClicked = () => {
  64. copyTextToClipboard(location);
  65. };
  66. copyRawLinkButtonClicked = () => {
  67. copyTextToClipboard(location + "/raw");
  68. };
  69. copyTextButtonClicked = () => {
  70. selectElementContents(document.querySelector("pre"));
  71. document.execCommand("copy");
  72. };
  73. document.querySelectorAll("#controls button").forEach(button => {
  74. button.addActivateEvent((event) => {
  75. event.target.blur();
  76. window[event.target.dataset["mainAction"]]();
  77. setMessage(event.target.dataset["successMessage"]);
  78. });
  79. });
  80. setTimeout(() => {
  81. selectElementContents(document.querySelector("pre"));
  82. }, 0);
  83. </script>
  84. </html>