diff --git a/html/search.ejs b/html/search.ejs index 7c753f83..43218758 100644 --- a/html/search.ejs +++ b/html/search.ejs @@ -494,7 +494,8 @@ video[counter].classList.add("shake"); <% }) %> -
+
+
@@ -515,19 +516,14 @@ function isMathExpression(query) { return /^[0-9\s\+\-\*\/\.\x]+$/.test(query); } -function evaluateMathExpression(expression) { - // twenyone - if (expression.replace(/\s+/g, '') === '9+10') { - return '21'; +if (/^[0-9\s+\-*/.x]+$/.test(query)) { + const expr = query.replace(/\s+/g, ''); + answer = expr === '9+10' ? '21' : (() => { + try { return eval(expr); } catch { return 'Invalid Expression'; } + })(); + return answer; } - try { - return eval(expression); - } catch (error) { - return 'Invalid Expression'; - } -} - function getCurrentDate() { const now = new Date(); return now.toLocaleDateString(); @@ -538,58 +534,138 @@ function getCurrentYear() { } function getTimeInTimezone(location) { - const timezones = { - "california": "America/Los_Angeles", - "new york": "America/New_York", - "chicago": "America/Chicago", - "denver": "America/Denver", - "phoenix": "America/Phoenix", - "anchorage": "America/Anchorage", - "honolulu": "Pacific/Honolulu", - "london": "Europe/London", - "paris": "Europe/Paris", - "berlin": "Europe/Berlin", - "madrid": "Europe/Madrid", - "rome": "Europe/Rome", - "moscow": "Europe/Moscow", - "athens": "Europe/Athens", - "sydney": "Australia/Sydney", - "melbourne": "Australia/Melbourne", - "brisbane": "Australia/Brisbane", - "perth": "Australia/Perth", - "tokyo": "Asia/Tokyo", - "osaka": "Asia/Osaka", - "seoul": "Asia/Seoul", - "beijing": "Asia/Shanghai", - "shanghai": "Asia/Shanghai", - "hong kong": "Asia/Hong_Kong", - "taipei": "Asia/Taipei", - "bangkok": "Asia/Bangkok", - "jakarta": "Asia/Jakarta", - "delhi": "Asia/Kolkata", - "mumbai": "Asia/Kolkata", - "kolkata": "Asia/Kolkata", - "karachi": "Asia/Karachi", - "lahore": "Asia/Karachi", - "dubai": "Asia/Dubai", - "abu dhabi": "Asia/Dubai", - "riyadh": "Asia/Riyadh", - "johannesburg": "Africa/Johannesburg", - "cairo": "Africa/Cairo", - "nairobi": "Africa/Nairobi", - "lagos": "Africa/Lagos", - "algiers": "Africa/Algiers", - "casablanca": "Africa/Casablanca", - "lisbon": "Europe/Lisbon", - "dublin": "Europe/Dublin", - "zurich": "Europe/Zurich", - "vienna": "Europe/Vienna", - "stockholm": "Europe/Stockholm", - "oslo": "Europe/Oslo", - "helsinki": "Europe/Helsinki" - }; +const tzMap = { + "california": "America/Los_Angeles", + "new york": "America/New_York", + "chicago": "America/Chicago", + "denver": "America/Denver", + "phoenix": "America/Phoenix", + "anchorage": "America/Anchorage", + "honolulu": "Pacific/Honolulu", + "london": "Europe/London", + "paris": "Europe/Paris", + "berlin": "Europe/Berlin", + "madrid": "Europe/Madrid", + "rome": "Europe/Rome", + "moscow": "Europe/Moscow", + "athens": "Europe/Athens", + "sydney": "Australia/Sydney", + "melbourne": "Australia/Melbourne", + "brisbane": "Australia/Brisbane", + "perth": "Australia/Perth", + "tokyo": "Asia/Tokyo", + "osaka": "Asia/Osaka", + "seoul": "Asia/Seoul", + "beijing": "Asia/Shanghai", + "shanghai": "Asia/Shanghai", + "hong kong": "Asia/Hong_Kong", + "taipei": "Asia/Taipei", + "bangkok": "Asia/Bangkok", + "jakarta": "Asia/Jakarta", + "delhi": "Asia/Kolkata", + "mumbai": "Asia/Kolkata", + "karachi": "Asia/Karachi", + "dubai": "Asia/Dubai", + "abu dhabi": "Asia/Dubai", + "riyadh": "Asia/Riyadh", + "johannesburg": "Africa/Johannesburg", + "cairo": "Africa/Cairo", + "nairobi": "Africa/Nairobi", + "lagos": "Africa/Lagos", + "algiers": "Africa/Algiers", + "casablanca": "Africa/Casablanca", + "lisbon": "Europe/Lisbon", + "dublin": "Europe/Dublin", + "zurich": "Europe/Zurich", + "vienna": "Europe/Vienna", + "stockholm": "Europe/Stockholm", + "oslo": "Europe/Oslo", + "helsinki": "Europe/Helsinki", + "prague": "Europe/Prague", + "budapest": "Europe/Budapest", + "warsaw": "Europe/Warsaw", + "bucharest": "Europe/Bucharest", + "sofia": "Europe/Sofia", + "zagreb": "Europe/Zagreb", + "belgrade": "Europe/Belgrade", + "sarajevo": "Europe/Sarajevo", + "podgorica": "Europe/Podgorica", + "ljubljana": "Europe/Ljubljana", + "tirana": "Europe/Tirane", + "valletta": "Europe/Malta", + "andorra la vella": "Europe/Andorra", + "monaco": "Europe/Monaco", + "luxembourg": "Europe/Luxembourg", + "bratislava": "Europe/Bratislava", + "vilnius": "Europe/Vilnius", + "riga": "Europe/Riga", + "tallinn": "Europe/Tallinn", + "istanbul": "Europe/Istanbul", + "jerusalem": "Asia/Jerusalem", + "amman": "Asia/Amman", + "beirut": "Asia/Beirut", + "damascus": "Asia/Damascus", + "baghdad": "Asia/Baghdad", + "tehran": "Asia/Tehran", + "islamabad": "Asia/Karachi", + "kathmandu": "Asia/Kathmandu", + "thimphu": "Asia/Thimphu", + "dhaka": "Asia/Dhaka", + "yangon": "Asia/Yangon", + "hanoi": "Asia/Ho_Chi_Minh", + "ho chi minh city": "Asia/Ho_Chi_Minh", + "manila": "Asia/Manila", + "singapore": "Asia/Singapore", + "kuala lumpur": "Asia/Kuala_Lumpur", + "colombo": "Asia/Colombo", + "bagotville": "America/Montreal", + "toronto": "America/Toronto", + "vancouver": "America/Vancouver", + "mexico city": "America/Mexico_City", + "guadalajara": "America/Mexico_City", + "monterrey": "America/Monterrey", + "sao paulo": "America/Sao_Paulo", + "buenos aires": "America/Argentina/Buenos_Aires", + "santiago": "America/Santiago", + "rio de janeiro": "America/Sao_Paulo", + "caracas": "America/Caracas", + "bogota": "America/Bogota", + "lima": "America/Lima", + "quito": "America/Quito", + "georgetown": "America/Guyana", + "paramaribo": "America/Paramaribo", + "cayenne": "America/Cayenne", + "kingston": "America/Jamaica", + "port_of_spain": "America/Port_of_Spain", + "st johns": "America/St_Johns", + "midway": "Pacific/Midway", + "apia": "Pacific/Apia", + "nuku alofa": "Pacific/Tongatapu", + "tarawa": "Pacific/Tarawa", + "funafuti": "Pacific/Funafuti", + "suva": "Pacific/Fiji", + "chatham": "Pacific/Chatham", + "pitcairn": "Pacific/Pitcairn", + "galapagos": "Pacific/Galapagos", + "easter island": "Pacific/Easter", + "honiara": "Pacific/Guadalcanal", + "port vila": "Pacific/Efate", + "palikir": "Pacific/Pohnpei", + "palau": "Pacific/Palau", + "mcmurdo": "Antarctica/McMurdo", + "rothera": "Antarctica/Rothera", + "troll": "Antarctica/Troll", + "davis": "Antarctica/Davis", + "casey": "Antarctica/Casey", + "mawson": "Antarctica/Mawson", + "vostok": "Antarctica/Vostok", + "syowa": "Antarctica/Syowa", + "gmt": "Etc/GMT", + "utc": "UTC" +}; - const timezone = timezones[location.toLowerCase()]; + + const timezone = tzMap[location.toLowerCase()]; if (!timezone) { return null; } @@ -601,7 +677,166 @@ function getTimeInTimezone(location) { const query = q.toLowerCase().trim(); let answer = ''; +// 19 utility functions +function randomCompliment() { + const compliments = [ + "Youโ€™re an awesome friend.", + "You light up the room.", + "You have a great sense of humor.", + "You make a difference.", + "You're like a ray of sunshine." + ]; + return compliments[Math.floor(Math.random() * compliments.length)]; +} + +function randomEncouragement() { + const encourages = [ + "Keep goingโ€”youโ€™ve got this!", + "Donโ€™t give up now!", + "Every step counts.", + "Believe in yourself.", + "You can do anything." + ]; + return encourages[Math.floor(Math.random() * encourages.length)]; +} + +function base64Encode(str) { + return btoa(str); +} + +function base64Decode(str) { + try { + return atob(str); + } catch { + return 'Invalid Base64'; + } +} + +function hexToDec(str) { + return parseInt(str.replace(/^0x/, ''), 16).toString(); +} + +function decToHex(num) { + return Number(num).toString(16); +} + +function textToCharCodes(text) { + return text.split('').map(c => c.charCodeAt(0)).join(' '); +} + +function charCodesToText(codes) { + return String.fromCharCode(...codes.split(/\s+/).map(n => +n)); +} + +function countWords(text) { + return text.trim().split(/\s+/).length; +} + +function titleCase(text) { + return text + .split(' ') + .map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()) + .join(' '); +} + +function slugify(text) { + return text + .toLowerCase() + .trim() + .replace(/[^a-z0-9]+/g, '-') + .replace(/^-+|-+$/g, ''); +} + +function isPrime(n) { + n = Number(n); + if (n < 2) return false; + for (let i = 2; i <= Math.sqrt(n); i++) { + if (n % i === 0) return false; + } + return true; +} + +function gcd(a, b) { + a = Math.abs(a); b = Math.abs(b); + while (b) [a, b] = [b, a % b]; + return a; +} + +function lcm(a, b) { + return Math.abs(a * b) / gcd(a, b); +} + +function fibonacci(n) { + n = Number(n); + if (n < 2) return n; + let a = 0, b = 1; + for (let i = 2; i <= n; i++) [a, b] = [b, a + b]; + return b; +} + +function generatePassword(length = 8) { + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()'; + let pw = ''; + for (let i = 0; i < length; i++) { + pw += chars.charAt(Math.floor(Math.random() * chars.length)); + } + return pw; +} + +function daysUntil(dateStr) { + const now = new Date(); + const then = new Date(dateStr); + const diff = then - now; + return diff > 0 + ? Math.ceil(diff / (1000 * 60 * 60 * 24)) + ' days' + : 'Date passed'; +} + +function generateUUID() { + return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace( + /[018]/g, + c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) + ); +} + +function generateRandomString(length = 8) { + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + let s = ''; + for (let i = 0; i < length; i++) { + s += chars.charAt(Math.floor(Math.random() * chars.length)); + } + return s; +} + + + const emojiMap = { + "grinning face":"๐Ÿ˜€","grin":"๐Ÿ˜","smiley":"๐Ÿ˜ƒ","smile":"๐Ÿ˜„","sweat smile":"๐Ÿ˜…", + "joy":"๐Ÿ˜‚","rofl":"๐Ÿคฃ","relaxed":"โ˜บ๏ธ","blush":"๐Ÿ˜Š","innocent":"๐Ÿ˜‡", + "slightly_smiling_face":"๐Ÿ™‚","upside_down":"๐Ÿ™ƒ","wink":"๐Ÿ˜‰","relieved":"๐Ÿ˜Œ", + "heart eyes":"๐Ÿ˜","kissing_heart":"๐Ÿ˜˜","kissing":"๐Ÿ˜—","kissing_smiling_eyes":"๐Ÿ˜™", + "kissing_closed_eyes":"๐Ÿ˜š","yum":"๐Ÿ˜‹","stuck out tongue":"๐Ÿ˜›","stuck out tongue wink":"๐Ÿ˜œ", + "stuck out tongue closed eyes":"๐Ÿ˜","money_mouth":"๐Ÿค‘","hug":"๐Ÿค—","nerd":"๐Ÿค“", + "sunglasses":"๐Ÿ˜Ž","star_struck":"๐Ÿคฉ","thinking":"๐Ÿค”","zipper_mouth":"๐Ÿค", + "raised_eyebrow":"๐Ÿคจ","neutral":"๐Ÿ˜","expressionless":"๐Ÿ˜‘","no_mouth":"๐Ÿ˜ถ", + "roll_eyes":"๐Ÿ™„","smirk":"๐Ÿ˜","persevere":"๐Ÿ˜ฃ","disappointed_relieved":"๐Ÿ˜ฅ", + "cold_sweat":"๐Ÿ˜ฐ","pensive":"๐Ÿ˜”","confused":"๐Ÿ˜•","worried":"๐Ÿ˜Ÿ","slightly_frowning":"๐Ÿ™", + "frowning":"โ˜น๏ธ","anguished":"๐Ÿ˜ง","open_mouth":"๐Ÿ˜ฎ","grimacing":"๐Ÿ˜ฌ","hushed":"๐Ÿ˜ฏ", + "astonished":"๐Ÿ˜ฒ","flushed":"๐Ÿ˜ณ","pleading":"๐Ÿฅบ","frowning2":"๐Ÿ˜ฆ","anguished2":"๐Ÿ˜ง", + "cry":"๐Ÿ˜ข","disappointed":"๐Ÿ˜ž","scream":"๐Ÿ˜ฑ","fearful":"๐Ÿ˜จ","tired_face":"๐Ÿ˜ซ", + "weary":"๐Ÿ˜ฉ","triumph":"๐Ÿ˜ค","angry":"๐Ÿ˜ ","rage":"๐Ÿ˜ก","poop":"๐Ÿ’ฉ","thumbsup":"๐Ÿ‘", + "thumbsdown":"๐Ÿ‘Ž","clap":"๐Ÿ‘","raised_hands":"๐Ÿ™Œ","pray":"๐Ÿ™","muscle":"๐Ÿ’ช","eyes":"๐Ÿ‘€", + "ear":"๐Ÿ‘‚","nose":"๐Ÿ‘ƒ","tongue":"๐Ÿ‘…","lips":"๐Ÿ‘„","kiss":"๐Ÿ’‹","crown":"๐Ÿ‘‘","womans hat":"๐Ÿ‘’", + "eyeglasses":"๐Ÿ‘“","necktie":"๐Ÿ‘”","shirt":"๐Ÿ‘•","jeans":"๐Ÿ‘–","dress":"๐Ÿ‘—","kimono":"๐Ÿ‘˜", + "bikini":"๐Ÿ‘™","sandal":"๐Ÿ‘ก","boot":"๐Ÿ‘ข","mans shoe":"๐Ÿ‘ž","high heel":"๐Ÿ‘ ","sock":"๐Ÿงฆ", + "gloves":"๐Ÿงค","scarf":"๐Ÿงฃ","tophat":"๐ŸŽฉ","billed cap":"๐Ÿงข","flag us":"๐Ÿ‡บ๐Ÿ‡ธ","flag gb":"๐Ÿ‡ฌ๐Ÿ‡ง", + "flag ca":"๐Ÿ‡จ๐Ÿ‡ฆ","flag de":"๐Ÿ‡ฉ๐Ÿ‡ช","flag fr":"๐Ÿ‡ซ๐Ÿ‡ท","flag es":"๐Ÿ‡ช๐Ÿ‡ธ","flag it":"๐Ÿ‡ฎ๐Ÿ‡น","flag jp":"๐Ÿ‡ฏ๐Ÿ‡ต", + "flag cn":"๐Ÿ‡จ๐Ÿ‡ณ","flag in":"๐Ÿ‡ฎ๐Ÿ‡ณ","flag br":"๐Ÿ‡ง๐Ÿ‡ท","flag ru":"๐Ÿ‡ท๐Ÿ‡บ","flag za":"๐Ÿ‡ฟ๐Ÿ‡ฆ","flag au":"๐Ÿ‡ฆ๐Ÿ‡บ", + "flag nz":"๐Ÿ‡ณ๐Ÿ‡ฟ","flag ng":"๐Ÿ‡ณ๐Ÿ‡ฌ","flag eg":"๐Ÿ‡ช๐Ÿ‡ฌ","flag ar":"๐Ÿ‡ฆ๐Ÿ‡ท","flag mx":"๐Ÿ‡ฒ๐Ÿ‡ฝ","flag kr":"๐Ÿ‡ฐ๐Ÿ‡ท", + "flag tr":"๐Ÿ‡น๐Ÿ‡ท" +}; + +let m; if (isMathExpression(query)) { answer = evaluateMathExpression(query); } else if (query.includes('date') || query.includes('what date is it')) { @@ -618,16 +853,64 @@ if (isMathExpression(query)) { const options = { weekday: 'long' }; answer = now.toLocaleDateString(undefined, options); } else if (query.includes('u are cute') || query.includes('you are cute')) { - answer = "jifshfgdhjf >~< no u" + answer = "jifshfgdhjf >~< no u"; } else if (query.includes('ur cute') || query.includes('your cute')) { - answer = "efkohgefgef >///< no u" + answer = "efkohgefgef >///< no u"; } else if (query.includes('am i cute') || query.includes('am i a cutie?')) { - answer = "yesh :3 u are " + answer = "yesh :3 u are "; } else if (query.includes('am i a good girl') || query.includes('am i a good boy?')) { - answer = query.includes('girl') ? "yesh :3 u are a good girl" : "yesh :3 u are a good boy"; + answer = query.includes('girl') + ? "yesh :3 u are a good girl" + : "yesh :3 u are a good boy"; } else if (query.includes('ur hot') || query.includes('you are hot')) { - answer = "jrifyehgyerfgu9wdswgfsafgydwgbfwdfge >~< " -} + answer = "jrifyehgyerfgu9wdswgfsafgydwgbfwdfge >~< "; +} else if (query.startsWith('emoji ')) { + const name = query.slice(6); + answer = emojiMap[name] || 'Unknown emoji'; +} else if (query.includes('compliment')) { + answer = randomCompliment(); +} else if (query.includes('encouragement') || query.includes('encourage me')) { + answer = randomEncouragement(); +} else if (query.startsWith('base64 encode ')) { + answer = base64Encode(query.slice(14)); +} else if (query.startsWith('base64 decode ')) { + answer = base64Decode(query.slice(14)); +} else if ((m = /0x[0-9a-f]+/i.exec(query))) { + answer = hexToDec(m[0]); +} else if (query.match(/\d+\s+to\s+hex/i)) { + answer = decToHex(query.match(/\d+/)[0]); +} else if (query.startsWith('char codes for ')) { + answer = textToCharCodes(query.slice(15)); +} else if (query.startsWith('text from codes ')) { + answer = charCodesToText(query.slice(16)); +} else if (query.startsWith('word count of ')) { + answer = countWords(query.slice(14)).toString(); +} else if (query.startsWith('titlecase ')) { + answer = titleCase(query.slice(10)); +} else if (query.startsWith('slugify ')) { + answer = slugify(query.slice(8)); +} else if (query.match(/\bprime\b/)) { + answer = isPrime(query.match(/\d+/)[0]) ? 'Yes' : 'No'; +} else if (query.includes('gcd of ')) { + const nums = query.match(/\d+/g); + answer = gcd(nums[0], nums[1]).toString(); +} else if (query.includes('lcm of ')) { + const nums = query.match(/\d+/g); + answer = lcm(nums[0], nums[1]).toString(); +} else if (query.match(/fib(?:onacci)?\s*\d+/i)) { + answer = fibonacci(query.match(/\d+/)[0]).toString(); +} else if (query.startsWith('generate password')) { + const n = query.match(/\d+/); + answer = generatePassword(n ? Number(n[0]) : undefined); +} else if (query.includes('days until ')) { + answer = daysUntil(query.split('days until ')[1].trim()); +} else if (query.includes('uuid')) { + answer = generateUUID(); +} else if (query.startsWith('random string')) { + const n = query.match(/\d+/); + answer = generateRandomString(n ? Number(n[0]) : undefined); +} + const upsellMessages = [ "[new] Try searching 'What's 4+4?'", @@ -653,31 +936,89 @@ function extractQueryFromUpsellMessage(message) { %> %> <% if (answer) { %> -
-

- Answer to ur question -

-

- <%= answer %> -
+
+
+

Answer to ur question

+ +
+
<%= answer %>
+ +
+ + + + + <% } else if (showUpsell) { %> <% } %> - -<% if (q == "ai" || q == "aibot" || q == "chatbot") { %> -
-

- No, POKE Will Never Have "AI" โ€”Because It Doesn't Need It -

- - POKE doesnโ€™t need "AI." Thereโ€™s no good reason for a YouTube front end to include some gimmicky AI assistant. These days, "AI" just means slapping a ChatGPT wrapper on an app, calling it innovative, and hoping no one notices the lack of actual purpose. Itโ€™s the latest fad, sure, but POKE is about simplicity, privacy, and doing things rightโ€”not just joining tech trends for the sake of it. -
- POKE is here to make watching videos smoother, not cluttered with unnecessary "features." Real value doesnโ€™t come from chasing whatever big tech wants to sell you on. Itโ€™s about staying true to what actually helps users. So, yeah, no AI here, and honestly, no need for it. -
- If u really want a "chatbot" or "ai" : look at the chatgpt website - (or search using the !ai bang - which is made by duckduckgo, not us) -
-
-<% } %> + <% @@ -1018,12 +1359,12 @@ font-weight: 1000;" href="/watch?v=<%= x.videoId %>" class="title max-lines-2">< <%= x.author %><% if (x?.authorVerified) { %> <% } %>
- +
Download
- +
Open on YouTube :/