move copy-code.js into ui.js
This commit is contained in:
		@@ -24,7 +24,6 @@
 | 
			
		||||
  <footer class="darkbg">
 | 
			
		||||
    <span>Pyrom commit <a href="{{ "https://git.poto.cafe/yagich/pyrom/commit/" + __commit }}">{{ __commit[:8] }}</a></span>
 | 
			
		||||
  </footer>
 | 
			
		||||
  <script src="{{ "/static/js/copy-code.js" | cachebust }}"></script>
 | 
			
		||||
  <script src="{{ "/static/js/ui.js" | cachebust }}"></script>
 | 
			
		||||
  <script src="{{ "/static/js/date-fmt.js" | cachebust }}"></script>
 | 
			
		||||
</body>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
for (let button of document.querySelectorAll(".copy-code")) {
 | 
			
		||||
  button.addEventListener("click", async () => {
 | 
			
		||||
    await navigator.clipboard.writeText(button.value)
 | 
			
		||||
    button.textContent = "Copied!"
 | 
			
		||||
    setTimeout(() => {button.textContent = "Copy"}, 1000.0)
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
@@ -144,4 +144,13 @@ document.addEventListener("DOMContentLoaded", () => {
 | 
			
		||||
      openLightbox(belongingTo, idx);
 | 
			
		||||
    });
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  // copy code blocks
 | 
			
		||||
  for (let button of document.querySelectorAll(".copy-code")) {
 | 
			
		||||
    button.addEventListener("click", async () => {
 | 
			
		||||
      await navigator.clipboard.writeText(button.value)
 | 
			
		||||
      button.textContent = "Copied!"
 | 
			
		||||
      setTimeout(() => {button.textContent = "Copy"}, 1000.0)
 | 
			
		||||
    })
 | 
			
		||||
  };
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user