您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a Twitter share button to repository page
当前为
// ==UserScript== // @name GitHub Repo Share-to-Twitter Button // @namespace http://tampermonkey.net/ // @version 0.1 // @description Add a Twitter share button to repository page // @author eggplants // @homepage https://github.com/eggplants // @match https://github.com/*/* // @grant none // @license MIT // ==/UserScript== (window.onload = function() { "use strict"; const description = document.title; const pg_link = location.href; var a = document.getElementsByClassName('pagehead-actions flex-shrink-0 d-none d-md-inline')[0]; var b = document.createElement('a'); b.className = 'btn btn-sm'; b.setAttribute('target', '_blank'); b.href = 'http://twitter.com/share?text="' + description + '"%0a%0a' + pg_link; b.textContent = 'Share to Twitter'; var c = document.createElement('li'); c.appendChild(b); a.insertBefore(c, document.getElementsByClassName('pagehead-actions flex-shrink-0 d-none d-md-inline')[0].children[0]); }());