text: 
  
  /* web/extensions/fax/fax.min.js */
  var fax={ext_name:"fax",first_time:!0,stop_start_state:0,url_params:null,winH:400,winSBW:15,n_menu:4,menu0:-1,menu1:-1,menu2:-1,menu3:-1,phasing:!0,autostop:!1,debug:0,contrast:1,file:0,ch:0,data_canvas:0,copy_canvas:0,pbL:800,black:1500,cf:1900,white:2300,pbH:3e3,lpm:120,lpm_i:3,lpm_s:[60,90,100,120,180,240]};function fax_main(){ext_switch_to_client(fax.ext_name,fax.first_time,fax_recv),fax.first_time||fax_controls_setup(),fax.first_time=!1}var fax_tw,fax_scope_colors=["black","red"],fax_image_y=0,fax_w=1024,fax_h=2048,fax_startx=150,fax_mkr=0;function fax_clear_display(){var a=fax.data_canvas.ctx;a.fillStyle="black",a.fillRect(0,0,fax_startx,fax_h),a.fillStyle="lightCyan",a.fillRect(fax_startx,0,fax_w,fax_h),fax_image_y=0}var fax_cmd={CLEAR:255,DRAW:254};function fax_recv(a){var e=fax.data_canvas,t=e.ctx;if("DAT"!=arrayBufferToStringLen(a,3)){var i=arrayBufferToString(a).substring(4).split(" ");for(d=0;d<i.length;d++){var f=i[d].split("=");switch(f[0]){case"ready":fax_controls_setup(),fax.ch=parseInt(f[1]);break;case"fax_download_avail":var _=kiwi_url_origin()+"/kiwi.config/fax.ch"+fax.ch+"_"+f[1],s=_+".png",n=_+".thumb.png";w3_remove_then_add("id-fax-file-icon1","fa-circle-o-notch fa-refresh fa-spin w3-text-aqua","fa-circle w3-text-pink"),w3_add("id-fax-file-icon2","w3-hide"),w3_el("id-fax-file-status").innerHTML=w3_link("",s,"<img src="+dq(n)+" />");break;case"fax_sps_changed":if(fax_mkr)(t=e.ctx).fillStyle="red",t.fillRect(fax_startx-fax_mkr,fax_image_y-1,fax_mkr,1);break;case"fax_record_line":var x=w3_el("id-fax-line");x&&(x.innerHTML=f[1]);break;case"fax_phased":w3_visible("id-fax-phased",!0),setTimeout(function(){w3_visible("id-fax-phased",!1)},5e3);break;case"fax_autostopped":var l=1==f[1];w3_button_text("id-fax-stop-start",l?"Start":"Stop"),w3_visible("id-fax-stopped",l),fax.stop_start_state^=1;break;default:console.log("fax_recv: UNKNOWN CMD "+f[0])}}}else{var o=new Uint8Array(a,4),r=o[0];if(r==fax_cmd.CLEAR)fax_clear_display();else if(r==fax_cmd.DRAW){for(var c=e.imd,d=0;d<fax_w;d++)c.data[4*d+0]=o[d+1],c.data[4*d+1]=o[d+1],c.data[4*d+2]=o[d+1],c.data[4*d+3]=255;var p=w3_el("id-fax-data").scrollTop,w=p+fax.winH;if(fax_image_y>=p&&fax_image_y<=w)fax_image_y>=w&&(w3_el("id-fax-data").scrollTop=fax_image_y+1-fax.winH);if(fax_image_y<fax_h)fax_image_y++;else{var m=fax_w+fax_mkr,u=fax_startx-fax_mkr;t.drawImage(e,u,1,m,fax_h-1,u,0,m,fax_h-1),fax_mkr&&(t.fillStyle="black",t.fillRect(fax_startx-fax_mkr,fax_image_y-1,fax_mkr,1))}t.putImageData(c,fax_startx,fax_image_y-1)}else{var h=r;t.fillStyle=fax_scope_colors[h];for(var d=0;d<fax_w;d++)t.fillRect(fax_startx+d,o[d+1],1,1)}}}var fax_disabled,fax_prev_disabled,fax_europe={Hamburg:[],"DDH/K DE":[3855,7880,13882.5,15988],Northwood:[],"GYA UK":[2618.5,4610,6834,8040,11086.5],Athens:[],"SVJ4 GR":[4482.9,8106.9],Murmansk:[],"RBW RU":[5336,"6328.5 lsb",7908.8,8444.1,10130]},fax_asia_pac={"Pt. Reyes":[],"NMC US":[4346,8682,12786,17151.2,22527],Honolulu:[],"KVM70 HI":[8295.5,9982.5,11090,16135],Kodiak:[],"NOJ AK":[2054,4298,8459,12412.5],Wellington:[],"ZKLF NZ":[3247.4,5807,9459,13550.5,16340.1],Charleville:[],"VMC AU":[2628,5100,11030,13920,20469],Wiluna:[],"VMW AU":[5755,7535,10555,15615,18060],Tokyo:[],"JMH JP":[3622.5,7795,13988.5],"JFC/JFW/JFX":[],JP:[6414.5,8658,13074,16907.5,22559.6],Kyodo:[],"JJC/JSC JP":["4316/60","8467.5/60","12745.5/60","16971/60","17069.6/60","22542/60"],Seoul:[],"HLL2 KR":[3585,5857.5,7433.5,9165,13570],Shanghai:[],"XSG, CN":[4170,8302,12382,16559],Bangkok:[],"HSW64 TH":[7396.9],Singapore:[],"9VF SG":[16035,17430]},fax_americas={"Pt. Reyes":[],"NMC US":[4346,8682,12786,17151.2,22527],"New Orleans":[],"NMG US":[4317.9,8503.9,12789.9,17146.4],Boston:[],"NMF US":[4235,6340.5,9110,12750],Kodiak:[],"NOJ AK":[2054,4298,8459,12412.5],Honolulu:[],"KVM70 HI":[8295.5,9982.5,11090,16135],"Nova Scotia":[],"VCO CA":[4416,6915.1],Iqaluit:[],"VFF CA":[3253,7710],Resolute:[],"VFR CA":[3253,7710],Inuvik:[],"VFA CA":[4292,8456],Brazil:[],"PWZ33 BR":[12665,16978],Chile:[],"CBV/M CL":[4228,4322,8677,8696,17146.4]},fax_africa={"S. Africa":[],"ZSJ SA":[4014,7508,13538,18238]};function fax_controls_setup(){kiwi_isMobile()&&(fax_startx=0),fax_tw=fax_startx+fax_w+fax.winSBW,fax.debug=0;var a=fax.url_params=ext_param();a&&(a=a.split(",")).forEach(function(a,e){console.log("FAX param1 <"+a+">");var t,i=a.split(":");i=i[i.length-1].toLowerCase(),(t=w3_ext_param("lpm",a)).match?w3_ext_param_array_match_num(fax.lpm_s,t.num,function(a,e){fax.lpm_i=a,fax.lpm=e}):(t=w3_ext_param("align",a)).match?fax.phasing=0==t.num?0:1:(t=w3_ext_param("stop",a)).match?fax.autostop=0==t.num?0:1:(t=w3_ext_param("debug",a)).match&&(fax.debug=0==t.num?0:1)});var e=time_display_html("fax")+w3_div("id-fax-data|left:0; width:"+px(fax_tw)+"; height:"+px(fax.winH)+"; background-color:black; position:relative; overflow-y:scroll; overflow-x:hidden",'<canvas id="id-fax-data-canvas" width='+dq(fax_tw)+' style="left:'+px(0)+'; position:absolute;"></canvas>','<canvas id="id-fax-copy-canvas" width='+dq(fax_tw)+' style="left:'+px(0)+'; position:absolute;z-index:-1;"></canvas>'),t=w3_div("id-fax-controls w3-text-white",w3_divs("w3-container/w3-tspace-8",w3_col_percent("",w3_div("w3-medium w3-text-aqua","<b>HF FAX decoder</b>"),30,w3_div("id-fax-station w3-text-css-yellow"),60,w3_div(),10),w3_inline("w3-halign-space-between/",w3_select_hier("w3-text-red","Europe","select","fax.menu0",fax.menu0,fax_europe,"fax_pre_select_cb"),w3_select_hier("w3-text-red","Asia/Pacific","select","fax.menu1",fax.menu1,fax_asia_pac,"fax_pre_select_cb"),w3_select_hier("w3-text-red","Americas","select","fax.menu2",fax.menu2,fax_americas,"fax_pre_select_cb"),w3_select_hier("w3-text-red","Africa","select","fax.menu3",fax.menu3,fax_africa,"fax_pre_select_cb")),w3_inline("/w3-margin-between-16",w3_select("|color:red","","LPM","fax.lpm_i",fax.lpm_i,fax.lpm_s,"fax_lpm_cb"),w3_button("w3-padding-smaller","Next","fax_next_prev_cb",1),w3_button("w3-padding-smaller","Prev","fax_next_prev_cb",-1),w3_button("id-fax-stop-start w3-padding-smaller","Stop","fax_stop_start_cb"),w3_button("w3-padding-smaller","Clear","fax_clear_cb"),w3_inline("",w3_div("",w3_div('fa-stack||title="record"',w3_icon("id-fax-file-icon1","fa-circle fa-nudge-down fa-stack-2x w3-text-pink",22,"","fax_file_cb"),w3_icon("id-fax-file-icon2","fa-stop fa-stack-1x w3-text-pink w3-hide",10,"","fax_file_cb"))),w3_div("id-fax-file-status w3-margin-left"))),w3_inline("",w3_checkbox("w3-label-inline w3-label-not-bold/","auto align","fax.phasing",fax.phasing,"fax_phasing_cb"),w3_div("id-fax-phased w3-margin-left w3-padding-small w3-text-black w3-css-lime w3-hidden","aligned"),w3_checkbox("w3-margin-left/w3-label-inline w3-label-not-bold/","auto stop","fax.autostop",fax.autostop,"fax_autostop_cb"),w3_div("id-fax-stopped w3-margin-left w3-padding-small w3-text-black w3-css-orange w3-hidden","stopped")),w3_div("",w3_inline("w3-halign-space-between/",w3_link("","https://www.weather.gov/media/marine/rfax.pdf","FAX transmission schedules")),w3_div("","Shift-click (PC) or touch (mobile) the image to align."))));ext_panel_show(t,e,null),time_display_setup("fax"),fax.url_params&&(a=fax.url_params.split(",")).forEach(function(a,e){w3_ext_param("help",a).match&&extint_help_click()}),fax.data_canvas=w3_el("id-fax-data-canvas"),fax.copy_canvas=w3_el("id-fax-copy-canvas"),fax.data_canvas.ctx=fax.data_canvas.getContext("2d"),fax.copy_canvas.ctx=fax.copy_canvas.getContext("2d"),fax.data_canvas.imd=fax.data_canvas.ctx.createImageData(fax_w,1),fax.data_canvas.addEventListener("mousedown",fax_mousedown,!1),kiwi_isMobile()&&fax.data_canvas.addEventListener("touchstart",fax_touchstart,!1),fax.data_canvas.height=fax_h.toString(),fax.copy_canvas.height=fax_h.toString(),ext_set_data_height(fax.winH),w3_el("id-fax-data").scrollTop=0,fax_clear_display(),ext_set_controls_width_height(550,200);var i=!1;if(fax.url_params){var f=parseFloat(fax.url_params);if(!isNaN(f))for(var _=0;_<fax.n_menu;_++){var s="fax.menu"+_;if(w3_select_enum(s,function(a){i||parseFloat(a.innerHTML)!=f||(fax_pre_select_cb(s,a.value,!1),i=!0)}),i)break}}i||ext_set_passband(fax.pbL,fax.pbH),fax_start_stop(1)}function fax_pre_select_cb(a,e,t){if(!t){e=+e;var i=parseInt(a.split("fax.menu")[1]);w3_select_enum(a,function(t){if(t.disabled&&(fax_prev_disabled=fax_disabled,fax_disabled=t),t.value==e){var i=t.innerHTML;console.log("fax_pre_select_cb opt.val="+t.value+" opt.inner="+i);var f=i.includes("lsb");ext_tune(parseFloat(i)+(f?1.9:-1.9),f?"lsb":"usb",ext_zoom.ABS,11);var _=f?-fax.pbH:fax.pbL,s=f?-fax.pbL:fax.pbH;ext_set_passband(_,s),w3_el("id-fax-station").innerHTML="<b>Station: "+fax_prev_disabled.innerHTML+", "+fax_disabled.innerHTML+"</b>";var n,x=i.split("/"),l=120;x.length>1&&!isNaN(n=parseInt(x[1]))&&(l=n),fax_lpm(l),w3_select_set_if_includes("fax.lpm_i","\\b"+l+"\\b"),w3_select_value(a,e)}});for(var f=0;f<fax.n_menu;f++)f!=i&&w3_select_value("fax.menu"+f,-1)}}function fax_next_prev_cb(a,e,t){e=+e;for(var i,f=0,_=0,s=0,n=0,x=0;x<fax.n_menu;x++){i="fax.menu"+x;var l=w3_el(i).value;if(-1!=l){w3_select_enum(i,function(a){a.disabled||(_&&(s=a.value,_=0),a.value===l&&(n=f,_=1),f=a.value)});break}}l=0,1==e&&s&&(l=s),-1==e&&n&&(l=n),l&&fax_pre_select_cb(i,l,!1)}function fax_mousedown(a){fax_shift(a,!0)}function fax_touchstart(a){fax_shift(a,!1)}function fax_shift(a,e){var t=a.clientX?a.clientX:a.offsetX?a.offsetX:a.layerX,i=fax_startx;if(!(e&&!a.shiftKey||t<i||t>=i+fax_w)){var f=((t-=i)/fax_w).toFixed(6);console.log("FAX offset="+t+" shift="+f);var _=fax.data_canvas,s=fax.copy_canvas,n=_.ctx,x=s.ctx,l=(i=i,fax_h),o=t,r=fax_w-o;x.drawImage(_,i+o,0,r,l,i,0,r,l),n.drawImage(_,i,0,o,l,i+r,0,o,l),n.drawImage(s,i,0,r,l,i,0,r,l),ext_send("SET fax_shift="+f)}}function fax_start_stop(a){a?ext_send("SET fax_start lpm="+fax.lpm+" phasing="+(fax.phasing?1:0)+" autostop="+(fax.autostop?1:0)+" debug="+(fax.debug?1:0)):ext_send("SET fax_stop")}function fax_stop_start_cb(a,e,t){fax_start_stop(fax.stop_start_state),fax.stop_start_state^=1,w3_button_text(a,fax.stop_start_state?"Start":"Stop"),w3_visible("id-fax-stopped",!1)}function fax_phasing_cb(a,e,t){t||(fax.phasing=e,fax.stop_start_state||(fax_start_stop(0),fax_start_stop(1)))}function fax_autostop_cb(a,e,t){t||(fax.autostop=e,fax.stop_start_state||(fax_start_stop(0),fax_start_stop(1)))}function fax_lpm(a){console.log("fax_lpm lpm="+a+" fax.lpm="+fax.lpm),isNaN(a)||fax.lpm!=a&&(fax.lpm=a,fax.stop_start_state||(fax_start_stop(0),fax_start_stop(1)))}function fax_lpm_cb(a,e,t){t||(e=+e,lpm=fax.lpm_s[e],fax_lpm(lpm))}function fax_clear_cb(){fax_clear_display(),fax.file||(w3_remove_then_add("id-fax-file-icon1","fa-circle-o-notch fa-refresh fa-spin w3-text-aqua","fa-circle  w3-text-pink"),w3_add("id-fax-file-icon2","w3-hide"),w3_el("id-fax-file-status").innerHTML="")}function fax_file_cb(a,e,t){fax.file^=1;var i=w3_el("id-fax-file-icon1"),f=w3_el("id-fax-file-icon2");fax.file?(ext_send("SET fax_file_open"),w3_remove_then_add(i,"fa-circle","fa-circle-o-notch fa-spin"),w3_remove(f,"w3-hide"),w3_el("id-fax-file-status").innerHTML=w3_div("w3-show-inline-block","recording<br>line "+w3_div("id-fax-line w3-show-inline-block"))):(ext_send("SET fax_file_close"),w3_remove_then_add(i,"fa-circle-o-notch w3-text-pink","fa-refresh fa-spin w3-text-aqua"),w3_add(f,"w3-hide"),w3_el("id-fax-file-status").innerHTML="processing")}function fax_blur(){ext_send("SET fax_stop"),ext_send("SET fax_close"),ext_set_data_height()}function fax_config_html(){ext_config_html(fax,"fax","FAX","FAX configuration")}function fax_help(a){if(a){var e=w3_text("w3-medium w3-bold w3-text-aqua","FAX decoder help")+'<br>When "auto align" is checked the phasing information sent at the beginning of most <br>FAXes is used to horizontally align the image. This may not work if the signal is not strong.<br><br>When "auto stop" is checked the start and stop tones sent at the beginning and end of most <br>FAXes is used to stop the window scrolling. This may not work if the signal is not strong.<br><br>Most stations use an LPM (lines per minute) value of 120. The exception is JJC/JSC which <br>mostly uses 60. <br><br>You can manually align the image by shift-clicking (touch on mobile devices) at the location <br>you want moved to the left edge. <br><br>URL parameters: <br>First parameter can be a frequency matching an entry in station menus. <br>align<i>[:0|1]</i> &nbsp; stop<i>[:0|1]</i> &nbsp; lpm:<i>value</i> <br>So for example this is valid: <i>&ext=fax,3855,auto,stop</i> <br>';confirmation_show_content(e,620,325)}return!0}