transform.js 892 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. * /passport/login--->/#/passport/login
  10. * /passport/callback/---->/#/passport/callback/
  11. */
  12. function locationTransform(transPath){
  13. var topHref = top.location.href;
  14. if(topHref.indexOf('#') <= 0){
  15. var loginIndex = topHref.indexOf(transPath);
  16. if(loginIndex >- 1){
  17. topHref = topHref.substring(0,loginIndex) + '/#' + topHref.substring(loginIndex);
  18. top.location.href = topHref;
  19. }
  20. }
  21. }
  22. var transPaths = [
  23. '/passport/login',
  24. '/passport/callback/'
  25. ];
  26. for (i = 0; i < transPaths.length; i++) {
  27. locationTransform(transPaths[i]);
  28. }