(Deprecated) Instagram Source Opener

Open the original source of an IG post, story or profile picture

< Opinie na (Deprecated) Instagram Source Opener

Ocena: Dobry - skrypt działa

§
Napisano: 18-03-2020
Edytowano: 18-03-2020

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).

jomifepeAutor
§
Napisano: 19-03-2020

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.

§
Napisano: 20-03-2020

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.

jomifepeAutor
§
Napisano: 21-03-2020

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:

  1. Go to the source code on your script manager
  2. Enable debugging messages by changing the topmost constant (LOGGING_ENABLED) to true and then save
  3. On an Instagram page, open the developer options (F12 or Ctrl+Shift+I) and go to the Console tab on the top
  4. Reload the page
  5. Execute the steps that you're describing (setting a new key binding and then opening a new tab)
  6. Paste the messages that start by "[ISO]" from both tabs
§
Napisano: 22-03-2020

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

§
Napisano: 22-03-2020

A few other things I've observed:

  1. This only aplies to Firefox. Chrome works.
  2. Both FF and Chrome had the values saved in the "Values" tab provided by Violentmonkey(presumably from an earlier version of the script). I've deleted them manually in both browsers. Chrome continues to work and remembers the values, though it does not store them under that tab anymore.
  3. ISO 0.9.2 work just fine in both browsers.
  4. Opening in a private window, with all other addons disabled except VM doesn't help.
jomifepeAutor
§
Napisano: 22-03-2020
Edytowano: 22-03-2020

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.

jomifepeAutor
§
Napisano: 22-03-2020

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.

§
Napisano: 22-03-2020

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.

jomifepeAutor
§
Napisano: 22-03-2020

I see, please do one more thing for me, check if the script is saving the key bindings correctly by doing the following steps:

  1. Change the key bindings and open a new Instagram tab
  2. On the new tab, open the developer options (F12 or Ctrl+Shift+I) and go to the Application tab on the top
  3. On the left menu, under Storage, expand Local Storage and select "https://www.instagram.com/".
  4. Check if the "isopoststorykb" and "isoprofilepicturekb" keys match the key bindings that you defined previously.
§
Napisano: 22-03-2020

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.

jomifepeAutor
§
Napisano: 22-03-2020
Edytowano: 22-03-2020

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?

§
Napisano: 22-03-2020

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.

jomifepeAutor
§
Napisano: 23-03-2020
Edytowano: 23-03-2020

I reverted back to the GM functions and fixed support for Greasemonkey, so make sure to test the new version.

§
Napisano: 23-03-2020

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!

Odpowiedz

Zaloguj się, by odpowiedzieć.