mobile.install.js 984 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * DO NOT EDIT THIS FILE.
  3. * See the following change record for more information,
  4. * https://www.drupal.org/node/2815083
  5. * @preserve
  6. **/
  7. /*eslint-disable */
  8. (function () {
  9. function findActiveStep(steps) {
  10. for (var i = 0; i < steps.length; i++) {
  11. if (steps[i].className === 'is-active') {
  12. return i + 1;
  13. }
  14. }
  15. if (steps[steps.length - 1].className === 'done') {
  16. return steps.length;
  17. }
  18. return 0;
  19. }
  20. function installStepsSetup() {
  21. var steps = document.querySelectorAll('.task-list li');
  22. if (steps.length) {
  23. var header = document.querySelector('header[role="banner"]');
  24. var stepIndicator = document.createElement('div');
  25. stepIndicator.className = 'step-indicator';
  26. stepIndicator.innerHTML = findActiveStep(steps) + '/' + steps.length;
  27. header.appendChild(stepIndicator);
  28. }
  29. }
  30. if (document.addEventListener) {
  31. document.addEventListener('DOMContentLoaded', installStepsSetup);
  32. }
  33. })();