Volafile Mark Read

Adds a line to Volafile chat showing the line last read

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

  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.0
  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 sf, i
  24. if (e.keyCode === 27) {
  25. if (g.chat_max_history < 1000) g.chat_max_history = 1000;
  26. m.appendChild(w.prog0);
  27. w.file_list.insertBefore(w.prog1, w.file_list.querySelector('#file_list .filelist_file:not(.file_uploading):not(.file_queued)'));
  28. sf = m.querySelectorAll('.chat_message.staff:not(.profile)');
  29. i = sf.length;
  30. while (i--) if (sf[i].querySelector('.username').innerText.substr(0, 5) === 'News:') m.removeChild(sf[i]);
  31. }
  32. }
  33. function refreshConfig() {
  34. var pin = d.querySelector('.ui_frame_table [name="password"]'), b, i;
  35. if (g.chat_max_history < 1000) {
  36. g.chat_max_history = 1000;
  37. c.showMessage('Script', 'chat_max_history bumped to 1000', {'dontsave': true, 'staff': true});
  38. }
  39. if (pin) {
  40. b = d.querySelectorAll('.ui_frame_buttons .button:not(.light)');
  41. i = b.length;
  42. while (i--) b[i].click();
  43. }
  44. }
  45. function unCuck() {
  46. u = d.getElementById('dolos_cuckmenu');
  47. if (u) {
  48. u.style.fontSize = '75%';
  49. if (k) w.clearInterval(k);
  50. }
  51. }
  52. w.addEventListener('DOMContentLoaded', unCuck, false);
  53. w.addEventListener('load', unCuck, false);
  54. if (u) u.style.fontSize = '75%';
  55. else k = w.setInterval(unCuck, 100);
  56. w.chat_scroller.style.borderTop = '4px dotted #597895';
  57. if (g.chat_max_history < 1000) g.chat_max_history = 1000;
  58. while (i--) {
  59. s = pr[i].style;
  60. pr[i].className = n[i];
  61. pr[i].setAttribute('id', 'prog' + i);
  62. s.borderTop = '3px dashed #f88';
  63. s.height = '3px';
  64. s.overflow = 'hidden';
  65. s.color = 'rgba(0,0,0,0)';
  66. pr[i].innerText = 'qwerty';
  67. b.appendChild(pr[i]);
  68. }
  69. w.addEventListener('onkeydown', reloadMarker, false);
  70. c.showMessage('Script', 'vola marker line loaded', {'dontsave': true, 'staff': true});
  71. g.bump = w.setInterval(refreshConfig, 60000);
  72. })(window, document, document.body || body, window.config, window.chat_messages, window.Room.prototype._extensions.connection.prototype.room.extensions.chat);