Advertisement
Guest User

BBH_MR_byD

a guest
Jan 29th, 2016
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         BBH Map Redirector by Davf
  3. // @namespace    http://zenoo0.fr
  4. // @version      0.1
  5. // @description  Map redirection
  6. // @author       Zenoo
  7. // @include        http://www.hordes.fr/*
  8. // @include        http://www.die2nite.com/*
  9. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js
  10. // @grant unsafeWindow
  11. // @downloadURL http://zenoo0.fr/uploaded/bbhmr.user.js
  12. // @updateURL http://zenoo0.fr/uploaded/bbhmr.meta.js
  13. // ==/UserScript==
  14.  
  15. // Update by Davf
  16. // Include die2nite => For the test
  17. // Cleaning code is necessary
  18.  
  19. var init = function() {
  20.    
  21.     var refresh = function() {
  22.         if($('.random').children().first().text() == 'Choisissez votre prochaine existence :' || 'Choose where you will live and die next:'){
  23.             $('.random').next().children().first().children().first().append('<th>BBH</th>');
  24.            
  25.             $('.random').next().children().first().children().each(function(){
  26.                 if($(this).children().first().hasClass('name')){
  27.                     if($(this).find('.lockReason').length == 0){
  28.                         var temp = $(this).children().first().children().eq(1).attr('href');
  29.                         console.log(temp)
  30.                         var regex = "=(.*?);";
  31.                         var mapId = temp.match(regex)[1];
  32.                         $(this).append('<td class="bbhmr"><a class="bbhmr_lk" href="http://bbh.fred26.fr/?cid='+mapId+'" target="_blank"><img src="http://www.hordes.fr/file/64.dat"></a></td>');
  33.                     }
  34.                     else {
  35.                         $(this).append('<td class="bbhmr nope"><img src="http://www.hordes.fr/file/64.dat" style="opacity:0.5;" onmouseover="js.HordeTip.showSpecialTip(this, &#39helpTip&#39, &#39&#39, &#39Lien vers BBH impossible.&#39, event);" onmouseout="js.HordeTip.hide(event)"></td>')
  36.                     }
  37.                 }
  38.             });
  39.         }
  40.       else{
  41.         if($('.bbhmr').length != 0){
  42.           $('bbhmr').remove();
  43.         }
  44.       }
  45.     }
  46.  
  47.     js.XmlHttp._bbhmr_onEnd = js.XmlHttp.onEnd;
  48.     js.XmlHttp.onEnd = function() {
  49.         var url = this.urlForBack;
  50.         this._bbhmr_onEnd();
  51.         refresh();
  52.     };
  53. };
  54.  
  55. var script = document.createElement('script');
  56. script.setAttribute('id',   'bbhmr:script:init');
  57. script.setAttribute('type', 'application/javascript');
  58. document.body.appendChild(script);
  59. script.textContent = '(' + init.toString() + ')();';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement