ForumSpark Support app Faster, straight from your home screen. Tap Share, then Add to Home Screen.
Add ForumSpark Support to your home screen
  1. Tap Share at the bottom of Safari.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. ForumSpark Support now opens like an app.
  1. Tap Install, or open the browser menu.
  2. Choose Install app or Add to Home screen.
  3. Confirm. ForumSpark Support now opens like an app.

Copy Code

Cory's Avatar
Cory · in Themes & Extensions
0 replies 167 views

Preview

When the "Copy Code" link is clicked, it will copy all code in between the code BBCode tags.

Admin CP → Themes → Board Templates → Below the board

<script>
const code = document.querySelectorAll('code');

if (code) {
    code.forEach(element => {
        element.parentElement.insertAdjacentHTML('beforebegin', '<a href="javascript: void(0)" class="copy-code" style="float: right">Copy Code</a><br>');
    });

const copyCode = document.querySelectorAll('a.copy-code');

copyCode.forEach(element => {
    element.addEventListener('click', function() {
        element.insertAdjacentHTML('beforeend', '<div id="code-copied" class="panel" style="position: absolute; border-width: 1px; border-radius: 5px; padding: 3px; color: initial">Code Copied</div>');
        const text = element.nextElementSibling.nextElementSibling.querySelector('code').innerText;
        navigator.clipboard.writeText(text);

        setTimeout(function() {
            document.querySelector('#code-copied').remove();
        }, 1000);
    });
});
}
</script>

You might also like...

Topic Replies Views Last reply
Boo & Co Popular in Themes & Extensions, started by Cedric, 2 months ago
19 555
Cedric's Avatar
Cedric4 days ago
Horizon Popular in Themes & Extensions, started by Cedric, 3 months ago
9 281
Cedric's Avatar
Cedric3 months ago
Quests Popular in Themes & Extensions, started by Cedric, 2 days ago
8 284
Cedric's Avatar
Cedric10 hours ago
Classifieds Popular in Themes & Extensions, started by Cedric, 2 days ago
7 260
Cedric's Avatar
Cedric1 day ago
Flurry Popular in Themes & Extensions, started by Cedric, 2 months ago
6 240
Cedric's Avatar
Cedric2 months ago