您需要先安装一个扩展,例如 篡改猴、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 *://github.com/*
- // @grant none
- // @license MIT
- // ==/UserScript==
- (window.onload = function() {
- "use strict";
- var a = document.getElementsByClassName('btn ml-2 d-none d-md-block')[0];
- var set_interval_id = setInterval(function() {
- try{
- a.parentNode;
- clearInterval(set_interval_id);
- } catch (error) {
- // None
- }
- }, 1000);
- const owner = document.getElementsByClassName('url fn')[0].textContent;
- const pjname = document.getElementsByClassName('mr-2 flex-self-stretch')[0].textContent.trim();
- const repo = 'https://github.com/' + owner + '/' + pjname;
- var b = document.createElement('a');
- b.className = 'btn btn-info';
- b.setAttribute('target', '_blank');
- b.href = 'http://twitter.com/share?url=' + repo + '&text=[write comments]%0a%0a';
- b.textContent = 'Share to Twitter';
- a.parentNode.insertBefore(b, a);
- }());
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址