MCPcopy Index your code
hub / github.com/ocsjs/ocsjs / createGuide

Function createGuide

packages/scripts/src/projects/common.ts:1711–1823  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1709}
1710
1711const createGuide = () => {
1712 const showProjectDetails = (project: Project) => {
1713 $modal.simple({
1714 title: project.name,
1715 width: 800,
1716 content: h('div', [
1717 h('div', [
1718 '运行域名:',
1719 ...(project.domains || []).map((d) =>
1720 h(
1721 'a',
1722 { href: d.startsWith('http') ? d : 'https://' + d, target: '_blank', style: { margin: '0px 4px' } },
1723 d
1724 )
1725 )
1726 ]),
1727 h('div', '脚本列表:'),
1728 h(
1729 'ul',
1730 Object.keys(project.scripts)
1731 .sort((a, b) => (project.scripts[b].hideInPanel ? -1 : 1))
1732 .map((key) => {
1733 const script = project.scripts[key];
1734 return h(
1735 'li',
1736 [
1737 h('b', script.name),
1738 $ui.notes([
1739 h('span', ['操作面板:', script.hideInPanel ? '隐藏' : '显示']),
1740
1741 [
1742 '运行页面:',
1743 h(
1744 'ul',
1745 script.matches
1746 .map((m) => (Array.isArray(m) ? m : (['无描述', m] as [string, string | RegExp])))
1747 .map((i) =>
1748 h('li', [
1749 i[0],
1750 ':',
1751 i[1] instanceof RegExp ? i[1].toString().replace(/\\/g, '').slice(1, -1) : h('span', i[1])
1752 ])
1753 )
1754 )
1755 ]
1756 ])
1757 ],
1758 (li) => {
1759 li.style.marginBottom = '12px';
1760 }
1761 );
1762 }),
1763 (ul) => {
1764 ul.style.padding = '12px 24px';
1765 ul.style.border = '1px solid #e1e1e1';
1766 ul.style.borderRadius = '4px';
1767 ul.style.maxHeight = '400px';
1768 ul.style.overflow = 'auto';

Callers 1

onrenderFunction · 0.85

Calls 1

showProjectDetailsFunction · 0.85

Tested by

no test coverage detected