File indexing completed on 2025-02-23 05:00:21

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "webengineaccesskeyutils.h"
0008 
0009 QString WebEngineViewer::WebEngineAccessKeyUtils::script()
0010 {
0011     const QString script = QString::fromLatin1(
0012         "(function() {"
0013         "var out = [];"
0014         "var matches = document.querySelectorAll(\"a[href], area,button:not([disabled]), "
0015         "input:not([disabled]):not([hidden]),label[for],legend,select:not([disabled]),textarea:not([disabled])\");"
0016         "for (var i = 0; i < matches.length; ++i) {"
0017         "     var r = matches[i].getBoundingClientRect();"
0018         "     out.push({"
0019         "       text: matches[i].innerText,"
0020         "       tagName: matches[i].tagName,"
0021         "       src: matches[i].href,"
0022         "       boundingRect: [r.left, r.top, r.right - r.left, r.bottom - r.top],"
0023         "       accessKey: matches[i].getAttribute('accesskey'),"
0024         "       target: matches[i].getAttribute('target')"
0025         "       });"
0026         "}"
0027         "return out;})()");
0028     return script;
0029 }