Fake Gelocation getCurrentPosition

prompt instead native geolocation

  1. // ==UserScript==
  2. // @name Fake Gelocation getCurrentPosition
  3. // @description prompt instead native geolocation
  4. // @namespace http://eldar.cz/myf/
  5. // @include *
  6. // @version 1.0.0
  7. // @grant none
  8. // @run-at document-start
  9. // ==/UserScript==
  10.  
  11.  
  12. ;(function(){
  13. // navigator.geolocation.originalGetCurrentPosition = navigator.geolocation.getCurrentPosition;
  14. navigator.geolocation.getCurrentPosition = fakeGet;
  15. function fakeGet(ok, err){
  16. var p = prompt('coords','0.2581778, 6.6247559');
  17. var c = p.trim().split(/\s*,\s*/).map(e=>Number(e));
  18. if(c[0] && c[1]) {
  19. ok({coords:
  20. { latitude: c[0]
  21. , longitude: c[1]
  22. }
  23. });
  24. } else {
  25. err(JSON.parse(p));
  26. }
  27. }
  28. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址