Messagelib

webengineaccesskeyutils.cpp
1/*
2 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "webengineaccesskeyutils.h"
8
9QString WebEngineViewer::WebEngineAccessKeyUtils::accessKeyScript()
10{
11 const QString script = QString::fromLatin1(
12 "(function() {"
13 "var out = [];"
14 "var matches = document.querySelectorAll(\"a[href], area,button:not([disabled]), "
15 "input:not([disabled]):not([hidden]),label[for],legend,select:not([disabled]),textarea:not([disabled])\");"
16 "for (var i = 0; i < matches.length; ++i) {"
17 " var r = matches[i].getBoundingClientRect();"
18 " out.push({"
19 " text: matches[i].innerText,"
20 " tagName: matches[i].tagName,"
21 " src: matches[i].href,"
22 " boundingRect: [r.left, r.top, r.right - r.left, r.bottom - r.top],"
23 " accessKey: matches[i].getAttribute('accesskey'),"
24 " target: matches[i].getAttribute('target')"
25 " });"
26 "}"
27 "return out;})()");
28 return script;
29}
QString fromLatin1(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:54:19 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.