11local function openWikipage (func_name )
2- func_name = string .Replace (func_name ," ." ," /" )
3- func_name = string .Replace (func_name ," :" ," /" )
4- gui .OpenURL (" https://wiki.garrysmod.com/page/" .. func_name )
2+
3+ gui .OpenURL (" https://wiki.facepunch.com/gmod/" .. func_name )
54 -- input.SetCursorPos(ScrW()/2+239, ScrH()/2+34) -- hackerman
65end
76
@@ -14,7 +13,7 @@ local disclamer = [[
1413local preloaded_data = file .Read (" garrysmod/lua/send.txt" , " BASE_PATH" )
1514
1615
17- local wiki_base = " https://wiki.garrysmod .com/page /"
16+ local wiki_base = " https://wiki.facepunch .com/gmod /"
1817function BadCoderz .reportToText (dataTbl )
1918
2019 if table .IsEmpty (dataTbl ) then
@@ -23,13 +22,13 @@ function BadCoderz.reportToText(dataTbl)
2322
2423 local str = disclamer
2524 for functionsNames , hookTable in pairs (dataTbl ) do
26- local function_internet_name = string .Replace (functionsNames ," ." ," /" )
27- if not string.find (function_internet_name , ' / ' ,1 , true ) then
28- function_internet_name = " Global/ " .. function_internet_name
25+ local function_internet_name = functionsNames -- string.Replace(functionsNames,".","/")
26+ if not string.find (function_internet_name , ' . ' ,1 , true ) then
27+ function_internet_name = " Global. " .. function_internet_name
2928 end
3029 str = str .. " \n Function : " .. functionsNames .. " (Wiki page : " .. wiki_base .. function_internet_name .. " )\n "
3130 for hookName , callsLocations in pairs (hookTable ) do
32- local hook_internet_name = string .Replace (hookName ," :" ," /" )
31+ local hook_internet_name = hookName -- string.Replace(hookName,":","/")
3332 str = str .. " Hook : " .. hookName .. " (Wiki page : " .. wiki_base .. hook_internet_name .. " )\n "
3433 for filename , LinesTable in pairs (callsLocations ) do
3534 local warning ;
6160
6261
6362local function getDescFromWikiBody (body )
63+ body = util .JSONToTable (body ).html
64+
6465
65- local tofind = " >Description</span></h1> "
66+ local tofind = " function_description section "
6667
6768 if not string.find (body , tofind ) then
6869 return " "
6970 end
70- local found = string.find (body , tofind ) + string.len (tofind ) + 4
71+ local found = string.find (body , tofind ) + string.len (tofind ) + 5
7172 local enddesc = string.find (body , " ." , found , true )
7273 local tip = string.sub (body , found , enddesc )
7374 tip = string.gsub (tip , " <.->" , " " )
@@ -96,9 +97,9 @@ function BadCoderz.populateTreeWithData(treePanel, dataTbl, client)
9697
9798 for functionsNames , hookTable in pairs (dataTbl ) do
9899 local nodeFunctionName = treePanel :AddNode ( functionsNames , " icon16/sitemap.png" )
99- local function_internet_name = string .Replace (functionsNames ," ." ," /" )
100- if not string.find (function_internet_name , ' / ' ,1 , true ) then
101- function_internet_name = " Global/ " .. function_internet_name
100+ local function_internet_name = functionsNames -- string.Replace(functionsNames,".","/")
101+ if not string.find (function_internet_name , ' . ' ,1 , true ) then
102+ function_internet_name = " Global. " .. function_internet_name
102103 end
103104
104105 nodeFunctionName :SetExpanded (true , true )
@@ -109,11 +110,12 @@ function BadCoderz.populateTreeWithData(treePanel, dataTbl, client)
109110 if BadCoderz .toolTips [fName ] then
110111 nodeFunctionName :SetTooltip (BadCoderz .toolTips [fName ])
111112 end
112- http .Fetch (" https://wiki.garrysmod.com/page/" .. function_internet_name ,function (body )
113+
114+ http .Fetch (" https://wiki.facepunch.com/gmod/" .. function_internet_name .. " ?format=json" ,function (body )
113115 if nodeFunctionName and IsValid (nodeFunctionName ) then
114116 local tip = getDescFromWikiBody (body )
115117 if BadCoderz .toolTips [fName ] then
116- tip = tip .. " \n " .. BadCoderz .toolTips [fName ]
118+ tip = tip .. " \n ------------------- \n " .. BadCoderz .toolTips [fName ]
117119 end
118120
119121 nodeFunctionName :SetTooltip (tip )
@@ -122,9 +124,9 @@ function BadCoderz.populateTreeWithData(treePanel, dataTbl, client)
122124
123125 for hookName , callsLocations in pairs (hookTable ) do
124126 local nodeHookName = nodeFunctionName :AddNode ( hookName , " icon16/wrench.png" )
125- local hook_internet_name = string .Replace (hookName ," :" ," /" )
127+ local hook_internet_name = hookName -- string.Replace(hookName,":","/")
126128 nodeHookName :SetTooltip (" Loading ..." )
127- http .Fetch (" https://wiki.garrysmod .com/page /" .. hook_internet_name ,function (body )
129+ http .Fetch (" https://wiki.facepunch .com/gmod /" .. hook_internet_name .. " ?format=json " ,function (body )
128130 if nodeHookName and IsValid (nodeHookName ) then
129131 nodeHookName :SetTooltip (getDescFromWikiBody (body ))
130132 end
@@ -287,4 +289,4 @@ function BadCoderz.generateDListView(pnl, x, y, w, h, dataTbl, client)
287289 end
288290
289291 return CompiledFuncsList
290- end
292+ end
0 commit comments