Enhances the Editor Profile by such features as pulling the correct forum post count & adding a Forum Profile button
当前为
- // ==UserScript==
- // @name Waze Editor Profile Enhancements
- // @namespace http://tampermonkey.net/
- // @version 0.4
- // @description Enhances the Editor Profile by such features as pulling the correct forum post count & adding a Forum Profile button
- // @author JustinS83
- // @include https://www.waze.com/user/editor*
- // @grant GM_xmlhttpRequest
- // ==/UserScript==
- (function() {
- 'use strict';
- function bootstrap(tries) {
- tries = tries || 1;
- if (W &&
- W.EditorProfile &&
- $) {
- init();
- } else if (tries < 1000) {
- console.log(tries);
- setTimeout(function () {bootstrap(tries++);}, 200);
- }
- }
- bootstrap();
- function init(){
- $.get('https://www.waze.com/forum/memberlist.php?username=' + W.EditorProfile.data.username, function(forumResult){
- var re = forumResult.match(/<a.*?"Search user’s posts">(\d+)<\/a>/)[1];
- var WazeVal = $('#header > div > div.user-info > div > div.user-highlights > div > div:nth-child(3) > div.user-stats-value')[0].innerHTML.trim();
- var userForumID = forumResult.match(/<a href="\.\/memberlist\.php\?mode=viewprofile&u=(\d+)"/)[1];
- $('#header > div > div.user-info > div > div.user-highlights > div > div:nth-child(3) > div.highlight-title').css('position', 'relative');
- if(WazeVal !== re){
- $('#header > div > div.user-info > div > div.user-highlights > div > div:nth-child(3) > div.user-stats-value')[0].innerHTML = re;
- $('#header > div > div.user-info > div > div.user-highlights > div > div:nth-child(3) > div.user-stats-value').css('color','red');
- $('#header > div > div.user-info > div > div.user-highlights > div > div:nth-child(3) > div.user-stats-value').prop('title', 'Waze reported value: ' + WazeVal);
- }
- $('#header > div > div.user-info > div > div.user-highlights > div > div:nth-child(3)').wrap('<a href="https://www.waze.com/forum/search.php?author_id=' + userForumID + '&sr=posts" targ="_blank"></a>');
- $('#header > div > div.user-info > div > div.user-highlights > a').prepend('<a href="https://www.waze.com/forum/memberlist.php?mode=viewprofile&u=' + userForumID +'" target="_blank" style="margin-right:5px;"><button class="message s-modern-button s-modern"><i class="fa fa-user"></i><span>Forum Profile</span></button></a>');
- });
- }
- })();