Waze Editor Profile Enhancements

Pulls the correct forum post count

当前为 2017-03-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Waze Editor Profile Enhancements
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Pulls the correct forum post count
  6. // @author JustinS83
  7. // @include https://www.waze.com/user/editor*
  8. // @grant GM_xmlhttpRequest
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function bootstrap(tries) {
  15. tries = tries || 1;
  16.  
  17. if (W &&
  18. W.EditorProfile &&
  19. $) {
  20. init();
  21. } else if (tries < 1000) {
  22. console.log(tries);
  23. setTimeout(function () {bootstrap(tries++);}, 200);
  24. }
  25. }
  26.  
  27. bootstrap();
  28.  
  29. function init(){
  30. $.get('https://www.waze.com/forum/memberlist.php?username=' + W.EditorProfile.data.username, function(forumResult){
  31. var re = forumResult.match(/<a.*?"Search user’s posts">(\d+)<\/a>/)[1];
  32. $('#header > div > div.user-info > div > div.user-highlights > div > div:nth-child(3) > div.user-stats-value')[0].innerHTML = re;
  33. });
  34. }
  35. })();