Bale's Relay Overrides

I added this to topmenu:
Code:
	//=============================
	//Based bUMRATS and mafia code, reworked, kerjiggered, and it LIVES!
	string clanlist = visit_url("clan_signup.php");
	
	if (index_of(clanlist, "<select name=whichclan>") >= 0 && index_of(clanlist, "<input type=submit class=button value='Go to Clan'>") >= 0)
	{
		string whitelist = substring(clanlist, index_of(clanlist, "<select name=whichclan>")+23, index_of(clanlist, "<input type=submit class=button value='Go to Clan'>"));
		string change="\"showclan.php?pwd="+my_hash()+"&action=joinclan&confirm=on&whichclan=\"";
		string droplist="<div style='position: absolute; right: 0px; top: 0px;'><font size=-1>";
		droplist+="<select onchange='if (this.selectedIndex>0) { top.mainpane.document.location.href="+change+" + this.options[this.selectedIndex].value; this.options[0].selected=true;}'><option>-change clan-</option>"+whitelist;
		droplist+="</div></body>";
		results.replace_string("</body>",droplist);
	}
	//=============================
I inserted it at the end of my copy, but I thought it might be handy. The dropdown is activate on select, like the relay dropdown. Thought you might find it useful or might retool it for a better fit. I've had to change clans a bit because of Dreadsylvania and DrEvi1's changer was hidden by CHIT.
 
Well. That's actually kinda awesome. I wish I'd been using that for the last few weeks. The only problem is that some clans have ridiculously long names which makes the selection box extend way too far. I can fix that easily enough since I doubt anyone really needs more than 23 characters to identify their clan.

svn update
 
Humm... Was this supposed to happen with that update?

topmenu.jpg

Also, where did my images for the clanlog and florist go?

(sorry the preview is a bit small...)
 
The clan list dropdown shows properly for me. This update did shift the clan log and florist a bit towards the center. Prior to this update they were closer to the left margin.
 
Well, it shows just fine, it only overlaps with the relay-script dropdown... :)
(downgraded to r14 and at least it works fine now :))
 
Additional: The icons style have the Help, Bug report, and Logout icons covered by the drop downs. Although, judging by things, the topmenu override is only really work with the link style. The others don't have the friar or raid log quick link. By the looks of things, Bale only intended to have this work with the links style. Hence all the link work. Maybe something for future work is adaptation for image and menu formats?
 
Additional: The icons style have the Help, Bug report, and Logout icons covered by the drop downs. Although, judging by things, the topmenu override is only really work with the link style. The others don't have the friar or raid log quick link. By the looks of things, Bale only intended to have this work with the links style. Hence all the link work. Maybe something for future work is adaptation for image and menu formats?

Friar and Raid log appeared with dropdown style yesterday.
 
My answer to all the above comments:

svn update topmenu

  • Fixed a display issue for smaller screens making the moons disappear under the relay menu.
  • Fixed clanlog and florist for drop-down style topmenu.
  • Added support for icons-style topmenu. It's not as complete. I'm not terribly thrilled with icons for raidlog and friars, but the support is finally there.
  • Fixed the way that KoLmafia has always overlaid the relay menu over the logout icon for this topmenu style.
 
After some extensive usage of the inspection tool in Firefox (great tool, never knew it existed) I've changed lines 60-82 of topmenu.ash to the following in order to get the topmenu to display properly:
PHP:
// Add Whitelist to top of right side
// Based on bUMRATS, reworked and kerjiggered by Fluxxdog and Bale
void addWhitelist(buffer results) {
    string clanlist = visit_url("clan_signup.php");
    if(index_of(clanlist, "<select name=whichclan>") >= 0 && index_of(clanlist, "<input type=submit class=button value='Go to Clan'>") >= 0) {
        buffer whitelist;
        whitelist.append(substring(clanlist, index_of(clanlist, "<select name=whichclan>")+23, index_of(clanlist, "<input type=submit class=button value='Go to Clan'>")));
        // Shorten all Clan names to 23 characters:
        matcher option = create_matcher('<option value\=\\d+>([^<]+)</option>', whitelist);
        while(option.find()) {
            if(length(option.group(1)) > 11)
                whitelist.replace_string(option.group(1), substring(option.group(1), 0, 11));
        }
        results.replace_string("</body>", "<div style='position: absolute; left: 0px; bottom: 0px;'><font size=-1><select onchange='if (this.selectedIndex>0) { top.mainpane.document.location.href=\"showclan.php?pwd="
            + my_hash() + "&action=joinclan&confirm=on&whichclan=\" + this.options[this.selectedIndex].value; this.options[0].selected=true;}'><option>-change clan-</option>"
            + whitelist + "</div></body>");
    }
}

string raidlog = '<a href="clan_raidlogs.php" target="mainpane">'
          + '<img src="http://images.kingdomofloathing.com/adventureimages/hobofort.gif" height=20 width=20 alt="Clan Raidlog" title="Clan Raidlog" style="margin:0 0 0 0; border: 0" /></a>';
string florist = '<div style="height: 40px; overflow: hidden; margin: -10px; border: 0px none; bottom: 0px; position: relative; left: -20px;"><a href="forestvillage.php?action=floristfriar" target="mainpane">'
              + '<img src="http://images.kingdomofloathing.com/otherimages/forestvillage/friarcottage.gif" width=20 height=20 alt="Florist Friars" title="Florist Friars" style="margin-top:10px; border:0" /></a></div>';

This makes the images not too big (i.e. the actually fit in the topmenu frame) and also moves the clanhopping dropdown to the right so that it doesn't have to compete with Mafia's for the screen space (again making it so that the dropdowns fit in the frame). I also shrunk it down a fair bit since otherwise I couldn't get everything on one line.
 
You pointed out some problems to whose existence I was unaware. I hadn't realized that if I switched to drop-down syle and refreshed the page, the menu's height would decrease. However I didn't really like any of your solutions. (Perhaps you've forgotten that other menu styles have a greater height?) I've attempted to address all your issues in a different way.

svn update topmenu
 
Well,given my totallackof undestanding of divs and whatnot (my only programming course involving html was back when frames was still the latest and coolest) I was just happy to have made something that worked for me :-)
 
Hey Bale, I really like the new clan menu, however I have a suggestion... these days I am clan hopping so much I am confused about what clan I am currently in. Instead of "-change clan-" could you instead have the text of the current clan you are in ? Admittedly this may not be great for clans with super long names, so take this idea with a grain of salt, but it may be worth trying.
 
The problem with that is that if you change your current clan I'd have to refresh the topmenu to update it for the new clan. I'd rather not have the unnecessary extra server hits.
 
Just made a small update to topmenu. Winterbay, I've got some good news and some bad news. :)

The bad news is that it is going to conflict with your modification to clan drop-down width. The good news is that you can throw away your old version since this one takes care of your problem.
 
I'll have to try that when I get home and can get around the silly restriction that the company firewall has on accessing sourceforge :)
 
Yep, that works, and yep it conflicted. Also, I lied. I have a second change. I've changed "campground()" to "campground_link()" to avoid a conflict with another script in use in my MasterOverride.
 
Back
Top