Commit 95bb64ef authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

We need some script for search image in html page

parent 91ea613a
......@@ -102,6 +102,7 @@ if (QTWEBENGINE_EXPERIMENTAL_OPTION)
webengine/webhittestresult.cpp
webengine/webhittest.cpp
webengine/webenginepage.cpp
webengine/webenginescript.cpp
)
set(libmessageviewer_web_LIB Qt5::WebEngine Qt5::WebEngineWidgets ${libmessageviewer_web_LIB})
endif()
......@@ -207,6 +208,7 @@ set(libmessageviewer_scamdetection_SRCS
scamdetection/scamdetectiondetailsdialog.cpp
scamdetection/scamattribute.cpp
scamdetection/scamcheckshorturl.cpp
scamdetection/scamexpandurljob.cpp
)
set(libmessageviewer_findbar_SRCS
......@@ -234,7 +236,7 @@ set(libmessageviewer_htmlwriter_SRCS
htmlwriter/queuehtmlwriter.cpp
htmlwriter/teehtmlwriter.cpp
htmlwriter/webkitparthtmlwriter.cpp
#${libmessageviewer_htmlwriter_webengine_SRCS}
${libmessageviewer_htmlwriter_webengine_SRCS}
)
set(libmessageviewer_antispam_SRCS
......
/*
Copyright (c) 2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "webenginescript.h"
QString MessageViewer::WebEngineScript::findAllImages()
{
const QString source = QLatin1String("(function() {"
"var out = [];"
"var imgs = document.getElementsByTagName('img');"
"for (var i = 0; i < imgs.length; ++i) {"
" var e = imgs[i];"
" out.push({"
" src: e.src"
" });"
"}"
"return out;"
"})()");
return source;
}
QString MessageViewer::WebEngineScript::findAllScripts()
{
const QString source = QLatin1String("(function() {"
"var out = [];"
"var scripts = document.getElementsByTagName('script');"
"for (var i = 0; i < scripts.length; ++i) {"
" var e = scripts[i];"
" out.push({"
" src: e.src"
" });"
"}"
"return out;"
"})()");
return source;
}
/*
Copyright (c) 2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef WEBENGINESCRIPT_H
#define WEBENGINESCRIPT_H
#include <QString>
#include "messageviewer_export.h"
namespace MessageViewer
{
namespace WebEngineScript
{
MESSAGEVIEWER_EXPORT QString findAllImages();
MESSAGEVIEWER_EXPORT QString findAllScripts();
}
}
#endif // WEBENGINESCRIPT_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment