thewisepotato

Fix Reblogs Update - XKit Extension

Sep 5th, 2015
520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. //* TITLE Fix Dash Reblogs **//
  2. //* VERSION 1.0 REV A **//
  3. //* DESCRIPTION Mimics the old dashboard. **//
  4. //* DEVELOPER scal-aru **//
  5. //* DETAILS Mimics the old dashboard by nesting reblogs instead of putting them one after the other.<br/>Currently doesn't work on the in-dash blog viewer. **//
  6. //* FRAME false **//
  7. //* SLOW true **//
  8.  
  9. XKit.extensions.fix_reblogs_update = new Object({
  10.  
  11. running: false,
  12.  
  13. preferences: {
  14. "blockquote_color": {
  15. text: "Blockquote color:",
  16. default: "#eeeeee",
  17. value: "#eeeeee",
  18. type: "text"
  19. },
  20. "blockquote_width": {
  21. text: "Blockquote width:<br/> (make sure to include 'px' at the end)",
  22. default: "3px",
  23. value: "3px",
  24. type: "text"
  25. }
  26. },
  27.  
  28. run: function() {
  29. this.running = true;
  30. XKit.tools.init_css("fix_reblogs_update");
  31. XKit.post_listener.add("fix_reblogs_update", XKit.extensions.fix_reblogs_update.fixit);
  32. XKit.extensions.fix_reblogs_update.fixit();
  33. XKit.interface.post_window_listener.add("fix_reblogs_update", XKit.extensions.fix_reblogs_update.fixit);
  34. },
  35.  
  36. fixit: function() {
  37. // CSS STYLES
  38. $(".reblog-list-item .reblog-tumblelog-name").attr("style","text-decoration:underline !important; font-size:1em; font-weight:400;");
  39. $(".reblog-list-item .reblog-avatar").css("display","none");
  40. $(".reblog-list-item .reblog-header").css({"padding-left":"0", "margin-bottom":"0"});
  41. $(".reblog-list-item").css({"border-bottom":"none", "padding":"0"});
  42. $(".reblog-list-item .reblog-content").css({"border-left":"solid 3px #eee", "padding-left":"20px", "margin":"10px 0px"});
  43. $(".reblog-list, .reblog-list-item.contributed-content").css({"border-top":"none", "padding":"5px 20px"});
  44. $("blockquote").css("margin-left","15px");
  45. $(".post_full .post_media").css("margin-bottom","15px");
  46. $(".reblog-list .reblog-list-item figure.tmblr-full, .reblog-list .reblog-list-item figure.tmblr-embed").css({"margin-left":"0", "margin-right":"0"});
  47. $(".contributed-content .reblog-header").css("display","none");
  48. $(".contributed-content .reblog-content").css({"margin":"initial", "padding":"initial", "border-left":"initial"});
  49. $(".reblog-list-item .reblog-content").css({
  50. "border-left-color":XKit.extensions.fix_reblogs_update.preferences.blockquote_color.value,
  51. "border-left-width":XKit.extensions.fix_reblogs_update.preferences.blockquote_width.value
  52. });
  53.  
  54.  
  55. // ACTUAL CODE
  56. var done = 0;
  57.  
  58. $("div.reblog-list").each(function() {
  59. fixinit($(this));
  60. done++;
  61. });
  62.  
  63. function fixinit (post) {
  64. var comments = post.children().length;
  65.  
  66. post.children().each(function() {
  67. var index = $(this).index();
  68. var next = $(this).next().children("div.reblog-content");
  69. if (index < comments-1) {
  70. $(this).prependTo(next);
  71. }
  72. });
  73. var title = post.find(".reblog-title");
  74. title.prependTo(post);
  75.  
  76. }
  77.  
  78. $(".reblog-header").each(function() {
  79. var empty = $(this).next().hasClass("reblog-content");
  80. if ( empty == false ) {
  81. $(this).css("display","none");
  82. }
  83. });
  84.  
  85. },
  86.  
  87.  
  88. destroy: function() {
  89. this.running = false;
  90. XKit.post_listener.remove("fix_reblogs_update");
  91. XKit.tools.remove_css("fix_reblogs_update");
  92.  
  93. $(".reblog-header").css("display","initial");
  94. $(".reblog-list-item .reblog-tumblelog-name").attr("style","");
  95.  
  96. }
  97.  
  98. });
Advertisement
Add Comment
Please, Sign In to add comment