grim's exhentai popular right now

add an iframe for g.e-hentai

  1. // ==UserScript==
  2. // @name grim's exhentai popular right now
  3. // @namespace https://greasyfork.org/en/users/4367-d-p
  4. // @description add an iframe for g.e-hentai
  5. // @include http://exhentai.org/
  6. // @include https://exhentai.org/
  7. // @version 0.1
  8. // ==/UserScript==
  9.  
  10. /*
  11.  
  12. see:
  13. I wanna be an active user.js
  14. + for iframe usage
  15. http://stackoverflow.com/questions/14249712/basic-method-to-add-html-content-to-the-page-with-greasemonkey
  16. + for adding a new element to an html page
  17.  
  18. */
  19.  
  20. var newHtmlCustomElement = document.createElement ('div');
  21. newHtmlCustomElement.innerHTML = ' \
  22. <div id="gmCustomIdForExhentai"> \
  23. <p>Some paragraph</p> \
  24. etc. \
  25. </div> \
  26. ';
  27.  
  28. document.body.appendChild (newHtmlCustomElement);
  29.  
  30.  
  31.  
  32. /*** start I wanna be an active user userscript ***/
  33.  
  34. var wnd = window
  35. var doc = wnd.document
  36. var loc = location
  37. var href = loc.href
  38.  
  39. if(/^http:\/\/exhentai\.org\//)
  40. {
  41. var eventpane = doc.getElementById('gmCustomIdForExhentai')
  42. if(!eventpane) { throw 'exit' }
  43. var t = eventpane.textContent
  44. var frm = doc.createElement('IFRAME')
  45. frm.src = 'http://g.e-hentai.org/#pp'
  46. frm.width = wnd.innerWidth
  47. frm.height = wnd.innerHeight * 0.3
  48. frm.frameBorder = 0
  49. doc.getElementById('gmCustomIdForExhentai').parentNode.replaceChild(frm, doc.getElementById('gmCustomIdForExhentai'))
  50. }
  51.  
  52.  
  53. /*** end I wanna be an active user userscript ***/