DC_safe_zone

Try to take over the world!

  1. // ==UserScript==
  2. // @name DC_safe_zone
  3. // @author Ladoria
  4. // @version 0.2
  5. // @namespace DC_custom
  6. // @description Try to take over the world!
  7. // @match http://www.dreadcast.net/Main
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. $(document).ready( function() {
  12. $('body').append('<style>#dc_safe_zone {display: none;background: url(http://img4.hostingpics.net/pics/703237distancerats.png) no-repeat;height: 225px;width: 225px;margin: 3px 0 0 3px;top: -100px;left: -100px;}#dc_cadre_position {background: ' + $('#cadre_position').css('background-image') + ' no-repeat;width: 31px;height: 31px;position: absolute;top: 0px;}#zone_page #zone_carte #carte #cadre_position {background-image: none !important;}</style>'); // CSS de la zone.
  13. $('#cadre_position').append('<div id="dc_safe_zone"></div><div id="dc_cadre_position"></div>'); // HTML de la zone.
  14. });
  15.  
  16. function display_safezone() {
  17. if (true !== /SOUTERRAIN/gi.test($('#lieu_actuel .titre1').html())) { // Pas de souseterrain ? Quitter.
  18. return;
  19. }
  20. if(0 === $('#combat_barre_out').length) { // Pas de combat ? Cacher la zone, quitter.
  21. $('#dc_safe_zone').hide();
  22. return;
  23. }
  24. $('#dc_safe_zone').show(); // Sinon, afficher la zone.
  25. }
  26.  
  27. $(document).ajaxComplete( function(a,b,c) { // A chaque refresh même invisible
  28. if(/Check/.test(c.url)) { // Durant certains refresh
  29. display_safezone();
  30. }
  31. });
  32.  
  33. console.log('DC - Save Zone started');