Skip to content

Instantly share code, notes, and snippets.

@nucther
Last active July 13, 2023 03:33
Show Gist options
  • Save nucther/dbdfd9f1b087db9221481c5ebe82a836 to your computer and use it in GitHub Desktop.
Save nucther/dbdfd9f1b087db9221481c5ebe82a836 to your computer and use it in GitHub Desktop.
Enable Bridge
function displayTableHtml(){for(var e="",t="",n=0;n<all_wan_info.wan.length;n++){var i=n+1,a=all_wan_info.wan[n],l=a.wan_index+"_"+a.wan_session_index+"_"+a.iporppp+"_"+a.Name;t+='<tr id="outtable_'+n+'" style="cursor: pointer;" onclick="Showthisinfo(this.id)">',t+='<td align="center">'+i+"</td>",t+='<td align="center">'+a.Name+"</td>",t+='<td align="center">'+a.p8021+"/"+a.vlanid+"</td>","1"==a.IPMode?e="IPv4":"2"==a.IPMode?e="IPv6":"3"==a.IPMode&&(e="IPv4&IPv6"),t+='<td align="center">'+e+"</td>",t+='<td align="center"><input type="checkbox" class="delselwan" value="'+l+'"></td>',t+="</tr>"}$("#internet_list").html(t)}function setBridge(){setTimeout(()=>{$("#WanConnectMode_select").append('<option value="bridge">Bridge</option>')},1e3)}displayTableHtml(),$("td").click(()=>{setBridge()});
function parseWanData(t){var d="";if(t&&t.wan){var e=t.wan;if(0<(g_wandata=e).length)for(var n=0;n<e.length;n++){var s,i=e[n];d+='<tr id="wan_'+n+'" style="cursor:pointer" onclick="Showthiswanmoreinfo(1, this.id)">',d+="<td>"+(n+1)+"</td>","Connected"==i.ConnectionStatus?d+="<td>Up</td>":d+="<td>Down</td>",d+="<td>"+i.ServiceList.replace(/,/g,"_")+"</td>","PPPoE_Bridged"==i.ConnectionType?d+="<td></td>":"PPPOE"==i.AddressingType.toUpperCase()?d+="<td>PPPoE</td>":d+="<td>"+i.AddressingType+"</td>","PPPoE_Bridged"!=i.ConnectionType&&!(0<=i.ConnectionType.toUpperCase().indexOf("BRIDGE")||"Connected"!=i.ConnectionStatus&&"Static"!=i.AddressingType)?(0==isValidIpAddress(i.ExternalIPAddress)?d+="<td></td>":d+="<td>"+i.ExternalIPAddress+"</td>","PPPOE"==i.AddressingType.toUpperCase()?d+="<td>255.255.255.255</td>":0==isValidIpAddress(i.SubnetMask)?d+="<td></td>":d+="<td>"+i.SubnetMask+"</td>",""==i.DNSSevers?d+="<td></td>":(s=i.DNSServers+",",0==isValidIpAddress(s.split(",")[0])?d+="<td></td>":d+="<td>"+s.split(",")[0]+"</td>")):(d+="<td></td>",d+="<td></td>",d+="<td></td>"),d+="<td>"+i.vlanid+"/"+i.p8021+"</td>","IP_Routed"==i.ConnectionType||"PPPoE_Routed"==i.ConnectionType?d+="<td>Route</td>":d+="<td>Bridge</td>",d+="</tr>"}}$("#wancfgv4").html(d),Showthiswanmoreinfo("0",g_index)}XHR.poll(gStatusFreshInterval,"get_allwan_info",null,parseWanData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment