Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. KurahenPremium.prototype.colorizeAndNamePosters = function () {
  2. var postersIds = document.getElementsByClassName('posteruid');
  3. var postersStats = {};
  4.  
  5. var opId;
  6. for (var i = 0; i < postersIds.length; i++) {
  7. var posterId = this.parsePosterId(postersIds[i].textContent);
  8. postersIds[i].title = posterId;
  9. posterId = posterId.replace(/[\.|\/|\+|\-]/g, '_');
  10.  
  11. if (i === 0) {
  12. opId = posterId;
  13. }
  14.  
  15. postersIds[i].className += ' poster-id-' + posterId;
  16. if (roundedIdBackground) {
  17. postersIds[i].className += ' id-rounded';
  18. }
  19. if (posterId === opId) {
  20. postersIds[i].textContent = '\u00a0OP nitki';
  21. } else {
  22. postersIds[i].textContent = '\u00a0' + posterId;
  23. }
  24.  
  25. if (typeof postersStats[posterId] === 'undefined') {
  26. postersStats[posterId] = [postersIds[i]];
  27. } else {
  28. postersStats[posterId].push(postersIds[i]);
  29. }
  30. }
  31.  
  32. var style = '';
  33. for (var id in postersStats) {
  34. if (postersStats.hasOwnProperty(id) && postersStats[id].length > 1) {
  35. style += '.poster-id-' + id + '{color:#000;background-color: ' + this.getNextColor() + ';}\n';
  36. var numeral;
  37. if (postersStats[id].length < 5) {
  38. numeral = ' posty';
  39. } else {
  40. numeral = ' postów';
  41. }
  42.  
  43. if (showPostCountNearId) {
  44. style += '.poster-id-' + id + ':after{content:" (';
  45. style += postersStats[id].length + numeral + ')\u00a0"}\n';
  46. }
  47.  
  48. if (enableHighlightPostsButton) {
  49. this.setHighlightPostsButton(postersStats[id], id);
  50. }
  51.  
  52. if (enableJumpButtons) {
  53. this.setJumpButtons(postersStats[id]);
  54. }
  55. }
  56. }
  57.  
  58. if (roundedIdBackground) {
  59. style += '.id-rounded { font-size: 11px; border-radius: 6px; padding: 0px 6px 0px 2px;}\n';
  60. }
  61. style += '.small-icon { font-size: 16px; vertical-align: middle }\n';
  62. style += '.post-animated { transition: opacity 0.4s}\n';
  63. style += '.hiden-post { opacity: ' + unhighlightedPostOpacity + '}\n';
  64. style += '.highlighting-button { font-size: 11px; cursor:pointer}\n';
  65. style += '.highlighting-button:hover { color: orange;}\n';
  66. GM_addStyle(style);
  67.  
  68. var allUserPosts = document.getElementsByClassName('postContainer');
  69. for (i = 0; i < allUserPosts.length; i++) {
  70. allUserPosts[i].classList.add('post-animated');
  71. }
  72. var firstPostBar = document.querySelector('.opContainer .postInfo');
  73. var threadPostersStats = document.createElement('span');
  74. threadPostersStats.textContent = ' (' + postersIds.length + ' postów od ' + Object.keys(postersStats).length +
  75. ' anonów)';
  76. firstPostBar.appendChild(threadPostersStats);
  77. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement