Volafile Mark Read

Adds a line to Volafile chat showing the line last read

目前為 2020-05-16 提交的版本,檢視 最新版本

// ==UserScript==
// @name Volafile Mark Read
// @author Arnold François Lecherche and a Vola anon named Adonis
// @namespace greasyfork.org
// @icon https://volafile.org/favicon.ico
// @version 1.0
// @description Adds a line to Volafile chat showing the line last read
// @include http://volafile.org/*
// @include http://*.volafile.org/*
// @include https://volafile.org/*
// @include https://*.volafile.org/*
// @grant none
// @run-at document-end
// @copyright 2020 Arnold François Lecherche
// ==/UserScript==
(function (w, d, b, g, m, c) {
  'use strict';
  var pr = [w.prog0 || d.createElement('div'), w.prog1 || d.createElement('div')],
    u = d.getElementById('dolos_cuckmenu'),
    n = ['chat_message', 'filelist_file'],
    i = pr.length, s, k;
  function reloadMarker(e) {
    var sf, i
    if (e.keyCode === 27) {
      if (g.chat_max_history < 1000) g.chat_max_history = 1000;
      m.appendChild(w.prog0);
      w.file_list.insertBefore(w.prog1, w.file_list.querySelector('#file_list .filelist_file:not(.file_uploading):not(.file_queued)'));
      sf = m.querySelectorAll('.chat_message.staff:not(.profile)');
      i = sf.length;
      while (i--) if (sf[i].querySelector('.username').innerText.substr(0, 5) === 'News:') m.removeChild(sf[i]);
    }
  }
  function refreshConfig() {
    var pin = d.querySelector('.ui_frame_table [name="password"]'), b, i;
    if (g.chat_max_history < 1000) {
      g.chat_max_history = 1000;
      c.showMessage('Script', 'chat_max_history bumped to 1000', {'dontsave': true, 'staff': true});
    }
    if (pin) {
      b = d.querySelectorAll('.ui_frame_buttons .button:not(.light)');
      i = b.length;
      while (i--) b[i].click();
    }
  }
  function unCuck() {
    u = d.getElementById('dolos_cuckmenu');
    if (u) {
      u.style.fontSize = '75%';
      if (k) w.clearInterval(k);
    }
  }
  w.addEventListener('DOMContentLoaded', unCuck, false);
  w.addEventListener('load', unCuck, false);
  if (u) u.style.fontSize = '75%';
  else k = w.setInterval(unCuck, 100);
  w.chat_scroller.style.borderTop = '4px dotted #597895';
  if (g.chat_max_history < 1000) g.chat_max_history = 1000;
  while (i--) {
    s = pr[i].style;
    pr[i].className = n[i];
    pr[i].setAttribute('id', 'prog' + i);
    s.borderTop = '3px dashed #f88';
    s.height = '3px';
    s.overflow = 'hidden';
    s.color = 'rgba(0,0,0,0)';
    pr[i].innerText = 'qwerty';
    b.appendChild(pr[i]);
  }
  w.addEventListener('onkeydown', reloadMarker, false);
  c.showMessage('Script', 'vola marker line loaded', {'dontsave': true, 'staff': true});
  g.bump = w.setInterval(refreshConfig, 60000);
})(window, document, document.body || body, window.config, window.chat_messages, window.Room.prototype._extensions.connection.prototype.room.extensions.chat);