Messagelib

webengineaccesskeyutils.cpp
1 /*
2  SPDX-FileCopyrightText: 2016-2023 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "webengineaccesskeyutils.h"
8 
9 QString WebEngineViewer::WebEngineAccessKeyUtils::script()
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(const char *str, int size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Mar 24 2023 04:08:32 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.