Compare commits
2 Commits
a69abb5b2f
...
052ac74ef7
Author | SHA1 | Date |
---|---|---|
Sascha Nitsch | 052ac74ef7 | |
Sascha Nitsch | 96b1c19f0a |
|
@ -177,7 +177,15 @@ function _mousemoveaction($main, $control, $options, $targetX, $targetY)
|
|||
function mousemoverel($main, $control, $options)
|
||||
{
|
||||
$coord = explode(" ", $options['parameter']);
|
||||
$control->mousemoveRel(intval($coord[0], 10), intval($coord[1], 10));
|
||||
$x = intval($coord[0], 10);
|
||||
$y = intval($coord[1], 10);
|
||||
if (array_key_exists('jump', $options)) {
|
||||
$control->mousemoveRel($x, $y);
|
||||
} else {
|
||||
$mouseX = $main->getMouseX();
|
||||
$mouseY = $main->getMouseY();
|
||||
_mousemoveaction($main, $control, $options, $mouseX + $x, $mouseY + $y);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,28 @@
|
|||
namespace ScriptedBrowser\Commands;
|
||||
|
||||
/**
|
||||
* wrap given element in a <span id="">
|
||||
* unwrap given element from <span data-id="">
|
||||
*
|
||||
* @param \ScriptedBrowser\Main $main main instance
|
||||
* @param \ScriptedBrowser\Control $control control interface
|
||||
* @unused-param $control
|
||||
* @param array<string,mixed> $options options
|
||||
* @return bool true on success
|
||||
*/
|
||||
function spanunwrap($main, $control, $options)
|
||||
{
|
||||
$id = $options['parameter'];
|
||||
$js = '
|
||||
const node = document.querySelector("span[data-id=\"' . $id . '\"]");
|
||||
const text = node.parentNode.innerHTML;
|
||||
node.parentNode.innerHTML = text.replace(node.outerHTML, node.innerHTML);
|
||||
';
|
||||
$control->executeScript($js);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* wrap given element in a <span data-id="">
|
||||
*
|
||||
* @param \ScriptedBrowser\Main $main main instance
|
||||
* @param \ScriptedBrowser\Control $control control interface
|
||||
|
|
Loading…
Reference in New Issue