Volafile Mark Read

Adds a line to Volafile chat showing the line last read

当前为 2020-05-24 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Volafile Mark Read
  3. // @author Arnold François Lecherche and a Vola anon named Adonis
  4. // @namespace greasyfork.org
  5. // @icon https://volafile.org/favicon.ico
  6. // @version 1.02
  7. // @description Adds a line to Volafile chat showing the line last read
  8. // @include http://volafile.org/*
  9. // @include http://*.volafile.org/*
  10. // @include https://volafile.org/*
  11. // @include https://*.volafile.org/*
  12. // @grant none
  13. // @run-at document-end
  14. // @copyright 2020 Arnold François Lecherche
  15. // ==/UserScript==
  16. (function (w, d, b, g, m, c) {
  17. 'use strict';
  18. var pr = [w.prog0 || d.createElement('div'), w.prog1 || d.createElement('div')],
  19. u = d.getElementById('dolos_cuckmenu'),
  20. n = ['chat_message', 'filelist_file'],
  21. i = pr.length, s, k;
  22. function reloadMarker(e) {
  23. var key = e.key || e.charCode || e.keyCode, sf, i;
  24. if (!key) return;
  25. if (key === 'Escape' || key === 'Esc' || key === 27) {
  26. if (g.chat_max_history < 1000) g.chat_max_history = 1000;
  27. m.appendChild(w.prog0);
  28. w.file_list.insertBefore(w.prog1, w.file_list.querySelector('#file_list .filelist_file:not(.file_uploading):not(.file_queued)'));
  29. sf = m.querySelectorAll('.chat_message.staff:not(.profile)');
  30. i = sf.length;
  31. while (i--) if (sf[i].querySelector('.username').innerText.substr(0, 5) === 'News:') m.removeChild(sf[i]);
  32. }
  33. }
  34. function refreshConfig() {
  35. var pin = d.querySelector('.ui_frame_table [name="password"]'), b, i;
  36. if (g.chat_max_history < 1000) g.chat_max_history = 1000;
  37. if (pin) {
  38. b = d.querySelectorAll('.ui_frame_buttons .button:not(.light)');
  39. i = b.length;
  40. while (i--) b[i].click();
  41. }
  42. }
  43. function unCuck() {
  44. u = d.getElementById('dolos_cuckmenu');
  45. if (u) {
  46. u.style.fontSize = '75%';
  47. if (k) w.clearInterval(k);
  48. }
  49. }
  50. w.addEventListener('DOMContentLoaded', unCuck, false);
  51. w.addEventListener('load', unCuck, false);
  52. if (u) u.style.fontSize = '75%';
  53. else k = w.setInterval(unCuck, 100);
  54. w.chat_scroller.style.borderTop = '4px dotted #597895';
  55. if (g.chat_max_history < 1000) g.chat_max_history = 1000;
  56. while (i--) {
  57. s = pr[i].style;
  58. pr[i].className = n[i];
  59. pr[i].setAttribute('id', 'prog' + i);
  60. s.borderTop = '3px dashed #f88';
  61. s.height = '3px';
  62. s.overflow = 'hidden';
  63. s.color = 'rgba(0,0,0,0)';
  64. pr[i].innerText = 'qwerty';
  65. b.appendChild(pr[i]);
  66. }
  67. w.addEventListener('keydown', reloadMarker, false);
  68. c.showMessage('Script', 'vola marker line loaded', {'dontsave': true, 'staff': true});
  69. g.bump = w.setInterval(refreshConfig, 60000);
  70. })(window, document, document.body || body, window.config, window.chat_messages, window.Room.prototype._extensions.connection.prototype.room.extensions.chat);