Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- var ctrlDown = false,
- ctrlKey = 17,
- cmdKey = 91,
- vKey = 86,
- cKey = 67;
- $(document).keydown(function(e) {
- if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = true;
- }).keyup(function(e) {
- if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = false;
- });
- $(".no-copy-paste").keydown(function(e) {
- if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey)) return false;
- });
- // Document Ctrl + C/V
- $(document).keydown(function(e) {
- if (ctrlDown && (e.keyCode == cKey)) {
- $($(".active-cursor")[0]).html($($(".active-cursor")[0]).html() + "<textarea id='textclip'>" + $($(".active-cursor")[0]).html() + "</textarea>");
- document.getElementById("textclip").focus();
- document.getElementById("textclip").select();
- document.execCommand("copy");
- $($("#textclip")[0]).remove()
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement