-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopup.html
More file actions
187 lines (175 loc) · 8.73 KB
/
Copy pathpopup.html
File metadata and controls
187 lines (175 loc) · 8.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Substack to Markdown</title>
<link rel="stylesheet" href="popup.css">
</head>
<body>
<div class="container">
<!-- Header -->
<div class="header-row">
<div class="brand">
<span class="header-logo">📝</span>
<h1>Substack to Markdown</h1>
</div>
<button id="settingsBtn" class="icon-button" title="Settings">
<svg viewBox="0 0 24 24"><path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58a.48.48 0 0 0 .12-.61l-1.92-3.32a.49.49 0 0 0-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54a.484.484 0 0 0-.48-.41H9.08a.48.48 0 0 0-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96a.48.48 0 0 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.04.64.09.94l-2.03 1.58a.48.48 0 0 0-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.57 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/></svg>
</button>
</div>
<!-- Loading Skeleton -->
<div id="loadingState" style="display: none;">
<div class="skeleton-card"></div>
<div class="skeleton-row">
<div class="skeleton-btn"></div>
<div class="skeleton-btn"></div>
</div>
<div class="skeleton-grid">
<div class="skeleton-box"></div>
<div class="skeleton-box"></div>
<div class="skeleton-box"></div>
<div class="skeleton-box"></div>
</div>
</div>
<!-- Empty State -->
<div id="emptyState" style="display: none;" class="empty-state">
<div class="empty-icon">📄</div>
<h3 class="empty-title">No Article Detected</h3>
<p class="empty-desc">
Please open a Substack article page to use this extension.
</p>
<button id="retryBtn" class="button button-primary" style="width: auto; margin: 0 auto;">
Retry Detection
</button>
</div>
<!-- Status Toast (Hidden by default) -->
<div id="status" class="status" style="display: none;"></div>
<!-- Settings Drawer -->
<div id="settingsPanel" class="settings-drawer">
<div class="settings-section">
<h4 class="settings-title">General</h4>
<div class="setting-item">
<span class="setting-label">Filename</span>
<select id="filenameFormat" class="setting-input">
<option value="title-date">Title-Date</option>
<option value="date-title">Date-Title</option>
<option value="author-title">Author-Title</option>
</select>
</div>
</div>
<div class="settings-section">
<h4 class="settings-title">Markdown / Obsidian</h4>
<label class="setting-item checkbox-wrapper">
<input type="checkbox" id="useFrontmatter" checked>
<span>Include Frontmatter</span>
</label>
<div class="setting-item" id="frontmatterTemplateContainer" style="display:none; margin-top:8px;">
<textarea id="frontmatterTemplate" class="setting-textarea" placeholder="tags: [substack] status: unread" rows="3"></textarea>
<div class="setting-hint">Variables: {title}, {url}, {date}, {author}</div>
</div>
</div>
<div class="settings-section">
<h4 class="settings-title">PDF Export</h4>
<div class="setting-row">
<label class="checkbox-wrapper">
<input type="checkbox" id="pdfShowCover" checked>
<span>Cover</span>
</label>
<label class="checkbox-wrapper">
<input type="checkbox" id="pdfShowFootnotes" checked>
<span>Footnotes</span>
</label>
</div>
<div class="setting-item">
<span class="setting-label">Font Size</span>
<select id="pdfFontSize" class="setting-input">
<option value="10">Small (10pt)</option>
<option value="11" selected>Medium (11pt)</option>
<option value="13">Large (13pt)</option>
</select>
</div>
<div class="setting-item">
<span class="setting-label">Font Family</span>
<select id="pdfFontFamily" class="setting-input">
<option value="default" selected>Auto (Smart Detect)</option>
<option value="Roboto">English (Roboto)</option>
<option value="NotoSerifSC">Chinese (Noto Serif SC)</option>
</select>
<div class="setting-hint">Auto: Roboto for English (Bold supported), Noto for Chinese.</div>
</div>
</div>
</div>
<!-- Article Info Section -->
<div id="articleInfo" style="display: none;">
<!-- Immersive Article Card -->
<div class="article-card">
<img class="article-bg" id="articleCover" src="" alt="Cover">
<div class="article-details">
<h3 id="articleTitle">-</h3>
<div class="article-meta">
<span id="articleAuthor">-</span>
<span class="meta-sep">•</span>
<span id="articleDate">-</span>
</div>
</div>
</div>
<!-- Primary Actions: Side by Side -->
<div class="primary-actions">
<button id="extractBtn" class="button button-primary">
<svg viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>
<span class="btn-label">Markdown</span>
</button>
<button id="pdfDirectBtn" class="button button-primary">
<svg viewBox="0 0 24 24"><path d="M20 2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 7.5c0 .83-.67 1.5-1.5 1.5H9v2H7.5V7H10c.83 0 1.5.67 1.5 1.5v1zm5 2c0 .83-.67 1.5-1.5 1.5h-2.5V7H15c.83 0 1.5.67 1.5 1.5v3zm4-3H19v1h1.5V11H19v2h-1.5V7h3v1.5zM9 9.5h1v-1H9v1zM4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm10 5.5h1v-3h-1v3z"/></svg>
<span class="btn-label">PDF</span>
</button>
</div>
<!-- Secondary Actions: 4-col Grid -->
<div class="secondary-actions-grid">
<button id="copyBtn" class="tool-button" title="Copy to Clipboard">
<svg viewBox="0 0 24 24"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>
<span>Copy</span>
</button>
<button id="extractZipBtn" class="tool-button" title="Download ZIP">
<svg viewBox="0 0 24 24"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm2 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"/></svg>
<span>ZIP</span>
</button>
<button id="obsidianBtn" class="tool-button obsidian" title="Save to Obsidian">
<svg viewBox="0 0 24 24"><path d="M20.36 10.66l-6.21-8.54c-.5-.69-1.5-.69-2 0L5.94 10.66c-.66.91-.01 2.21 1.12 2.21h2.38v6.5c0 .83.67 1.5 1.5 1.5h4.25c.83 0 1.5-.67 1.5-1.5v-6.5h2.38c1.13 0 1.78-1.3 1.12-2.21z"/></svg>
<span>Obsidian</span>
</button>
<button id="pdfBtn" class="tool-button" title="Print to PDF">
<svg viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>
<span>Print</span>
</button>
<button id="previewBtn" class="tool-button" title="Preview Markdown">
<svg viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>
<span>Preview</span>
</button>
</div>
<!-- Preview Modal -->
<div id="previewModal" class="modal" style="display: none;">
<div class="modal-content">
<div class="modal-header">
<h3>Markdown Preview</h3>
<button id="closePreviewBtn" class="icon-button">
<svg viewBox="0 0 24 24"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</div>
<div id="markdownPreview" class="preview"></div>
</div>
</div>
</div>
<div class="footer">
Powered By Activer - v1.1.6
</div>
</div>
<script src="lib/jszip.min.js"></script>
<script src="libs/marked.min.js"></script>
<script src="libs/pdfmake.min.js"></script>
<script src="libs/vfs_fonts.js"></script>
<script src="utils/markdown-pdf.js"></script>
<script src="popup.js"></script>
</body>
</html>