Mercurial > hg > isophonics-drupal-site
view vendor/jcalderonzumba/mink-phantomjs-driver/src/Resources/Script/check_element.js.twig @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
{% autoescape 'js' %} (function (xpath, check) { function getPolterNode(xpath) { var polterAgent = window.__poltergeist; var ids = polterAgent.find("xpath", xpath, document); return polterAgent.get(ids[0]); } var pNode = getPolterNode(xpath); if (check && pNode.element.checked) { //requested to check the element and is already check, do nothing. return true; } if (!check && pNode.element.checked == false) { //move along nothing to be done return true; } if (check && pNode.element.checked == false) { //we have to check the element, we will do so by triggering a click event so all change listeners are aware. pNode.trigger("click"); pNode.element.checked = true; } if (!check && pNode.element.checked) { //move along nothing to be done pNode.trigger("click"); pNode.element.checked = false; return true; } return false; }('{{xpath}}', {{check}})); {% endautoescape %}