WEvent ToolBox Beta

Ajout du profile editor & co

  1. // ==UserScript==
  2. // @name WEvent ToolBox Beta
  3. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wYBBicLUdqBwAAAA1lJREFUWMPFl0tIVFEYx39nug46qE1DYoWU1KJAKZHEoEVRLhwXQUFGKG6CHpsy7KlEi/BJA7myxyKoGSKDAhfpwoIWQWJgQzNQQTZa9DJKKjTG0dPijDo6984cG6UPLsy9c875/8/3/oSUEl15FITuF8iBIQiNwOiY+u50QP5KKMoH9xZEWaH2kQgdAie9yPZukBHASLI4uqa2HBoPIBz2FAg0dyHrfRqgVjIBTdVwfg9iwQQKzyKDw4CN1GQKCtZC/yVEup04JnEEJibBdRj5+w+LKpnpEGpHuDLnkogjkHVo8cFjSXztQGTE+IVtvtqXChzg9x8oucCcG9tiHS44nCLCpApJItZLgsMKK45AvTd1h3MXw48bcO0IELZYZIN6H4yFYwicvI0kzWKDVDfTeVY51ZbDu8BXm4CEAQ13lRaElBJbFebBOAmXayDPBToJc0MulKyffX/wHPa1gdnlBDDlQxi9AesM5y6Guop/N8nerVC9E7xPTRQbgd4AGD1+pFWmexSEgRCsWaEHmGGH7IzZ99A36OyzNkOPH2kMDFkfGI5A8ZmojTWkugxuH1O/33yCTacgkeUGhsAIjSQ5Nc3chqYOHk1xL9/D5rNgXQGiGhoBY7qkLobcegLjYbj3LDk4qHKuH/kS9peq4mKtArjXpwc+s8Xp0AP3t0DncajZsXgaczrAyM+Bwa+JF77ywMbV0eoqAd16sSyx/+TngKjzSul5aL7AbsBrj2q3puXnuLKzjnz8Adsuqmgyk7oKMMq3IDxd5rmgsnQuOKg4j431RJK7HHYXQLffvHUrL0IkTsUTcP807C2Z/dQ/CG+/aDSbAj58h1O3oqawSsUAJ8rhSo95DtjXBt5aqNquPnX0ws3Hui5uDg5wwh1TDZsOICxruB2qr8D1KOjn0eihOo+w7pwbK9W/My1ZSxfy/J0EPUEEnNkw+sv6VrpNavNBOLdnHoGZTvgDSyoFeRBondXNHALjE5B7FPnrfzWl6Wnwrh2Rlb404KF2NRuYNqXToeHKhC9XEYV5SfL+QgaTPHXz+TMBZi4ngIw0eNmKaD6YuMNNKhHlcIFWpXbxL8PpWBgaOhc2nApD5ZaUh9O4Fi0A3X7kiyF4N388z4GideAuQpQV6CvpLyjrNaUqOdRiAAAAAElFTkSuQmCC
  4. // @namespace WEvent_ns
  5. // @version 0.0.10
  6. // @description:en Added editor profile and other
  7. // @description Ajout du profile editor & co
  8. // @require https://greasyfork.org/scripts/439116-wf-global-lib/code/WF%20Global%20Lib.js
  9. // @author Exolium
  10. // @match http://*.waze.com/*/events/*
  11. // @match https://*.waze.com/*/events/*
  12. // @copyright 2015-2022 Exolium
  13. // @license GNU GPL v2
  14. // @grant GM_xmlhttpRequest
  15. // ==/UserScript==
  16.  
  17. /* **************************************************************************** *
  18. * Info version : Alpha release : 0.0.1.1, 0.1.1.1, 1.1.2.1,...
  19. * Info version : Beta release : 0.0.1 , 0.2.1 , 1.1.1 ,...
  20. * Info version : Production release : 1.0 , 1.1 , 2.0 ,...
  21. * **************************************************************************** *
  22. * Thanks to beta tester and script developer who bring innovative ideas to me
  23. * laurenthembord, laurenthembprd,....
  24. * *************************************************************************** */
  25.  
  26. //============================== Options ================================//
  27. var WGL_Log_level = 5; // 0 = no log / 1 = error / 2 = warn / 3 = min log / 4 = Medium Log / 5 = high detail Log
  28. var WEvent_targetblank = true;
  29. var WEvent_button_editorprofil = 'Editor Profil A';
  30. var WEvent_baseurl_profil = 'https://www.waze.com/forum/memberlist.php?mode=searchuser&username=';
  31. var WEvent_regexp = '//*[@id="memberlist"]/tbody/tr[1]/td[1]/a[1]';
  32. var WEvent_search_profil = Array();
  33. var WEvent_search_profil_result = Array();
  34.  
  35. function recup_phpbbprofil(WEvent_L_Pseudo) {
  36. var WEvent_L_url = '';
  37. //var WEvent_L_profil_pg = '';
  38. var WEvent_mk_forumprofilelement = document.createElement('a');
  39. WEvent_mk_forumprofilelement.text = ' (profil forum)';
  40.  
  41. WGL_Log ('recup_phpbbprofil', 5, 'url search ' + WEvent_baseurl_profil + WEvent_L_Pseudo);
  42.  
  43. GM_xmlhttpRequest({
  44. method: "GET",
  45. url: WEvent_baseurl_profil + WEvent_L_Pseudo,
  46. headers: {
  47. "User-Agent": "Mozilla/5.0",
  48. },
  49. onload: function(responseDetails) {
  50. WGL_Log ('recup_phpbbprofil', 5, 'Load Usersearch page');
  51. var WEvent_L_profil_pg = document.createElement('div');
  52. WEvent_L_profil_pg.innerHTML = responseDetails.responseText;
  53. WEvent_search_profil_result = WGL_xpath(WEvent_regexp, WEvent_L_profil_pg);
  54. WGL_Log ('recup_phpbbprofil', 5, 'nb occurence ' + WEvent_search_profil_result.length);
  55. //WEvent_mk_forumprofilelement.href=WEvent_search_profil_result[0].href;
  56. if(WEvent_search_profil_result.length > 0) {
  57. WGL_Log ('recup_phpbbprofil', 5, ' url WEvent_search_profil_result[0].href = ' + WEvent_search_profil_result[0].href);
  58. WEvent_L_url = WEvent_search_profil_result[0].href;
  59. WEvent_mk_forumprofilelement.href=' https://www.waze.com/forum/memberlist.php?mode=viewprofile&u=' + WEvent_search_profil_result[0].href.split('=')[2];
  60. WEvent_mk_forumprofilelement.target = '_blank';
  61. //WEvent_mk_forumprofilelement.href=WEvent_search_profil_result[0];
  62. WGL_Log ('recup_phpbbprofil', 5, ' url split 1 = ' + WEvent_search_profil_result[0].href.split('=')[2]);
  63. WGL_Log ('recup_phpbbprofil', 5, ' url WEvent_L_url = ' + WEvent_L_url);
  64. //
  65. WGL_Log ('recup_phpbbprofil', 5, ' WEvent_beta_editor');
  66. } else WEvent_mk_forumprofilelement.text = ' (pas de profil forum)';
  67. //return ' <a href="' + WEvent_L_url + '"> (profil forum)</a>';
  68. //return WEvent_L_url;
  69. }
  70. });
  71.  
  72. //GL_Log('recup_phpbbprofil', 5, ' url WEvent_L_url = ' + WEvent_L_url);
  73.  
  74. //return ' <a href="' + WEvent_L_url + '" target="_blank"> (profil forum)</a>';
  75. WGL_Log ('recup_phpbbprofil', 5, ' WEvent_search_profil_result.length = ' + WEvent_search_profil_result.length)
  76. return WEvent_mk_forumprofilelement;
  77. }
  78.  
  79. //================================ Vars ======================================//
  80. var WEvent_beta_editor_verify = false;
  81. var WEvent_beta_editor = false;
  82. var WEvent_profil = Array();
  83. var WEvent_Settings = {};
  84. var WEvent_search = '//*[contains(@class, \'mte-user__name\')]';
  85.  
  86. //================================ Code ======================================//
  87. (function() {
  88. 'use strict';
  89. var WEvent_L_result = WGL_xpath(WEvent_search, document);
  90. var WEvent_L_usersearch = '';
  91. //recup_phpbbprofil('exolium');
  92. for(var WEvent_L_cpt = 0; WEvent_L_cpt < WEvent_L_result.length; WEvent_L_cpt++) {
  93. WEvent_L_usersearch = WEvent_L_result[WEvent_L_cpt].innerHTML;
  94. WEvent_L_result[WEvent_L_cpt].innerHTML = '<a target="_blank" href="https://www.waze.com/fr/user/editor/' + WEvent_L_result[WEvent_L_cpt].innerHTML + '"> ' + WEvent_L_result[WEvent_L_cpt].innerHTML + '</a>';
  95. WEvent_L_result[WEvent_L_cpt].appendChild(recup_phpbbprofil(WEvent_L_usersearch));
  96. }
  97. })();
  98.  
  99. //============================================================================//