mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Tweaked Click2Flash replacing script.
- it now creates temporary empty element that has the same size and occupies the same position as original flash object
This commit is contained in:
parent
e204af30c6
commit
2c4b6e3d42
@ -123,9 +123,10 @@ void BookmarksWidget::toggleSpeedDial()
|
||||
|
||||
void BookmarksWidget::showAt(QWidget* _parent)
|
||||
{
|
||||
show();
|
||||
|
||||
QPoint p = _parent->mapToGlobal(QPoint(0, 0));
|
||||
move((p.x() + _parent->width()) - width(), p.y() + _parent->height());
|
||||
show();
|
||||
}
|
||||
|
||||
BookmarksWidget::~BookmarksWidget()
|
||||
|
@ -240,20 +240,18 @@ void ClickToFlash::load()
|
||||
So asynchronous JavaScript code is used to remove element from page and then substitute
|
||||
it with unblocked Flash. The JavaScript code is:
|
||||
|
||||
var qz_c2f_clone = this.cloneNode(true);
|
||||
var qz_c2f_parentNode = this.parentNode;
|
||||
var qz_c2f_nextSibling = this.nextSibling;
|
||||
var qz_c2f_clone = this.cloneNode(true);
|
||||
var qz_c2f_parentNode = this.parentNode;
|
||||
var qz_c2f_substituteElement = document.createElement(this.tagName);
|
||||
|
||||
this.parentNode.removeChild(this);
|
||||
qz_c2f_substituteElement.width = this.width;
|
||||
qz_c2f_substituteElement.height = this.height;
|
||||
|
||||
setTimeout(function(){
|
||||
if(qz_c2f_nextSibling) {
|
||||
qz_c2f_parentNode.insertBefore(qz_c2f_clone,qz_c2f_nextSibling);
|
||||
}
|
||||
else {
|
||||
qz_c2f_parentNode.appendChild(qz_c2f_clone);
|
||||
}
|
||||
}, 250);
|
||||
this.parentNode.replaceChild(qz_c2f_substituteElement, this);
|
||||
|
||||
setTimeout(function(){
|
||||
qz_c2f_parentNode.replaceChild(qz_c2f_clone, qz_c2f_substituteElement);
|
||||
}, 250);
|
||||
|
||||
*/
|
||||
|
||||
@ -264,10 +262,10 @@ void ClickToFlash::load()
|
||||
m_element.setAttribute("type", "application/futuresplash");
|
||||
|
||||
QString js = "var qz_c2f_clone=this.cloneNode(true);var qz_c2f_parentNode=this.parentNode;"
|
||||
"var qz_c2f_nextSibling=this.nextSibling;this.parentNode.removeChild(this);"
|
||||
"setTimeout(function(){if(qz_c2f_nextSibling){"
|
||||
"qz_c2f_parentNode.insertBefore(qz_c2f_clone,qz_c2f_nextSibling);}"
|
||||
"else{qz_c2f_parentNode.appendChild(qz_c2f_clone);}},250);";
|
||||
"var qz_c2f_substituteElement=document.createElement(this.tagName);"
|
||||
"qz_c2f_substituteElement.width=this.width;qz_c2f_substituteElement.height=this.height;"
|
||||
"this.parentNode.replaceChild(qz_c2f_substituteElement,this);setTimeout(function(){"
|
||||
"qz_c2f_parentNode.replaceChild(qz_c2f_clone,qz_c2f_substituteElement);},250);";
|
||||
|
||||
m_element.evaluateJavaScript(js);
|
||||
}
|
||||
|
@ -31,6 +31,10 @@ WebPluginFactory::WebPluginFactory(WebPage* page)
|
||||
|
||||
QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, const QStringList &argumentValues) const
|
||||
{
|
||||
if (url.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
|
||||
if (mime.isEmpty()) {
|
||||
if (url.toString().endsWith(".swf")) {
|
||||
@ -43,7 +47,7 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
|
||||
|
||||
if (mime != "application/x-shockwave-flash") {
|
||||
if (mime != "application/futuresplash" && mime != "application/x-java-applet") {
|
||||
qDebug() << "WebPluginFactory::create missing mimeType handler for: " << mime;
|
||||
qDebug() << "WebPluginFactory::create creating object of mimeType : " << mime;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -74,9 +74,15 @@ RSSWidget::RSSWidget(WebView* view, QWidget* parent)
|
||||
|
||||
void RSSWidget::showAt(QWidget* _parent)
|
||||
{
|
||||
QPoint p = _parent->mapToGlobal(QPoint(0, 0));
|
||||
move((p.x() + _parent->width() - width()), p.y() + _parent->height());
|
||||
show();
|
||||
|
||||
const QPoint &widgetPos = _parent->mapToGlobal(QPoint(0, 0));
|
||||
|
||||
QPoint newPos;
|
||||
newPos.setX(widgetPos.x() + _parent->width() - width());
|
||||
newPos.setY(widgetPos.y() + _parent->height());
|
||||
|
||||
move(newPos);
|
||||
}
|
||||
|
||||
void RSSWidget::addRss()
|
||||
|
@ -88,9 +88,10 @@ SiteInfoWidget::SiteInfoWidget(QupZilla* mainClass, QWidget* parent)
|
||||
|
||||
void SiteInfoWidget::showAt(QWidget* _parent)
|
||||
{
|
||||
show();
|
||||
|
||||
QPoint p = _parent->mapToGlobal(QPoint(0, 0));
|
||||
move(p.x(), p.y() + _parent->height());
|
||||
show();
|
||||
}
|
||||
|
||||
SiteInfoWidget::~SiteInfoWidget()
|
||||
|
Loading…
Reference in New Issue
Block a user