Greasy Fork 还支持 简体中文。

Gnome Extensions tweaks

opens extension pages in the new tab and changes a sort type of the extensions list

Od 25.05.2020.. Pogledajte najnovija verzija.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name            Gnome Extensions tweaks
// @namespace       almaceleste
// @version         0.4.1
// @description     opens extension pages in the new tab and changes a sort type of the extensions list
// @description:ru  открывает страницы расширений в новой вкладке и изменяет сортировку списка расширений
// @author          (ɔ) Paola Captanovska
// @license         AGPL-3.0; http://www.gnu.org/licenses/agpl.txt
// @icon            https://cdn1.iconfinder.com/data/icons/system-shade-circles/512/gnome-32.png
// @icon64          https://cdn1.iconfinder.com/data/icons/system-shade-circles/512/gnome-128.png

// @homepageURL     https://greasyfork.org/en/users/174037-almaceleste
// @homepageURL     https://openuserjs.org/users/almaceleste
// @homepageURL     https://github.com/almaceleste/userscripts
// @supportURL      https://github.com/almaceleste/userscripts/issues

// @require         https://code.jquery.com/jquery-3.3.1.js
// @require         https://openuserjs.org/src/libs/sizzle/GM_config.js
// @grant           GM_getValue
// @grant           GM_setValue
// @grant           GM_registerMenuCommand

// @match           https://extensions.gnome.org/
// @match           https://extensions.gnome.org/#sort*
// ==/UserScript==

// ==OpenUserJS==
// @author almaceleste
// ==/OpenUserJS==

const extensionsdiv = 'extensions-list';
const extensionslist = 'extensions';
const extensionlink = 'a.title-link';
const navbarbtn = '#navbar-wrapper a:contains("Extensions")';

const configId = 'getweaksCfg';
const windowcss = `
    #${configId} {
        background-color: darkslategray;
        color: whitesmoke;
    }
    #${configId} a,
    #${configId} button,
    #${configId} input,
    #${configId} select,
    #${configId} select option,
    #${configId} .section_desc {
        color: whitesmoke !important;
    }
    #${configId} button,
    #${configId} select,
    #${configId} select option,
    #${configId} .section_desc {
        background-color: #333;
        border: 1px solid #222;
    }
    #${configId} button{
        height: 1.65em !important;
    }
    #${configId}_header {
        font-size: 1.3em !important;
    }
    #${configId}_buttons_holder {
        position: fixed;
        width: 97%;
        bottom: 0;
    }
    #${configId} .reset_holder {
        float: left;
        position: relative;
        bottom: -1em;
    }
    #${configId} .saveclose_buttons {
        margin: .7em;
    }
    #${configId}_field_url {
        background: none !important;
        border: none;
        cursor: pointer;      
        padding: 0 !important;
        text-decoration: underline;
    }
    #${configId}_field_url:hover,
    #${configId}_resetLink:hover {
        filter: drop-shadow(0 0 1px dodgerblue);
    }
`;
const iframecss = `
    height: 15em;
    width: 30em;
    border: 1px solid;
    border-radius: 3px;
    position: fixed;
    z-index: 999;
`;

GM_registerMenuCommand(`${GM_info.script.name} Settings`, () => {
	GM_config.open();
    GM_config.frame.style = iframecss;
});

GM_config.init({
    id: `${configId}`,
    title: `${GM_info.script.name} ${GM_info.script.version}`,
    fields: {
        extensionlink: {
            section: ['', 'Settings'],
            label: 'open extension links in new tab',
            labelPos: 'right',
            type: 'checkbox',
            default: true,
        },
        sorttype: {
            label: 'extension list sort type',
            labelPos: 'left',
            type: 'select',
            options: ['name', 'recent', 'downloads', 'popularity'],
            default: 'recent',
        },
        url: {
            section: ['', 'Support'],
            label: 'almaceleste.github.io',
            title: 'more info on almaceleste.github.io',
            type: 'button',
            click: () => {
                GM_openInTab('https://almaceleste.github.io', {
                    active: true,
                    insert: true,
                    setParent: true
                });
            }
        },
    },
    css: windowcss,
    events: {
        save: function() {
            GM_config.close();
        }
    },
});

(function() {
    'use strict';

    const sorttype = '#sort=' + GM_config.get('sorttype');
    if (window.location.pathname == '/'){
        window.location.hash = sorttype;
    }

    $(document).ready(() => {
        if(GM_config.get('extensionlink')) {
            var targetNode, callback, observer;
            var config = {childList: true};
            targetNode = document.getElementById(extensionsdiv);
            callback = function(e){
                if(e.nodeName == 'UL' && e.className == extensionslist){
                    observer.disconnect();
                    $(extensionlink).attr('target', '_blank');
                }
            };

            observer = new MutationObserver(function(mutations) {
                for(var m of mutations) {
                    m.addedNodes.forEach(callback);
                }
            });

            observer.observe(targetNode, config);
        }
    });
})();