Make sure jQuery selectors are inside context
Modify if to else if
Removed unused PATHAUTO_IGNORE_WORDS constant in module file
Removed taxonomy_get_tree in favor of the \Drupal::entityManager()