HV Lottery Prize Reminder

Show the grand prizes of daily lotteries on the left bottom of the screen

Versão de: 29/10/2014. Veja: a última versão.

  1. // ==UserScript==
  2. // @name HV Lottery Prize Reminder
  3. // @description Show the grand prizes of daily lotteries on the left bottom of the screen
  4. // @include http://hentaiverse.org/*
  5. // @grant GM_getValue
  6. // @grant GM_setValue
  7. // @version 0.0.1.20141029072429
  8. // @namespace https://greasyfork.org/users/2233
  9. // ==/UserScript==
  10.  
  11. if(document.getElementById('togpane_log') || document.getElementById('riddlemaster')) { throw 'exit' }
  12.  
  13. var wnd = window
  14. var doc = wnd.document
  15. var loc = location
  16. var href = loc.href
  17.  
  18. var $ = function(e, css) { if(!css) { css=e; e=doc }; return e.querySelector(css) }
  19. var $$ = function(e, css) { if(!css) { css=e; e=doc }; return e.querySelectorAll(css) }
  20.  
  21. var update_p1 = function() { // Update the grand prize of a weapon lottery
  22. var frm = doc.createElement('IFRAME')
  23. frm.src = 'http://hentaiverse.org/?s=Bazaar&ss=lt'
  24. frm.width = frm.height = frm.frameBorder = 0
  25. frm.onload = function() {
  26. $('#a1').textContent = GM_getValue('p1')
  27. frm.parentNode.removeChild(frm)
  28. }
  29. doc.body.appendChild(frm)
  30. }
  31.  
  32. var update_p2 = function() { // Update the grand prize of an armor lottery
  33. var frm = doc.createElement('IFRAME')
  34. frm.src = 'http://hentaiverse.org/?s=Bazaar&ss=la'
  35. frm.width = frm.height = frm.frameBorder = 0
  36. frm.onload = function() {
  37. $('#a2').textContent = GM_getValue('p2')
  38. frm.parentNode.removeChild(frm)
  39. }
  40. doc.body.appendChild(frm)
  41. }
  42.  
  43. var display_prizes = function() { // Create a div to display the grand prizes of daily lotteries
  44. var div = doc.createElement('DIV')
  45.  
  46. div.appendChild(doc.createElement('BR'))
  47. var a1 = doc.createElement('A')
  48. a1.id = 'a1'
  49. a1.href = 'http://hentaiverse.org/?s=Bazaar&ss=lt'
  50. a1.target = '_self'
  51. a1.textContent = GM_getValue('p1')
  52. div.appendChild(a1)
  53. div.appendChild(doc.createElement('BR'))
  54.  
  55. div.appendChild(doc.createElement('BR'))
  56. var a2 = doc.createElement('A')
  57. a2.id = 'a2'
  58. a2.href = 'http://hentaiverse.org/?s=Bazaar&ss=lt'
  59. a2.target = '_self'
  60. a2.textContent = GM_getValue('p2')
  61. div.appendChild(a2)
  62. div.appendChild(doc.createElement('BR'))
  63.  
  64. $('.clb').lastChild.appendChild(div)
  65. }
  66.  
  67. if(/&ss=lt\b/.test(href)) { // Weapon lottery
  68. try{ GM_setValue('p1', $('#equipment').previousSibling.textContent) } catch(e) {}
  69. addEventListener('DOMContentLoaded', function() { update_p2(); display_prizes() }, false)
  70. }
  71. else if(/&ss=la\b/.test(href)) { // Armor lottery
  72. try{ GM_setValue('p2', $('#equipment').previousSibling.textContent) } catch(e) {}
  73. addEventListener('DOMContentLoaded', function() { update_p1(); display_prizes() }, false)
  74. }
  75. else { update_p1(); update_p2(); display_prizes() }