cytube_clear_chatline_button

チャット入力欄のクリアボタン

目前为 2020-07-14 提交的版本。查看 最新版本

// ==UserScript==
// @name         cytube_clear_chatline_button
// @namespace    https://cytube.xyz/
// @version      1.0
// @description  チャット入力欄のクリアボタン
// @author       utubo
// @match        *://cytube.xyz/*
// @grant        none
// ==/UserScript==
(function() {
  var backup = '';
  var chatline = document.getElementById('chatline'); 
  var btn = document.getElementById('chatlineClearBtn');
  if (btn) btn.remove();
  btn = document.createElement('DIV');
  btn.id = 'chatlineClearBtn';
  btn.style.cssText = 'position:absolute;right:30px;bottom:8px;opacity:.5;';
  var icon = document.createElement('SPAN');
  icon.className = 'glyphicon glyphicon-remove';
  btn.appendChild(icon);
  chatline.parentElement.insertBefore(btn, chatline.nextSibiling);
  btn.addEventListener('click', e => {
    backup = chatline.value || backup;
    chatline.value = chatline.value ? '' : backup;
    chatline.focus();  
  });
})();