Feature - Implemented Pop-up Relay Browser window instead of Mini-browser window

Bale

Minion
As everyone knows, mafia pops up a mini-browser window when something goes wrong. As helpful as this is, I would find it much more convenient if mafia would pop-up a tab in my relay browser instead.

This would be especially useful for combat since the relay browser could add my CAB to assist me with finishing the combat.

Since some people actually run mafia without using the relay browser (GASP!) I think that this should remain an option so that those people aren't troubled by mafia suddenly interacting with their non-mafia browser. This could be a secret feature like the chatBeep preference or else it would fit nicely on the "Browser" tab in preferences, right under Preferred web browser. (Open emergency requests in relay browser.)

I imagine that when KoLmafia was written this feature would have been a trifle inconvenient since there weren't any multi-tab browsers. However all modern browsers will simply open the request in a new tab of the same window, making this extremely convenient.

Would this feature be difficult to implement?
 
If the relay browser is already open, would it be more useful if it were refreshed, rather than opening another instance of the relay browser in a new tab?

Usually when the mini-browser pops up for me, it's a problem in a fight, so I just click on a random link (e.g. last visited location) in the relay browser to get the "twiddle your thumbs" message, and the CAB. The only downside of this is that the round count gets out by one, making it hard to run a CCS.
 

Theraze

Active member
I don't think we want to deal with the chaos of trying to detect current relay status... launching a new browser window, whatever that means for you (existing window, new window, or new tab), through a preference would be a nice (and easier to implement) option. :)
 

jasonharper

Developer
This is not nearly as simple as everyone seems to think it is...

When mafia needs to do an emergency browser display, it has already loaded the page that triggered the problem. It's no problem to stuff that page into the mini-browser display, which is entirely under mafia's control, but the only thing that can be done with an external browser is to point it to a specific URL - so what URL would we point it to in this case? Reusing the URL that triggered the problem is not going to work very well - for example, in the case of a combat abort, loading fight.php in the relay browser is just going to give you a "twiddle your thumbs" page, with no details at all about what went wrong. There would need to be some trickery to replace the page being loaded in the relay browser with the already-loaded page that the mini-browser currently displays.

Simplest solution might be to add a "grab from mini-browser" link in the relay browser somewhere, that loads a mafia-specific URL that simply reads the mini-browser page rather than forwarding the request to KoL (and probably closes the mini-browser at the same time). You'd have the option of using this link instead of doing anything with the mini-browser whenever it pops up.
 

Bale

Minion
When mafia needs to do an emergency browser display, it has already loaded the page that triggered the problem. It's no problem to stuff that page into the mini-browser display, which is entirely under mafia's control, but the only thing that can be done with an external browser is to point it to a specific URL - so what URL would we point it to in this case?

Actually, that's not entirely true. A browser can also read an html file. What about creating an "error.html" file that contains the page which triggered the problem and send that to the relay browser. Would that work? (Serious question, I have no idea if that would work! I worry that it might not work if you wanted to continue playing from the emergency window. I'm hoping though.)
 
Last edited:

Theraze

Active member
I like Jason's "simplest solution" choice... if it works like that, it could even be automatically redirected through a preference...
 

StDoodle

Minion
Actually, that's not entirely true. A browser can also read an html file.

Yes, by pointing the U(niversal) R(esource) L(ocator) at a static, local page, specifying the file protocol, a browser can read a local file. ;) I think your "error.html" idea may have some merit, but I imagine it may get tricky with some of the ajax junk. The mini-browser, being under mafia's control, doesn't automatically do junk like obeying the frameset loading rules, and thus won't be refreshed / reloaded an additional time in the act of being passed around. Trying to tell a regular browser not to do so is trickier; it probably means stripping out quite a bit of the <script> and junk. I dunno if you could easily strip out the parts that force-refresh and still leave in the parts that allow CAB usage, so I'm not sure what could be gained. Blech.
 

holatuwol

Developer
No idea if it makes sense to fire relay overrides with the current implementation of this feature (r9031) since the request to KoL is already done, but I am open to suggestions.
 
Last edited:

StDoodle

Minion
Probably not, and it probably wouldn't even be a bad idea to insert a "Warning: blah blah" div or something at the top of the main frame.
 

Veracity

Developer
Staff member
No idea if it makes sense to fire relay overrides with the current implementation of this feature (r9031) since the request to KoL is already done, but I am open to suggestions.
Relay overrides that are coded to properly deal the current interface - i.e. they are called before the URL is submitted - will call visit_url() with no arguments to submit the URL. That function posts KoLmafiaASH.relayRequest to do so. You could set up that request such that it already has a responseText and make visit_url() not bother submitting the request if that condition is true.

The problem would be relay overrides that don't want to submit the original URL but, instead, do something different.

By the way, this submit worked like a charm today for my multi who was automating the slime tube: when he encountered Mother Slime, the choice adventure popped up in his open Relay Browser, rather than popping up a mini browser. Nice!
 

Winterbay

Active member
Here too :)
Allthough the reason for them popping was that something had set my choices to other things than what I wanted. I suspect a script has been involved with that though :)
 

StDoodle

Minion
Tested myself as well, it's pretty nifty! (Will require some careful rework to my fight.php override script, but it's worth it.)
 

kitsunegami

New member
If the relay browser is already open, would it be more useful if it were refreshed, rather than opening another instance of the relay browser in a new tab?

Usually when the mini-browser pops up for me, it's a problem in a fight, so I just click on a random link (e.g. last visited location) in the relay browser to get the "twiddle your thumbs" message, and the CAB. The only downside of this is that the round count gets out by one, making it hard to run a CCS.
Agreed. I'm finding it highly annoying that mafia keeps opening a second tab in Opera (especially since it lacks my current chat conversations).

How do I go back to the less irritating mini-browser pop-up?
 

roippi

Developer
highly annoying... irritating...

As an aside, and I know you probably didn't mean to be accusatory with your post, but inclusion of adjectives such as these generally will not net you a positive response from the devs. Just a heads up.
 

StDoodle

Minion
The problem would be relay overrides that don't want to submit the original URL but, instead, do something different.

Since the advent of relay info scripts, I can't think of a particularly good reason to completely overwrite the page on a relay override. Some -- even heavy -- modification, yes. Completely different? Seems like you'd be better off with a relay info script.

If (and I say "if" as there could well be much more to this than meets the eye, I dunno) that is the only major point against allowing relay overrides to fire on such pages, I'd say go for it!
 

kitsunegami

New member
As an aside, and I know you probably didn't mean to be accusatory with your post, but inclusion of adjectives such as these generally will not net you a positive response from the devs. Just a heads up.
Good point. But my boundless love for mafia is widely known so I hope no one will take it as accusatory. 8o)
 

icon315

Member
There seems to be problem with this. When it happens during a script which requests adventures one at a time, it loops which open A LOT of windows.
 
Top