Greasy Fork

来自缓存

Greasy Fork is available in English.

Tower任务标题复制

任务标题一键复制功能

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Tower任务标题复制
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  任务标题一键复制功能
// @author       ZJoker
// @match        https://tower.im/teams/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tower.im
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    function copyTitle(e) {
        const contentDiv = e.target.parentNode.nextElementSibling.nextElementSibling
        const title = contentDiv.children[1].innerHTML
        let oInput = document.createElement('input')
        oInput.value = title
        document.body.appendChild(oInput)
        oInput.select()
        document.execCommand('Copy')
        oInput.remove()
    }

    setTimeout(() => {
        const todoList = document.querySelectorAll('.todo-actions')
        todoList.forEach(item => {
            const span = document.createElement('span')
            span.style.cursor = 'pointer'
            span.style.width = '25px'
            span.style.display = 'flex'
            span.style.alignItems = 'center'
            span.style.justifyContent = 'center'
            span.style.height = '100%'
            span.style.outlineColor = '#44acb6'
            span.style.color = '#44acb6'
            span.style.textDecoration = 'none'
            span.style.margin = '0'
            span.style.padding = '0'
            span.style.fontSize = '12px'
            span.style.verticalAlign = 'baseline'
            span.style.background = 'transparent'
            span.title = '复制'
            span.innerHTML = '复制'
            span.addEventListener('click', copyTitle)
            item.appendChild(span)
        })
    }, 1000)


})();