1 2// included by: 3// kiwisdr/{ext,quickstart,ks}/index.html 4// kiwisdr/php/update.php => public/index.html (generated file) 5// kiwisdr/ks/using_Kiwi.html 6// jks/{5370,gps,wwvb,cic,sdgps}/*.html 7// 8// FIXME: 9// doesn't do the right thing when both o= and n= options used together 10 11web = { 12 fontsize_i: 1, 13 fontsize_s: [ 'small', 'regular', 'large', 'huge' ], 14 fontsize: [ '100%', '120%', '150%', '175%' ], 15 width: [ 800, 800, 1024, 1024 ], 16 17 debug: false, 18 search_val: '', 19 band_s: [ 'all', 'non-HF' ], 20 band: 0, 21 BAND_ALL: 0, 22 BAND_NON_HF: 1, 23 snr_sort_s: [ '0-30 MHz', '1.8-30 MHz' ], 24 snr_sort: 1, 25 SNR_ALL: 0, 26 SNR_HF: 1, 27 snr: 0, 28 url_params: '', 29 url_p_seen: false, 30 31 LIST_SEARCH: 1, 32 LIST_SNR: 2, 33 list: [], 34 list_el: [], 35 36 tab_cancel_first: false, 37 38 end: null 39}; 40 41kiwi = {}; // because kiwi.js is not loaded (only kiwi_util.js) 42 43 44// done this way to implement an AND between the search and snr fields 45 46function web_show_list(idx, which, show, el) 47{ 48 //if (which == web.LIST_SEARCH) console.log(idx +': which='+ which +' show='+ show); 49 //console.log(el); 50 if (idx == 0) { 51 if (which == web.LIST_SEARCH) web.search_hits = show? 1:0; 52 if (which == web.LIST_SNR) web.snr_hits = show? 1:0; 53 } else { 54 if (which == web.LIST_SEARCH && show) web.search_hits++; 55 if (which == web.LIST_SNR && show) web.snr_hits++; 56 } 57 58 if (show) 59 web.list[idx] |= which; 60 else 61 web.list[idx] &= ~which; 62 63 web.last_list_idx = idx; 64 web.list_el[idx] = el; 65} 66 67function web_show_list_result() 68{ 69 // perform AND between search and snr only if both had matches 70 var show_match = web.LIST_SEARCH | web.LIST_SNR; 71 //console.log('web_show_list_result last_idx='+ web.last_list_idx +' show_match: SEARCH('+ web.search_hits +') SNR('+ web.snr_hits +')'); 72 var idx, matches = 0, any_hidden = false; 73 74 for (idx = 0; idx <= web.last_list_idx; idx++) { 75 var show = (show_match != 0 && web.list[idx] == show_match); 76 //if (show) console.log('list['+ idx +']'); 77 w3_show_hide(web.list_el[idx], show, ''); 78 if (show) matches++; else any_hidden = true; 79 } 80 w3_innerHTML('id-matches-container', any_hidden? (matches +' match') : ''); 81} 82 83function web_search_input_cb(path, val) 84{ 85 var non_hf = (web.band == 1); 86 var hf = !non_hf; 87 var no_filter = (val == ''); 88 val = web.search_val = val.toLowerCase(); 89 var c = null, and = false, or = false, no_bool = false, search_hidden = false; 90 if (val.includes(',')) { c = ','; and = true; } 91 else 92 if (val.includes('|')) { c = '|'; or = true; } 93 else 94 no_bool = true; 95 96 var v_a = c? val.split(c) : [val]; 97 var v_ap = [], v_an = []; 98 v_a.forEach( 99 function(v,i) { 100 if (v[0] == '!') { 101 v = v.slice(1); 102 if (v[0] == '^') search_hidden = true; 103 v_an.push(v); 104 } else { 105 if (v[0] == '^') search_hidden = true; 106 v_ap.push(v); 107 } 108 } 109 ); 110 var v_ap_l = v_ap.length; 111 var v_an_l = v_an.length; 112 //console.log('v_ap:'); console.log(v_ap); 113 //console.log('v_an:'); console.log(v_an); 114 var no_kiwi = !web.show_kiwi; 115 var no_owrx = !web.show_owrx; 116 var skip = no_filter && hf; 117 console.log('web_search_input_cb <'+ val +'> AND='+ and +' OR='+ or +' no_filter='+ no_filter +' non_hf='+ non_hf +' no_kiwi='+ no_kiwi +' no_owrx='+ no_owrx +' skip='+ skip); 118 119 w3_iterate_children('body', function(el1, i) { 120 if (el1.nodeName != 'DIV') return; 121 if (!w3_contains(el1, 'id-list')) return; 122 123 var list_idx = 0; 124 w3_iterate_children(el1, function(el2, j) { 125 if (el2.nodeName != 'DIV') return; 126 if (!w3_contains(el2, 'cl-entry')) return; 127 128 w3_iterate_children(el2, function(el3, k) { 129 if (el3.nodeName != 'DIV') return; 130 if (!w3_contains(el3, 'cl-info')) return; 131 132 var band_ok = true; 133 var type_ok = true; 134 var match_vec = 0, match_vec_not = 0; 135 var entry_ok; 136 var trig = false;
137 138 if (skip) { 139 entry_ok = true; 140 } else { 141 entry_ok = false; 142 w3_iterate_childNodes(el3, 143 function(el4, k) { 144 if (el4.nodeType == Node.COMMENT_NODE) { 145 if (no_kiwi && el4.data.includes('sw_version=KiwiSDR')) { 146 type_ok = false; return; 147 } else 148 if (no_owrx && el4.data.includes('sw_version=OpenWebRX')) { 149 type_ok = false; return; 150 } else 151 if (non_hf && el4.data.includes('bands=')) { 152 var ar = el4.data.match(/([0-9]*)-([0-9]*)/); 153 var Flo = +ar[1] / 1e6, Fhi = +ar[2] / 1e6; 154 //console.log('non_hf Flo='+ Flo); 155 if (Flo <= 32) { band_ok = false; return; } 156 trig = true; 157 } 158 } 159 160 if (no_filter) return; 161 //console.log(el4); 162 var v_el, hidden = false;; 163 if (el4.nodeType == Node.COMMENT_NODE) { 164 if (!search_hidden) return; 165 v_el = el4.data.toLowerCase(); 166 hidden = true; 167 } else { 168 if (el4.nodeName != 'DIV' && el4.nodeName != 'SPAN' && el4.nodeName != 'A') return; 169 v_el = el4.innerText.toLowerCase(); 170 } 171 if (0) console.log(list_idx +' hidden='+ TF(hidden) +' <'+ v_el +'>'); 172 v_ap.forEach( 173 function(v,i) { 174 if (v[0] == '^') { 175 if (!hidden) return; 176 v = v.slice(1); 177 } else { 178 if (hidden) return; 179 } 180 if (v_el.includes(v)) { 181 match_vec |= 1 << i; 182 if (hidden) console.log('HIDDEN match: <'+ v_el +'>'); 183 //console.log(i +' '+ v +' <'+ v_el +'>'); 184 } 185 } 186 ); 187 v_an.forEach( 188 function(v,i) { 189 if (v[0] == '^') { 190 if (!hidden) return; 191 v = v.slice(1); 192 } else { 193 if (hidden) return; 194 } 195 if (v_el.includes(v)) { 196 match_vec_not |= 1 << i; 197 //console.log(i +' NOT '+ v +' <'+ v_el +'>'); 198 } 199 } 200 ); 201 } 202 ); 203 204 if (no_filter) { 205 entry_ok = true; 206 } else { 207 // AND: want all the v_ap search terms to match somewhere across all el4 nodes, hence the bit vector (and no v_an matches) 208 // OR: (and without any qualifier) only one term has to match 209 var bcv = kiwi_bitCount(match_vec); 210 if (and || no_bool) { 211 if (bcv == v_ap_l && match_vec_not == 0) entry_ok = true; 212 } else 213 if (or) { 214 if (match_vec != 0 || (v_an_l != 0 && match_vec_not == 0)) entry_ok = true; 215 } 216 var s = and? 'AND' : (or? 'OR' : 'NO_BOOL'); 217 if (0) 218 console.log(w3_sb('#'+ list_idx, s, 219 'vp='+ match_vec.toHex() +'('+ bcv +','+ v_ap_l +')', 220 'vn='+ match_vec_not.toHex() +'('+ kiwi_bitCount(match_vec_not) +','+ v_an_l +')', 221 (entry_ok? 'MATCH':'NOMAT'))); 222 } 223 } 224 225 var ok = band_ok && type_ok && entry_ok; 226 //if (ok) console.log(list_idx +' '+ el2); 227 web_show_list(list_idx, web.LIST_SEARCH, ok, el2); 228 list_idx++; 229 }); 230 }); 231 }); 232 233 web_show_list_result(); 234} 235 236/* 237function web_type_cb(path, checked, first, type) 238{ 239 //console.log('web_type_cb: checked='+ checked +' type='+ type +' first='+ first +' show_kiwi='+ web.show_kiwi +' show_owrx='+ web.show_owrx +' cur_search='+ web.search_val); 240 web['show_'+ type] = checked? true:false; 241 writeCookie('show_'+ type, checked? 'true':'false'); 242 243 web_search_input_cb(null, web.search_val); 244} 245*/ 246 247function web_band_cb(path, val, first) 248{ 249 //console.log('web_band_cb val='+ val +' first='+ first); 250 if (first) return; 251 web.band = +val; 252 w3_select_value(path, val); 253 web_search_input_cb(null, web.search_val); 254} 255 256var hf_bands = [ 257 { lo: 0.010, hi: 0.030, s: 'VLF', c: 'purple' }, 258 { lo: 0.010, hi: 0.5, s: 'LF', c: 'purple' }, 259 { lo: 3.5, hi: 4, s: '80m', c: 'red' }, 260 { lo: 7, hi: 7.3, s: '40m', c: 'green' }, 261]; 262hf_bands.forEach(function(b) { b.w = b.hi - b.lo; } ); 263 264var vhf_bands = [ 265 { lo: 50, hi: 54, s: '6m', c: 'red' }, 266 { lo: 70, hi: 70.5, s: '4m', c: 'red' }, 267 { lo: 118, hi: 138, s: 'Airband', c: 'blue' }, 268 { lo: 144, hi: 148, s: '2m', c: 'cyan,black' }, 269 { lo: 222, hi: 225, s: '1.25m', c: 'cyan,black' }, 270]; 271vhf_bands.forEach(function(b) { b.w = b.hi - b.lo; } ); 272 273var uhf_bands = [ 274 { lo: 420, hi: 450, s: '70cm', c: 'lime,black' }, 275 { lo: 902, hi: 928, s: '33cm', c: 'lime,black' }, 276 { lo: 1240, hi: 1300, s: '23cm', c: 'lime,black' }, 277 { lo: 10000, hi: 10500, s: '10GHz', c: 'lime,black' }, 278]; 279uhf_bands.forEach(function(b) { b.w = b.hi - b.lo; } ); 280 281function web_band_icon() 282{ 283 w3_iterate_children('body', function(el1, i) { 284 if (el1.nodeName != 'DIV') return; 285 if (!w3_contains(el1, 'id-list')) return; 286 287 w3_iterate_children(el1, function(el2, j) { 288 if (el2.nodeName != 'DIV') return; 289 if (!w3_contains(el2, 'cl-entry')) return; 290 291 w3_iterate_children(el2, function(el3, j) { 292 if (el3.nodeName != 'DIV') return; 293 if (!w3_contains(el3, 'cl-info')) return; 294 295 var no_bands = true; 296 var Flo = 0, Fhi = 0, Fw, Flo_p, Fhi_p, Flo_s, Fhi_s; 297 w3_iterate_childNodes(el3, function(el4, k) { 298 if (el4.nodeType == Node.COMMENT_NODE && el4.data.includes('bands=')) { 299 var ar = el4.data.match(/([0-9]*)-([0-9]*)/); 300 if (ar.length == 3) { 301 Flo = +ar[1] / 1e6; 302 Flo_p = (Flo && Flo < 1)? 3 : (((Flo - Math.floor(Flo)) >= 0.099)? 1:0); 303 Fhi = +ar[2] / 1e6; 304 Fhi_p = (Fhi && Fhi < 1)? 3 : (((Fhi - Math.floor(Fhi)) >= 0.099)? 1:0); 305 Flo_s = Flo.toFixed(Flo_p); Fhi_s = Fhi.toFixed(Fhi_p); 306 Fw = Fhi - Flo; 307 no_bands = false;
308 } 309 //if (Flo > 32) console.log(Flo +'-'+ Fhi); 310 } else 311 312 if (el4.nodeName == 'SPAN' && w3_contains(el4, 'id-band')) { 313 if (no_bands) { 314 w3_hide(el4); 315 } else 316 if (Flo <= 3 && Fhi >= 30 && Fhi <= 32) { // HF is special case 317 w3_innerHTML(el4, web.debug? ('HF '+ Flo_s +'-'+ Fhi_s) : 'HF'); 318 el4.style.backgroundColor = web.debug? 'grey' : 'rgb(145, 71, 255)'; 319 } else { 320 var found = null; 321 var bands = (Flo >= 300)? uhf_bands : ((Flo > 32)? vhf_bands : hf_bands); 322 if (web.debug) console.log('----'); 323 if (web.debug) console.log(Flo.toFixed(3) +'-'+ Fhi.toFixed(3) +' '+ Flo_s +'-'+ Fhi_s); 324 bands.forEach(function(b,i) { 325 //if (web.debug) console.log(b); 326 var inside = ((Flo <= b.lo && Fhi >= b.lo) || (Flo <= b.hi && Fhi >= b.hi) || (Flo >= b.lo && Fhi <= b.hi)); 327 if (web.debug && found && inside) console.log(b.s +' '+ (b.w/Fw).toFixed(3) +' >? '+ (found.w/Fw).toFixed(3)); 328 if (inside && (!found || (b.w/Fw > found.w/Fw))) { 329 found = b; 330 if (web.debug) console.log('match '+ (found.w/Fw).toFixed(3)); 331 return; 332 } 333 }); 334 if (found && found.w/Fw >= 0.3) { // minimum overlap width 335 if (web.debug) { 336 console.log('found...'); 337 console.log(found); 338 } 339 w3_innerHTML(el4, found.s + (web.debug? (' '+ Flo_s +'-'+ Fhi_s) : '')); 340 w3_colors(el4, found.c); 341 } else { 342 if (web.debug) console.log('not found'+ (found? (': max ratio '+ (found.w/Fw).toFixed(3) +' '+ found.s) : '')); 343 w3_innerHTML(el4, Flo_s +'-'+ Fhi_s +' MHz'); 344 w3_colors(el4, web.debug? 'red' : 'grey'); 345 } 346 } 347 } 348 }); 349 }); 350 }); 351 }); 352} 353 354function web_snr_sort_cb(path, val, first) 355{ 356 //console.log('web_snr_sort_cb val='+ val +' first='+ first); 357 if (first) return; 358 web.snr_sort = +val; 359 w3_select_value(path, val); 360 361 // see: stackoverflow.com/questions/66289976/dynamically-re-arrange-order-of-div-using-javascript-only 362 var a = iterable_to_array(document.querySelectorAll("div[class*=snr_all]")); 363 364 if (web.snr_sort == web.SNR_ALL) { 365 //a = a.sort((a,b) => w3_match_wildcard(b,'snr_all').replace('snr_all_','') - w3_match_wildcard(a,'snr_all').replace('snr_all_','')); 366 a = a.sort(function(a,b) { 367 return (w3_match_wildcard(b,'snr_all').replace('snr_all_','') - w3_match_wildcard(a,'snr_all').replace('snr_all_','')); 368 }); 369 } else { 370 //a = a.sort((a,b) => w3_match_wildcard(b,'snr_hf').replace('snr_hf_','') - w3_match_wildcard(a,'snr_hf').replace('snr_hf_','')); 371 a = a.sort(function (a,b) { 372 return (w3_match_wildcard(b,'snr_hf').replace('snr_hf_','') - w3_match_wildcard(a,'snr_hf').replace('snr_hf_','')); 373 }); 374 } 375 376 // NB: appendChild() actually *moves* an existing element to the end of the list! 377 a.forEach(function(div) { w3_el('id-list').appendChild(div); }); 378} 379 380function web_snr_input_cb(path, val) 381{ 382 var snr_field = +val; 383 var no_filter = (val == ''); 384 //console.log('web_snr_input_cb <'+ val +'> no_filter='+ no_filter); 385 w3_innerHTML('id-web.snr-label', (snr_field >= 0)? 'SNR ≥' : 'SNR ≤'); 386 387 w3_iterate_children('body', function(el1, i) { 388 if (el1.nodeName != 'DIV') return; 389 if (!w3_contains(el1, 'id-list')) return; 390 391 var list_idx = 0; 392 w3_iterate_children(el1, function(el2, j) { 393 if (el2.nodeName != 'DIV') return; 394 if (!w3_contains(el2, 'cl-entry')) return; 395 396 w3_iterate_children(el2, function(el3, k) { 397 if (el3.nodeName != 'DIV') return; 398 if (!w3_contains(el3, 'cl-info')) return; 399 400 var show; 401 if (no_filter) { 402 show = true; 403 } else { 404 show = false;
405 w3_iterate_childNodes(el3, function(el4, k) { 406 if (el4.nodeType == Node.COMMENT_NODE && el4.data.includes('snr=')) { 407 var snr = +(el4.data.split('=')[1].split(',')[(web.snr_sort == web.SNR_ALL)? 0:1]); 408 if (snr != 0) { // snr == 0 means snr measurement is disabled, so don't even consider 409 if (snr_field >= 0) { 410 if (snr >= snr_field) show = true; 411 } else { 412 if (snr <= -(snr_field)) show = true; 413 } 414 } 415 } 416 }); 417 } 418 web_show_list(list_idx, web.LIST_SNR, show, el2); 419 list_idx++; 420 }); 421 }); 422 }); 423 424 web_show_list_result(); 425} 426 427function web_url_params_input_cb(path, val) 428{ 429 val = val || ''; 430 while (val.length >= 1 && (val[0] == '/' || val[0] == '?')) val = val.slice(0,-1); 431 kiwi_storeWrite('url_params', val); 432 w3_el('id-url-params').style.setProperty('border', (val == '')? '' : '4px solid red', 'important'); 433 434 // append the URL param onto every list anchor element 435 w3_iterate_children('body', function(el1, i) { 436 if (el1.nodeName != 'DIV') return; 437 if (!w3_contains(el1, 'id-list')) return; 438 439 w3_iterate_children(el1, function(el2, j) { 440 if (el2.nodeName != 'DIV') return; 441 if (!w3_contains(el2, 'cl-entry')) return; 442 443 w3_iterate_children(el2, function(el3, j) { 444 if (el3.nodeName != 'DIV') return; 445 if (!w3_contains(el3, 'cl-info')) return; 446 447 w3_iterate_childNodes(el3, function(el4, k) { 448 if (el4.nodeType == Node.ELEMENT_NODE && el4.nodeName == 'A') { 449 var s = el4.innerHTML.split('?')[0]; 450 if (s[s.length-1] == '/') s = s.slice(0,-1); 451 el4.innerHTML = s; 452 el4.href = el4.href.split('?')[0]; 453 if (val != '') { 454 el4.innerHTML += '/?'+ val; 455 el4.href = el4.href +'?'+ val; // href always terminates in '/' 456 } 457 //console.log(el4); 458 } 459 }); 460 }); 461 }); 462 }); 463} 464 465/* 466function web_tab_cb(path, checked, first) 467{ 468 //console.log('web_tab_cb path='+ path +' checked='+ checked +' first='+ first +' tab_cancel_first='+ web.tab_c
468ancel_first) 469 if (web.tab_cancel_first && first) { 470 web.tab_cancel_first = false; 471 return; 472 } 473 474 writeCookie('open_in_new_tab', checked); 475 476 w3_iterateDeep_children('body', function(el, i) { 477 if (el.nodeName != 'A') return; 478 el.target = checked? '_blank' : '_self'; 479 }); 480} 481*/ 482 483function kiwi_bodyonload() 484{ 485 var s, el; 486 var url = window.location.href; 487 488 //console.log('kiwi_bodyonload: '+ url); 489 490 deleteCookie('open_in_new_tab'); 491 492 /* 493 w3_div('cl-cyan-highlight-text w3-padding-LR-6 w3-text-black w3-bold|width:100%', 'KiwiSDR 2'), 494 w3_text('w3-margin-left w3-margin-T-8 w3-text-black', 'Please see the forum for the ' + 495 w3_link('w3-link-darker-color', 496 'https://forum.kiwisdr.com/index.php?p=/discussion/2986/kiwisdr-2-production-status/p1', 497 'KiwiSDR 2 production status') +' and '+ 498 w3_link('w3-link-darker-color', 499 'https://forum.kiwisdr.com/index.php?p=/discussion/2994/kiwisdr-2-your-expression-of-interest-needed/p1', 500 'expression of interest') +'.' 501 ), 502 */ 503 504 /* 505 w3_text('w3-margin-L-8 w3-margin-T-8 w3-text-black', 'Please visit ' + 506 w3_link('w3-link-darker-color', 'https://kiwisdr.nz', 'kiwisdr.nz') 507 +' and the '+ 508 w3_link('w3-link-darker-color', 509 'https://forum.kiwisdr.com/index.php?p=/discussion/3051/kiwisdr-2-the-online-store-is-open-for-orders-please-visit-kiwisdr-nz/p1', 510 'Kiwi forum') +' for more information.' 511 */ 512 513 /* 514 w3_text('w3-margin-left w3-margin-T-8 w3-text-black', 'First build sold out. ' + 515 'Message will appear here when store is ready for second build ordering.' 516 ), 517 */ 518 519 /* 520 w3_div('cl-yellow-highlight-text w3-margin-left w3-margin-T-8 w3-text-black', 'Want to purchase from the second production build? ' + 521 'Please email [email protected]' 522 ), 523 */ 524 525 // kiwisdr.com/public (rx.kiwisdr.com) 526 if (url.includes('kiwisdr.com/public') || url.includes('kiwisdr.com/.public') || url.includes('update.php') || url.includes('linkfanel.html')) { 527 w3_innerHTML('id-announce', 528 w3_div('cl-lime-highlight-text w3-padding-LR-6 w3-text-black w3-bold|width:100%', 'KiwiSDR 2'), 529 530 w3_div('w3-margin-left w3-margin-T-8 cl-yellow-highlight-text w3-text-black w3-bold', 531 'The online store is open for orders:' + 532 w3_link('w3-margin-L-8 w3-margin-T-8 w3-link-darker-color', 'kiwisdr.nz', 'kiwisdr.nz') 533 ), 534 535 //w3_div('w3-margin-left w3-margin-T-8 cl-yellow-highlight-text w3-text-black w3-bold', 'Second build is sold out. Third build happening soon.'), 536 537 //w3_link('w3-margin-left w3-margin-T-8 w3-link-darker-color', 'kiwisdr.nz', 'Our online store: kiwisdr.nz'), 538 539 /* 540 w3_link('w3-margin-left w3-margin-T-8 w3-link-darker-color', 'forum.kiwisdr.com/index.php?p=/discussion/3098/kiwisdr-2-shipping-status/p1', 541 'Shipping status'), ' ', 542 w3_div('cl-yellow-highlight-text w3-text-black', 'Updated 22 April'), 543 */ 544 545 w3_link('w3-margin-left w3-margin-T-8 w3-link-darker-color', 'forum.kiwisdr.com/index.php?p=/discussion/2986/kiwisdr-2-production-status#latest', 'Production status'), 546 //' ', 547 //w3_div('cl-yellow-highlight-text w3-text-black', 'Updated 18 July'), 548 549 w3_link('w3-margin-left w3-margin-T-8 w3-link-darker-color', 'forum.kiwisdr.com/index.php?p=/discussion/comment/17634/#Comment_17634', 'Factory image/video') 550 551 //'<br>', 552 553 //w3_div('w3-margin-T-8 w3-text-css-red|position:relative; left:116px', 'Your Kiwi must be running the v1.690 (or later) release to be listed here.'), 554 555 //w3_hr('|margin:8px 0 0 0') 556 ); 557 w3_add('id-announce', 'w3-margin w3-font-18px'); 558 559 w3_innerHTML('id-map-button', 560 w3_link('', 'http://rx.linkfanel.net', w3_button('cl-button-map w3-blue w3-large w3-padding-large w3-round-xlarge', 'KiwiSDR Map')) 561 ); 562 563 w3_innerHTML('id-search-container', 564 w3_input('/id-search w3-padding-small||size=25', 'Search', 'web.search', '', 'web_search_input_cb') 565 ); 566 web_search_input_cb(null, ''); 567 568 w3_innerHTML('id-and-or-container', 569 //w3_text('w3-font-14px w3-text-css-grey', 'AND: word,word <br> OR: word|word') 570 w3_text('w3-font-14px w3-text-css-grey', 'AND: word,word <br> OR: word|word <br> NOT: !word <yel>NEW</yel>') 571 ); 572 573 w3_innerHTML('id-band-container', 574 w3_select('/w3-padding-small w3-margin-T-0', 'Band', '', 'web.band', web.band, web.band_s, 'web_band_cb') 575 ); 576 577 w3_innerHTML('id-snr-sort-container', 578 w3_select('/w3-padding-small w3-margin-T-0', 'SNR sort value', '', 'web.snr_sort', web.snr_sort, web.snr_sort_s, 'web_snr_sort_cb') 579 ); 580 581 w3_innerHTML('id-snr-val-container', 582 w3_input('/w3-flex-noshrink/id-snr-val w3-padding-small||size=4', 'SNR ≥', 'web.snr', '', 'web_snr_input_cb') 583 ); 584 web_snr_input_cb(null, ''); 585 586 w3_innerHTML('id-url-params-container', 587 w3_input('/id-url-params w3-padding-small||size=25 title="saved in browser storage"', 588 'Kiwi URL params', 'web.url_params', '', 'web_url_params_input_cb') 589 ); 590 591 el = w3_el('id-url-usage'); 592 w3_innerHTML(el, 593 w3_inline('w3-margin-L-16 w3-text-css-grey/', 594 w3_div('', 'Entries are sorted by SNR'), 595 w3_div('w3-margin-L-16 w3-font-14px', 596 '<b>URL params:</b> s=(search terms), b=(band menu match), o=(SNR menu 0|1), n=(snr ≥ value), u=(Kiwi URL params, <i>must be last</i>) e.g. ' + 597 '<a href="http://rx.kiwisdr.com/?s=uk,gps&n=30&u=f=10Mamnz10" target="_blank">rx.kiwisdr.com/?s=uk,gps&n=30&u=f=10Mamnz10</a>') 598 ) 599 ); 600 601 //web.show_kiwi = (initCookie('show_kiwi', 'true') == 'false')? false : true; 602 //web.show_owrx = (initCookie('show_owrx', 'false') == 'false')? false : true; 603 web.show_kiwi = true; 604 web.show_owrx = false;
605 606 /* 607 web.tab = (initCookie('open_in_new_tab', true) == 'false')? false : true; 608 w3_innerHTML('id-tab-container', 609 w3_checkbox('w3-label-inline w3-label-left/id-tab', 'Open in new tab:', 'web.tab', web.tab, 'web_tab_cb') 610 ); 611 */ 612 613 var url_p = '', doSearch = false, search_el, search_v; 614 var params = new URLSearchParams(window.location.search); 615 params.forEach(function(v,k) { 616 var rv; 617 //console.log('URL QS k='+ k +' v=<'+ v +'>'); 618 if (url_p != '') { 619 // accumulate url parameters 620 url_p += '&'+ k; 621 if (v != '') url_p += '='+ v; 622 } else { 623 if (k.startsWith('s')) { 624 el = w3_el('id-search'); 625 //console.log('search: <'+ v +'>'); 626 if (el && isArg(v)) { 627 w3_set_value(el, v); 628 search_el = el; 629 search_v = v; 630 doSearch = true; 631 } 632 } else 633 if (k.startsWith('b')) { 634 if (isArg(v)) { 635 rv = w3_select_match('id-web.band', v); 636 if (rv.idx != -1) 637 web_band_cb('web.band', rv.idx); 638 } 639 } else 640 if (k.startsWith('o')) { 641 if (isArg(v)) { 642 rv = w3_select_match('id-web.snr_sort', v); 643 if (rv.idx != -1) 644 web_snr_sort_cb('web.snr_sort', rv.idx); 645 } 646 } else 647 if (k.startsWith('n')) { 648 el = w3_el('id-snr-val'); 649 //console.log('snr: <'+ v +'>'); 650 if (el && isArg(v)) { 651 w3_set_value(el, v); 652 web_snr_input_cb(el, v); 653 } 654 } else 655 if (k == 'debug') { 656 web.debug = true; 657 } else 658 if (k.startsWith('u') || k.startsWith('p')) { 659 //console.log('u: <'+ v +'>'); 660 web.url_p_seen = true; 661 url_p = v; // start accumulating url parameters 662 } 663 } 664 }); 665 666 var _url_p = (web.url_p_seen)? url_p : kiwi_storeInit('url_params', ''); 667 //console.log('url_p_seen='+ web.url_p_seen +' _url_p=<'+ _url_p +'>'); 668 if (_url_p != '' || web.url_p_seen) { // web.url_p_seen allows "u=" in URL to erase field 669 el = w3_el('id-url-params'); 670 //console.log('url params: <'+ _url_p +'>'); 671 w3_set_value(el, _url_p); 672 web_url_params_input_cb(el, _url_p); 673 } 674 675 web_band_icon(); 676 if (doSearch) web_search_input_cb(search_el, search_v); 677 678 /* 679 s = qs('k') || qs('kiwi') || qs('kiwisdr'); 680 //console.log('k: qs='+ s); 681 if (s != null) { 682 s = (s == '' || s == '1' || s == 'true')? true:false; 683 //console.log('URL kiwi: s='+ s); 684 web_type_cb(null, s, false, 'kiwi'); 685 } 686 687 s = qs('o') || qs('owrx') || qs('openwebrx'); 688 //console.log('o: qs='+ s); 689 if (s != null) { 690 s = (s == '' || s == '1' || s == 'true')? true:false;
691 //console.log('URL owrx: s='+ s); 692 web_type_cb(null, s, false, 'owrx'); 693 } 694 695 w3_innerHTML('id-type-container', 696 w3_div('', 697 w3_checkbox('id-kiwi w3-label-inline w3-label-left/id-tab', 'Show KiwiSDR:', 'web.show_kiwi', web.show_kiwi, 'web_type_cb', 'kiwi'), 698 w3_checkbox('id-owrx w3-label-inline w3-label-left/id-tab', 'Show OpenWebRX:', 'web.show_owrx', web.show_owrx, 'web_type_cb', 'owrx') 699 ) 700 ); 701 702 s = params.get('notab'); 703 el = w3_el('id-tab'); 704 //console.log('notab: el='+ el +' s='+ s); 705 if (el && s != null) { 706 w3_checkbox_set(el, false); 707 web_tab_cb(null, false, false); 708 web.tab_cancel_first = true; 709 } 710 */ 711 } else { // not kiwisdr.com/public (rx.kiwisdr.com) 712 if (!url.includes('proxy') && !kiwi_isMobile()) { 713 w3_create_appendElement('body', 'div', 714 (url.includes('jks')? 715 w3_link('', 'http://www.jks.com', w3_button('cl-button-home', 'jks.com')) : 716 w3_link('', 'http://www.kiwisdr.com', w3_button('cl-button-home', 'kiwisdr.com')) 717 ) + 718 w3_div('id-font-menu', 719 w3_select('id-font-select', '', 'font size', 'web.fontsize_i', W3_SELECT_SHOW_TITLE, web.fontsize_s, 'web_fontsize_cb') 720 ) 721 ); 722 } 723 } 724
725 w3_setAllHref('id-mt', enc("nbjowl9pvsslqwChjtjpgq-`ln")); 726 w3_call('kiwisdr_main'); 727} 728 729function web_fontsize_cb(path, val, first) 730{ 731 val = +val; 732 //console.log('web_fontsize_cb val='+ val +' first='+ first); 733 var el = w3_el('s_colorbox'); 734 if (el) { 735 el.style.fontSize = web.fontsize[val]; 736 el.style.width = px(web.width[val]); 737 el.style.maxWidth = px(web.width[val]); 738 } 739}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.