2026-06-13 18:16:39 -04:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "UTF-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< title > NEONEX — Search the Grid</ title >
< style >
: root {
--neon-pink : #ff2d95 ;
--neon-cyan : #00f0ff ;
--neon-purple : #b347ea ;
--neon-yellow : #ffd319 ;
--dark : #0a0a0f ;
}
*, * :: before , * :: after { box-sizing : border-box ; margin : 0 ; padding : 0 ; }
body {
font-family : 'Segoe UI' , system-ui , - apple-system , sans-serif ;
background : var ( -- dark );
color : #e0e0ff ;
min-height : 100 vh ;
overflow-x : hidden ;
-webkit- font-smoothing : antialiased ;
}
/* ── Background layers ── */
. grid-floor {
position : fixed ;
bottom : 0 ; left : 50 % ;
transform : translateX ( -50 % );
width : 200 vw ; height : 70 vh ;
background :
repeating-linear-gradient ( 0 deg , transparent , transparent 2 px , rgba ( 255 , 45 , 149 , 0.08 ) 2 px , rgba ( 255 , 45 , 149 , 0.08 ) 3 px ),
repeating-linear-gradient ( 90 deg , transparent , transparent 80 px , rgba ( 0 , 240 , 255 , 0.05 ) 80 px , rgba ( 0 , 240 , 255 , 0.05 ) 81 px );
mask-image : linear-gradient ( to top , rgba ( 0 , 0 , 0 , 0.6 ) 0 % , rgba ( 0 , 0 , 0 , 0 ) 100 % );
pointer-events : none ; z-index : 0 ;
}
. sun {
position : fixed ;
bottom : 20 % ; left : 50 % ;
transform : translateX ( -50 % );
width : 600 px ; height : 300 px ;
border-radius : 300 px 300 px 0 0 ;
background : linear-gradient ( 180 deg , var ( -- neon - yellow ) 0 % , #ff6b35 40 % , var ( -- neon - pink ) 70 % , transparent 100 % );
opacity : 0.15 ; filter : blur ( 40 px );
pointer-events : none ; z-index : 0 ;
}
. sun-cut {
position : fixed ;
bottom : 20 % ; left : 50 % ;
transform : translateX ( -50 % );
width : 600 px ; height : 150 px ;
border-radius : 300 px 300 px 0 0 ;
background : linear-gradient ( 180 deg , var ( -- neon - yellow ) 0 % , #ff6b35 40 % , var ( -- neon - pink ) 80 % );
opacity : 0.25 ; filter : blur ( 2 px );
pointer-events : none ; z-index : 0 ;
}
. sun-lines {
position : fixed ;
bottom : 20 % ; left : 50 % ;
transform : translateX ( -50 % );
width : 600 px ; height : 150 px ;
border-radius : 300 px 300 px 0 0 ;
background : repeating-linear-gradient ( 0 deg , transparent , transparent 4 px , rgba ( 10 , 10 , 15 , 0.3 ) 4 px , rgba ( 10 , 10 , 15 , 0.3 ) 5 px );
pointer-events : none ; z-index : 0 ;
}
. triangle-decor {
position : fixed ; pointer-events : none ; z-index : 0 ;
}
. triangle-decor . t1 {
top : 10 % ; left : 8 % ;
width : 120 px ; height : 100 px ;
background : linear-gradient ( 135 deg , var ( -- neon - cyan ) 0 % , transparent 60 % );
clip-path : polygon ( 50 % 0 % , 0 % 100 % , 100 % 100 % );
opacity : 0.08 ;
}
. triangle-decor . t2 {
bottom : 30 % ; right : 10 % ;
width : 80 px ; height : 70 px ;
background : linear-gradient ( 225 deg , var ( -- neon - pink ) 0 % , transparent 60 % );
clip-path : polygon ( 50 % 0 % , 0 % 100 % , 100 % 100 % );
opacity : 0.1 ;
}
. scanlines {
position : fixed ; inset : 0 ;
pointer-events : none ; z-index : 999 ;
2026-06-13 18:26:28 -04:00
background : repeating-linear-gradient (
0 deg ,
transparent ,
transparent 2 px ,
rgba ( 0 , 0 , 0 , 0.04 ) 2 px ,
rgba ( 0 , 0 , 0 , 0.04 ) 3 px
);
animation : scanlines-scroll 8 s linear infinite ;
opacity : 0.7 ;
}
@ keyframes scanlines-scroll {
from { background-position : 0 0 ; }
to { background-position : 0 6 px ; }
}
/* Subtle CRT flicker overlay */
. scan-flicker {
position : fixed ; inset : 0 ;
pointer-events : none ; z-index : 998 ;
background : transparent ;
animation : crt-flicker 0.15 s infinite ;
}
@ keyframes crt-flicker {
0 % { background : rgba ( 255 , 255 , 255 , 0.003 ); }
50 % { background : transparent ; }
100 % { background : rgba ( 0 , 0 , 0 , 0.006 ); }
2026-06-13 18:16:39 -04:00
}
/* ── Layout ── */
. app {
position : relative ; z-index : 10 ;
max-width : 760 px ;
margin : 0 auto ;
padding : 40 px 20 px ;
display : flex ; flex-direction : column ;
align-items : center ;
min-height : 100 vh ;
}
. app . has-results {
padding-top : 24 px ;
align-items : stretch ;
}
/* ── Logo ── */
. logo-wrap { text-align : center ; position : relative ; }
. logo {
font-family : 'Courier New' , monospace ;
font-size : 4.5 rem ; font-weight : 900 ;
letter-spacing : 0.08 em ;
color : var ( -- neon - cyan );
text-shadow :
0 0 10 px var ( -- neon - cyan ), 0 0 40 px var ( -- neon - cyan ),
0 0 80 px var ( -- neon - cyan ), 0 0 120 px rgba ( 0 , 240 , 255 , 0.4 ),
2 px 2 px 0 var ( -- neon - pink ), -2 px -2 px 0 var ( -- neon - purple );
animation : flicker 3 s infinite ;
cursor : pointer ; user-select : none ;
}
@ keyframes flicker {
0 %, 19 %, 21 %, 23 %, 25 %, 54 %, 56 %, 100 % { opacity : 1 }
20 %, 24 %, 55 % { opacity : 0.85 }
}
. logo-sub {
font-family : 'Courier New' , monospace ;
font-size : 0.85 rem ; letter-spacing : 0.3 em ;
color : var ( -- neon - pink );
text-shadow : 0 0 20 px var ( -- neon - pink );
margin-top : 4 px ; text-transform : uppercase ;
}
. jp-tag {
position : absolute ; top : -12 px ; right : -40 px ;
font-size : 0.65 rem ; color : var ( -- neon - purple );
letter-spacing : 0.2 em ;
text-shadow : 0 0 10 px var ( -- neon - purple );
font-family : 'Courier New' , monospace ;
}
. has-results . logo { font-size : 2 rem ; }
. has-results . logo-sub { font-size : 0.6 rem ; }
. has-results . jp-tag { font-size : 0.5 rem ; top : -8 px ; right : -30 px ; }
/* ── Host badge ── */
. host-badge {
font-family : 'Courier New' , monospace ;
font-size : 0.6 rem ;
padding : 4 px 12 px ;
border-radius : 12 px ;
margin-bottom : 12 px ;
letter-spacing : 0.05 em ;
display : none ;
}
. host-badge . local {
display : inline-block ;
background : rgba ( 0 , 240 , 255 , 0.1 );
border : 1 px solid rgba ( 0 , 240 , 255 , 0.2 );
color : var ( -- neon - cyan );
text-shadow : 0 0 6 px var ( -- neon - cyan );
}
. host-badge . netlify {
display : inline-block ;
background : rgba ( 179 , 71 , 234 , 0.1 );
border : 1 px solid rgba ( 179 , 71 , 234 , 0.2 );
color : var ( -- neon - purple );
text-shadow : 0 0 6 px var ( -- neon - purple );
}
/* ── Search ── */
. search-wrap { width : 100 % ; position : relative ; margin : 32 px 0 24 px ; }
. has-results . search-wrap { margin : 16 px 0 ; }
. search-box {
width : 100 % ; display : flex ;
background : rgba ( 20 , 20 , 40 , 0.8 );
border : 2 px solid rgba ( 255 , 45 , 149 , 0.3 );
border-radius : 50 px ; overflow : hidden ;
backdrop-filter : blur ( 20 px );
-webkit- backdrop-filter : blur ( 20 px );
box-shadow : 0 0 30 px rgba ( 255 , 45 , 149 , 0.15 ), 0 0 60 px rgba ( 0 , 240 , 255 , 0.08 ), inset 0 1 px 0 rgba ( 255 , 255 , 255 , 0.05 );
transition : all 0.3 s ease ;
}
. search-box : focus-within {
border-color : var ( -- neon - cyan );
box-shadow : 0 0 40 px rgba ( 0 , 240 , 255 , 0.25 ), 0 0 80 px rgba ( 255 , 45 , 149 , 0.15 ), 0 0 0 4 px rgba ( 0 , 240 , 255 , 0.06 );
}
. search-icon {
display : flex ; align-items : center ;
padding-left : 20 px ; font-size : 1.2 rem ;
color : var ( -- neon - pink );
text-shadow : 0 0 10 px var ( -- neon - pink );
}
. search-box input {
flex : 1 ; background : transparent ; border : none ;
padding : 16 px 20 px ; font-size : 1.1 rem ;
color : #fff ; outline : none ; font-family : inherit ;
}
. search-box input :: placeholder { color : rgba ( 200 , 200 , 255 , 0.3 ); }
. search-btn {
background : linear-gradient ( 135 deg , var ( -- neon - pink ), var ( -- neon - purple ));
border : none ; color : #fff ;
padding : 16 px 28 px ; font-size : 0.95 rem ; font-weight : 700 ;
cursor : pointer ; letter-spacing : 0.05 em ;
transition : all 0.3 s ease ;
text-shadow : 0 0 10 px rgba ( 255 , 255 , 255 , 0.5 );
position : relative ; overflow : hidden ;
}
. search-btn : hover {
background : linear-gradient ( 135 deg , #ff4da6 , #c75bff );
box-shadow : 0 0 30 px rgba ( 255 , 45 , 149 , 0.4 );
}
. search-btn :: after {
content : '' ; position : absolute ;
top : 0 ; left : 0 ; right : 0 ; height : 1 px ;
background : rgba ( 255 , 255 , 255 , 0.4 );
}
. search-btn : disabled {
opacity : 0.5 ; cursor : not-allowed ;
box-shadow : none ;
}
/* ── API Key row (local dev only) ── */
. key-row {
display : flex ; gap : 10 px ; align-items : center ;
margin-bottom : 20 px ; flex-wrap : wrap ; justify-content : center ;
}
. key-row . hidden { display : none ; }
. key-input {
background : rgba ( 20 , 20 , 40 , 0.6 );
border : 1 px solid rgba ( 255 , 45 , 149 , 0.2 );
border-radius : 20 px ;
padding : 6 px 14 px ; font-size : 0.75 rem ;
color : var ( -- neon - cyan );
font-family : 'Courier New' , monospace ;
width : 280 px ; outline : none ;
transition : all 0.3 s ease ;
}
. key-input : focus {
border-color : var ( -- neon - cyan );
box-shadow : 0 0 15 px rgba ( 0 , 240 , 255 , 0.15 );
}
. key-input :: placeholder { color : rgba ( 200 , 200 , 255 , 0.2 ); }
. key-save {
padding : 6 px 16 px ; border-radius : 20 px ;
font-size : 0.7 rem ; font-weight : 700 ;
letter-spacing : 0.05 em ; cursor : pointer ;
border : 1 px solid var ( -- neon - cyan );
background : rgba ( 0 , 240 , 255 , 0.1 );
color : var ( -- neon - cyan );
text-shadow : 0 0 6 px var ( -- neon - cyan );
transition : all 0.3 s ease ;
}
. key-save : hover {
background : rgba ( 0 , 240 , 255 , 0.2 );
box-shadow : 0 0 15 px rgba ( 0 , 240 , 255 , 0.2 );
}
. key-status {
font-family : 'Courier New' , monospace ;
font-size : 0.65 rem ;
letter-spacing : 0.05 em ;
}
. key-status . set { color : var ( -- neon - cyan ); text-shadow : 0 0 6 px var ( -- neon - cyan ); }
. key-status . unset { color : rgba ( 255 , 45 , 149 , 0.6 ); }
/* ── Quick links ── */
. quick-links {
display : flex ; gap : 16 px ; flex-wrap : wrap ; justify-content : center ;
}
. quick-link {
padding : 10 px 22 px ; border-radius : 25 px ;
font-size : 0.85 rem ; font-weight : 600 ; cursor : pointer ;
letter-spacing : 0.04 em ;
color : var ( -- neon - cyan );
background : rgba ( 0 , 240 , 255 , 0.06 );
border : 1 px solid rgba ( 0 , 240 , 255 , 0.2 );
backdrop-filter : blur ( 10 px );
-webkit- backdrop-filter : blur ( 10 px );
transition : all 0.3 s ease ;
text-shadow : 0 0 8 px rgba ( 0 , 240 , 255 , 0.3 );
}
. quick-link : hover {
background : rgba ( 0 , 240 , 255 , 0.15 );
border-color : var ( -- neon - cyan );
box-shadow : 0 0 25 px rgba ( 0 , 240 , 255 , 0.25 );
transform : translateY ( -2 px );
}
. has-results . quick-links { display : none ; }
/* ── Results ── */
. results-area { display : none ; width : 100 % ; }
. has-results . results-area { display : block ; }
. results-meta {
font-family : 'Courier New' , monospace ;
font-size : 0.7 rem ;
color : rgba ( 200 , 200 , 255 , 0.4 );
margin-bottom : 20 px ;
letter-spacing : 0.05 em ;
}
. result-card {
background : rgba ( 20 , 20 , 40 , 0.6 );
border : 1 px solid rgba ( 255 , 45 , 149 , 0.1 );
border-left : 2 px solid rgba ( 0 , 240 , 255 , 0.3 );
border-radius : 0 12 px 12 px 0 ;
padding : 18 px 22 px ;
margin-bottom : 12 px ;
backdrop-filter : blur ( 12 px );
-webkit- backdrop-filter : blur ( 12 px );
transition : all 0.3 s ease ;
cursor : pointer ;
}
. result-card : hover {
border-color : var ( -- neon - cyan );
border-left-width : 4 px ;
box-shadow : 0 0 25 px rgba ( 0 , 240 , 255 , 0.12 );
background : rgba ( 30 , 30 , 60 , 0.7 );
}
. result-url {
font-size : 0.7 rem ;
color : var ( -- neon - purple );
margin-bottom : 4 px ;
overflow : hidden ; text-overflow : ellipsis ; white-space : nowrap ;
}
. result-title {
font-size : 1.05 rem ;
font-weight : 600 ;
color : var ( -- neon - cyan );
text-shadow : 0 0 6 px rgba ( 0 , 240 , 255 , 0.2 );
margin-bottom : 6 px ;
text-decoration : none ;
}
. result-desc {
font-size : 0.85 rem ;
color : rgba ( 200 , 200 , 255 , 0.6 );
line-height : 1.5 ;
}
. loading {
text-align : center ; padding : 40 px ;
color : var ( -- neon - cyan );
font-family : 'Courier New' , monospace ;
text-shadow : 0 0 20 px var ( -- neon - cyan );
animation : pulse 1 s infinite alternate ;
}
@ keyframes pulse {
from { opacity : 0.5 ; } to { opacity : 1 ; }
}
. error {
text-align : center ; padding : 30 px ;
color : var ( -- neon - pink );
font-family : 'Courier New' , monospace ;
text-shadow : 0 0 15 px var ( -- neon - pink );
border : 1 px solid rgba ( 255 , 45 , 149 , 0.3 );
border-radius : 12 px ;
background : rgba ( 30 , 20 , 40 , 0.5 );
}
. no-results {
text-align : center ; padding : 40 px ;
color : rgba ( 200 , 200 , 255 , 0.2 );
font-family : 'Courier New' , monospace ;
font-size : 0.9 rem ;
}
/* ── Status bar ── */
. status-bar {
font-family : 'Courier New' , monospace ;
font-size : 0.7 rem ;
color : rgba ( 200 , 200 , 255 , 0.4 );
letter-spacing : 0.08 em ;
display : flex ; gap : 20 px ; align-items : center ;
margin-top : auto ; padding : 24 px 0 ;
}
. status-dot {
width : 6 px ; height : 6 px ; border-radius : 50 % ;
background : var ( -- neon - cyan );
box-shadow : 0 0 8 px var ( -- neon - cyan );
animation : dotPulse 2 s infinite ;
}
@ keyframes dotPulse {
0 %, 100 % { opacity : 1 } 50 % { opacity : 0.4 }
}
/* ── Responsive ── */
@ media ( max-width : 600px ) {
. logo { font-size : 2.8 rem ; }
. logo-sub { font-size : 0.7 rem ; }
. search-btn { padding : 16 px 18 px ; font-size : 0.8 rem ; }
. quick-links { gap : 10 px ; }
. key-input { width : 200 px ; }
. has-results . logo { font-size : 1.5 rem ; }
}
@ media ( prefers-reduced-motion : reduce ) {
. logo { animation : none ; }
. status-dot { animation : none ; }
. loading { animation : none ; }
2026-06-13 18:26:28 -04:00
. scanlines { animation : none ; }
. scan-flicker { animation : none ; }
2026-06-13 18:16:39 -04:00
}
2026-06-13 18:21:55 -04:00
/* ── Pagination ── */
. pagination {
display : flex ; align-items : center ; justify-content : center ;
gap : 16 px ; padding : 24 px 0 8 px ;
}
. page-btn {
font-family : 'Courier New' , monospace ;
font-size : 0.8 rem ; font-weight : 700 ;
letter-spacing : 0.06 em ;
padding : 10 px 22 px ;
border-radius : 25 px ;
cursor : pointer ;
transition : all 0.25 s ease ;
text-transform : uppercase ;
border : 2 px solid rgba ( 0 , 240 , 255 , 0.25 );
background : rgba ( 0 , 240 , 255 , 0.06 );
color : var ( -- neon - cyan );
text-shadow : 0 0 8 px rgba ( 0 , 240 , 255 , 0.3 );
}
. page-btn : hover : not ( : disabled ) {
background : rgba ( 0 , 240 , 255 , 0.18 );
border-color : var ( -- neon - cyan );
box-shadow : 0 0 20 px rgba ( 0 , 240 , 255 , 0.25 ), 0 0 40 px rgba ( 0 , 240 , 255 , 0.08 );
transform : translateY ( -1 px );
}
. page-btn : disabled {
opacity : 0.2 ; cursor : not-allowed ; box-shadow : none ; transform : none ;
}
. page-info {
font-family : 'Courier New' , monospace ;
font-size : 0.7 rem ;
color : rgba ( 200 , 200 , 255 , 0.35 );
letter-spacing : 0.05 em ;
white-space : nowrap ;
}
. page-info span {
color : var ( -- neon - cyan );
text-shadow : 0 0 6 px rgba ( 0 , 240 , 255 , 0.3 );
}
2026-06-13 18:16:39 -04:00
</ style >
</ head >
< body >
< div class = "grid-floor" ></ div >
< div class = "sun" ></ div >
< div class = "sun-cut" ></ div >
< div class = "sun-lines" ></ div >
< div class = "triangle-decor t1" ></ div >
< div class = "triangle-decor t2" ></ div >
< div class = "stars" id = "stars" ></ div >
< div class = "scanlines" ></ div >
2026-06-13 18:26:28 -04:00
< div class = "scan-flicker" ></ div >
2026-06-13 18:16:39 -04:00
< div class = "app" id = "app" >
< div class = "logo-wrap" >
< span class = "jp-tag" > サーチ</ span >
< h1 class = "logo" id = "logo" > NEONEX</ h1 >
< p class = "logo-sub" > S E A R C H _ T H E _ G R I D</ p >
</ div >
< div class = "host-badge" id = "hostBadge" ></ div >
<!-- API key row — only shown when running locally -->
< div class = "key-row hidden" id = "keyRow" >
< input type = "password" class = "key-input" id = "keyInput" placeholder = "Brave Search API key..." >
< button class = "key-save" id = "keySave" > SET KEY</ button >
< span class = "key-status" id = "keyStatus" > ⚡ NO KEY</ span >
</ div >
< div class = "search-wrap" >
< div class = "search-box" >
< span class = "search-icon" > ◇</ span >
< input type = "text" id = "searchInput" placeholder = "Enter the grid..." autofocus >
< button class = "search-btn" id = "searchBtn" > SEARCH</ button >
</ div >
</ div >
< div class = "quick-links" >
< span class = "quick-link" data-query = "vaporwave aesthetic" > AESTHETIC</ span >
< span class = "quick-link" data-query = "synthwave music" > SYNTHWAVE</ span >
< span class = "quick-link" data-query = "retro computing" > RETRO</ span >
< span class = "quick-link" data-query = "cyberpunk art" > CYBER</ span >
< span class = "quick-link" data-query = "80s design" > 80s</ span >
</ div >
< div class = "results-area" id = "resultsArea" >
< div class = "results-meta" id = "resultsMeta" ></ div >
< div id = "resultsList" ></ div >
2026-06-13 18:21:55 -04:00
< div class = "pagination" id = "pagination" style = "display:none" >
< button class = "page-btn" id = "prevBtn" disabled > ← PREV</ button >
< span class = "page-info" id = "pageInfo" ></ span >
< button class = "page-btn" id = "nextBtn" disabled > NEXT →</ button >
</ div >
2026-06-13 18:16:39 -04:00
</ div >
< div class = "status-bar" >
< span class = "status-dot" ></ span >
< span > GRID ONLINE</ span >
< span > ∥</ span >
< span id = "clock" > 00:00:00</ span >
< span > ∥</ span >
< span id = "sysVer" > SYS v4.0.0</ span >
</ div >
</ div >
< script >
// ── Detect environment ──
const isFileProtocol = window . location . protocol === 'file:' ;
const isLocalhost = isFileProtocol ||
window . location . hostname === 'localhost' ||
window . location . hostname === '127.0.0.1' ||
window . location . hostname . startsWith ( '192.168.' ) ||
window . location . hostname . endsWith ( '.local' );
const isNetlify = ! isLocalhost ;
const hostBadge = document . getElementById ( 'hostBadge' );
if ( isFileProtocol ) {
hostBadge . textContent = '◆ FILE MODE ◆' ;
hostBadge . className = 'host-badge local' ;
document . getElementById ( 'sysVer' ). textContent = 'SYS v4.0.0 · FILE' ;
} else if ( isLocalhost ) {
hostBadge . textContent = '◆ LOCAL DEV ◆' ;
hostBadge . className = 'host-badge local' ;
} else {
hostBadge . textContent = '◆ NETLIFY ◆' ;
hostBadge . className = 'host-badge netlify' ;
document . getElementById ( 'sysVer' ). textContent = 'SYS v4.0.0 · NETLIFY' ;
}
// ── API Key management (local dev only) ──
const keyRow = document . getElementById ( 'keyRow' );
const keyInput = document . getElementById ( 'keyInput' );
const keySave = document . getElementById ( 'keySave' );
const keyStatus = document . getElementById ( 'keyStatus' );
function getApiKey () {
return localStorage . getItem ( 'neonex_brave_key' ) || '' ;
}
function updateKeyUI () {
const key = getApiKey ();
if ( key ) {
keyInput . value = key . substring ( 0 , 8 ) + '••••••••' ;
keyStatus . textContent = '🔑 KEY SET' ;
keyStatus . className = 'key-status set' ;
keyInput . placeholder = 'Key saved — enter new key to replace' ;
} else {
keyInput . value = '' ;
keyStatus . textContent = '⚡ NO KEY' ;
keyStatus . className = 'key-status unset' ;
keyInput . placeholder = 'Brave Search API key...' ;
}
}
// Show key row only on localhost
if ( isLocalhost ) {
keyRow . classList . remove ( 'hidden' );
updateKeyUI ();
}
keySave . addEventListener ( 'click' , () => {
const val = keyInput . value . trim ();
if ( val && ! val . includes ( '•' )) {
localStorage . setItem ( 'neonex_brave_key' , val );
updateKeyUI ();
} else if ( ! getApiKey ()) {
alert ( 'Enter a valid Brave Search API key first.\nGet one: https://brave.com/search/api/' );
}
});
keyInput . addEventListener ( 'focus' , () => {
if ( getApiKey () && keyInput . value . includes ( '•' )) {
keyInput . value = '' ;
keyInput . placeholder = 'Paste new key here...' ;
}
});
// ── Search ──
const input = document . getElementById ( 'searchInput' );
const btn = document . getElementById ( 'searchBtn' );
const app = document . getElementById ( 'app' );
const resultsArea = document . getElementById ( 'resultsArea' );
const resultsList = document . getElementById ( 'resultsList' );
const resultsMeta = document . getElementById ( 'resultsMeta' );
2026-06-13 18:21:55 -04:00
// Pagination state
const pagination = document . getElementById ( 'pagination' );
const prevBtn = document . getElementById ( 'prevBtn' );
const nextBtn = document . getElementById ( 'nextBtn' );
const pageInfo = document . getElementById ( 'pageInfo' );
const RESULTS_PER_PAGE = 12 ;
let currentQuery = '' ;
let currentOffset = 0 ;
let totalResults = 0 ;
function updatePagination () {
if ( totalResults === 0 || currentQuery === '' ) {
pagination . style . display = 'none' ;
return ;
2026-06-13 18:16:39 -04:00
}
2026-06-13 18:21:55 -04:00
pagination . style . display = 'flex' ;
const currentPage = Math . floor ( currentOffset / RESULTS_PER_PAGE ) + 1 ;
const totalPages = Math . max ( 1 , Math . ceil ( totalResults / RESULTS_PER_PAGE ));
const isLastPage = currentOffset + RESULTS_PER_PAGE >= totalResults ;
pageInfo . innerHTML = `<span>PAGE ${ currentPage } </span> / ${ totalPages } ` ;
prevBtn . disabled = currentOffset === 0 ;
nextBtn . disabled = isLastPage ;
2026-06-13 18:16:39 -04:00
}
2026-06-13 18:21:55 -04:00
async function doPagedSearch ( offset ) {
const q = currentQuery ;
2026-06-13 18:16:39 -04:00
if ( ! q ) return ;
2026-06-13 18:21:55 -04:00
currentOffset = offset ;
resultsList . innerHTML = '<div class="loading">◆ SCANNING GRID PAGE ' + ( Math . floor ( offset / RESULTS_PER_PAGE ) + 1 ) + ' ◆</div>' ;
2026-06-13 18:16:39 -04:00
btn . disabled = true ;
btn . textContent = '...' ;
2026-06-13 18:21:55 -04:00
prevBtn . disabled = true ;
nextBtn . disabled = true ;
2026-06-13 18:16:39 -04:00
2026-06-13 18:21:55 -04:00
const endpoints = getSearchEndpoints ( q , offset );
2026-06-13 18:16:39 -04:00
let lastError = null ;
for ( const endpoint of endpoints ) {
try {
const fetchOpts = endpoint . headers ? { headers : endpoint . headers } : {};
const res = await fetch ( endpoint . url , fetchOpts );
if ( ! res . ok ) {
const errText = await res . text ();
throw new Error ( `API error ${ res . status } : ${ errText . substring ( 0 , 200 ) } ` );
}
const data = await res . json ();
if ( data . error ) {
throw new Error ( data . error );
}
const web = data . web ;
const results = web ? . results || [];
2026-06-13 18:21:55 -04:00
totalResults = web ? . total_result_count || ( currentOffset + results . length );
// If we got fewer results than requested OR hit the total, this is the last page
const isLastPage = results . length < RESULTS_PER_PAGE ||
( web ? . total_result_count && currentOffset + RESULTS_PER_PAGE >= web . total_result_count );
2026-06-13 18:16:39 -04:00
resultsMeta . textContent =
2026-06-13 18:21:55 -04:00
`Found ~ ${ totalResults . toLocaleString () } results · ` +
2026-06-13 18:16:39 -04:00
` ${ ( data . processing_time_ms / 1000 ). toFixed ( 2 ) } s · [ ${ endpoint . name } ]` ;
if ( results . length === 0 ) {
resultsList . innerHTML = '<div class="no-results">NO SIGNALS DETECTED IN THE GRID</div>' ;
} else {
resultsList . innerHTML = results . map (( r ) => `
<a class="result-card" href=" ${ r . url } " target="_blank" rel="noopener" style="text-decoration:none;display:block;">
<div class="result-url"> ${ escapeHtml ( r . url ) } </div>
<div class="result-title"> ${ escapeHtml ( r . title ) } </div>
<div class="result-desc"> ${ escapeHtml ( r . description || '' ) } </div>
</a>
` ). join ( '' );
}
2026-06-13 18:21:55 -04:00
updatePagination ();
2026-06-13 18:16:39 -04:00
return ;
} catch ( err ) {
lastError = err ;
}
}
2026-06-13 18:21:55 -04:00
// All failed
2026-06-13 18:16:39 -04:00
resultsList . innerHTML = `<div class="error">
⚠ GRID DISRUPTION<br><br>
<span style="font-size:0.75rem;text-shadow:none;color:rgba(255,45,149,0.7);"> ${ escapeHtml ( lastError ? . message || 'All search endpoints failed' ) } </span><br><br>
<span style="font-size:0.65rem;color:rgba(200,200,255,0.3);">
${ isLocalhost ? 'Make sure the proxy is running:<br><code style="color:var(--neon-cyan)">python3 neonex-proxy.py</code>' : 'Check that BRAVE_API_KEY is set in Netlify environment variables' }
</span>
</div>` ;
2026-06-13 18:21:55 -04:00
pagination . style . display = 'none' ;
2026-06-13 18:16:39 -04:00
btn . disabled = false ;
btn . textContent = 'SEARCH' ;
}
2026-06-13 18:21:55 -04:00
// Pagination button handlers
prevBtn . addEventListener ( 'click' , () => {
if ( currentOffset > 0 ) {
doPagedSearch ( Math . max ( 0 , currentOffset - RESULTS_PER_PAGE ));
}
});
nextBtn . addEventListener ( 'click' , () => {
doPagedSearch ( currentOffset + RESULTS_PER_PAGE );
});
/**
* Build a list of search endpoints to try in order:
* 1. Local proxy (if on localhost)
* 2. Netlify function (relative URL — works on Netlify)
* 3. Direct Brave API (needs key in localStorage)
*/
function getSearchEndpoints ( q , offset = 0 ) {
const endpoints = [];
// 1. Local Python proxy (any time we're local — file://, localhost, etc.)
if ( isLocalhost ) {
endpoints . push ({
name : 'Local Proxy' ,
url : `http://localhost:8777/search?q= ${ encodeURIComponent ( q ) } &count= ${ RESULTS_PER_PAGE } &offset= ${ offset } ` ,
});
// Also send key to proxy if we have one
const apiKey = getApiKey ();
if ( apiKey ) {
fetch ( `http://localhost:8777/key?set= ${ encodeURIComponent ( apiKey ) } ` ). catch (() => {});
}
}
// 2. Netlify function (relative URL — only when NOT on file:// protocol)
if ( ! isFileProtocol ) {
endpoints . push ({
name : 'Netlify Function' ,
url : `/search?q= ${ encodeURIComponent ( q ) } &count= ${ RESULTS_PER_PAGE } &offset= ${ offset } ` ,
});
}
// 3. Direct Brave API fallback (needs localStorage key)
const localKey = getApiKey ();
if ( localKey ) {
endpoints . push ({
name : 'Brave Direct' ,
url : `https://api.search.brave.com/res/v1/web/search?q= ${ encodeURIComponent ( q ) } &count= ${ RESULTS_PER_PAGE } &offset= ${ offset } ` ,
headers : {
'Accept' : 'application/json' ,
'X-Subscription-Token' : localKey ,
},
});
}
return endpoints ;
}
async function doSearch ( query ) {
const q = query || input . value . trim ();
if ( ! q ) return ;
// Reset pagination state for a new search
currentQuery = q ;
currentOffset = 0 ;
totalResults = 0 ;
// Switch to results mode
app . classList . add ( 'has-results' );
input . value = q ;
await doPagedSearch ( 0 );
}
2026-06-13 18:16:39 -04:00
function escapeHtml ( str ) {
const div = document . createElement ( 'div' );
div . textContent = str ;
return div . innerHTML ;
}
btn . addEventListener ( 'click' , () => doSearch ());
input . addEventListener ( 'keydown' , ( e ) => {
if ( e . key === 'Enter' ) doSearch ();
});
// Quick links
document . querySelectorAll ( '.quick-link' ). forEach ( link => {
link . addEventListener ( 'click' , () => doSearch ( link . dataset . query ));
});
// Click logo to reset to home
document . getElementById ( 'logo' ). addEventListener ( 'click' , () => {
if ( app . classList . contains ( 'has-results' )) {
app . classList . remove ( 'has-results' );
resultsList . innerHTML = '' ;
2026-06-13 18:21:55 -04:00
pagination . style . display = 'none' ;
currentQuery = '' ;
currentOffset = 0 ;
totalResults = 0 ;
2026-06-13 18:16:39 -04:00
input . value = '' ;
input . focus ();
// Glitch effect
const logo = document . getElementById ( 'logo' );
logo . style . textShadow = '3px 0 var(--neon-pink), -3px 0 var(--neon-cyan), 0 0 80px var(--neon-pink)' ;
setTimeout (() => {
logo . style . textShadow = '0 0 10px var(--neon-cyan), 0 0 40px var(--neon-cyan), 0 0 80px var(--neon-cyan), 0 0 120px rgba(0,240,255,0.4), 2px 2px 0 var(--neon-pink), -2px -2px 0 var(--neon-purple)' ;
}, 150 );
}
});
// ── Stars ──
const starsEl = document . getElementById ( 'stars' );
for ( let i = 0 ; i < 80 ; i ++ ) {
const star = document . createElement ( 'div' );
const size = Math . random () * 2.5 + 1 ;
star . style . cssText = `
position:absolute;width: ${ size } px;height: ${ size } px;
background: ${ Math . random () > 0.7 ? 'var(--neon-cyan)' : 'var(--neon-pink)' } ;
border-radius:50%;
top: ${ Math . random () * 100 } %;left: ${ Math . random () * 100 } %;
opacity: ${ Math . random () * 0.5 + 0.1 } ;
box-shadow:0 0 ${ size * 3 } px currentColor;
animation:twinkle ${ Math . random () * 3 + 2 } s infinite alternate;
` ;
starsEl . appendChild ( star );
}
const twinkleStyle = document . createElement ( 'style' );
twinkleStyle . textContent = '@keyframes twinkle{from{opacity:0.15}to{opacity:0.6}}' ;
document . head . appendChild ( twinkleStyle );
// ── Clock ──
function updateClock () {
document . getElementById ( 'clock' ). textContent = new Date (). toTimeString (). split ( ' ' )[ 0 ];
}
updateClock ();
setInterval ( updateClock , 1000 );
</ script >
</ body >
</ html >