FURSTREAM chat expander

Make the chat more compact on stream pages

当前为 2014-06-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name FURSTREAM chat expander
  3. // @namespace furstre.am
  4. // @description Make the chat more compact on stream pages
  5. // @include https://furstre.am/stream/*
  6. // @version 3
  7. // @grant none
  8. // ==/UserScript==
  9.  
  10. function addGlobalStyle(css) {
  11. $("head").append($(document.createElement("style")).attr("type", "text/css").html(css));
  12. }
  13.  
  14. var insertListener = function(e){
  15. if (e.animationName == "nodeInserted") {
  16. var avatar = $(e.target).children(".av").detach();
  17. var details = $(e.target).children(".content").children(".details").detach();
  18. $(e.target).children(".content").prepend(details);
  19. $(e.target).children(".content").prepend(avatar);
  20. }
  21. }
  22.  
  23. $(window).load(function(){
  24. addGlobalStyle(".body.stream { margin: 0 !important; }")
  25. addGlobalStyle(".comunica #comunica-chat-pane .msg { margin: 0 !important; }")
  26. addGlobalStyle(".comunica #comunica-chat-pane .msg .content { margin: 0 !important; float: none !important; width: 100% !important; }")
  27. addGlobalStyle(".comunica #comunica-chat-pane .msg .content p { margin: 0 0 8px !important; }")
  28. addGlobalStyle(".comunica #comunica-chat-pane .msg .content .details { margin: 0 !important; }")
  29. addGlobalStyle(".comunica #comunica-chat-pane .msg .content:after { display: none; !important }")
  30. addGlobalStyle(".comunica #comunica-chat-pane .msg .content.pull-right:after { display: none !important; }")
  31. addGlobalStyle(".comunica #comunica-chat-pane .msg .av { position: static !important; float: left !important; }")
  32. addGlobalStyle("@keyframes nodeInserted { from { opacity: 0.99; } to { opacity: 1; } }")
  33. addGlobalStyle(".comunica #comunica-chat-pane .msg { animation-duration: 0.001s; animation-name: nodeInserted; }")
  34. document.addEventListener("animationstart", insertListener, false)
  35. })