Ver código fonte

got rid of the ticks in the viewspecs window, they were overcomplicating

Juan-789 3 meses atrás
pai
commit
70baf57789
1 arquivos alterados com 6 adições e 25 exclusões
  1. 6 25
      src/templates/html.rs

+ 6 - 25
src/templates/html.rs

@@ -141,16 +141,12 @@ fn header(title: &str, css_path: &str) -> String {
             }}
         }}
 
-        function refreshPage() {{
-            localStorage.setItem('scrollPosition', window.scrollY);
-            localStorage.setItem('blankLinesVisible', blankLinesVisible);
-            localStorage.setItem('numberingVisible', numberingVisible);
-            location.reload();
-        }}
+
 
         function openNewWindow() {{
-            const newWindow = window.open('', '', 'width=400,height=300');
+            const newWindow = window.open('', '', 'width=250,height=200');
             const popupContent = `
+                <!DOCTYPE html>
                 <html>
                 <head>
                     <title>Viewspecs</title>
@@ -187,26 +183,11 @@ fn header(title: &str, css_path: &str) -> String {
                     <div class="popup-content">
                         <fieldset>
                             <legend>Show</legend>
-                            <label><input type="checkbox" id="blankLines"> Blank lines (y/z)</label>
-                            <label><input type="checkbox" id="numbering" checked> Numbering (m/n)</label>
+                            <label> Blank lines (y/z)</label>
+                            <label> Numbering (m/n)</label>
                         </fieldset>
                         <button class="accept-button" onclick="window.close()">Accept</button>
                     </div>
-                    <script>
-                        const mainWindow = window.opener;
-                        document.getElementById('blankLines').checked = mainWindow.blankLinesVisible;
-                        document.getElementById('numbering').checked = mainWindow.numberingVisible;
-
-                        document.getElementById('blankLines').addEventListener('change', function() {{
-                            mainWindow.blankLinesVisible = this.checked;
-                            mainWindow.applyBlankLinesVisibility();
-                        }});
-
-                        document.getElementById('numbering').addEventListener('change', function() {{
-                            mainWindow.numberingVisible = this.checked;
-                            mainWindow.applyNumberingVisibility();
-                        }});
-
                 </body>
                 </html>
             `;
@@ -227,7 +208,7 @@ fn header(title: &str, css_path: &str) -> String {
             jumpButton.addEventListener('click', jumpToItem);
 
             // Apply stored states on load
-            blankLinesVisible = JSON.parse(localStorage.getItem('blankLinesVisible') || 'false');
+            blankLinesVisible = JSON.parse(localStorage.getItem('blankLinesVisible') || 'true');
             numberingVisible = JSON.parse(localStorage.getItem('numberingVisible') || 'true');
             applyBlankLinesVisibility();
             applyNumberingVisibility();