As part of RequestEditorKit.java, addChatFeatures attempts to add right click capabilities to to almost every page by injecting the actions list and including rcm.2.js.
In rcm.2.js a check is made while building the list for actions of type 1 and 5 which are automatically added and then an else check looks for a variable notchat.
Since this variable is only set in mchat.php and lchat.php, the javascript throws an exception causing the menu not to build correctly.
If a user has any of the following options enabled, the RCM breaks as these are not actions 1 or 5:
Perform /whois in chat
Send private message in chat
Add to contact list
Add to ignore list
It seems like a simple fix for this is to add a var notchat = true; prior to writing the actions list.
However, this should not be done on the chat page itself (why are we changing the RCM on the chat pages anyway?)
Another way to fix it would be to surround this check with a try/catch in the javascript although this file is coming directly from the KoL servers so less practical.
Steps to reproduce:
1) Enable any of the above 4 options under the Chat preferences in KoL options.
2) Exit out of KoLMafia (needed to refresh the cached Right Click Menu from lchat.php)
3) Restart KoLMafia
4) Navigate to a page that uses the right click menu such as the Mall Sales Activity.
5) Right click on a player's name and notice that the default browser context menu is displayed
I've tested a quick ASH fix for backoffice.php to verify this works:
writeln(visit_url().replace_string("var actions = {", "var notchat = true; var actions = {"));
For non-chat pages, we want notchat to be true as the specified menu options unsuccessfully attempt to update components of the chat pane if notchat is false.
In rcm.2.js a check is made while building the list for actions of type 1 and 5 which are automatically added and then an else check looks for a variable notchat.
Since this variable is only set in mchat.php and lchat.php, the javascript throws an exception causing the menu not to build correctly.
If a user has any of the following options enabled, the RCM breaks as these are not actions 1 or 5:
Perform /whois in chat
Send private message in chat
Add to contact list
Add to ignore list
It seems like a simple fix for this is to add a var notchat = true; prior to writing the actions list.
However, this should not be done on the chat page itself (why are we changing the RCM on the chat pages anyway?)
Another way to fix it would be to surround this check with a try/catch in the javascript although this file is coming directly from the KoL servers so less practical.
Steps to reproduce:
1) Enable any of the above 4 options under the Chat preferences in KoL options.
2) Exit out of KoLMafia (needed to refresh the cached Right Click Menu from lchat.php)
3) Restart KoLMafia
4) Navigate to a page that uses the right click menu such as the Mall Sales Activity.
5) Right click on a player's name and notice that the default browser context menu is displayed
I've tested a quick ASH fix for backoffice.php to verify this works:
writeln(visit_url().replace_string("var actions = {", "var notchat = true; var actions = {"));
For non-chat pages, we want notchat to be true as the specified menu options unsuccessfully attempt to update components of the chat pane if notchat is false.