Greasy Fork 还支持 简体中文。

TorViet Shoutbox Enhancer

A small script to simplify the shoutbox

目前為 2015-05-11 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name TorViet Shoutbox Enhancer
  3. // @namespace http://torviet.com/userdetails.php?id=1662
  4. // @version 0.4.1
  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. toggleEmoSlt();
  45. $('#emogroup').change();
  46. $('#idQuestion').focus();
  47. setTimeout(function(){
  48. addEmoticons();
  49.  
  50. $('a.btuEmotion').click(function(){
  51. var number = parseInt($(this).attr('alt').substr(3));
  52.  
  53. if (number >= 200 && number <= 234 || number == 707) {
  54. var x = $('#idQuestion').attr('value');
  55. $('#idQuestion').attr('value', x + $(this).attr('alt'));
  56. $('#idQuestion').focus();
  57. }
  58. });
  59. }, 200);
  60.  
  61. function getRemainingHeight() {
  62. return $('.input-section').parent().height() + $('.navigation_page').height();
  63. }
  64.  
  65. function addEmoticons() {
  66. var emo = '<div style="height:43px;width:43px;float:left;display:inline-block;margin:1px;"><a style="margin:0px 0px 0px 0px;" class="btuEmotion" alt="[em707]"><img style="max-width: 43px; max-height: 43px" src="/pic/smilies/707.gif" alt=""></a></div>';
  67. $('.emo-group-detail').append(emo);
  68. for (i = 200; i < 234; i++) {
  69. emo = '<div style="height:43px;width:43px;float:left;display:inline-block;margin:1px;"><a style="margin:0px 0px 0px 0px;" class="btuEmotion" alt="[em' + i + ']"><img style="max-width: 43px; max-height: 43px" src="/pic/smilies/' + i + '.gif" alt=""></a></div>';
  70. $('.emo-group-detail').append(emo);
  71. }
  72. }
  73. });