js-tampermonkey-public-scripts/TryShowDockerFileTag.user.js
Unkas Amanjolov 42b29defae first commit
2024-10-07 10:25:50 +05:00

31 lines
1.1 KiB
JavaScript

// ==UserScript==
// @name TryShowDockerFileTag
// @namespace https://github.com/le91
// @version 1.0.0
// @description Попробовать показать вкладку DockerFile
// @author You
// @match https://hub.docker.com/r/*
// @match https://hub.docker.com/u/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=docker.com
// @grant none
// ==/UserScript==
(function() {
window.onload = setTimeout(function() {
// Ваш код скрипта здесь
const v_default = document.querySelector(".MuiTabs-flexContainer").innerHTML
const parts = window.location.href.split('/');
const baseUrl = parts.slice(0, 6).join('/') + '/DockerFile';
var v_dockerfile = document.querySelector(".MuiTabs-flexContainer > a:nth-child(2)").outerHTML
v_dockerfile = v_dockerfile.replace('tabindex="-1"','tabindex="-2"').replace('>Tags<','>DockerFile<')
var replacedText = v_dockerfile.replace(/href="[^"]*"/, 'href="' + baseUrl + '"');
document.querySelector(".MuiTabs-flexContainer").innerHTML = v_default + replacedText
}, 3000);
})();