Results 1 to 35 of 35

Thread: VBForums FireFox Extension

  1. #1

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    VBForums FireFox Extension

    Ill keep updates on progress here.

    Currently trying to create an overlay which is needed to expand on the basic navigator functionality.


    Lack of detailed information on some of this stuff is making it hard to do
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Maybe yo ushould contact someone who has done a FF extention before to see how they did it and what resources they used.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Yeah I have..gotten so useful info too.

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Well this is on hold until they get this stuff stable. The newest package I made for testing purposes for no good reason has made Firefox un-openable. Not even re-isntalls help and there is no information on exactly where this stuff gets stored when a package is installed, so screw it for now until they get some proper information circulating.

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Ain't they installed in the FF root by default?

  6. #6

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Apparently not.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    here, try these:
    http://www.mozilla.org/projects/fire...structure.html
    http://www.mozilla.org/projects/firefox/extensions/

    Or have you already gone spellinking through there?

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    That might be helpful. Its not completely dead in the water, the project, im just waiting for a little more about the changes to come out and make sure they dont make any more huge changes real soon wit hthe problems they are having with the .9 versions.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    I have worked on the python thingy for a long time now. And suddenly I realised it is a bug in the code and not my RegEx. Everytime the setLanguage(...) function fires, the "key" array has to be emptied. If not there will be a problem.

    I.E, you first heighlight something with C++, then try to heilight something with Java, then the Java will be heilighted with C++ heighlighting.


    I am not sure what the right way to empty an array is. But as a work around I have now added an extra keys = new Array(); inside the setLanguage function before the switch. Do anyone know about a better way? Or if this is OK JS?


    ØØ

  10. #10

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    Maybe setting it to null?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  11. #11
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Will test that right away. But when I have you here. Isn't look behind supported in JS version of RegEx. I tried to do this:

    Code:
    keys.push({style:{color:"#CC0000", bold:false, italic:false,  name:"functions"}, start:/(?<=def\s)[\w\d_]*(?=\()/mg});

    And then NOTHING works...

  12. #12
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Setting it too null didn't work..

  13. #13
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    I have tried a lot of things the last two hours to be able to check where the function declarations are. They look like this:


    def main():


    so I have to search for def, but not include it, and ( but not include it. And a valid RegEx for this is:
    (?<=def\s)\w+(?=\()


    but JS won't listen. So I wil ahve a look at it again next week. Except taht everything is working for Python heiglighting too now. And fixed a couple of small buggs here and there. but still not sure about the easiest and safest way to reset an array.

    So this is the current version of the extension. Nothing Neb has done the two last days are in it. So hope you can add it to this version. All the files are on the server too.



    ØØ
    Attached Files Attached Files

  14. #14

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    I'll try to look at this weekend if possible. But right nowits Friday and I don't want to type any code.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  15. #15
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    OK...I think I have a solution. But I need some help from you. Because the function:

    function colorCode(f,language)

    is a bit messy.....


    If I use a regular expression to fetch:


    def main

    Then I guess I can later on strip out "def ", can't I? But if so how? Where is the fetch actualy stored? And is it an index that is stored? Or the actual text? I guess it is an index. But I can't get that to work...hmmmm...any insight help.


    BTW RegEx to feth "def main":

    start:/[\s](?:def\s)\w+(?=\()/mg});

  16. #16
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    OMG, it was a spelling error....I guess I make spelling errors in programming after all...



    Will wrap it up and post it again, and put it on the server.



    [Edit] Nope I will not. I forgot a rule. "If you fix one problem, you will get a new one"



    ØØ
    Last edited by NoteMe; Jun 25th, 2005 at 10:49 AM.

  17. #17
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    I think my problem is that I don't understand the keys structure you have made. Can you elaborte a bit on it.


    Is it something like this.


    - keys (array of structs?)
    member variables:
    - color
    - bold
    - italic
    - name


    but where is the actual information stored? And is it stored as an index or the word it self. I need to manipulate it. But I fail too see how it stores it.


    Ø

  18. #18
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Well, I still can't see if you are actualy declearing keys anywhere, or if you even have to do that in JS, but I managed to make it work anyway.....this brings a new feauture to the color heiglighting. We now have the code and the RegEx to heiglight funciton declerations..:....just look how pretty it is...


    Code:
    #Hello mother
    def _ma5in_():
       if len(sys.argv) < 1:
          usage() #Yeah thats your mother all right
       else:
          kek_number_list = tidy_up_file(sys.argv[1])
       if kek_number_list != -1:
          download_pdf(kek_number_list)
    
    #Poo is a country

    Here is the new and updated XPI.


    BTW Cander, what editor are you using. I am in my appartment now, and now the code looks much better then in Emacs. But I still think you should be kicked in the ass for writing lines like this:

    Code:
    for (var i = 0; i != keys.length; ++i) keys[i].startPos = -1;
    and this too...

    Code:
    for (var i = 1; i < keys.length; ++i) // find first matching key
    if (keys[i].startPos < keys[match].startPos) match = i;
    if (keys[match].end != undefined) { // end must be found
    var end = new RegExp(keys[match].end.source + "|" + keys[match].neglect.source, "mg");
    end.lastIndex = keys[match].endPos;
    while (keys[match].endPos != s.length)
    What did the first for loop do again?


    Attached Files Attached Files

  19. #19
    Fanatic Member
    Join Date
    Jan 2005
    Location
    Cebu
    Posts
    607

    Re: VBForums FireFox Extension

    ToDo list:

    • Delphi
    • CSS
    • Text size
    • Text differer
    • add common notes to Canders editor (or something like that)
    • Fix the console output with my new version, or is it Nebs output version now...
    • add the new smilies
    • ?Tabs for the smilies? (Do we need it?)
    • List |list||list=1||list=a| (using canders editor again?)

    Correct me if I'm wrong people, but I guess this is the updated TODO list from NoteMe. Just wanna remind.
    Last edited by nebulom; Jun 27th, 2005 at 02:34 AM.

  20. #20
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Version 0.2.6 is now on the server. Use FTP or IE to download it.






    As a note. If we are going to get tabs on smilies I guess we have to put the menu toolbars that we are using now on TOP of a window or something, and then add tabs to the windows rather then the menu toolbar it self.


    ØØ

  21. #21

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    I am using textpad.

    And yes, remember the top of the vbf.js file saying TODO: clean this up because it is ugly as ****?

    I just never got around to it. I was never really expecting anyone else to be working on the code.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  22. #22
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    You hoped, but never expected....thats nice..


    BTW I can't belive it is soooo hard for different text editors to make the indent look the same in them. It ticks me off that they are not working the same way.


    Well, at least we have come a long way though. Even if we havn't cleaned up much.....I don't have any time to work on it today, and probably not tomorrow either. But there is still some things to do, so I'll be back..

    ØØ

  23. #23

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    I'll be gone a couple days myself if you need me. Getting Wisdom teeth cut out.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  24. #24
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Hehehe....are they so big that you need a couple of days off...well well. But just before you go. Can you tell me a bit about the Keys array?


    Is it an array of Objects/structs? Is it declared somewhere at all? Or don't you have to do that in JS? I am so confused by what actualy happens when you use pop on that array (stack)...

  25. #25

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    Look harder .

    keys = new Array();

    http://www.w3schools.com/js/js_obj_array.asp
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  26. #26
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    But that doesn't say anything about how it is laied out. For me it looks like you have one struckt in the array for name, colour, bold and so on, and then I guess there is something more to it. Becasuse the regular expression has to store something to, but how/where/what...hmmm


    And it also seems to me that each regular expression only uses ONE "cell" in the array. So does that make it two dimensional, or how is the results for the regex stored?


    ØØ

  27. #27

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    think of it as CSS where you define a class and its properties (in the case of style being the class and color, bold, etc are the properties. But it placed into an array.

    Get it?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  28. #28
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Like, go to this page:

    http://www.w3schools.com/js/tryit.as...s_array_length


    Then add this code to the left window:

    Code:
    <html>
    <body>
    
    var codeme = "#Hello mother def _ma5in_():  if len(sys.argv) < 1:  usage() #Yeah thats your mother all right  else:  kek_number_list = tidy_up_file(sys.argv[1])  if kek_number_list != -1:  download_pdf(kek_number_list) #Poo is a country"
    
    <script type="text/javascript">
    var keys = new Array()
    
    keys.push({style:{color:"#CC0000", bold:true, italic:false,  name:"pythondef"}, start:/\bdef\s\w+(?=\()/mg});
    keys.push({style:{color:"#FF6666", bold:false, italic:false,  name:"functions2"}, start:/\b\w+(?=\()/mg, neglect:/\sdef\s\w+(?=\()/mg});
    keys.push({style:{color:"#009900", bold:false, italic:true,  name:"comment"}, start:/\s*\#/mg, end:/\n/mg, neglect:/\\|\?\?\//mg}); //start:/\#[\w\s]*\n/mg});
    keys.push({style:{color:"#009900", bold:false, italic:false, name:"comment"}, start:/\s*?^\s*(?:#|\?\?=|%:)/mg, end:/\n/m, neglect:/\\[\s\S]|\?\?\/[\s\S]/m});
    keys.push({style:{color:"#3333FF", bold:false, italic:false, name:"keyword"}, start:/\s*\b(?:__name__|def|elif|else|except|file|for|if|import|in|len|open|print|return|str|try)\b/mg});
    keys.push({style:{color:"#000000", bold:true,  italic:false, name:"operator"}, start:/:/mg});
    keys.push({style:{color:"#CC9933", bold:false, italic:false, name:"string"}, start:/\s*(?:\bL)?"/mg, end:/"/m, neglect:/\\[\s\S]|\?\?\/[\s\S]/m});
    keys.push({style:{color:"#CC9933", bold:false, italic:false, name:"char"}, start:/\s*(?:\bL)?'/mg, end:/'/m, neglect:/\\[\s\S]|\?\?\/[\s\S]/m});
    keys.push({style:{color:"#993399", bold:false, italic:false, name:"int"}, start:/\s*\b(?:0[0-7]*|[1-9]\d*|0x[\dA-F]+)(?:UL?|LU?)?\b/mgi});
    
    for (i=0; i<famname.length; i++)
    {
    document.write(keys[i] + "<br>")
    }
    </script>
    
    </body>
    </html>
    What do I have to edit where I have heiglighted now to get what is inside the array if you look away from the color, bold, name, italic? What does the regular expression store, and where..

  29. #29
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Quote Originally Posted by Cander
    think of it as CSS where you define a class and its properties (in the case of style being the class and color, bold, etc are the properties. But it placed into an array.

    Get it?

    Yeah I get that. But is what the RegEx returned also a property? If so what is it called? How do I get it out..

  30. #30

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    I really don't understand what you are asking.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  31. #31
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    Ohhh...I might start to understand now....it often helps to ask stupid questions for me..


    The RegEx isn't executed on that line? Is that it? Ahha...it only STORES the reg ex on that line. The actual reg ex is called in that other function? And then it stores the startPos then. That has NOTHING to do with that line at all...grrrr....*smacks my head in the wall*.....

  32. #32

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    Right. They keys is just an Array. nothing more.

    Now smack your head some more. lol
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  33. #33
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    I really thought it was executing the RegEx THERE, since it is not in the {color, bold, italic, name} array at all, but outside it..



    Ok, last question about it. On lines like this (I can't say how much I hate one line braching though..):

    Code:
    if (keys[i].style.bold) keys[i].before += "[b]";
    the before "property", that is a property right? I can't find any method called that. but the werid thing is that there was no property called that when you started the array. So I guess you can add properties too then? Like Before/After/StartPos?

    So I also guess that the array in JS is not actualy an array, but some advanced List that can expand over time? ?

    Just answer this, and I will go home from work and do nothing else then smack my head for the rest of the day..


    ØØØ

  34. #34

    Thread Starter
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913

    Re: VBForums FireFox Extension

    Hash Table is the correct term here. Yes, you can just have those custom properties just thrown in.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  35. #35
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: VBForums FireFox Extension

    OK. I totaly got it now. I can even see why my python thingy worked now in the end....It wasn't weird I used a lot of time to try to move the startPos 4 places forward when I thought it was executed in the big Case test function.


    Well I have a vague idea on how to colour import modules for python too now. Not sure if it is nessesary for other languages. People seldom need it in C++, except if they insist to write the whole name for namespaces and so on.

    std::cout

    Will try one day when I have the time. Guess I need an other array to remember the import modules, and then color every occourence of them in some way.


    Thanks for your help. Your code doesn't look THAT sloppy now...


    Greg Snooks law:

    Note: For every coder, there is a coder that doesn't like his coding style.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width