-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
270 lines (244 loc) · 12.5 KB
/
index.html
File metadata and controls
270 lines (244 loc) · 12.5 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text x=%2250%%22 y=%2250%%22 dominant-baseline=%22central%22 text-anchor=%22middle%22 font-family=%22monospace%22 font-weight=%22900%22 font-size=%22100px%22 fill=%22%23ed0303%22>UT</text></svg>">
<title>Universal Toaster v3.0 | Rich Text Tooltips</title>
<style>
:root { --primary: #ed0303; --bg: #f8fafc; --text: #334155; --code-bg: #1e293b; --card-bg: #ffffff; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); margin: 0; line-height: 1.6; }
/* Layout */
.hero { background: white; padding: 60px 20px; text-align: center; border-bottom: 1px solid #e2e8f0; }
.hero h1 { margin: 0; font-size: 2.8rem; color: #0f172a; letter-spacing: -1px; }
.hero p { font-size: 1.2rem; color: #64748b; max-width: 600px; margin: 15px auto 0; }
.btn-download { display: inline-block; margin-top: 20px; padding: 12px 24px; background: var(--primary); color: white; text-decoration: none; border-radius: 8px; font-weight: 600; transition: transform 0.2s; }
.btn-download:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.badge { display: inline-block; background: #dbeafe; color: #1e40af; padding: 4px 12px; border-radius: 20px; font-weight: 600; font-size: 0.9rem; margin-bottom: 10px; }
.container { max-width: 1000px; margin: 0 auto; padding: 40px 20px; }
/* Sections */
section { margin-bottom: 50px; }
h2 { font-size: 1.8rem; border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 20px; color: #0f172a; }
/* Syntax Table */
table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 20px; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #e2e8f0; }
th { background: #f1f5f9; font-weight: 600; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-family: 'Consolas', monospace; color: #ed0303; font-size: 0.9em; }
/* Demo Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.card { background: var(--card-bg); padding: 25px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); border: 1px solid #e2e8f0; }
.card h3 { margin-top: 0; color: var(--primary); }
.card p { font-size: 0.95rem; color: #64748b; margin-bottom: 15px; }
/* Interactive Elements */
.btn-demo {
background: white; border: 1px solid #cbd5e1; padding: 10px 20px;
border-radius: 6px; cursor: pointer; font-weight: 600; color: #334155;
transition: all 0.2s; display: block; width: 100%; text-align: center;
}
.btn-demo:hover { border-color: var(--primary); color: var(--primary); background: #eef2ff; }
.dark-mode-zone { background: #0f172a; padding: 30px; border-radius: 12px; text-align: center; color: white; }
.corner-btn { position: fixed; bottom: 20px; right: 20px; background: #ef4444; color: white; padding: 15px 25px; border-radius: 50px; text-decoration: none; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4); font-weight: bold; }
</style>
<!-- CONFIGURATION -->
<script>
window.UniversalToasterConfig = {
fontSize: "13px",
borderRadius: "6px",
padding: "8px 12px"
// Colors set to null for Auto-Contrast
};
</script>
</head>
<body>
<div class="hero">
<p>Turn native HTML tooltips into modern, smart floating toasts.</p>
<span class="badge">New v3.0</span>
<h1>Universal Toaster</h1>
<p>The zero-dependency tooltip library with <b>Rich Text Formatting</b>, Google Fonts support, and smart positioning.</p>
<a href="https://github.com/MegaMind-Solution/toaster" class="btn-download">View on GitHub</a>
</div>
<div class="container">
<!-- OVERVIEW -->
<section>
<h2>Overview</h2>
<p>
Universal Toaster is a plug-and-play JavaScript solution. It scans your page for any element with a
<code>title="Example"</code> attribute, suppresses the browser's default tooltip, and replaces it with
a sleek, hardware-accelerated floating label that follows the mouse.
</p>
<ul>
<li>⚡ <strong>Zero Dependencies:</strong> No jQuery, no CSS frameworks.</li>
<li>🌓 <strong>Auto-Contrast:</strong> Detects dark/light backgrounds automatically.</li>
<li>📐 <strong>Smart Positioning:</strong> Never goes off-screen (flips on edges).</li>
<li>📱 <strong>Mobile Optimized:</strong> Clamps to screen edges on mobile to prevent overflow.</li>
</ul>
</section>
<!-- SYNTAX GUIDE -->
<section>
<h2>Syntax Cheat Sheet</h2>
<p>Use these shortcodes inside any <code>title="..."</code> attribute.</p>
<table>
<thead>
<tr>
<th>Feature</th>
<th>Syntax</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td><b>Font Size </b></td>
<td><code>&fz=12px; ... &fz;</code></td>
<td><code>&fz=12px;Font Size&fz;</code></td>
</tr>
<tr>
<td><b>Text Color</b></td>
<td><code>&cl=color; ... &cl;</code></td>
<td><code>&cl=red;Error&cl;</code></td>
</tr>
<tr>
<td><b>Background</b></td>
<td><code>&bgcl=color; ... &bgcl;</code></td>
<td><code>&bgcl=yellow;Highlight&bgcl;</code></td>
</tr>
<tr>
<td><b>Font Family</b></td>
<td><code>&fn=Name; ... &fn;</code></td>
<td><code>&fn=Roboto;Hello&fn;</code></td>
</tr>
<tr>
<td><b>Font Weight</b></td>
<td><code>&fw=Weight; ... &fw;</code></td>
<td><code>&fw=bold;Bold Text&fw;</code></td>
</tr>
<tr>
<td><b>Truncate</b></td>
<td><code>&chr=Limit; ... &chr;</code></td>
<td><code>&chr=10;Long Text&chr;</code></td>
</tr>
</tbody>
</table>
</section>
<!-- SECTION: INSTALLATION -->
<section>
<h2>Installation & Tutorial</h2>
<p>1. Download <a href="https://gitfolderdownloader.github.io/api/?=https://github.com/MegaMind-Solution/toaster/tree/main/src" class="btn-download" style="padding: 0;background: transparent;border-radius: 0;"><code>toaster.js</code></a> and place it in your project.</p>
<p>2. Or use hosted file</p>
<p>3. Add the script to the bottom of your HTML body.</p>
<pre><code><span class="comment"><!-- Optional: Configuration (Place BEFORE the script) --></span>
<script>
window.UniversalToasterConfig = {
// COLORS
// Set to null to allow Auto-Contrast (Recommended)
backgroundColor: null, // e.g. "#333"
textColor: null, // e.g. "#fff"
// TYPOGRAPHY
fontFamily: "inherit", // Uses page font
fontSize: "13px",
fontWeight: "500",
// SHAPE
borderRadius: "6px",
padding: "8px 12px",
boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
};
<span class="comment">// Leave colors null for auto-contrast</span>
};
</script>
<span class="comment"><!-- Main Script --></span>
<script src="src/toaster.js"></script></code></pre>
</section>
<!-- LIVE DEMOS -->
<section>
<h2>Live Examples</h2>
<p>Hover over the elements below to see the script in action.</p>
<div class="grid">
<!-- 1. COLORS -->
<div class="card">
<h3>🎨 Colors & Backgrounds</h3>
<p>Mix text colors and background highlights.</p>
<button class="btn-demo" title="Normal text. &cl=#ec4899;Pink Text&cl; and &bgcl=#fef08a;&cl=black; Highlighted &cl;&bgcl;">
Hover: Colors
</button>
<br>
<code>title="&cl=red;Red&cl; &bgcl=yellow;Bg&bgcl;"</code>
</div>
<!-- 2. FONTS -->
<div class="card">
<h3>🔤 Google Fonts</h3>
<p>Auto-fetches fonts from Google API.</p>
<button class="btn-demo" title="Standard. &fn=Pacifico;&cl=#4f46e5;Fancy Handwriting!&cl;&fn; &fn=Oswald;Modern Font&fn;">
Hover: Fonts
</button>
<br>
<code>title="&fn=Pacifico;Handwriting&fn;"</code>
</div>
<!-- 3. WEIGHT & LIMITS -->
<div class="card">
<h3>⚖️ Weights & Limits</h3>
<p>Bold text and character truncation.</p>
<button class="btn-demo" title="&fw=bold;BOLD TITLE&fw;
Preview: &chr=20;This is a very long description that will be cut off automatically.&chr;">
Hover: Truncation
</button>
<br>
<code>title="&fw=bold;B&fw; &chr=5;Long...&chr;"</code>
</div>
<!-- 4. COMPLEX CARD -->
<div class="card">
<h3>🆔 User Card (Nested)</h3>
<p>Combine everything for rich UIs.</p>
<button class="btn-demo" title="&fn=Roboto;&fw=bold;User Profile&fw;&fn;
&fw=bold;Name:&fw; &cl=#0ea5e9;Jane Doe&cl;
&fw=bold;Status:&fw; &bgcl=#22c55e;&cl=white; ONLINE &cl;&bgcl;
&fw=bold;Bio:&fw; &fn=Caveat;&cl=gray;Frontend Dev & Coffee Lover&cl;&fn;">
Hover: User Card
</button>
</div>
<!-- 2. FONT SIZE -->
<div class="card">
<h3>⭕ Font Size</h3>
<p>Auto-fetches fonts from Google API.</p>
<button class="btn-demo" title="&fz=50px;Font Size Is 50PX&fz; &cl=red;And&cl; &fz=25px;Font Size Is 25PX&fz;">
Hover: Fonts
</button>
<br>
<code>title="&fn=18px;Font Size Is 18PX&fz;"</code>
</div>
</div>
</section>
<!-- DARK MODE -->
<section>
<h2>Auto-Contrast System</h2>
<div class="dark-mode-zone">
<p>The toaster detects this dark container and automatically switches to Light Theme.</p>
<button class="btn-demo" style="background:#334155; color:white; border:none;"
title="💡 I turned white because the background is dark!">
Hover Me (Dark Mode)
</button>
</div>
</section>
</div>
<a href="" class="corner-btn" title="🚀 I flipped Up and Left because I hit the corner!">
Corner Test
</a>
<!-- SCRIPT LOADER -->
<script src="src/toaster.js"></script>
<script>
window.UniversalToasterConfig = {
// COLORS
// Set to null to allow Auto-Contrast (Recommended)
backgroundColor: null, // e.g. "#333"
textColor: null, // e.g. "#fff"
// TYPOGRAPHY
fontFamily: "inherit", // Uses page font
fontSize: "13px",
fontWeight: "500",
// SHAPE
borderRadius: "6px",
padding: "8px 12px",
boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
};
// Leave colors null for auto-contrast
};
</script>
</body>
</html>