hwm_shortcuts_to_host

HWM mod - Shortcuts to host (by Demin)

  1. // ==UserScript==
  2. // @name hwm_shortcuts_to_host
  3. // @namespace Demin
  4. // @description HWM mod - Shortcuts to host (by Demin)
  5. // @homepage http://userscripts.org/scripts/show/123829
  6. // @version 1.04
  7. // @include http://*heroeswm.*/*
  8. // @include http://178.248.235.15/*
  9. // @include http://*герои.рф/?15091
  10. // ==/UserScript==
  11.  
  12. // (c) 2012, demin (http://www.heroeswm.ru/pl_info.php?id=15091)
  13.  
  14. var version = '1.04';
  15.  
  16. var url_cur = location.href;
  17. var url = 'http://'+location.hostname+'/';
  18.  
  19. if ( (tag('body'))[0] ) {
  20.  
  21. var check_a = 0;
  22.  
  23. var all_a = tag('a');
  24. var a_len = all_a.length;
  25. for (var i=0; i < a_len; i++) {
  26. var a_i = all_a[i];
  27. if ( a_i.parentNode.innerHTML.match(/class=.?pi.?/) ) {
  28.  
  29. check_a += 1;
  30. if ( check_a > 20 ) { break; }
  31.  
  32. if ( a_i.href.indexOf(url)==-1 && !a_i.href.match(/daily\.heroeswm/) && ( a_i.href.match(/heroeswm\./) || a_i.href.match(/178\.248\.235\.15/) ) ) {
  33. var regexp_sp = /(^http:\/\/[A-Za-z\.]+\/)/.exec(a_i.href)[1];
  34. all_a[i].href = a_i.href.split(regexp_sp).join(url);
  35. }
  36. }
  37. }
  38.  
  39. }
  40.  
  41. function $( id ) { return document.getElementById( id ); }
  42.  
  43. function tag( id ) { return document.getElementsByTagName( id ); }