Volafile Mark Read

Adds a line to Volafile chat showing the line last read, along with a menu to show a list of file URLs for use with downloaders.

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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.04
// @description Adds a line to Volafile chat showing the line last read, along with a menu to show a list of file URLs for use with downloaders.
// @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, q, c) {
  'use strict';
  var pr = [w.prog0 || d.createElement('div'), w.prog1 || d.createElement('div')],
    menu = w.menu || d.createElement('div'),
    f = d.querySelector('#files_header_row'),
    u = d.getElementById('dolos_cuckmenu'),
    n = ['chat_message', 'filelist_file'],
    p = /^(MOTD|News|System|Script)/i,
    i = pr.length, s, k;
  function killnews(m) {
    var msg = q[m], i = msg.length;
    while (i--) {
      if (msg[i].options.staff && p.test(msg[i].nick)) {
        if (msg[i].elem.parentNode) msg[i].elem.parentNode.removeChild(msg[i].elem);
        msg.splice(i, 1);
      }
    }
  }
  function reloadMarker(e) {
    var key = e.key || e.charCode || e.keyCode, k;
    if (!key) return;
    if (key === 'Escape' || key === 'Esc' || key === 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)'));
      killnews('messages');
      d.querySelector('.icon-arrow-down').style.display = 'none';
      k = d.querySelector('#kill_flist');
      if (k) k.click();
    }
  }
  function refreshConfig() {
    var pin = d.querySelector('.ui_frame_table [name="password"]'), b, i;
    if (g.chat_max_history < 1000) g.chat_max_history = 1000;
    if (pin) {
      b = d.querySelectorAll('.ui_frame_buttons .button:not(.light)');
      i = b.length;
      while (i--) b[i].click();
    }
    killnews('queued_messages');
  }
  function flist(e) {
    var f = d.querySelectorAll('#file_list .filelist_file:not([id]):not([style]):not(.file_queued):not(.file_uploading)'),
      v = b.appendChild(d.createElement('div')),
      i = f.length, t = '', inf;
    while (i--) {
      inf = '#____' + f[i].querySelector('a .file_tag').innerText + '_' +
        f[i].querySelector('.file_right_part').childNodes[0].data.replace(' ', '');
      t += f[i].querySelector('a[href]').href + inf + '\n';
    }
    v.innerHTML += '<div id="flist_list" style="position:absolute;top:0;left:0;background:#88f">' +
      '<a id="kill_flist" href="#" onclick="this.parentNode.parentNode.removeChild(this.parentNode)">[⮽ CLOSE]</a> &bull; ' +
      '<a href="#" onclick="window.text.value=window.text.value.replace(/\\n$/,[]).split(\'\\n\').reverse().join(\'\\n\')+\'\\n\'">[⇵ reverse]</a>' +
      '<textarea id="text" spellcheck="false" style="width:80em;height:30em;margin:1em;resize:both;display:block">' +
      t + '</textarea></div>';
    e.preventDefault();
    return false;
  }
  function unCuck() {
    u = d.getElementById('dolos_cuckmenu');
    if (u) {
      u.style.fontSize = '75%';
      if (k) w.clearInterval(k);
    }
  }
  menu.id = 'menu';
  menu.style.display = 'inline-block';
  menu.innerHTML = '<a href="#" style="border-right:1px solid #597895;padding:0 1em;font-size:10px">File list</a>';
  f.insertBefore(menu, f.firstChild);
  menu.firstChild.addEventListener('click', flist, false);
  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 = '3px 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].id = 'prog' + i;
    s.borderTop = '3px dashed #f88';
    s.height = '2px';
    s.overflow = 'hidden';
    s.color = 'rgba(67,94,120,0)';
    pr[i].innerText = 'qwerty';
    b.appendChild(pr[i]);
  }
  w.addEventListener('keydown', reloadMarker, false);
  c.showMessage('Script', 'Vola marker line loaded. Hit [esc] to activate.', {'dontsave': true, 'staff': true});
  g.bump = w.setInterval(refreshConfig, 60000);
})(window, document, document.body || body, window.config, window.chat_messages, window.RoomInstance.extensions.chat, window.Room.prototype._extensions.connection.prototype.room.extensions.chat);