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

54 lines
2.1 KiB
JavaScript

// ==UserScript==
// @name Test 01 go link
// @namespace http://tampermonkey.net/
// @version 2024-07-23
// @description try to take over the world!
// @author You
// @match https://traefik-sdsdcrsoita9e6uknkyn.skynet.kz/dashboard/
// @icon https://www.google.com/s2/favicons?sz=64&domain=skynet.kz
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Функция для добавления ссылки
function addLink(element, url) {
const link = document.createElement('a');
link.href = url;
link.target = '_blank';
link.textContent = 'Open Link';
const div = document.createElement('div');
div.style.marginBottom = '10px'; // Добавляем отступ для красоты
div.appendChild(link);
element.parentNode.insertBefore(div, element);
}
// Функция для обработки каждой строки таблицы
function processTableRows() {
const rows = document.querySelectorAll('tbody > tr');
rows.forEach(row => {
const hostCell = row.querySelector('.app-chip-rule');
if (hostCell && hostCell.textContent.includes('Host(`oraclexe.skynet.kz`)')) {
const entryPointCell = row.querySelector('.app-chip-entry-points');
if (entryPointCell) {
const entryPoint = entryPointCell.textContent.trim();
const hostText = hostCell.textContent.replace('Host(', '').replace(')', '').trim();
let url;
if (entryPoint === 'http') {
url = `http://${hostText}`;
} else if (entryPoint === 'https') {
url = `https://${hostText}`;
}
if (url) {
addLink(hostCell, url);
}
}
}
});
}
// Запускаем обработку после загрузки страницы
window.addEventListener('load', processTableRows);
})();