TorViet Shoutbox Enhancer

A small script to simplify the shoutbox

目前为 2015-05-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name TorViet Shoutbox Enhancer
  3. // @namespace http://torviet.com/userdetails.php?id=1662
  4. // @version 0.3
  5. // @license http://www.wtfpl.net/txt/copying/
  6. // @icon http://torviet.com/pic/salad.png
  7. // @description A small script to simplify the shoutbox
  8. // @author Salad
  9. // @match http://torviet.com/qa.php*
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. $(function(){
  14. // Remove unneeded stuffs
  15. $('#boxHead').remove();
  16. $('.marquee').remove();
  17. $('#sltTheme').remove();
  18. $('#clock').remove();
  19.  
  20. // Alter existing element CSS
  21. $('.all-wrapper').css({
  22. 'background-image': 'none',
  23. 'margin': 'auto',
  24. 'height': $(window).height()
  25. });
  26. $('.input-section').parent().css('padding', '0px');
  27. $('.navigation_page').css('width', 'auto');
  28. $('#boxQuestion').css('height', $(window).height() - getRemainingHeight() - 20);
  29. $('#emo-section').css('height', $(window).height() - getRemainingHeight() - 22);
  30.  
  31. // Alter existing element attributes
  32. $('#emogroup option:contains("Voz")').prop('selected', true);
  33.  
  34. // Add elements
  35. var myScript = document.createElement('script');
  36. myScript.type = 'text/javascript';
  37. myScript.innerHTML = 'function toggleEmoSlt() {' +
  38. '$(".emo-group-title-wrapper").slideToggle();' +
  39. '}';
  40. $('.input-section-a').append(myScript);
  41. $('.input-section-a').append('<input type="button" value="Toggle" onclick="toggleEmoSlt()" />');
  42.  
  43. // Functions
  44. $('.emo-group-title-wrapper').slideToggle();
  45. $('#emogroup').change();
  46. $('#idQuestion').focus();
  47.  
  48. function getRemainingHeight() {
  49. return $('.input-section').parent().height() + $('.navigation_page').height();
  50. }
  51. });