您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Groups distributive links into OS-specific containers
当前为
// ==UserScript== // @name 1C distributives grouper // @description Groups distributive links into OS-specific containers // @version 0.4 // @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, addSelectorRow = 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); if (addSelectorRow) { const row = document.createElement('div'); row.className = 'row-fluid'; div.append(row); } return div; } function addTabAndPane(id, title, active = false, addSelectorRow = false) { addTab(id, title, active); return addPane(id, active, addSelectorRow); } function addOption(select, value, title) { const option = document.createElement('option'); option.setAttribute('value', value); option.textContent = title; select.append(option); } function addArchSelector(pane) { const row = pane.querySelector('.row-fluid'); const span = document.createElement('div'); span.className = 'span3'; if (row === null) { pane.append(span); } else { row.append(span); } const label = document.createElement('label'); label.setAttribute('for', 'arch-select'); label.textContent = 'Arch:'; span.append(label); const select = document.createElement('select'); select.setAttribute('id', 'arch-select'); span.append(select); addOption(select, 'all', 'all'); addOption(select, '86', 'x86'); addOption(select, '64', 'x64'); select.onchange = (event) => { const value = select.selectedOptions[0].value; if (value === 'all') { pane.querySelectorAll('.formLine').forEach((e) => { e.style.display = "block"; }); } else if (value === '86') { pane.querySelectorAll('.formLine').forEach((e) => { if (/.*64-bit.*/i.test(e.querySelector('a').innerText)) { e.style.display = "none"; } else { e.style.display = "block"; } }); } else { pane.querySelectorAll('.formLine').forEach((e) => { if (/.*64-bit.*/i.test(e.querySelector('a').innerText)) { e.style.display = "block"; } else { e.style.display = "none"; } }); } }; } const cCont = addTabAndPane('common', 'Common', true, true); addArchSelector(cCont); const wCont = addTabAndPane('windows', 'Windows', false, true); addArchSelector(wCont); const lCont = addTabAndPane('linux', 'Linux', false, true); addArchSelector(lCont); 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)) { lCont.append(e) } else if (/.*MacOS.*/i.test(a.innerText)) { mCont.append(e) } else { oCont.append(e) } }); })();