Greasy Fork is available in English.

获取 Github 当前仓库唯一标识

定义函数 getGithubId() 获取当前仓库唯一标识,例如:talelin/lin-ui

此脚本不应被直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/421765/901113/%E8%8E%B7%E5%8F%96%20Github%20%E5%BD%93%E5%89%8D%E4%BB%93%E5%BA%93%E5%94%AF%E4%B8%80%E6%A0%87%E8%AF%86.js

// ==UserScript==
// @name         获取 Github 当前仓库唯一标识
// @namespace    https://juzibiji.top/
// @version      1.0.0
// @icon         https://cdn.juzibiji.top/img/20210216152424.png
// @description  定义函数 getGithubId() 获取当前仓库唯一标识,例如:talelin/lin-ui
// @author       桔子
// @match        https://github.com/*
// @grant        none
// ==/UserScript==

/**
* 获取当前仓库唯一标识
*/
function getGithubId() {
    const strArray = location.pathname.split("/");
    return `${strArray[1]}/${strArray[2]}`;
}