Rename Title

rename title

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Rename Title
// @version      2024-05-11
// @description  rename title
// @author       Cocowwy
// @match        *://*/*
// @namespace https://greasyfork.org/users/1299821
// ==/UserScript==

// 重命名
function showPopup() {
  var input = prompt('Rename Title:');
  if (input !== null) {
     document.title = input;
  }
}
// 记录按键状态的变量
var isCommandPressed = false;
var isOptionPressed = false;
var isTPressed = false;

// 监听按键按下事件
document.addEventListener('keydown', function(event) {
  // 检查是否按下 Command 键
  if (event.keyCode === 91) {
    isCommandPressed = true;
  }

  // 检查是否按下 Option 键
  if (event.keyCode === 18) {
    isOptionPressed = true;
  }

  // 检查是否按下字母键 T
  if (event.keyCode === 84) {
    isTPressed = true;
  }

  // 检查是否同时按下了 Command、Option 和 T 键
  if (isCommandPressed && isOptionPressed && isTPressed) {
    // 在这里添加你想要执行的操作代码
    showPopup();
    isCommandPressed = false;
    isOptionPressed = false;
    isTPressed = false;
  }
});

// 监听按键释放事件
document.addEventListener('keyup', function(event) {
  // 检查是否释放了 Command 键
  if (event.keyCode === 91) {
    isCommandPressed = false;
  }

  // 检查是否释放了 Option 键
  if (event.keyCode === 18) {
    isOptionPressed = false;
  }

  // 检查是否释放了 T 键
  if (event.keyCode === 84) {
    isTPressed = false;
  }
});