It's all Blink's fault.

Add "It's all Blink's fault." to every sentence you write in the shoutbox.

当前为 2014-07-16 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name It's all Blink's fault.
  3. // @description Add "It's all Blink's fault." to every sentence you write in the shoutbox.
  4. // @include http://harddrop.com/file/shout/shout.php
  5. // @namespace https://greasyfork.org/users/2233
  6. // @version 0.0.1.20140716100521
  7. // ==/UserScript==
  8.  
  9. var wnd = window
  10. var doc = wnd.document
  11. var loc = location
  12. var href = loc.href
  13.  
  14. if(doc.getElementById('ShoutCloud-Container')==null) { throw 'exit' }
  15.  
  16. // enable the input box
  17. setTimeout("",2000)
  18. addEventListener('load', function(){
  19. doc.getElementsByName('ShoutCloud-Msg')[0].disabled=false
  20. doc.getElementsByName('ShoutCloud-Msg')[0].value=''
  21. }, false)
  22.  
  23. // don't clear unsent text when unfocuing the input box
  24. doc.getElementsByName('ShoutCloud-Msg')[0].onblur = function(){ return }
  25.  
  26. addEventListener('keydown', function(evt){
  27. if(evt.keyCode==13)
  28. {
  29. evt.preventDefault()
  30. var my_chat = doc.getElementsByName('ShoutCloud-Msg')[0].value
  31. if(!/[a-zA-Z0-9]$/.test(my_chat[my_chat.length-1])) // end with punctuation
  32. {
  33. my_chat = my_chat + " It's all Blink's fault."
  34. }
  35. else
  36. {
  37. my_chat = my_chat + ". It's all Blink's fault."
  38. }
  39. doc.getElementsByName('ShoutCloud-Msg')[0].value = my_chat
  40. doc.getElementById('ShoutCloud-Shout').click()
  41. }
  42. }, false)