mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 12:44:07 +00:00
fix: js unexpected error.
This commit is contained in:
parent
d2257ce061
commit
20c3a7241d
|
@ -531,46 +531,28 @@ void ArticleView::loadFinished( bool )
|
||||||
QObject* obj=sender();
|
QObject* obj=sender();
|
||||||
qDebug()<<"article view loaded url is :"<<url<<" sender class is :"<<obj->metaObject()->className();
|
qDebug()<<"article view loaded url is :"<<url<<" sender class is :"<<obj->metaObject()->className();
|
||||||
|
|
||||||
// See if we have any iframes in need of expansion
|
// // See if we have any iframes in need of expansion
|
||||||
ui.definition->page()->runJavaScript(QString("var frames=windows.frames;"
|
// ui.definition->page()->runJavaScript(QString(""
|
||||||
"for(int i=0;i<frames.length;i++){"
|
//"var frames = window.frames;"
|
||||||
" var f=frames[i];"
|
//"for (var i=0; i < frames.length; i++) {"
|
||||||
" f.height=%1;"
|
//" var f = frames[i];"
|
||||||
" f.style.display='block';"
|
//" "
|
||||||
"var gdLastUrlText;"
|
//" f.onload = function()"
|
||||||
" f.document.addEventListener( 'click', function() { gdLastUrlText = window.event.srcElement.textContent; }, true );"
|
//" {"
|
||||||
" f.document.addEventListener( 'contextmenu', function() { gdLastUrlText = window.event.srcElement.textContent; }, true );"
|
//" f.style.height = "
|
||||||
|
//" f.contentWindow.document.body.scrollHeight + 'px';"
|
||||||
"}"));
|
//" f.style.width = "
|
||||||
|
//" f.contentWindow.document.body.scrollWidth+'px'; "
|
||||||
//QList< QWebEnginePage * > frames = ui.definition->page()->mainFrame()->childFrames();
|
//" }"
|
||||||
|
//" f.style.display = 'block';"
|
||||||
|
//" var gdLastUrlText;"
|
||||||
|
//" f.document.addEventListener('click', function () { gdLastUrlText = window.event.srcElement.textContent; });"
|
||||||
|
//" f.document.addEventListener('contextmenu', function () { gdLastUrlText = window.event.srcElement.textContent; });"
|
||||||
|
//"}"
|
||||||
|
//));
|
||||||
|
|
||||||
bool wereFrames = false;
|
bool wereFrames = false;
|
||||||
|
|
||||||
// for( QList< QWebEnginePage * >::iterator i = frames.begin(); i != frames.end(); ++i )
|
|
||||||
// {
|
|
||||||
// if ( (*i)->frameName().startsWith( "gdexpandframe-" ) )
|
|
||||||
// {
|
|
||||||
// //DPRINTF( "Name: %s\n", (*i)->frameName().toUtf8().data() );
|
|
||||||
// //DPRINTF( "Size: %d\n", (*i)->contentsSize().height() );
|
|
||||||
// //DPRINTF( ">>>>>>>>Height = %s\n", (*i)->runJavaScript( "document.body.offsetHeight;" ).toString().toUtf8().data() );
|
|
||||||
|
|
||||||
// // Set the height
|
|
||||||
// ui.definition->page()->runJavaScript( QString( "document.getElementById('%1').height = %2;" ).
|
|
||||||
// arg( (*i)->frameName() ).
|
|
||||||
// arg( (*i)->contentsSize().height() ) );
|
|
||||||
|
|
||||||
// // Show it
|
|
||||||
// ui.definition->page()->runJavaScript( QString( "document.getElementById('%1').style.display = 'block';" ).
|
|
||||||
// arg( (*i)->frameName() ) );
|
|
||||||
|
|
||||||
// (*i)->runJavaScript( "var gdLastUrlText;" );
|
|
||||||
// (*i)->runJavaScript( "document.addEventListener( 'click', function() { gdLastUrlText = window.event.srcElement.textContent; }, true );" );
|
|
||||||
// (*i)->runJavaScript( "document.addEventListener( 'contextmenu', function() { gdLastUrlText = window.event.srcElement.textContent; }, true );" );
|
|
||||||
|
|
||||||
// wereFrames = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//todo
|
//todo
|
||||||
if ( wereFrames )
|
if ( wereFrames )
|
||||||
|
|
Loading…
Reference in a new issue