Skip to content

Commit

Permalink
Allow editing front page as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
kildom committed Mar 1, 2024
1 parent 54f2927 commit 51ea98d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 42 deletions.
4 changes: 3 additions & 1 deletion docs/tmpl/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ async function editPage() {
await addScript('https://cdn.jsdelivr.net/npm/diff2html/bundles/js/diff2html-ui.min.js');
await addScript('https://cdnjs.cloudflare.com/ajax/libs/jsdiff/5.2.0/diff.js');
diffTarget = document.createElement('div');
textDiv.parentElement.insertBefore(diffTarget, textDiv);
diffTarget.style.background = 'white';
diffTarget.style.color = 'black';
textDiv.parentElement.appendChild(diffTarget);
setInterval(checkUpdates, 200);
}
}
86 changes: 45 additions & 41 deletions docs/tmpl/index.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
<script src="con-reg-exp.min.js"></script>
<script src="docs.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.css">
Expand All @@ -11,57 +12,60 @@
<link rel="stylesheet" href="index.css">
</head>
<body>
<div id="menu">
<%= menu.join('') %>
</div>
<div id="content">
<div id="title"><%= title %></div>
<div id="subtitle">
<div id="feature-container">
<div id="feature-list">
<%= subtitleList.map(x => `<div class="feature">${x}</div>`).join('') %>
<div style="position: fixed; top: 0px; left: 0px; z-index: 20000; width: 4px; height: 4px;" onclick="editPage()"></div>
<div id="text-content">
<div id="menu">
<%= menu.join('') %>
</div>
<div id="content">
<div id="title"><%= title %></div>
<div id="subtitle">
<div id="feature-container">
<div id="feature-list">
<%= subtitleList.map(x => `<div class="feature">${x}</div>`).join('') %>
</div>
</div>
<div id="feature-ending"><%= subtitleEnding %></div>
</div>
<div id="feature-ending"><%= subtitleEnding %></div>
</div>
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<% for (sample of samples) { %>
<div class="swiper-slide">
<div class="sample">
<pre class="sample-title language-javascriptwithcre">// <%- sample.title %></pre>
<div class="sample-part">Classic</div>
<pre
class="sample-code language-javascriptwithcre"><%- sample.regexp %></pre>
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<% for (sample of samples) { %>
<div class="swiper-slide">
<div class="sample">
<pre class="sample-title language-javascriptwithcre">// <%- sample.title %></pre>
<div class="sample-part">Classic</div>
<pre
class="sample-code language-javascriptwithcre"><%- sample.regexp %></pre>

<div class="sample-part">Convenient Regular Expressions</div>
<pre class="sample-code language-javascriptwithcre"><%- sample.code %></pre>
<div class="sample-part">Convenient Regular Expressions</div>
<pre class="sample-code language-javascriptwithcre"><%- sample.code %></pre>
</div>
</div>
<% } %>
</div>
<% } %>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-pagination"></div>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-pagination"></div>
</div>
</div>
<div id="details">
<% for (let section of sections) { let className = section.simple && section.sub.length > 4 ? 'benefit' : 'step' %>
<div class="benefits-header" id="<%- getHtmlId(section.title) %>">
<%= section.title %>
</div>
<div class="benefits">
<% for (let sub of section.sub) { %>
<div class="<%= className %>" id="<%- getHtmlId(sub.title) %>">
<div class="benefit-title"><%= sub.title %></div>
<div class="benefit-description">
<%= sub.html %>
<div id="details">
<% for (let section of sections) { let className = section.simple && section.sub.length > 4 ? 'benefit' : 'step' %>
<div class="benefits-header" id="<%- getHtmlId(section.title) %>">
<%= section.title %>
</div>
<div class="benefits">
<% for (let sub of section.sub) { %>
<div class="<%= className %>" id="<%- getHtmlId(sub.title) %>">
<div class="benefit-title"><%= sub.title %></div>
<div class="benefit-description">
<%= sub.html %>
</div>
</div>
</div>
<% } %>
</div>
<% } %>
</div>
<% } %>
<div id="copyright"><%= copy %></div>
</div>
<div id="copyright"><%= copy %></div>
</body>
</html>

0 comments on commit 51ea98d

Please sign in to comment.