MCPcopy Create free account
hub / github.com/Threadfin/Threadfin / showPreview

Function showPreview

ts/menu_ts.ts:2852–2915  ·  view source on GitHub ↗
(element: boolean)

Source from the content-addressed store, hash-verified

2850}
2851
2852function showPreview(element: boolean) {
2853
2854 var div = document.getElementById("myStreamsBox")
2855 switch (element) {
2856
2857 case false:
2858 div.className = "notVisible"
2859 return
2860 break;
2861 }
2862
2863 var streams: string[] = ["activeStreams", "inactiveStreams"]
2864
2865 streams.forEach(preview => {
2866
2867 var table = document.getElementById(preview)
2868 table.innerHTML = ""
2869 var obj: string[] = SERVER["data"]["StreamPreviewUI"][preview]
2870
2871 var caption = document.createElement("CAPTION")
2872 var result = preview.replace( /([A-Z])/g, " $1" );
2873 var finalResult = result.charAt(0).toUpperCase() + result.slice(1);
2874 caption.innerHTML = finalResult
2875 table.appendChild(caption)
2876
2877 var tbody = document.createElement("TBODY")
2878 table.appendChild(tbody)
2879
2880 obj.slice(0, 1000).forEach(channel => {
2881
2882 var tr = document.createElement("TR")
2883 var tdKey = document.createElement("TD")
2884 var tdVal = document.createElement("TD")
2885
2886 tdKey.className = "tdKey"
2887 tdVal.className = "tdVal"
2888
2889 switch (preview) {
2890 case "activeStreams":
2891 tdKey.innerText = "Channel: (+)"
2892 break;
2893
2894 case "inactiveStreams":
2895 tdKey.innerText = "Channel: (-)"
2896 break;
2897 }
2898
2899 tdVal.innerText = channel
2900 tr.appendChild(tdKey)
2901 tr.appendChild(tdVal)
2902
2903 tbody.appendChild(tr)
2904
2905 table.appendChild(tr)
2906
2907 });
2908
2909 });

Callers 1

showMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected