Skip to content

Commit f60106b

Browse files
committed
feat: adds tldr support
1 parent 93acfab commit f60106b

3 files changed

Lines changed: 422 additions & 8 deletions

File tree

index.html

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,7 @@ <h1 class="u-mb-none u-mt-none">
246246

247247
<!-- logo section -->
248248
<input type="checkbox" id="logo-checkbox" name="logo-checkbox" />
249-
<label
250-
for="logo-checkbox"
251-
class="c-test"
252-
style="text-decoration: underline; text-decoration-style: dotted"
253-
>Hide</label
254-
>
249+
<label for="logo-checkbox" class="c-test">Hide</label>
255250
<div class="c-auto-grid">
256251
<object
257252
type="image/svg+xml"
@@ -678,6 +673,63 @@ <h5 class="u-mt-none u-text-light">
678673
</include-footer>
679674
<!-- end of footer section -->
680675

676+
<!-- TLDR Generator Button -->
677+
<button
678+
id="tldr-generator-btn"
679+
class="c-tldr-btn"
680+
aria-label="Generate TLDR"
681+
>
682+
Generate TL;DR
683+
</button>
684+
685+
<!-- TLDR Modal -->
686+
<div
687+
id="tldr-modal"
688+
class="c-tldr-modal c-tldr-modal__hidden"
689+
role="dialog"
690+
aria-labelledby="tldr-modal-title"
691+
aria-hidden="true"
692+
>
693+
<div class="c-tldr-modal__overlay">
694+
<div class="sr-only">Choose a style for your summary</div>
695+
</div>
696+
<div class="c-tldr-modal__content">
697+
<h2 id="tldr-modal-title" class="c-tldr-modal__title">
698+
Generate TL;DR
699+
</h2>
700+
<p class="c-tldr-modal__subtitle">Choose a style for your summary</p>
701+
<div class="c-tldr-modal__categories">
702+
<button
703+
class="c-tldr-category u-link-clean"
704+
data-category="professional"
705+
>
706+
<span class="c-tldr-category__title">Professional</span>
707+
<span class="c-tldr-category__desc"
708+
>LinkedIn bios, job applications, networking events</span
709+
>
710+
</button>
711+
<button class="c-tldr-category u-link-clean" data-category="friendly">
712+
<span class="c-tldr-category__title">Friendly</span>
713+
<span class="c-tldr-category__desc"
714+
>Social media bios, friend introductions, casual meetups</span
715+
>
716+
</button>
717+
<button class="c-tldr-category u-link-clean" data-category="dating">
718+
<span class="c-tldr-category__title">Dating</span>
719+
<span class="c-tldr-category__desc"
720+
>Dating app bios, personal connections</span
721+
>
722+
</button>
723+
</div>
724+
<button
725+
class="c-tldr-modal__close u-link-clean"
726+
aria-label="Close modal"
727+
>
728+
close
729+
</button>
730+
</div>
731+
</div>
732+
681733
<!-- linking script sections -->
682734
<script type="text/javascript" src="./script.js" defer></script>
683735
</body>

script.js

Lines changed: 200 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,211 @@ const scrollManager = () => {
162162
});
163163
};
164164

165+
/**
166+
* TLDR Generator functionality
167+
*/
168+
const tldrGenerator = (() => {
169+
let modal, openBtn, closeBtn, categoryButtons;
170+
171+
// Prompt templates for each category - optimized for real-world use cases
172+
const prompts = {
173+
professional: `Visit ${window.location.origin} and analyze the website content. Also check https://github.com/ragarwalll if mentioned.
174+
175+
Create a professional TLDR summary that would be useful for:
176+
- Recruiters scanning LinkedIn profiles
177+
- Hiring managers reviewing candidates
178+
- Potential collaborators or clients
179+
- Networking events and introductions
180+
181+
REQUIREMENTS:
182+
1. Extract key information:
183+
- Current role and company
184+
- Years of experience and career progression
185+
- Core technical skills (be specific: languages, frameworks, tools)
186+
- Notable projects with impact/metrics (downloads, users, etc.)
187+
- Problem-solving approach and work philosophy
188+
- Educational background
189+
190+
2. Format as a concise professional bio (2-3 short paragraphs):
191+
- First paragraph: Current role, experience level, and primary expertise
192+
- Second paragraph: Key achievements, projects, and technical strengths
193+
- Third paragraph (optional): Approach to work, values, or unique differentiators
194+
195+
3. Style guidelines:
196+
- Professional but approachable tone
197+
- Use specific technologies and metrics when available
198+
- Focus on outcomes and impact, not just responsibilities
199+
- Avoid buzzwords and generic statements
200+
- Be authentic to the website's tone
201+
- No emojis
202+
203+
4. Make it scannable and LinkedIn-ready - something that can be copied directly into a professional profile or email introduction.`,
204+
205+
friendly: `Visit ${window.location.origin} and read through the website to understand Rahul's personality and interests.
206+
207+
Create a friendly, casual TLDR that would be useful for:
208+
- Introducing him to new friends or social groups
209+
- Social media bios (Twitter, Instagram, etc.)
210+
- Casual networking or meetups
211+
- When someone asks "tell me about yourself" in a non-professional setting
212+
213+
REQUIREMENTS:
214+
1. Extract key information:
215+
- Personal background and story
216+
- Hobbies, interests, and passions
217+
- Personality traits and quirks
218+
- Creative pursuits and adventures
219+
- What makes him interesting as a person
220+
- Projects mentioned casually (not too technical)
221+
222+
2. Format as a friendly introduction (2-3 paragraphs):
223+
- First paragraph: Who he is and what he's passionate about
224+
- Second paragraph: Interests, hobbies, and personality highlights
225+
- Third paragraph: Fun facts or what makes him unique
226+
227+
3. Style guidelines:
228+
- Warm, conversational, and approachable
229+
- Light humor is welcome
230+
- Focus on personality over professional achievements
231+
- Use casual language but stay authentic
232+
- Can include emojis sparingly if it fits the tone
233+
- Make it relatable and human
234+
235+
4. Make it something a friend would say when introducing him - natural, engaging, and easy to remember.`,
236+
237+
dating: `Visit ${window.location.origin} and analyze the website to understand Rahul's personality, interests, and what makes him interesting.
238+
239+
Create an engaging dating profile TLDR that would be useful for:
240+
- Dating apps (Hinge, Bumble, Tinder bios)
241+
- Social introductions in dating contexts
242+
- Personal connection and attraction
243+
244+
REQUIREMENTS:
245+
1. Extract key information:
246+
- Age and location (if mentioned)
247+
- Unique hobbies and interests
248+
- Personality traits and energy
249+
- Creative pursuits and adventures
250+
- What makes him stand out
251+
- Balance of professional and personal life
252+
- Values and what matters to him
253+
254+
2. Format as an attractive dating profile (2-3 short paragraphs):
255+
- First paragraph: Engaging hook that shows personality and confidence
256+
- Second paragraph: Interests, passions, and what he enjoys doing
257+
- Third paragraph: What makes him interesting or what he's looking for (if appropriate)
258+
259+
3. Style guidelines:
260+
- Confident but not arrogant
261+
- Authentic and genuine
262+
- Playful and charming
263+
- Show personality, not just list facts
264+
- Avoid clichés ("I love travel and food")
265+
- Be specific about interests
266+
- Light humor and wit are welcome
267+
- Emotionally intelligent tone
268+
269+
4. Make it appealing and authentic - something that would make someone want to know more about him. Focus on what makes him interesting as a person, not just his job.`,
270+
};
271+
272+
const openModal = () => {
273+
console.log("Opening modal", modal);
274+
if (modal) {
275+
modal.setAttribute("aria-hidden", "false");
276+
modal.classList.remove("c-tldr-modal__hidden");
277+
document.body.style.overflow = "hidden";
278+
} else {
279+
console.error("Modal not found when trying to open");
280+
}
281+
};
282+
283+
const closeModal = () => {
284+
if (modal) {
285+
modal.setAttribute("aria-hidden", "true");
286+
modal.classList.add("c-tldr-modal__hidden");
287+
document.body.style.overflow = "";
288+
}
289+
};
290+
291+
const generateTLDR = (category) => {
292+
const prompt = prompts[category];
293+
if (!prompt) {
294+
console.error("Invalid category:", category);
295+
return;
296+
}
297+
298+
// Try URL parameter method first
299+
const encodedPrompt = encodeURIComponent(prompt);
300+
const chatgptUrl = `https://chat.openai.com/?q=${encodedPrompt}`;
301+
302+
// Open ChatGPT with URL parameter
303+
window.open(chatgptUrl, "_blank");
304+
305+
closeModal();
306+
};
307+
308+
const init = () => {
309+
// Query DOM elements when initializing
310+
modal = document.getElementById("tldr-modal");
311+
openBtn = document.getElementById("tldr-generator-btn");
312+
closeBtn = modal?.querySelector(".c-tldr-modal__close");
313+
categoryButtons = modal?.querySelectorAll(".c-tldr-category");
314+
315+
if (!modal || !openBtn) {
316+
console.error("TLDR Generator: Modal or button not found", {
317+
modal,
318+
openBtn,
319+
});
320+
return;
321+
}
322+
323+
console.log("TLDR Generator initialized", {
324+
modal,
325+
openBtn,
326+
categoryButtons: categoryButtons?.length,
327+
});
328+
329+
// Open modal
330+
openBtn.addEventListener("click", (e) => {
331+
console.log("TLDR button clicked");
332+
openModal();
333+
});
334+
335+
// Close modal
336+
closeBtn?.addEventListener("click", closeModal);
337+
338+
// Close on overlay click
339+
const overlay = modal.querySelector(".c-tldr-modal__overlay");
340+
overlay?.addEventListener("click", closeModal);
341+
342+
// Close on Escape key
343+
document.addEventListener("keydown", (e) => {
344+
if (e.key === "Escape" && modal.getAttribute("aria-hidden") === "false") {
345+
closeModal();
346+
}
347+
});
348+
349+
// Handle category selection
350+
categoryButtons?.forEach((btn) => {
351+
btn.addEventListener("click", () => {
352+
const category = btn.getAttribute("data-category");
353+
generateTLDR(category);
354+
});
355+
});
356+
};
357+
358+
return { init };
359+
})();
360+
165361
// Initialize once DOM is loaded
166362
if (document.readyState === "loading") {
167-
document.addEventListener("DOMContentLoaded", ()=>{
363+
document.addEventListener("DOMContentLoaded", () => {
168364
faviconHandler();
169365
scrollManager();
366+
tldrGenerator.init();
170367
});
171368
} else {
172369
scrollManager();
173370
document.addEventListener("visibilitychange", faviconHandler);
174-
}
371+
tldrGenerator.init();
372+
}

0 commit comments

Comments
 (0)