Drupal investigation

mobile.install.js 893B

12345678910111213141516171819202122232425262728293031323334
  1. (function () {
  2. 'use strict';
  3. function findActiveStep(steps) {
  4. for (var i = 0; i < steps.length; i++) {
  5. if (steps[i].className === 'is-active') {
  6. return i + 1;
  7. }
  8. }
  9. // The final "Finished" step is never "active".
  10. if (steps[steps.length - 1].className === 'done') {
  11. return steps.length;
  12. }
  13. return 0;
  14. }
  15. function installStepsSetup() {
  16. var steps = document.querySelectorAll('.task-list li');
  17. if (steps.length) {
  18. var header = document.querySelector('header[role="banner"]');
  19. var stepIndicator = document.createElement('div');
  20. stepIndicator.className = 'step-indicator';
  21. stepIndicator.innerHTML = findActiveStep(steps) + '/' + steps.length;
  22. header.appendChild(stepIndicator);
  23. }
  24. }
  25. if (document.addEventListener) {
  26. document.addEventListener('DOMContentLoaded', installStepsSetup);
  27. }
  28. })();