mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24: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;
|
||||
}
|
||||
else {
|
||||
//audio ,video ,html5 tags fall here.
|
||||
//audio ,script,video ,html5 tags fall here.
|
||||
match = RX::Mdx::srcRe.match( linkTxt );
|
||||
if ( match.hasMatch() ) {
|
||||
QString newText;
|
||||
|
@ -992,9 +992,15 @@ void MdxDictionary::replaceLinks( QString & id, QString & article )
|
|||
else {
|
||||
scheme = "bres://";
|
||||
}
|
||||
|
||||
newText =
|
||||
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 );
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue