[Userscript]: Double-Check Workaround

Oh cool. I just updated to 0.2.0 and it now does this.

Thank you!

1 Like

Item Info does load, but Meaning and Reading aren’t uncollapsed accordingly.

Also, Item Info Injector Userscript doesn’t work alongside now, though I don’t know if you can help with that.

If no undo button shows up, I wonder if it’s not being loaded. Can you check the following for me?

  • The workaround script is enabled
  • The original script is disabled
  • You have version 0.2.1 of the script installed
  • (If you know how to check) do any errors show up in the browser console?

Thanks

Yes, I prioritized getting the info to show up first. I’m not yet sure how to tell it which type to use.

I’m not familiar with the item info injector userscript. I might glance at it to see where the conflict might be.

Regarding questionType

addEventListener('willShowNextQuestion', (e) => {
   const { questionType, subject } = e.detail;
})

Item Info Injector is pretty fast to update – [For Userscript Authors] WK Item Info Injector - #32 by Sinyaven

That doesn’t actually do anything with the question type information. It just puts it in a variable that is then never read.

But I do see a promising block in the item info controller:

enable = e=>{
    const {
      subjectWithStats: t,
      questionType: s,
      results: i
    }
    = e.detail;
    if (this.showException(s, i), this.toggleTarget.classList.remove(this.toggleDisabledClass), this.toggleTarget.setAttribute('href', this.urlTemplate.replace(':id', t.subject.id)), this.autoOpenAfterIncorrectCountValue > 0) {
      const {
        meaning: t,
        reading: s
      }
      = e.detail.subjectWithStats.stats;
      !i.passed && (t.incorrect >= this.autoOpenAfterIncorrectCountValue || s.incorrect >= this.autoOpenAfterIncorrectCountValue) && this.toggleTarget.click()
    }
  };

More than setting subject ID on .additional-content__item--item-info, probably you need to manually expand by [data-toggle-context-value]

image

1 Like

Oh, that looks promising. Let me try that.

Thanks for the reply. I don’t know what version of the script I had when I wrote that because it updated an hour ago to 0.2.0. With that version it still doesn’t work and I’m not being offered 0.2.1. Can I force an update?

I’ve had some issues getting some version updates, probably related to browser cache in some way. But you shouldn’t need to get 0.2.1 for things to work well, 0.2.0 was also fairly stable.

In that case, I have 0.2.0 of the script, the original script is disabled and Wanikani Open Framework is version 1.0.60. In the web developer console, I can see references to the open framework but no mention of your script. However, looking at tampermonkey when I’m on that page claims that both scripts are enabled.

I believe 0.3.0 opens the right section now. Thanks for helping dig in!

Well one last thing


Does the “wanakana” object exist in the console? That’s something I load with my script, so it should work for checking if my script loaded.

And to confirm, you don’t get an undo button at all?

I don’t get an undo button at all no. Not sure how to search for a particular object but I can’t see “wanakana” in any of the output.

If you open the interactive console, you can type things at the bottom (known as a REPL, but I don’t know your background) and evaluate them. The engine is JavaScript, so typing something like “2 + 2” and pressing “enter” will evaluate to 4 and print the result for you to see. In the same vein, you can just type “wanakana” and hit “enter” and see if the object exists.

But the fact that the undo button doesn’t show makes me think that either the script isn’t loading or something breaks in the initial load.

Actually, I wonder if it’s a conflict with another script? Can you disable all scripts except the open framework and my script and see if it works then? If it does you could go through and see which script is causing the conflict.

I loaded the item info injector and actually didn’t have any issues. So maybe there’s a conflict in a particular browser?

1 Like

With just your script and the framework, I get “Uncaught ReferenceError: wanakana is not defined” but 2+2 =4 :grinning:

Okay. Then yeah, somehow my script isn’t loading. Sounds like the matchers work because you get it as an option
 I’m not sure the cases where that would be happening, but you could try updating firefox and checking if you have any additional JS security settings in place?

Firefox is now version 111.0.1 and it now works \o/. The undo button is a little bit misaligned but it does the job. Thanks very much for your help, it’s much appreciated.

1 Like

nvm, it’s an error in my script unrelated to Info Injector.

Item Info doesn’t get collapsed on Undo.