下面是我的Grease monkey script / Tamper monkey,点击按钮(多个按钮),其名称包含'attach'。该脚本工作正常,但Chrome和Firefox有所不同。
在Firefox中,点击从“附加”(包含名称)按钮的顶部到底部顺序发生。 在Chrome中,每次页面加载都会从底部到顶部点击。
下面是我的greasemonkey / tampermonkey脚本
void ES3DScene::handlePickerClicked(QPickEvent *pick)
{
QPickTriangleEvent *trianglePick = qobject_cast<QPickTriangleEvent*>(pick);
// I'd like to get the vertex data from vertex1Index's position.
qDebug() << "Clicked " << trianglePick->vertex1Index();
QGeometry *geometry = m_mesh->geometry();
auto attributes = geometry->attributes();
for (auto i = 0; i < attributes.count(); ++i)
{
if (attributes.at(i)->name() == QAttribute::defaultPositionAttributeName())
{
QAttribute *attribute = attributes.at(i);
qDebug() << "Attrib " << attribute;
//This is where I'm stuck. I need to read the vertex attributes for the
//vertex at trianglePick->vertex1Index();
break;
}
}
}
答案 0 :(得分:0)
尝试在这里和那里修复一些小错误 - 因为一个浏览器可能会自动更正语法错误,而其他浏览器则不会(通常情况下我已经注意到了)
var inputs = document.getElementsByTagName('input');
// Add var to keep scope in the for loop
for (var x = 0; x < inputs.length; x++) {
// Add var here or else it will be global
var myname = inputs[x].getAttribute('name');
if (myname.indexOf('attach') == 0) {
// Syntax error: remove ' ' after (myname)
document.getElementsByName(myname)[0].click();
}
}