Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 5 gadiem
1234567891011121314151617181920212223242526272829
  1. gitbook.require(["gitbook", "jQuery"], function(gitbook, $) {
  2. var copyButton = '<button type="button" class="copy-to-clipboard-button" title="Copy to clipboard" aria-label="Copy to clipboard"><i class="fa fa-copy"></i></button>';
  3. var clipboard;
  4. gitbook.events.bind("page.change", function() {
  5. if (!ClipboardJS.isSupported()) return;
  6. // the page.change event is thrown twice: before and after the page changes
  7. if (clipboard) {
  8. // clipboard is already defined
  9. // we can deduct that we are before page changes
  10. clipboard.destroy(); // destroy the previous events listeners
  11. clipboard = undefined; // reset the clipboard object
  12. return;
  13. }
  14. $(copyButton).prependTo("div.sourceCode");
  15. clipboard = new ClipboardJS(".copy-to-clipboard-button", {
  16. text: function(trigger) {
  17. return trigger.parentNode.textContent;
  18. }
  19. });
  20. });
  21. });