Advertisement
Shell_Casing

javascript code

Dec 13th, 2018
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. const data = [
  3.     {
  4.         "name":"0.LicenseClient",
  5.         "id":1,
  6.         "children":[
  7.             {
  8.                 "name":"ProficyClient18_3_1436_0.exe",
  9.                 "id":"1.1"
  10.             }
  11.         ]
  12.     },
  13.     {
  14.         "name":"CIMPLICITY",
  15.         "id":2,
  16.         "children":[
  17.             {
  18.                 "name":"HMI-9.0.24485r.000031.exe",
  19.                 "id":"2.1"
  20.             },
  21.             {
  22.                 "name":"HMI-9.5.36749r.000017.exe",
  23.                 "id":"2.2"
  24.             }
  25.         ]
  26.     },
  27.     {
  28.         "name":"Historian",
  29.         "id":3,
  30.         "children":[
  31.             {
  32.                 "name":"historian_rest_api_reference_manual.chm",
  33.                 "id":"3.1"
  34.             }
  35.         ]
  36.     },
  37.     {
  38.         "name":"Historian/Proficy_Historian_English_v7.0",
  39.         "id":4,
  40.         "children":[
  41.             {
  42.                 "name":"GettingStartedSP5.pdf",
  43.                 "id":"4.1"
  44.             },
  45.             {
  46.                 "name":"Gold_SP5_Historian-7.0.1904.0.iso",
  47.                 "id":"4.2"
  48.             },
  49.             {
  50.                 "name":"HistorianIPISP5.pdf",
  51.                 "id":"4.3"
  52.             },
  53.             {
  54.                 "name":"Historian_REST_APIs_SP5.pdf",
  55.                 "id":"4.4"
  56.             }
  57.         ]
  58.     },
  59.     {
  60.         "name":"Historian/Proficy_Historian_English_v7.0/\u8865\u4e01",
  61.         "id":5,
  62.         "children":[
  63.             {
  64.                 "name":"Historian-7.0.29.0-SP5-SIM1.iso",
  65.                 "id":"5.1"
  66.             }
  67.         ]
  68.     },
  69.     {
  70.         "name":"Historian/SP6help",
  71.         "id":6,
  72.         "children":[
  73.             {
  74.                 "name":"Collector - S2D.chm",
  75.                 "id":"6.1"
  76.             },
  77.             {
  78.                 "name":"Collector - WPC.chm",
  79.                 "id":"6.2"
  80.             },
  81.             {
  82.                 "name":"Glossary.chm",
  83.                 "id":"6.3"
  84.             },
  85.             {
  86.                 "name":"historian_rest_api_reference_manual.chm",
  87.                 "id":"6.4"
  88.             },
  89.             {
  90.                 "name":"ihadmin.chm",
  91.                 "id":"6.5"
  92.             },
  93.             {
  94.                 "name":"ihexcel.chm",
  95.                 "id":"6.6"
  96.             },
  97.             {
  98.                 "name":"iHistAdv.chm",
  99.                 "id":"6.7"
  100.             },
  101.             {
  102.                 "name":"iHistAE.chm",
  103.                 "id":"6.8"
  104.             },
  105.             {
  106.                 "name":"iHistClientAccessAPI.chm",
  107.                 "id":"6.9"
  108.             },
  109.             {
  110.                 "name":"iHistCollMaster.chm",
  111.                 "id":"6.10"
  112.             },
  113.             {
  114.                 "name":"iHistCOLTK.chm",
  115.                 "id":"6.11"
  116.             },
  117.             {
  118.                 "name":"iHistDC.chm",
  119.                 "id":"6.12"
  120.             },
  121.             {
  122.                 "name":"iHistEXCEL.chm",
  123.                 "id":"6.13"
  124.             },
  125.             {
  126.                 "name":"iHistFFCOL.chm",
  127.                 "id":"6.14"
  128.             },
  129.             {
  130.                 "name":"ihistFLCOL.chm",
  131.                 "id":"6.15"
  132.             },
  133.             {
  134.                 "name":"iHistGS.chm",
  135.                 "id":"6.16"
  136.             },
  137.             {
  138.                 "name":"iHISTHDASrv.chm",
  139.                 "id":"6.17"
  140.             },
  141.             {
  142.                 "name":"iHistMG.chm",
  143.                 "id":"6.18"
  144.             },
  145.             {
  146.                 "name":"iHistODB.chm",
  147.                 "id":"6.19"
  148.             },
  149.             {
  150.                 "name":"iHISTOPCOL.chm",
  151.                 "id":"6.20"
  152.             },
  153.             {
  154.                 "name":"iHistOPCUADA.chm",
  155.                 "id":"6.21"
  156.             },
  157.             {
  158.                 "name":"iHISTOPCUAOL.chm",
  159.                 "id":"6.22"
  160.             },
  161.             {
  162.                 "name":"iHistOPC_HDA.chm",
  163.                 "id":"6.23"
  164.             },
  165.             {
  166.                 "name":"iHistorian.chm",
  167.                 "id":"6.24"
  168.             },
  169.             {
  170.                 "name":"iHistSICOL.chm",
  171.                 "id":"6.25"
  172.             },
  173.             {
  174.                 "name":"iHistViewCollector.chm",
  175.                 "id":"6.26"
  176.             },
  177.             {
  178.                 "name":"iHistWW.chm",
  179.                 "id":"6.27"
  180.             },
  181.             {
  182.                 "name":"ihPICollector.chm",
  183.                 "id":"6.28"
  184.             },
  185.             {
  186.                 "name":"ihPIDistributor.chm",
  187.                 "id":"6.29"
  188.             },
  189.             {
  190.                 "name":"ihsdk.chm",
  191.                 "id":"6.30"
  192.             },
  193.             {
  194.                 "name":"ihuserapi.chm",
  195.                 "id":"6.31"
  196.             }
  197.         ]
  198.     },
  199.     {
  200.         "name":"iFIX5.8",
  201.         "id":7,
  202.         "children":[
  203.             {
  204.                 "name":"iFIX58_DatabaseManager_005.exe",
  205.                 "id":"7.1"
  206.             },
  207.             {
  208.                 "name":"iFIX58_Networking_002.exe",
  209.                 "id":"7.2"
  210.             },
  211.             {
  212.                 "name":"iFIX58_SP2.exe",
  213.                 "id":"7.3"
  214.             },
  215.             {
  216.                 "name":"iFIX58_Workspace_030.exe",
  217.                 "id":"7.4"
  218.             }
  219.         ]
  220.     },
  221.     {
  222.         "name":"iFIX5.9",
  223.         "id":8,
  224.         "children":[
  225.             {
  226.                 "name":"iFIX59_Alarming_001.exe",
  227.                 "id":"8.1"
  228.             },
  229.             {
  230.                 "name":"iFIX59_Alarming_002.exe",
  231.                 "id":"8.2"
  232.             },
  233.             {
  234.                 "name":"iFIX59_AlarmSummaryOCX_001.exe",
  235.                 "id":"8.3"
  236.             },
  237.             {
  238.                 "name":"iFIX59_Blocks_001.exe",
  239.                 "id":"8.4"
  240.             },
  241.             {
  242.                 "name":"iFIX59_DatabaseManager_001.exe",
  243.                 "id":"8.5"
  244.             },
  245.             {
  246.                 "name":"iFIX59_DatabaseManager_002.exe",
  247.                 "id":"8.6"
  248.             },
  249.             {
  250.                 "name":"iFIX59_DataProvider_002.exe",
  251.                 "id":"8.7"
  252.             },
  253.             {
  254.                 "name":"iFIX59_Failover_001.exe",
  255.                 "id":"8.8"
  256.             },
  257.             {
  258.                 "name":"iFIX59_FixComponent_001.exe",
  259.                 "id":"8.9"
  260.             },
  261.             {
  262.                 "name":"iFIX59_SIM Tracking.xls",
  263.                 "id":"8.10"
  264.             },
  265.             {
  266.                 "name":"iFIX59_WorkSpace_003.exe",
  267.                 "id":"8.11"
  268.             },
  269.             {
  270.                 "name":"iFIX59_WorkSpace_006.exe",
  271.                 "id":"8.12"
  272.             }
  273.         ]
  274.     },
  275.     {
  276.         "name":"IGS",
  277.         "id":9,
  278.         "children":[
  279.             {
  280.                 "name":"IGS_7.63.exe",
  281.                 "id":"9.1"
  282.             }
  283.         ]
  284.     },
  285.     {
  286.         "name":"WebSpace4.8",
  287.         "id":10,
  288.         "children":[
  289.             {
  290.                 "name":"ProficyWebSpace_v4.8_Chinese.iso",
  291.                 "id":"10.1"
  292.             },
  293.             {
  294.                 "name":"ProficyWebSpace_v4.8_English.iso",
  295.                 "id":"10.2"
  296.             },
  297.             {
  298.                 "name":"PWS48_CompatibilityUpdate_006_x64.exe",
  299.                 "id":"10.3"
  300.             },
  301.             {
  302.                 "name":"PWS48_CompatibilityUpdate_007_x86.exe",
  303.                 "id":"10.4"
  304.             }
  305.         ]
  306.     },
  307.     {
  308.         "name":"WebSpace5.0",
  309.         "id":11,
  310.         "children":[
  311.             {
  312.                 "name":"ProficyWebSpace_v5_02_348English.iso",
  313.                 "id":"11.1"
  314.             }
  315.         ]
  316.     }
  317. ];
  318.  
  319. const files = document.getElementById('files');
  320. const phoneNumber = 123456789;
  321. const smsCode = 123;
  322.  
  323. function createFileTree(data){
  324.     const parent = document.createElement('li');
  325.     const children = document.createElement('ul');
  326.     parent.textContent = data.name;
  327.     parent.appendChild(children);
  328.     data.children.forEach(child=>{
  329.         const li = document.createElement('li');
  330.         const a = document.createElement('a');
  331.         const href = `http://dl.sep18.xyz:8008/download?phonenumber=${phoneNumber}&code=${smsCode}&file=${child.name}`;
  332.         li.appendChild(a);
  333.         a.textContent = child.name;
  334.         a.href = href;
  335.         children.appendChild(li);
  336.  
  337.         let details = document.createElement('details');
  338.         let summary = document.createElement('summary');
  339.         summary.textContent = data.name;
  340.         details.append(summary);
  341.         // details.append(children);
  342.     });
  343.  
  344.     files.append(parent);
  345. }
  346.  
  347. data.forEach(createFileTree);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement