Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Multibuffer</title>
  6.  
  7.  
  8. </head>
  9. <body>
  10. <table width="100%">
  11. <thead>
  12. <tr>
  13. <th>
  14. Время
  15. </th>
  16. <th>
  17. Содержание
  18. </th>
  19. </tr>
  20. </thead>
  21. <tbody class="data-time">
  22.  
  23. </tbody>
  24. </table>
  25. <script>
  26. var gui = new require('nw.gui');
  27. var text = '', array=[],clipboard = '',per = 1;
  28.  
  29.  
  30. Array.prototype.in_array = function (p_vai) {
  31. for(var i = 0, l = this.length; i < l; i++) {
  32. if (this[1] == p_vai) {
  33. return true;
  34. }
  35. }
  36. return false;
  37. };
  38.  
  39. function times() {
  40. var date = new Date();
  41. var H = date.getHours() < 10 ? "0"+date.getHours() : date.getHours() ,
  42. I = date.getMinutes() < 10 ? "0"+date.getMinutes() : date.getMinutes(),
  43. S = date.getSeconds() < 10 ? "0"+date.getSeconds() : date.getSeconds();
  44. return H+' : '+ I + ' : '+S;
  45.  
  46. }
  47.  
  48.  
  49.  
  50. var id = setInterval(function() {
  51. clipboard = gui.Clipboard.get();
  52. text = clipboard.get();
  53.  
  54. if(!array.in_array(text.trim())) {
  55. console.log(text);
  56. var time = times();
  57. $(".data-time").append('<tr><td>'+time+'</td><td><span>'+$('div').text(text) .html().trim()+'</span></td></tr>');
  58. array.push(text.trim());
  59.  
  60. }
  61. },1000);
  62.  
  63. </script>
  64. </body>
  65. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement