Github.io show source

Go to source code of a github.io page. Source code on https://github.com/LuisMayo/general-userscripts/

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Github.io show source
// @namespace    LuisMayo
// @version      0.1
// @description  Go to source code of a github.io page. Source code on https://github.com/LuisMayo/general-userscripts/
// @author       LuisMayo
// @match        https://*.github.io/*
// ==/UserScript==

(function() {
    'use strict';
    const container = document.createElement('a');
    container.style.position = 'absolute';
    container.style.right = '20px';
    container.style.top = '20px';
    container.style.zIndex = '1';
    container.style.backgroundColor = 'black';
    container.style.cursor = 'pointer';
    const goToGithubButton = document.createElement('span');
    goToGithubButton.style.border = '2px solid antiquewhite';
    goToGithubButton.style.backgroundColor = 'antiquewhite';
    goToGithubButton.style.borderRightColor = 'cornsilk';
    goToGithubButton.textContent = 'Open Source Code on github';
    goToGithubButton.addEventListener('click', (ev) => {
        const root = "https://github.com"
        const accountName = location.hostname.substring(0, location.hostname.indexOf('.'));
        const projectName = location.pathname.length > 1 ? location.pathname : location.hostname;
        window.open(root + '/' + accountName + '/' + projectName);
    });
    container.appendChild(goToGithubButton);
    const dismissLink = document.createElement('a');
    dismissLink.style.border = '2px solid antiquewhite';
    dismissLink.style.backgroundColor = 'antiquewhite';
    dismissLink.textContent = 'Dismiss';
    dismissLink.addEventListener('click', (ev) => container.remove());
    container.appendChild(dismissLink);
    document.body.appendChild(container);
})();