mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Don't use custom script for toggle play/pause and mute
This commit is contained in:
parent
a37fadd8dc
commit
3d5f45bfc5
@ -279,30 +279,3 @@ QString Scripts::getFormData(const QPoint &pos)
|
|||||||
|
|
||||||
return source.arg(pos.x()).arg(pos.y());
|
return source.arg(pos.x()).arg(pos.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Scripts::toggleMediaPause(const QPoint &pos)
|
|
||||||
{
|
|
||||||
QString source = QL1S("(function() {"
|
|
||||||
"var e = document.elementFromPoint(%1, %2);"
|
|
||||||
"if (!e)"
|
|
||||||
" return;"
|
|
||||||
"if (e.paused)"
|
|
||||||
" e.play();"
|
|
||||||
"else"
|
|
||||||
" e.pause();"
|
|
||||||
"})()");
|
|
||||||
|
|
||||||
return source.arg(pos.x()).arg(pos.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString Scripts::toggleMediaMute(const QPoint &pos)
|
|
||||||
{
|
|
||||||
QString source = QL1S("(function() {"
|
|
||||||
"var e = document.elementFromPoint(%1, %2);"
|
|
||||||
"if (!e)"
|
|
||||||
" return;"
|
|
||||||
"e.muted = !e.muted;"
|
|
||||||
"})()");
|
|
||||||
|
|
||||||
return source.arg(pos.x()).arg(pos.y());
|
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2015 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2015-2016 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -38,8 +38,6 @@ public:
|
|||||||
static QString getAllImages();
|
static QString getAllImages();
|
||||||
static QString getAllMetaAttributes();
|
static QString getAllMetaAttributes();
|
||||||
static QString getFormData(const QPoint &pos);
|
static QString getFormData(const QPoint &pos);
|
||||||
static QString toggleMediaPause(const QPoint &pos);
|
|
||||||
static QString toggleMediaMute(const QPoint &pos);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SCRIPTS_H
|
#endif // SCRIPTS_H
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -873,12 +873,12 @@ void WebView::reloadAllSpeedDials()
|
|||||||
|
|
||||||
void WebView::toggleMediaPause()
|
void WebView::toggleMediaPause()
|
||||||
{
|
{
|
||||||
page()->runJavaScript(Scripts::toggleMediaPause(m_clickedPos));
|
triggerPageAction(QWebEnginePage::ToggleMediaPlayPause);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::toggleMediaMute()
|
void WebView::toggleMediaMute()
|
||||||
{
|
{
|
||||||
page()->runJavaScript(Scripts::toggleMediaMute(m_clickedPos));
|
triggerPageAction(QWebEnginePage::ToggleMediaMute);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::initializeActions()
|
void WebView::initializeActions()
|
||||||
|
Loading…
Reference in New Issue
Block a user