Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Hobbes. Firefox Extension Idea.

Options
  • 26-03-2005 11:56pm
    #1
    Registered Users Posts: 11,980 ✭✭✭✭


    I've tried editing this myself but it doesn't work.

    The idea is to add a right click menu with contains the boards.ie forums. I use this for SA. It's quite hand, especially when you are off-site.

    http://www.extensionsmirror.nl/extfirefox/GoonMenu_0.3.1.xpi


«1

Comments

  • Registered Users Posts: 4,287 ✭✭✭NotMe


    I was messing around with this ( I don't know anything about javascript or XUL btw) and I'm after messing up firefox. :o It won't even start in safe mode. It shows up in processes but I can't see it. I've tried reinstalling and it still doesn't work. I'm using Opera now. :rolleyes:


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    Delete you're application data folder, and reopen. Save your bookmarks folder :D


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    I just renamed the extensions folder and its working but now I have to install all my extensions again. :(


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Yea that is one of the dangers of breaking an XPI file. I've managed to hose FF twice. Most of the FF destroying is due to XUL/XML files corrupted/incorrect. Javascript won't kill FF but will stop the extension from working.

    I posted up an FAQ some time ago..
    http://www.boards.ie/vbulletin/showthread.php?t=212605

    It covers a tutorial, reference guides and a build kit (although a dated kit. Certain reasons currently prevent me from releasing the latest version). The advantage of the build kit is you don't have to edit every file only 2-3 files to build your extension. The kit takes care of the rest (requires ANT or Eclipse).

    I would also recommend you go look at other extensions. If you take the Biki Search from [wiki]Firefox Extensions[/wiki] and look at its overlay code it shows you how to create right click menu items.

    eg.
    <popup id="contentAreaContextMenu">
      <menuitem id="bikisearch" label="Search Biki" accesskey="S" insertafter="context-stop"   			
      		oncommand="bikisearch();" image="chrome://@project.name@/skin/biki.png"/>
      <menuitem id="bikicreate" label="Create Biki" accesskey="C" insertafter="context-stop" 
      		oncommand="bikicreate();" image="chrome://@project.name@/skin/bikir.png"/>
    </popup>
    


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    With regards to the original question (thats what I Get for not reading fully). I'll have a looksee at the extension and see if I can create one for boards.


  • Advertisement
  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Lots of good links there. I'm interested in this now. I have the menu working with all the forums in it, now I just have to type out a million links. :D

    *edit* 303 to be exact so if anyone wants to help...


  • Registered Users Posts: 4,287 ✭✭✭NotMe




  • Registered Users Posts: 2,077 ✭✭✭parasite


    great stuff, fierce handy altogether
    did you have to type out all the addreses by hand, mmm tedious
    it would be nicer if it opened pages in new tabs by default ...

    a must for every boards ninja !


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Yeah I had to type them all out. :o Open links in a new tab yeah I'll look into it, I'm new to all this stuff.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    NotMe wrote:
    Yeah I had to type them all out. :o Open links in a new tab yeah I'll look into it, I'm new to all this stuff.

    Haven't used it yet (will this evening) but have a look at the source of the Private message monitor, the latest one.

    It has code for opening in different windows. You could even add a preferences part.

    As for all the names, possibly a better solution is to read the main page and parse the links from the menu. Admins (if they ever get free time) might even do up a special page with the list.


  • Advertisement
  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Hobbes wrote:
    Haven't used it yet (will this evening) but have a look at the source of the Private message monitor, the latest one.

    It has code for opening in different windows. You could even add a preferences part.
    I'll have a look at that.
    As for all the names, possibly a better solution is to read the main page and parse the links from the menu. Admins (if they ever get free time) might even do up a special page with the list.
    Yeah that would be a good idea because at the moment if a new forum is added then the extension will have to be updated. Anyway all I've done is modify the SA extension. I'm going to read up more on Javascript and XUL.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Had a look at the code. It would be a lot better pulling the list from the server. All you need is the forum name and its id code. Not the URL. You could avoid creating accesskeys as well.


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Is there any way to test the code without having to zip it all up and install it each time? Or just to parse it for syntax errors even?


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    Works, but one problem. It overwrites the goon menu!!

    And.

    User CP FAQ Members List Calendar Journals New Posts Search Quick Links Log Out


    Under a tools menu.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Giblet wrote:
    Works, but one problem. It overwrites the goon menu!!

    The reason for that is simple enough to fix. Basically each extension requires its own GUID. If you check the links I provided it explains how to fix this.


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Ok I fixed that problem with the goon menu. It wasn't actually a problem with GUIDs, it was because I didn't change the name of the menu so both menus were called 'forums-menu'.
    And I added a tools menu.
    http://members.boards.ie/notme/boardsmenu.zip


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    They both work together now, except, none of the boards.ie links work DOH!


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    :eek:

    (Back in a minute)

    Ok it works now I promise. :D


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    Great, works exactly as it should.

    Maybe hobbes could make a package of extensions that has all his extensions.

    There's another great one made by the guys at somethingawful for their forums. Basically is tells you which posts you've read, which of the ones you've read have new replies, which ones you've replied to, and has links to the last post you've read in each thread.


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Hobbes wrote:
    Had a look at the code. It would be a lot better pulling the list from the server. All you need is the forum name and its id code. Not the URL. You could avoid creating accesskeys as well.
    I wrote a bit of javascript to get this page:http://www.boards.ie/javascript/dhtmlmenu.js using XMLHttpRequest, parse it for the names of the menus and output them. It's takes a long time to parse the whole page though and if it has to do this every time you right click... :(
    Can you think of a better way to do it?

    My parsing code is:
    [PHP]
    var beginPos = 0; var endPos = 0;
    while((beginPos = page.indexOf("text=", endPos)) != -1)
    {
    endPos = page.indexOf(";", beginPos);
    document.getElementById("output").innerHTML += page.substring(beginPos
    + 5, endPos) + "<br/>";
    }
    [/PHP]


  • Advertisement
  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    You should be able to parse out the menu using the IDs at each menu.

    If you reinstall Firefox and do a custom install and install the DOM inspector you can find what in the DOM can be referenced to be pulled out.

    More information here...
    http://www.boards.ie/vbulletin/showthread.php?t=239271
    Maybe hobbes could make a package of extensions that has all his extensions.

    Its better to keep them seperate as not everyone would want everything. When notme feels happy with a good release we/he can add it to the [wiki]Firefox plugins[/wiki] wiki page.

    Incidently I was in the process of writing the same plugin (with more options) but notme is doing a good job and looks like hes learning lots. :) So its all his.


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Hey if you do decide to write the plugin I'd be very interested in what you come up with.
    And yes I am learning a lot through doing this. Thankfully javascript is a lot like Java so it's easy for me to pick up. I just went through the tutorial at http://www.w3schools.com/js/default.asp


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Well what you have is fine but I think there are way too many forums that a lot of people just won't be intrested in.

    So something like this.

    1. Preferences option. Does a one time call to the search page, parses out all the forum names/url and stores it in an RDF.

    2. The can then select what menu options they want to appear.

    Beyond that can't think of anything else.

    XULplanet and the Mozillazine wiki are good places to read as well.


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Yeah that sounds like a good idea. Ah yes I hadn't noticed that the search page has a handy list of all the forums and codes.

    Say I have the page downloaded and stored in a variable called 'pageText'
    The first menu item is:
    [PHP]<option value="506" class="fjdpth1" >    Anime / Manga</option>
    [/PHP]
    How do I access the value? Is it something like:
    [PHP]var x = pageText.getElementsByTagName("option");[/PHP]
    and then
    [PHP]x.item(0).getAttribute("value");[/PHP]
    I can't get it working.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    You need to access it as a DOM model then use the getElementById method.


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    I have:
    [PHP]var url = "http://www.boards.ie/vbulletin/search.php";
    ...
    result = new XMLHttpRequest();
    result.open("GET", url, true);
    ...[/PHP]
    and then:
    [PHP]page = result.responseText;[/PHP]
    To access it as a DOM model I would need (?)
    [PHP]page = result.responseXML; [/PHP]
    but I think that only works with xml files and not html.
    When I tried that it said in the javascript console:
    Error: result.responseXML has no properties


  • Registered Users Posts: 5,217 ✭✭✭Matthewthebig


    I just installed itand how do i get to said context menu?


  • Registered Users Posts: 4,287 ✭✭✭NotMe


    Right click.


  • Registered Users Posts: 5,217 ✭✭✭Matthewthebig


    Thanks i see it and i like


  • Advertisement
  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Your HTML page is nearly always supplied to you as a DOM.

    I've only done it before from reading the page loaded into the window like so...
    var page = window._content.document;
      var myAelems = page.getElementById("lnk3"); // Link menu element
    

    You can then read the childnodes off that.


Advertisement