Skip to content

Commit

Permalink
Merge pull request #6 from martin226/main
Browse files Browse the repository at this point in the history
Fix AnkiWeb bug
  • Loading branch information
michalrus authored Mar 8, 2023
2 parents 360d3f1 + 2f545ad commit 548d424
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion front.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@
var divOriginal = document.getElementById("cloze-original");
var divJsRendered = document.getElementById("cloze-js-rendered");

var currentCloze = +(document.body.className.match(/(^|\s)card(\d+)(\s|$)/)[2] || 0);
var currentCloze = +(
(document.body.className.match(/(^|\s)card(\d+)(\s|$)/) || [])[2] ||
((document.getElementById("qa_box") && document.getElementById("qa_box").className && document.getElementById("qa_box").className.match(/(^|\s)card(\d+)(\s|$)/)) || [])[2] ||
0
);

var allClozes = (function(){
var allMatches = divOriginal.innerHTML.match(/\{\{c\d+::[\s\S]*?\}\}/g);
Expand Down

0 comments on commit 548d424

Please sign in to comment.