3 $filename = $_GET['f'];
4 $stylesheet = "textfiles.css";
5 $stylesheet_href = $stylesheet . "?v=" . filemtime($stylesheet);
11 <meta name=
"viewport" content=
"width=device-width, initial-scale=1">
12 <link href='https://your.web.site/FontAwesome.css' type='text/css' rel='stylesheet'
/>
13 <link href='
<?php echo $stylesheet_href; ?>' type='text/css' rel='stylesheet'
/>
14 <script type='text/javascript' src='textfiles.js'
></script>
18 <div class='compensator'
>
22 <?php echo htmlentities(file_get_contents($filename)); ?>
25 <div id='ui-elements-container'
>
30 class='button copy-raw-link'
31 title='Copy raw link to clipboard [k]'
33 data-main-action='copyRawLinkButtonClicked'
34 data-success-message='Raw file URL copied to clipboard.'
39 title='View raw file [r]'
42 href='
<?php echo str_replace('.txt', '', $filename); ?>/raw'
46 class='button copy-text'
47 title='Copy text to clipboard [c]'
48 data-label='Copy text'
49 data-main-action='copyTextButtonClicked'
50 data-success-message='Text copied to clipboard.'
55 class='button copy-link'
56 title='Copy link to clipboard [l]'
57 data-label='Copy link'
58 data-main-action='copyLinkButtonClicked'
59 data-success-message='URL copied to clipboard.'
63 <span class='message'
></span>
65 <textarea id='scratchpad'
></textarea>
69 <script type='text/javascript'
>
70 copyLinkButtonClicked
= () => {
71 copyTextToClipboard(location
);
73 copyRawLinkButtonClicked
= () => {
74 copyTextToClipboard(location
+ "/raw");
76 copyTextButtonClicked
= () => {
77 selectElementContents(document
.querySelector("pre"));
78 document
.execCommand("copy");
81 document
.querySelectorAll("#controls button").forEach(button
=> {
82 button
.addActivateEvent((event
) => {
84 window
[event
.target
.dataset
["mainAction"]]();
85 setMessage(event
.target
.dataset
["successMessage"]);
90 selectElementContents(document
.querySelector("pre"));