Author Topic: War3Source_Interface.inc searcher  (Read 6124 times)

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
War3Source_Interface.inc searcher
« on: May 28, 2012, 12:00:24 PM »
http://ownageclan.com/war3source/functionreference/

only searches all .inc that is in W3Incs, (HEAD revision on the SVN) for functions (and parameter names)

« Last Edit: August 06, 2012, 10:57:55 AM by Ownz »

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: War3Source_Interface.inc searcher
« Reply #1 on: September 29, 2012, 04:05:19 PM »
yea its poorly coded in terms of memory usage. it fails because it runs out of memory. I need to re-do it some time.

this new one searches all .inc in the folder, not just interface.inc

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: War3Source_Interface.inc searcher
« Reply #2 on: December 25, 2013, 08:13:42 PM »
with your coding skills, im sure you can reverse engineer it easily :D

Revan

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: War3Source_Interface.inc searcher
« Reply #3 on: December 26, 2013, 11:24:05 AM »
I hacked Ownz server, please dont tell him :D
Code: [Select]


<body style="background-color:#EEEEEE">
<h2>Function reference search</h2>Click on a result to expand the function documentation. Made by OwnageOwnz<br>
<div id="loading" style="color:red">Still loading documentation......</div>
<form name="myform" action="http://ownageclan.com/war3source/functionreference/?search=player" method="get" >


<input type='text' name='search' id='search' value='
player' placeholder="search string"  onload='change();' OnKeyUp="change($('#search')[0]);"  /> <br>


<input type="submit" value="Deal with it" />


</form>

<span id='myoutput' style="background-color:#EEEEEE"></span>

<br><br><hr>

<pre>

///ACCEPTED COMMENTS FOR PARSING:
///COMMENT MUST BE DIRECTLY IN FRONT OF FUNCTION DECLARATION
///FUNCTION DECLARATION MUST HAVE ITS OWN LINE, CAN HAVE WHITE SPACE BEFORE FUNCTION KEYWORD
///WHITESPACE before is allowed as each line is "trimmed" where whitespaces are removed



//implementation:
//looks for /* .... */ blocks, the last block overwrites the previous, so use a single block
//looks for CONTIGUOUS blocks of //
//the documentation will be considered to be the documentation of the next function found, even if it is not intended.
//block unintended comments by putting a blank comment in front ( // is enough )



/* comments
comments
comments */

/* comment */

/******  comment */

//comments
/////comments

</pre>




<script>var files = ["https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Addon_AmmoControl.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_AttributeBuffs.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Attributes.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Aura.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Bots.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Buffs.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_CS_Interface.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Config.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Constants.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Currency.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Effects.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Events.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Gamecheck.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Health.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Interface.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_L4D_Interface.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Logging.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Notifications.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_PrecacheDownload.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Races.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Shopitems.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Shopitems2.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_SkillEffects.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_TF2_Interface.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_Wards.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/War3Source_XP_Gold.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/colors.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/socket.inc","https://raw.github.com/War3Source/War3Source/master/addons/sourcemod/scripting/W3SIncs/steamtools.inc"];</script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
 
 <script>
 var requestoutstanding=0;
 for (var i=0;i<files.length;i++)
{

var request = $.ajax({
 url: "parsefileV3.php?file="+files[i],
 type: "GET",
 dataType: "html"
});
requestoutstanding++;
request.done(function(msg) {
 //alert( msg );
 gotFile(msg);
 requestoutstanding--;
 if(requestoutstanding==0){
  $("#loading").hide();
  customsort();
 }
 else{
  $("#loading").html("Please WAIT!!! Still loading documentation... ("+(files.length-requestoutstanding)+"/"+files.length+")");
 }
});

request.fail(function(jqXHR, textStatus) {
 //alert( "Request failed: " + textStatus );
 
});
}
var myArrayDOC = new Array();
var myArrayFUNC = new Array();
var uniqueCountDoc=0;
var uniqueCountFunc=0;
function gotFile(html){

var testRE = html.match(/<i style=doc>([\s\S]*?)<\/i>/g ); // (.*?) means anything but not greedy

if(testRE!=null)
{
for(var i=0;i<testRE.length;i++)
{
//$("body").append(testRE[i]);
myArrayDOC[uniqueCountDoc++]=testRE[i].substring(13,testRE[i].length-4);
//var tt=testRE[i].substring(13,testRE[i].length-4);

}
}

testRE = html.match(/<b style=func>([\s\S]*?)<\/b>/g ); // (.*?) means anything but not greedy
if(testRE!=null)
{
for(var i=0;i<testRE.length;i++)
{
//$("body").append(testRE[i]);
myArrayFUNC[uniqueCountFunc++]=testRE[i].substring(14,testRE[i].length-4);
}
}

if(myArrayDOC.length!=myArrayFUNC.length){
alert("length mismatch");
}
change();
}


function change() {

var thediv=document.getElementById("myoutput");
var stringInTextBox=$('#search')[0].value;
var str="";
//document.write(stringInTextBox);

for(var i=0; i<myArrayFUNC.length&& stringInTextBox.length>0; i++) {

var value = myArrayFUNC[i];

if (value.toLowerCase().indexOf(stringInTextBox.toLowerCase()) != -1){

var re= new RegExp('('+stringInTextBox+')', 'gi');


value=myArrayFUNC[i].replace(re, '<b style="color: brown;">$1</b>');

str=str+"<br><span onmouseover=\"style.backgroundColor='#D0D0D0';\" onmouseout=\"style.backgroundColor='#EEEEEE'\"  id=func"+i+" onClick=\"openClose('doc"+i+"')\"><b>"+value+"</b></span>";

value=myArrayDOC[i];//.replace(re, '<b style="color: red;">$1</b>');

str=str+"<span zonmouseover=\"style.backgroundColor='#D0D0D0';\" zonmouseout=\"style.backgroundColor='#EEEEEE'\" id=doc"+i+" style='display:none' zonClick=\"openClose('doc"+i+"')\"><br>^^"+value+"</span>";


//document.write(str);

}



}









thediv.innerHTML=str;

}



function openClose(theID) {

$('#'+theID).toggle();

 }

 

 $(document).ready(function () {

 change($('#iii')[0]);

});

function customsort()
{
var A = myArrayFUNC;
var B = myArrayDOC;

var all = [];

for (var i = 0; i < B.length; i++) {
   all.push({ 'A': A[i], 'B': B[i] });
}

all.sort(function(a, b) {
// console.log(a.A - b.A);
 //return a.A - b.A;
 //console.log(a.A.localeCompare(b.A));
 return a.A.localeCompare(b.A)
});

A = [];
B = [];

for (var i = 0; i < all.length; i++) {
  A.push(all[i].A);
  B.push(all[i].B);
}    
myArrayFUNC=A;
myArrayDOC=B;
//console.log(A, B);
change();
}

</script>
It's HTML+JS you can show the source in your browser by clicking on show page source (or something similar).
« Last Edit: December 26, 2013, 06:54:19 PM by Revan »
#war3source on gamesurge

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: War3Source_Interface.inc searcher
« Reply #4 on: December 26, 2013, 01:37:33 PM »
OH NO, BETTER CALL SAUL