mobile.install.js 962 B

123456789101112131415161718192021222324252627282930313233343536
  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. (function () {
  8. function findActiveStep(steps) {
  9. for (var i = 0; i < steps.length; i++) {
  10. if (steps[i].className === 'is-active') {
  11. return i + 1;
  12. }
  13. }
  14. if (steps[steps.length - 1].className === 'done') {
  15. return steps.length;
  16. }
  17. return 0;
  18. }
  19. function installStepsSetup() {
  20. var steps = document.querySelectorAll('.task-list li');
  21. if (steps.length) {
  22. var header = document.querySelector('header[role="banner"]');
  23. var stepIndicator = document.createElement('div');
  24. stepIndicator.className = 'step-indicator';
  25. stepIndicator.innerHTML = findActiveStep(steps) + '/' + steps.length;
  26. header.appendChild(stepIndicator);
  27. }
  28. }
  29. if (document.addEventListener) {
  30. document.addEventListener('DOMContentLoaded', installStepsSetup);
  31. }
  32. })();