pianello-api/resources/js/components/source/index.js
Ale Gallo 82f958e5da Committing laravel (part 3)
committing js templating files and components
2023-11-10 16:00:59 +01:00

18 lines
563 B
JavaScript

(function () {
"use strict";
// Copy original code
$("body").on("click", ".copy-code", function () {
const content = $(this).html();
const self = this;
$(self).html(content.replace("Copy example code", "Copied!"));
setTimeout(() => {
$(self).html(content);
}, 1500);
const highlight = $(this).closest(".highlight");
$(highlight).find("textarea")[0].select();
$(highlight).find("textarea")[0].setSelectionRange(0, 99999);
document.execCommand("copy");
});
})();