mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: [mdx]js script with defer attribute (#1869)
* fix: [mdx] dictionary script element with defer
This commit is contained in:
parent
757b81f66d
commit
939e786331
|
@ -980,7 +980,7 @@ void MdxDictionary::replaceLinks( QString & id, QString & article )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//audio ,video ,html5 tags fall here.
|
//audio ,script,video ,html5 tags fall here.
|
||||||
match = RX::Mdx::srcRe.match( linkTxt );
|
match = RX::Mdx::srcRe.match( linkTxt );
|
||||||
if ( match.hasMatch() ) {
|
if ( match.hasMatch() ) {
|
||||||
QString newText;
|
QString newText;
|
||||||
|
@ -992,9 +992,15 @@ void MdxDictionary::replaceLinks( QString & id, QString & article )
|
||||||
else {
|
else {
|
||||||
scheme = "bres://";
|
scheme = "bres://";
|
||||||
}
|
}
|
||||||
|
|
||||||
newText =
|
newText =
|
||||||
match.captured( 1 ) + match.captured( 2 ) + scheme + id + "/" + match.captured( 3 ) + match.captured( 2 );
|
match.captured( 1 ) + match.captured( 2 ) + scheme + id + "/" + match.captured( 3 ) + match.captured( 2 );
|
||||||
|
|
||||||
|
//add defer to script tag
|
||||||
|
if ( linkType.compare( "script" ) == 0 ) {
|
||||||
|
newText = newText + " defer ";
|
||||||
|
}
|
||||||
|
|
||||||
newLink = linkTxt.replace( match.capturedStart(), match.capturedLength(), newText );
|
newLink = linkTxt.replace( match.capturedStart(), match.capturedLength(), newText );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue