-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrenderer.js
More file actions
281 lines (265 loc) · 9.17 KB
/
renderer.js
File metadata and controls
281 lines (265 loc) · 9.17 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
const resources = [
{
name: "Grammarly",
category: "writing",
description: "AI-powered writing assistant for grammar, spelling, and style improvements.",
url: "https://www.grammarly.com"
},
{
name: "Scrivener",
category: "writing",
description: "Professional writing software for authors, screenwriters, and academics.",
url: "https://www.literatureandlatte.com/scrivener/overview"
},
{
name: "Hemingway Editor",
category: "writing",
description: "Makes your writing bold and clear by highlighting complex sentences.",
url: "https://hemingwayapp.com"
},
{
name: "Google Docs",
category: "writing",
description: "Free, cloud-based word processor with real-time collaboration features.",
url: "https://docs.google.com"
},
{
name: "ProWritingAid",
category: "writing",
description: "In-depth writing analysis with style, grammar, and readability reports.",
url: "https://prowritingaid.com"
},
{
name: "Penguin Random House",
category: "publishing",
description: "One of the world's largest English-language trade book publishers.",
url: "https://www.penguinrandomhouse.com"
},
{
name: "HarperCollins",
category: "publishing",
description: "Major publishing house with diverse imprints for all genres.",
url: "https://www.harpercollins.com"
},
{
name: "QueryTracker",
category: "publishing",
description: "Comprehensive database of literary agents and their submission guidelines.",
url: "https://querytracker.net"
},
{
name: "Publishers Marketplace",
category: "publishing",
description: "Essential resource for publishing professionals with deal announcements and industry news.",
url: "https://www.publishersmarketplace.com"
},
{
name: "Manuscript Wish List",
category: "publishing",
description: "Find agents and editors actively seeking the kind of book you're writing.",
url: "https://www.manuscriptwishlist.com"
},
{
name: "Amazon KDP",
category: "self-publishing",
description: "Kindle Direct Publishing — self-publish eBooks and paperbacks for free.",
url: "https://kdp.amazon.com"
},
{
name: "IngramSpark",
category: "self-publishing",
description: "Professional self-publishing platform with global distribution.",
url: "https://www.ingramspark.com"
},
{
name: "Draft2Digital",
category: "self-publishing",
description: "Simplified ebook and print book publishing to multiple retailers.",
url: "https://www.draft2digital.com"
},
{
name: "BookBaby",
category: "self-publishing",
description: "Complete self-publishing services including editing, design, and distribution.",
url: "https://www.bookbaby.com"
},
{
name: "Reedsy",
category: "self-publishing",
description: "Marketplace for professional editors, designers, and marketers for self-published authors.",
url: "https://reedsy.com"
},
{
name: "BookBub",
category: "marketing",
description: "Book discovery service for readers and promotional platform for authors.",
url: "https://www.bookbub.com"
},
{
name: "Goodreads",
category: "marketing",
description: "World's largest site for readers and book recommendations.",
url: "https://www.goodreads.com"
},
{
name: "NetGalley",
category: "marketing",
description: "Service to provide advance reading copies to reviewers and influencers.",
url: "https://www.netgalley.com"
},
{
name: "Canva",
category: "marketing",
description: "Design platform for creating book covers, social media graphics, and promotional materials.",
url: "https://www.canva.com"
},
{
name: "MailerLite",
category: "marketing",
description: "Email marketing platform popular with authors for newsletters and reader funnels.",
url: "https://www.mailerlite.com"
},
{
name: "PrintNinja",
category: "printing",
description: "High-quality offset printing for books, games, and custom products.",
url: "https://printninja.com"
},
{
name: "Printful",
category: "printing",
description: "Print-on-demand service for custom merchandise and books.",
url: "https://www.printful.com"
},
{
name: "Blurb",
category: "printing",
description: "Self-publishing platform specializing in photo books and trade books.",
url: "https://www.blurb.com"
},
{
name: "Lulu",
category: "printing",
description: "Print-on-demand and distribution services for books and calendars.",
url: "https://www.lulu.com"
},
{
name: "48 Hour Books",
category: "printing",
description: "Fast turnaround book printing services for short runs.",
url: "https://www.48hrbooks.com"
},
{
name: "r/writing",
category: "communities",
description: "Reddit's community for writers to discuss craft, publishing, and share experiences.",
url: "https://www.reddit.com/r/writing"
},
{
name: "Absolute Write",
category: "communities",
description: "Online community and forums for writers at all stages of their career.",
url: "https://absolutewrite.com"
},
{
name: "NaNoWriMo",
category: "communities",
description: "National Novel Writing Month — annual writing event and year-round community.",
url: "https://nanowrimo.org"
},
{
name: "Writers Guild of America",
category: "communities",
description: "Professional labor union for writers in film, television, and digital media.",
url: "https://www.wga.org"
},
{
name: "20BooksTo50K",
category: "communities",
description: "Facebook group focused on making a living through self-publishing.",
url: "https://www.facebook.com/groups/20Booksto50k"
}
];
const categoryLabels = {
writing: 'Writing Tools',
publishing: 'Publishing',
'self-publishing': 'Self-Publishing',
marketing: 'Marketing',
printing: 'Printing & Merch',
communities: 'Communities'
};
let currentCategory = 'all';
let currentQuery = '';
function escapeHtml(s) {
return String(s)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
function openLink(url) {
if (window.electronAPI && typeof window.electronAPI.openExternal === 'function') {
window.electronAPI.openExternal(url);
} else {
window.open(url, '_blank', 'noopener,noreferrer');
}
}
function createResourceCard(resource) {
const card = document.createElement('div');
card.className = 'resource-card';
card.dataset.category = resource.category;
const label = categoryLabels[resource.category] || resource.category;
card.innerHTML = `
<span class="category-tag">${escapeHtml(label)}</span>
<h3>${escapeHtml(resource.name)}</h3>
<p>${escapeHtml(resource.description)}</p>
<a href="${escapeHtml(resource.url)}" class="resource-link" rel="noopener noreferrer">Visit</a>
`;
card.addEventListener('click', (e) => {
e.preventDefault();
openLink(resource.url);
});
return card;
}
function displayResources() {
const grid = document.getElementById('resourcesGrid');
const emptyState = document.getElementById('emptyState');
grid.innerHTML = '';
const q = currentQuery.trim().toLowerCase();
const filtered = resources.filter(r => {
if (currentCategory !== 'all' && r.category !== currentCategory) return false;
if (!q) return true;
return (
r.name.toLowerCase().includes(q) ||
r.description.toLowerCase().includes(q) ||
(categoryLabels[r.category] || r.category).toLowerCase().includes(q)
);
});
filtered.forEach(resource => {
grid.appendChild(createResourceCard(resource));
});
if (emptyState) {
emptyState.style.display = filtered.length === 0 ? 'block' : 'none';
}
}
function initializeApp() {
displayResources();
const categoryButtons = document.querySelectorAll('.category-btn');
categoryButtons.forEach(button => {
button.addEventListener('click', () => {
categoryButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
currentCategory = button.dataset.category;
displayResources();
});
});
const searchInput = document.getElementById('searchInput');
if (searchInput) {
searchInput.addEventListener('input', (e) => {
currentQuery = e.target.value;
displayResources();
});
}
}
document.addEventListener('DOMContentLoaded', initializeApp);