Skip to content
Snippets Groups Projects
Select Git revision
  • df476b179d860edf5c1581f0bbff52f489c211b4
  • main default protected
2 results

WikiAbstract-SolarSystem-09.stog.amr.dot

Blame
  • clipboard.js 590 B
    (function () {
      function select(element) {
        const selection = window.getSelection();
    
        const range = document.createRange();
        range.selectNodeContents(element);
    
        selection.removeAllRanges();
        selection.addRange(range);
      }
    
      document.querySelectorAll("pre code").forEach(code => {
        code.addEventListener("click", function (event) {
          if (window.getSelection().toString()) {
            return;
          }
          select(code.parentElement);
    
          if (navigator.clipboard) {
            navigator.clipboard.writeText(code.parentElement.textContent);
          }
        });
      });
    })();