Ikun Scripts

Menu: Copy Page Title

ikun · 1.0.0 · Installs 0 · Today 0 · Updated 2026-09-20 13:50

Script language Simplified Chinese · Also Simplified Chinese, Indonesian, Japanese, Korean, Traditional Chinese

Adds a userscript menu item to copy the page title (GM_registerMenuCommand demo).

Install

Opening the URL above in Ikun Browser asks you to install. Update checks use the same URL.

Version history

Namespace https://scripts.ikunbrowser.com/demo/copy-title

Matches

Grants

Source

// ==UserScript==
// @name               菜单:复制页面标题
// @name:zh-Hans       菜单:复制页面标题
// @name:zh-Hant       選單:複製頁面標題
// @name:en            Menu: Copy Page Title
// @name:ja            メニュー:ページタイトルをコピー
// @name:ko            메뉴: 페이지 제목 복사
// @name:id            Menu: Salin Judul Halaman
// @namespace          https://scripts.ikunbrowser.com/demo/copy-title
// @version            1.0.0
// @description        在用户脚本菜单里提供「复制标题」,演示 GM_registerMenuCommand
// @description:zh-Hans 在用户脚本菜单里提供「复制标题」,演示 GM_registerMenuCommand
// @description:zh-Hant 在使用者腳本選單裡提供「複製標題」,示範 GM_registerMenuCommand
// @description:en     Adds a userscript menu item to copy the page title (GM_registerMenuCommand demo).
// @description:ja     ユーザースクリプトメニューからタイトルをコピーします(GM_registerMenuCommand のデモ)。
// @description:ko     사용자 스크립트 메뉴에서 제목을 복사합니다(GM_registerMenuCommand 데모).
// @description:id     Item menu skrip untuk menyalin judul (demo GM_registerMenuCommand).
// @author             ikun
// @match              *://*/*
// @grant              GM_registerMenuCommand
// @grant              GM_setClipboard
// @license            MIT
// ==/UserScript==

(function () {
  'use strict';
  function copyTitle() {
    var text = document.title || location.href;
    if (typeof GM_setClipboard === 'function') {
      GM_setClipboard(text);
      return;
    }
    if (navigator.clipboard && navigator.clipboard.writeText) {
      navigator.clipboard.writeText(text);
    }
  }
  if (typeof GM_registerMenuCommand === 'function') {
    GM_registerMenuCommand('复制页面标题 / Copy title', copyTitle);
  }
})();