Bug - Fixed Relay Browser does not show rollover countdown in charpane

Veracity

Developer
Staff member
When I log in to vanilla KoL, as rollover approaches, I see the following at the top of the charpane:

4 minutes until daily
maintenance begins.

I don't see that in the Relay Browser.

Why not?
 

Veracity

Developer
Staff member
Other than built-in KoLmafia charpane decorations, no.

I was logged in to vanilla KoL using Safari. I saw the rollover counter counting down.
My Relay Browser opened in Firefox. I saw no rollover counter.

I had both browser windows side by side. The difference was obvious.
 

Bale

Minion
I've found a cause/solution by remembering some of my work on ChIT. I was able to recreate the bug despite not being at rollover by using a charpane.ash override:

Code:
string page = visit_url();

// Tell page it is only 2 minutes to rollover
matcher test = create_matcher("rollover \= (\\d+).*?rightnow \= (\\d+)",page);
if(test.find()) 
	page = page.replace_string(test.group(1),to_string(to_int(test.group(2))+120));

write(page);

That changes rollover time to 2 minutes after rightnow to activate the rollover timer. I know that works because last year I was using it to test the rollover timer's display in ChIT. After seeing that Veracity was quite correct I compared it to the vanilla charpane and recreated a nearby difference in the vanilla browser's html by adding a single line to that charpane override. Try the following charpane.ash

Code:
string page = visit_url();

// Tell page it is only 2 minutes to rollover
matcher test = create_matcher("rollover \= (\\d+).*?rightnow \= (\\d+)",page);
if(test.find()) 
	page = page.replace_string(test.group(1),to_string(to_int(test.group(2))+120));

// Remove strange javascript from KoLmafia's relay browser	
page = page.replace_string(' onload="updateSafetyText();"', '');

write(page);

By removing that bit of javascript the rollover timer appears. My question is, "What does updateSafetyText() accomplish and is it safe to remove?" Perhaps that function got broke at some time.



PS. This would look better if you changed the size of the pop-up window like...
replace_string('doc("maintenance")', 'poop("doc.php?topic=maintenance", "documentation", 560, 518, "scrollbars=yes,resizable=no")');
... but that might be excessive tampering with KoL's look.
 
Last edited:

Veracity

Developer
Staff member
Huh.

The "safety text" is something you can call up by clicking on the little ? we insert at the right end of the blue bar above various maps. There is a list of "locations" in RequestEditorKit.maps that defines the URLs whose blue bars get annotated like that. They are all "containers" that contain adventure locations in them.

Go to the Nearby Plains, for example. If you do not have chat open, when you click on the ?, it will use the chat pane to display "safety details". Your cursor turns into a black circle with a ? in it when it is hovering over an adventurable location in the map. Click on it and it overlays the chat pane with the "safety text" - the "location details" that you can see in the GUI, with combat rate, water level, the list of monsters and their drops, and so on.

You can dismiss the "safety text" by clicking on the "x" in the upper right corner of it. The chat pane goes back to being the Announcements, and so on. Unfortunately, the cursor will still be the "help" cursor when you hover over an adventure location, even though clicking there will now actually adventure. I'd call that a bug.

That's all done via code in basics.js using "attachSafetyText".

"updateSafetyText" is also in basics.js. The code that you pointed out is our annotation to charpane.php to call that Javascript function whenever the charpane loads. Looking at that function, it calls /KoLmafia/updateLocation. That is handled in RelayRequest. It calls RelayRequest.handleSafety, which builds the HTML with all the location details.

I do not understand why it calls this on a charpane refresh. When you are simply looking at locations, the charpane does not refresh. Ah - but if you buff up in the GUI, or something, and click "refresh" in the charpane, some of the details in the "safety text" can change - adjusted item drop rates, they chance that particular monsters can hit you, etc.

OK. This is a big complicated feature that I never, ever use. But, I'd prefer not to hobble that last part - charpane refresh forces an update - by removing the call to updateSafety on charpane load. I guess I just need to figure out why it disables the rollover counter.

Thanks for the lead, Bale. It was very helpful!
 

Veracity

Developer
Staff member
Ha.

KoL supplied charpane:

Code:
<body bgcolor=white text=black link=black alink=black vlink=black onload='startup();'>

KoLmafia munged charpane:

Code:
<body onload="updateSafetyText();" bgcolor=white text=black link=black alink=black vlink=black onload='startup();'>
We have competing "onload" functions, and apparently only the first gets to execute.
 

Veracity

Developer
Staff member
Revision 14665 calls both KoL's and KoLmafia's onload functions in the charpane.
Thanks, Bale.
 
Top