Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
342
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1.  
  2. $(document).ready(function() {
  3. var ctrlDown = false,
  4. ctrlKey = 17,
  5. cmdKey = 91,
  6. vKey = 86,
  7. cKey = 67;
  8.  
  9. $(document).keydown(function(e) {
  10. if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = true;
  11. }).keyup(function(e) {
  12. if (e.keyCode == ctrlKey || e.keyCode == cmdKey) ctrlDown = false;
  13. });
  14.  
  15. $(".no-copy-paste").keydown(function(e) {
  16. if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey)) return false;
  17. });
  18.  
  19. // Document Ctrl + C/V
  20. $(document).keydown(function(e) {
  21. if (ctrlDown && (e.keyCode == cKey)) { $("a").hover(function() {
  22. // var URL = $(this).attr("href");
  23. var URL = (this.href);
  24. GM_setClipboard(URL);
  25.  
  26. window.location.href = 'ms-word:ofe|u|https://sssssss.sharepoint.com/:w:/r/clients/Client%20Documents/T/BLAH%20BLAH/BLAH.docx';
  27. // window.location.assign("https://www.w3schools.com");
  28. // window.location = 'https://www.yahoo.com';
  29.  
  30. console.log('"'+URL+'" copied to clipboard');
  31.  
  32.  
  33. });}
  34. if (ctrlDown && (e.keyCode == vKey)) { $("a").hover(function() {
  35. // var URL = $(this).attr("href");
  36. var URL = (this.href);
  37. GM_setClipboard(URL);
  38.  
  39. var mystr = "ms-word:ofe|u|";
  40. mystr = mystr + URL;
  41.  
  42. console.log('"'+URL+'" copied to clipboard');
  43. console.log('"'+mystr+'" is now loaded');
  44. });}
  45. });
  46. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement