jdlorimer / incremental-reading

Anki add-on providing incremental reading features
https://ankiweb.net/shared/info/935264945
ISC License
216 stars 38 forks source link

Invalid HTML on card: SecurityError: Failed to execute 'insertRule' on 'CSSStyleSheet': Cannot access StyleSheet to insertRule #113

Open aalemayhu opened 3 years ago

aalemayhu commented 3 years ago

Hei there!

I downloaded the Incremental Reading add-on (v4103). I was trying to follow the instructions under the usage in the README file. I added a link but when I open up the deck I end up with the below error message.

Screenshot 2020-10-31 at 8 44 59 AM

I could reproduce this by

  1. Copy https://en.wikipedia.org/wiki/Incremental_reading
  2. Then paste it in after Alt+3.
  3. Open the deck

I am running Anki:

Version 2.1.36 (53a984ba)
Python 3.8.0 Qt 5.14.2 PyQt 5.14.2

On macOS v10.15.7 (19H2).

Thanks.

uuuser-name commented 3 years ago

I have exactly the same issue. Did you manage to fix it?

aalemayhu commented 3 years ago

No, let us know if you figure it out.

Thanks!

Alexander Alemayhu

YouTube: http://youtube.com/c/alexanderalemayhu http://youtube.com/c/alexanderalemayhu Twitch: http://twitch.tv/alexanderalemayhu http://twitch.tv/alemayhu Twitter: https://twitter.com/aalemayhu https://twitter.com/aalemayhu

On 25 Dec 2020, at 12:41 AM, uuuser-name notifications@github.com wrote:

I have exactly the same issue. Did you manage to fix it?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/luoliyan/incremental-reading/issues/113#issuecomment-751130882, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHB25FZOHEYRK6PQH67R6DSWPGT5ANCNFSM4TFX3SDQ.

AlexRiina commented 3 years ago

I think you can fix this issue by commenting out the javascript in the width.js file

// if (screen.width > {maxWidth}) {{
//     var styleSheet = document.styleSheets[0];
//     styleSheet.insertRule(
//         "div {{ width: {maxWidth}px; margin: 20px auto }}", 0
//     );
// }}

https://github.com/luoliyan/incremental-reading/blob/master/ir/web/width.js

scarbajali commented 3 years ago

I think you can fix this issue by commenting out the javascript in the width.js file

// if (screen.width > {maxWidth}) {{
//     var styleSheet = document.styleSheets[0];
//     styleSheet.insertRule(
//         "div {{ width: {maxWidth}px; margin: 20px auto }}", 0
//     );
// }}

https://github.com/luoliyan/incremental-reading/blob/master/ir/web/width.js

This worked for me. Thanks!

uuuser-name commented 3 years ago

I think you can fix this issue by commenting out the javascript in the width.js file

// if (screen.width > {maxWidth}) {{
//     var styleSheet = document.styleSheets[0];
//     styleSheet.insertRule(
//         "div {{ width: {maxWidth}px; margin: 20px auto }}", 0
//     );
// }}

https://github.com/luoliyan/incremental-reading/blob/master/ir/web/width.js

It worked for me as well. Thanks a lot!

tvhong commented 1 year ago

I'm trying it now and cannot reproduce.

My system info:

Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Mac 11.6.2
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-10-09 10:19:20

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Incremental Reading v4113 unofficial clone ['999215520', 2022-09-27T16:32, 'None', '']

===IDs of active AnkiWeb add-ons===
999215520

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])