Open the original source of an IG post, story or profile picture
< Feedback on (Deprecated) Instagram Source Opener
Hello, I couldn't reproduce what you described. The script uses the browser's localstorage, which is kept between sessions. Here's a video demonstration using ViolentMonkey and Firefox 74: https://youtu.be/60IiQdMvKbI.
IG is built so it keeps you on always on one tab. However, if you use a script that allows you to middle-click to open in a new tab, you will see that, upon opening in a new tab a different profile/page than the one where you've set the shortcuts, they stop working. I've checked the "values" tab in Violentmonkey and the settings are there, but the script doesn't read them(if I open the dialog to change them it says "Current key binding: Alt + O").
I've also just checked by downgreading to v0.9.2 and everything is fine, so the issue was introduced in a later version.
I still couldn't reproduce the issue you're describing, I tested opening a new tab (with or without that middle-click script) after changing the key bindings and they stay correctly bound.
Please execute the following steps:
ORIGINAL TAB:
[ISO] Registered menu commands Instagram Source Opener.user.js:1125:13 [ISO] Created script settings button Instagram Source Opener.user.js:1125:13 [ISO] Created script settings menu Instagram Source Opener.user.js:1125:13 [ISO] Loaded "profile picture" key binding: Alt + P Instagram Source Opener.user.js:1125:13 [ISO] Added profile key bindings Instagram Source Opener.user.js:1125:13 [ISO] Saved new key binding to open single post and story: Alt + Q Instagram Source Opener.user.js:1125:13 [ISO] Saved new key binding to open profile picture: Alt + W Instagram Source Opener.user.js:1125:13 [ISO] Removed profile key bindings Instagram Source Opener.user.js:1125:13 [ISO] Loaded "profile picture" key binding: Alt + W Instagram Source Opener.user.js:1125:13 [ISO] Added profile key bindings Instagram Source Opener.user.js:1125:13
After opening post and hitting Alt+Q: [ISO] Loaded "single post and story" key binding: Alt + Q Instagram Source Opener.user.js:1125:13 [ISO] Added single post opening key binding Instagram Source Opener.user.js:1125:13 [ISO] Detected source opening shortcut on a single post page
NEW TAB:
[ISO] Registered menu commands Instagram Source Opener.user.js:1125:13 [ISO] Created script settings button Instagram Source Opener.user.js:1125:13 [ISO] Created script settings menu Instagram Source Opener.user.js:1125:13 [ISO] Loaded "profile picture" key binding: Alt + P Instagram Source Opener.user.js:1125:13 [ISO] Added profile key bindings Instagram Source Opener.user.js:1125:13
After opening post: [ISO] Loaded "single post and story" key binding: Alt + O Instagram Source Opener.user.js:1125:13 [ISO] Added single post opening key binding
A few other things I've observed:
I'm not very familiar with Violentmonkey, but that tab only shows values that were stored using the GMgetValue and GMsetValue functions from the Greasemonkey API, which explains why it works on 0.9.2. Since I've been moving away from GM functions and using native ones, that tab doesn't show the values anymore. I wonder if Violentmonkey acts differently if values are not set using those functions. What version of Violentmonkey are you using? And have you tried Greasemonkey to see if that issue still occurs? I don't want to use the "it works on my machine" excuse, but I've tested everything on that Firefox version and it works fine. Regarding your debug output, everything seems to be working with no errors, apart from the fact that it resets the key bindings on a new tab.
To be honest, I'm fine with going back to the GMgetValue and GMsetValue functions, I never had a problem with them and this script is meant to be used with "Monkey" extensions (which have those functions), but having the script run only on native code is always a plus.
GMgetValue and GMsetValue are probly the safest bet, since even Firemonkey, which is very feature scarce and uses the native Firefox userscripts API, supports them. More importantly, i've just checked in Greasemonkey, Firemonkey and Tampermonkey and the problem exists with all of them, with the same debug output. Firemonkey and Greasemonkey also fail to open profile pictures regadless of the shortcut used and even if the script logs "[ISO] Detected profile picture opening shortcut on a profile page". I'm on windows on the latest versions of everything.
I see, please do one more thing for me, check if the script is saving the key bindings correctly by doing the following steps:
Firemonkey is the only one that preserves the values across tabs(perhaps because of it's native API usage?). All the rest(incl. GM) do not. However, like i said, both Firemonkey and Greasemonkey fail to open profile pictures regardless of the shortcuts used.
I can't tell if you were able to check the values on the developer options like I described or not. Was Firemonkey the only one that had the correct values on the "isopoststorykb" and "isoprofilepicturekb" keys?
I've checked local storage as intructed. The variables are saved for the current tab in all managers, but not kept upon opening a new, not visited before tab, Firemonkey beeing teh sole exception. All the others did not have the values defined at all in the new tab.
I reverted back to the GM functions and fixed support for Greasemonkey, so make sure to test the new version.
The "classics" GM, VM, and TM all work now and all can now open profile pictures. Thanks for this!
However, if you're interested, Firemonkey has lost the ability to to save keybindings, alerting "Failed to save new key binding to open profile picture using GM.setValue" and "Failed to save new key binding to open single post and story using GM.setValue" respectively and debug logging: [ISO] Registered menu commands using GMregisterMenuCommand [ISO] Created script settings button [ISO] Created script settings menu [ISO] Falling back to default key binding: Alt + P [ISO] Discovered profile picture key binding: Alt + P [ISO] Defined profile picture opening event listener [ISO] Failed to get current "single post and story key binding using GMgetValue [ISO] Failed to get current "single post and story key binding using GM.getValue [ISO] Falling back to default key binding: Alt + O [ISO] Failed to save new key binding to open single post and story using GM_setValue
The reason I mention FM is because I think it is the future on the Firefox side. As you've said, native functionality is always better.
Regardless, thanks again for your time and effort!
Custom KB shortcut set only work in current tab
Regardless of whether I set custom KB shortcuts using the script manager's menu or the on-page menu, they only work in the current tab. Any new tab opened goes back to the defaults and also the custom values are not kept between browser sessions(VilentMonkey + latest Firefox 74).