您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Groups distributive links to OS-specific containers
当前为
- // ==UserScript==
- // @name 1C distributives grouper
- // @description Groups distributive links to OS-specific containers
- // @version 0.2
- // @author Akpaev E.A.
- // @grant none
- // @namespace https://github.com/akpaevj
- // @license MIT
- // @match https://releases.1c.ru/version_files?nick=Platform83*
- // ==/UserScript==
- (function() {
- 'use strict';
- const container = document.createElement('div');
- container.className = 'container tabbale';
- const ul = document.createElement('ul');
- ul.className = 'nav nav-tabs';
- container.append(ul);
- const filesContainer = document.querySelector('.files-container');
- filesContainer.append(container);
- const tabContent = document.createElement('div');
- tabContent.className = 'tab-content';
- container.append(tabContent);
- function addTab(id, title, active = false) {
- const li = document.createElement('li');
- if (active) {
- li.className = 'active';
- }
- ul.append(li);
- const a = document.createElement('a');
- a.setAttribute('href', `#${id}`);
- a.dataset.toggle = 'tab';
- a.textContent = title;
- li.append(a);
- }
- function addPane(id, active = false) {
- const div = document.createElement('div');
- if (active) {
- div.className = 'tab-pane active';
- } else {
- div.className = 'tab-pane';
- }
- div.setAttribute('id', id);
- tabContent.append(div);
- return div;
- }
- function addTabAndPane(id, title, active = false) {
- addTab(id, title, active);
- return addPane(id, active);
- }
- const cCont = addTabAndPane('common', 'Common', true);
- const wCont = addTabAndPane('windows', 'Windows');
- const lCont = addTabAndPane('linux', 'Linux');
- const mCont = addTabAndPane('mac', 'Mac');
- const oCont = addTabAndPane('other', 'Other');
- document.querySelectorAll(".formLine").forEach((e) => {
- const a = e.querySelector('a');
- if (/.*Windows.*/i.test(a.innerText) && (/.*Linux.*/i.test(a.innerText) || /.*MacOS.*/i.test(a.innerText))) {
- cCont.append(e)
- } else if (/.*Windows.*/i.test(a.innerText)) {
- wCont.append(e)
- } else if (/.*Linux.*/i.test(a.innerText)) {
- if (/.*RPM.*/i.test(a.innerText)) {
- lCont.append(e)
- } else {
- lCont.append(e)
- }
- } else if (/.*MacOS.*/i.test(a.innerText)) {
- mCont.append(e)
- } else {
- oCont.append(e)
- }
- });
- })();