mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-12-18 15:34:06 +00:00
Revert "fix: <script> without src is not delayed like <script src="..." defer>"
This reverts commit 00dbc74bb7
.
This commit is contained in:
parent
ec364f0638
commit
5982b1d337
|
@ -877,8 +877,7 @@ QString & MdxDictionary::filterResource( QString & article )
|
||||||
void MdxDictionary::replaceLinks( QString & id, QString & article )
|
void MdxDictionary::replaceLinks( QString & id, QString & article )
|
||||||
{
|
{
|
||||||
QString articleNewText;
|
QString articleNewText;
|
||||||
qsizetype linkPos = 0;
|
int linkPos = 0;
|
||||||
|
|
||||||
QRegularExpressionMatchIterator it = RX::Mdx::allLinksRe.globalMatch( article );
|
QRegularExpressionMatchIterator it = RX::Mdx::allLinksRe.globalMatch( article );
|
||||||
while ( it.hasNext() ) {
|
while ( it.hasNext() ) {
|
||||||
QRegularExpressionMatch allLinksMatch = it.next();
|
QRegularExpressionMatch allLinksMatch = it.next();
|
||||||
|
@ -954,8 +953,7 @@ void MdxDictionary::replaceLinks( QString & id, QString & article )
|
||||||
articleNewText += linkTxt;
|
articleNewText += linkTxt;
|
||||||
match = RX::Mdx::closeScriptTagRe.match( article, linkPos );
|
match = RX::Mdx::closeScriptTagRe.match( article, linkPos );
|
||||||
if ( match.hasMatch() ) {
|
if ( match.hasMatch() ) {
|
||||||
articleNewText += QString( QStringLiteral( "gdOnReady(()=>{%1});</script>" ) )
|
articleNewText += article.mid( linkPos, match.capturedEnd() - linkPos );
|
||||||
.arg( article.mid( linkPos, match.capturedStart() - linkPos ) );
|
|
||||||
linkPos = match.capturedEnd();
|
linkPos = match.capturedEnd();
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
function gdOnReady(func) {
|
|
||||||
if (document.readyState !== "loading") {
|
|
||||||
func();
|
|
||||||
} else {
|
|
||||||
document.addEventListener("DOMContentLoaded", func);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function gdMakeArticleActive(newId, noEvent) {
|
function gdMakeArticleActive(newId, noEvent) {
|
||||||
const gdCurrentArticle =
|
const gdCurrentArticle =
|
||||||
document.querySelector(".gdactivearticle").attributes.id;
|
document.querySelector(".gdactivearticle").attributes.id;
|
||||||
|
|
Loading…
Reference in a new issue