Compare commits
No commits in common. "052ac74ef74bcdd52237440b11aa92b5a1cffabd" and "a69abb5b2f1ca7f9e6667ef6a80e8cfa2354c1a8" have entirely different histories.
052ac74ef7
...
a69abb5b2f
|
@ -177,15 +177,7 @@ function _mousemoveaction($main, $control, $options, $targetX, $targetY)
|
||||||
function mousemoverel($main, $control, $options)
|
function mousemoverel($main, $control, $options)
|
||||||
{
|
{
|
||||||
$coord = explode(" ", $options['parameter']);
|
$coord = explode(" ", $options['parameter']);
|
||||||
$x = intval($coord[0], 10);
|
$control->mousemoveRel(intval($coord[0], 10), intval($coord[1], 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,28 +9,7 @@
|
||||||
namespace ScriptedBrowser\Commands;
|
namespace ScriptedBrowser\Commands;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* unwrap given element from <span data-id="">
|
* wrap given element in a <span 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\Main $main main instance
|
||||||
* @param \ScriptedBrowser\Control $control control interface
|
* @param \ScriptedBrowser\Control $control control interface
|
||||||
|
|
Loading…
Reference in New Issue