Tcafe Block User

티카페 특정 유저 글과 코멘트 숨기기

  1. // ==UserScript==
  2. // @name Tcafe Block User
  3. // @namespace http://tampermonkey.net/
  4. // @version 4.25
  5. // @description 티카페 특정 유저 글과 코멘트 숨기기
  6. // @author DandyClubs
  7. // @include /tcafe2a.com/
  8. // @exclude *://tcafe2a.com/bbs/memo.php
  9. // @exclude https://tcafe2a.com/bbs/mypost.php*
  10. // @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
  11. // @grant GM_setValue
  12. // @grant GM_getValue
  13. // @grant GM_addStyle
  14. // @run-at document-body
  15. // @noframes
  16. // ==/UserScript==
  17. (function() { var css = document.createElement('link'); css.href = 'https://use.fontawesome.com/releases/v5.15.4/css/all.css'; css.rel = 'stylesheet'; css.type = 'text/css'; document.getElementsByTagName('head')[0].appendChild(css); })();
  18.  
  19.  
  20. GM_addStyle (`
  21. @import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@300&family=Noto+Sans+KR:wght@300&family=Noto+Sans:wght@300&display=swap');
  22.  
  23. body {
  24. font-family: 'Nanum Gothic', 'M PLUS Rounded 1c', 'Noto Sans', sans-serif !important;
  25. }
  26.  
  27. .BanList {
  28. position: fixed !important;
  29. left: auto;
  30. right: 10px;
  31. border: 2px solid Tomato !important;
  32. text-align: center;
  33. font-family: 'Nanum Gothic', 'M PLUS Rounded 1c', 'Noto Sans', sans-serif !important;
  34. background-color: white !important;
  35. padding: .25em .5em;
  36. margin: auto;
  37. font-size: 14px;
  38. border-radius: 4px;
  39. -webkit-box-sizing: border-box;
  40. box-sizing: border-box;
  41. z-index: 999999999 !important;
  42. cursor: pointer;
  43. max-height: 50%;
  44. overflow-y: auto;
  45. }
  46.  
  47. .BanButton {
  48. position: fixed !important;
  49. left: auto;
  50. right: 10px;
  51. font-family: 'Nanum Gothic', 'M PLUS Rounded 1c', 'Noto Sans', sans-serif !important;
  52. background-color: white !important;
  53. padding: .25em;
  54. margin: auto;
  55. font-size: 20px;
  56. border-radius: 2em;
  57. -webkit-box-sizing: border-box;
  58. box-sizing: border-box;
  59. z-index: 999999999 !important;
  60. cursor: pointer;
  61. }
  62. .BanList-wrapper {
  63. text-align: left !important;
  64. font-size: 12px !important;
  65. font-family: 'Nanum Gothic', "Malgun Gothic", dotum, sans-serif !important;
  66. z-index: 999999999 !important;
  67. height: auto;
  68. margin: auto;
  69. }
  70. .BanCheck {
  71. text-align: center !important;
  72. margin: auto;
  73. }
  74. .BanCounts.fa-layers-counter {
  75. background-color: #ff253a !important;
  76. border-radius: 1em;
  77. -webkit-box-sizing: border-box;
  78. box-sizing: border-box;
  79. color: #fff !important;
  80. height: 1.5em;
  81. line-height: 1;
  82. max-width: 5em;
  83. min-width: 1.5em;
  84. overflow: hidden;
  85. padding: .25em;
  86. right: 0;
  87. text-overflow: ellipsis;
  88. top: 0;
  89. font-size: 14px;
  90. -webkit-transform: scale(0.65);
  91. transform: scale(0.65);
  92. -webkit-transform-origin: top right;
  93. transform-origin: top right;
  94. }
  95. .BanCounts.fa-layers-counter, .fa-layers-text {
  96. display: inline-block;
  97. position: absolute;
  98. text-align: center;
  99. }
  100. .BanNotice {
  101. position: relative;
  102. text-align: center;
  103. border-radius: 4px;
  104. color: white !important;
  105. background:Tomato !important;
  106. padding: .25em 1em;
  107. font-size: 12px;
  108. font-family: 'Nanum Gothic', 'M PLUS Rounded 1c', 'Noto Sans', sans-serif !important;
  109. right: 30px;
  110. z-index: 999999999 !important;
  111. }
  112. .w-side .f-side-wrap {
  113. font-size: 13px !important;
  114. }
  115. .fas.fa-user-slash {
  116. display: inline-block;
  117. position: absolute;
  118. text-align: center;
  119. padding: .25em;
  120. cursor: pointer;
  121. }
  122. .btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
  123. display: inline-block !important;
  124. }
  125. .AddBan {
  126. position: absolute;
  127. display: inline-block;
  128. cursor: pointer;
  129. }
  130.  
  131. .side-event-img{
  132. display: inline-block !important;
  133. }
  134. `);
  135.  
  136. $(document).ready(function(){
  137.  
  138. //목록 글쓰기 버튼 위치 변경
  139. var listwrite = document.querySelector('.print-hide.view-btn.text-right')
  140. if(listwrite){
  141. listwrite.remove()
  142. document.querySelector("div.view-wrap").insertAdjacentHTML('beforeend', listwrite.outerHTML)
  143. }
  144.  
  145. // 차단유저 ID
  146. var IDs = JSON.parse(GM_getValue("IDs", "[]"))
  147. var IDsCounts = IDs.length
  148. var ShowHide = GM_getValue("ShowHide")
  149.  
  150. document.querySelector("body.is-pc").insertAdjacentHTML('afterbegin', '<div class="BanButton"><i class="BanButtonIcon fas fa-user-shield" style="color:#FF2D00 !important;"></i><span class="BanCounts fa-layers-counter" style="background:Tomato;">' + IDsCounts + '</span></>')
  151. document.querySelector("body.is-pc").insertAdjacentHTML('afterbegin', '<div class="BanList"><i class="Banupdate far fa-save" style="color:#ff0000;"></i>&nbsp;&nbsp;BanList&nbsp;&nbsp;<i class="BanListClose fas fa-times" style="color:Tomato;"></i></>')
  152.  
  153. if(ShowHide == 'Show'){
  154. $(".BanList").show()
  155. $(".BanButton").hide()
  156. }
  157. else{
  158. $(".BanButton").show()
  159. $(".BanList").hide()
  160. }
  161.  
  162.  
  163. let BanIDs = document.querySelectorAll('span.member')
  164.  
  165. for (let i = 0; i < BanIDs.length; i++) {
  166. BanIDs[i].parentNode.insertAdjacentHTML('afterend', '&nbsp;<span class="AddBan"><i class="fas fa-user-slash" style="color:#FF2D00 !important;"></i></><div class="BanNotice" style="background:Tomato; display:none;"></div>')
  167. }
  168.  
  169. let Addnab = document.querySelectorAll('.fa-user-slash')
  170.  
  171. for (let i = 0; i < BanIDs.length; i++) {
  172.  
  173. BanIDs[i].parentElement.closest('div').addEventListener("mouseover",togglebbtn,false);
  174. BanIDs[i].parentElement.closest('div').addEventListener("mouseout",togglebbtn,false);
  175.  
  176. Addnab[i].style.visibility = "hidden";
  177.  
  178. }
  179.  
  180.  
  181. //글쓰기 버튼 숨김
  182. if(/wr_id/.test(window.location.href)){
  183. $("h1 span").removeAttr("style")
  184. const form = document.getElementById('wr_content')
  185. const write = document.querySelector('.fa.fa-pencil').closest('a')
  186. form.addEventListener('focus', (event) => {
  187. write.style.visibility = "hidden"
  188. }, true);
  189.  
  190. form.addEventListener('blur', (event) => {
  191. write.style.visibility = "visible"
  192. }, true);
  193.  
  194. }
  195.  
  196. IDs.forEach(function (item) {
  197. var idx = item.ID
  198.  
  199. let IDNodeC = document.querySelectorAll('div.media-heading')
  200. let IDNodeW = document.querySelectorAll('td > div > a[onclick*="' + idx +'"]')
  201.  
  202. //코멘트 제거
  203. if(IDNodeC && /wr_id/.test(window.location.href)){
  204. for(var i=0; i < IDNodeC.length; i++) {
  205. var matchIDc = IDNodeC[i].innerHTML.match(/showSideView\(this, (\'[\w]+\')/)
  206. if (IDNodeC[i].closest('div.media') && matchIDc[1] == idx) {
  207. console.log('코멘트 번호 : ' + IDNodeC[i].closest('div.media').getAttribute('id') + ' -- 닉네임 : ' + item.NickName)
  208. IDNodeC[i].closest('div.media').style.display = 'none';
  209. }
  210. }
  211. }
  212. //글목록에서 제거
  213. if(IDNodeW){
  214. for(var j=0; j < IDNodeW.length; j++) {
  215. var matchID = IDNodeW[j].outerHTML.match(/showSideView\(this, (\'[\w]+\')/)
  216. if (IDNodeW[j].closest('tr') && matchID[1] == idx) {
  217. console.log('게시글 번호 : ' + IDNodeW[j].closest('tr').getAttribute('id') + ' -- 닉네임 : ' + item.NickName)
  218. IDNodeW[j].closest('tr').style.display = 'none';
  219. }
  220. }
  221. }
  222. })
  223.  
  224. function BanList(GetID, GetNickName, AddBanNoticei) {
  225.  
  226. let searchID = IDs.find( ({ ID }) => ID === GetID )
  227. let searchNickName = IDs.find( ({ NickName }) => NickName === GetNickName )
  228. if(searchNickName){
  229. //alert("[ " + GetNickName + " ] 이미 차단 등록되었습니다!")
  230. AddBanNoticei.textContent = GetNickName + ' 이미 차단 등록되었습니다!'
  231. $(AddBanNoticei).slideDown('fast')
  232. setTimeout(function(){ $(AddBanNoticei).slideUp('slow') }, 2000);
  233. } else if(searchID){
  234. //alert("[ " + GetID + " ] 이미 차단 등록되었습니다!")
  235. AddBanNoticei.textContent = GetID + ' 이미 차단 등록되었습니다!'
  236. $(AddBanNoticei).slideDown('fast')
  237. setTimeout(function(){ $(AddBanNoticei).slideUp('slow') }, 2000);
  238. } else {
  239. IDs.push({ID : GetID, NickName : GetNickName});
  240. GM_setValue("IDs", JSON.stringify(IDs))
  241. document.querySelector('.BanCounts').textContent = IDs.length
  242. AddBanNoticei.textContent = GetNickName + ' 차단 등록되었습니다!'
  243. $(AddBanNoticei).slideDown('fast')
  244. setTimeout(function(){ $(AddBanNoticei).slideUp('slow') }, 1000);
  245. Reload()
  246. }
  247. }
  248.  
  249. function update() {
  250. let BanCheck = document.querySelectorAll('.BanCheck')
  251. //console.log(BanCheck)
  252. for (let i = 0; i < BanCheck.length; i++) {
  253. if (BanCheck[i].checked == false){
  254. var RemoveNickName = BanCheck[i].getAttribute('NickName')
  255. //console.log(AddID)
  256. var removeIndex = IDs.map(function(item) { return item.NickName; }).indexOf(RemoveNickName);
  257.  
  258. // remove object
  259. IDs.splice(removeIndex, 1);
  260.  
  261. }
  262. if(i == BanCheck.length -1){
  263. GM_setValue("IDs", JSON.stringify(IDs))
  264. document.querySelector('.BanCounts').textContent = IDs.length
  265. Reload()
  266. }
  267. }
  268. }
  269.  
  270.  
  271.  
  272. const Bancontainer = document.querySelector('.BanList')
  273.  
  274. document.querySelector('.Banupdate').addEventListener("click", function(e){
  275. update()
  276. })
  277.  
  278. function Reload() {
  279. var element = document.querySelectorAll('.BanList-wrapper')
  280. Array.prototype.forEach.call( element, function( node ) {
  281. node.parentNode.removeChild( node );
  282. });
  283. MakeList()
  284. }
  285.  
  286. function MakeList() {
  287. for (let i = 0; i < IDs.length; i++) {
  288. let wrapper = document.createElement('div')
  289. wrapper.classList.add('BanList-wrapper')
  290. let checkbox = document.createElement('input')
  291.  
  292. //label.textContent = ' ' + IDs[i].NickName + " [ " + document.querySelectorAll("td > a[onclick*=" + IDs[i].ID +"]").length + " | " + document.querySelectorAll("div.user > a[onclick*=" + IDs[i].ID +"]").length + " ]"
  293. checkbox.type = 'checkbox'
  294. checkbox.checked = true
  295. checkbox.setAttribute("class", 'BanCheck')
  296. checkbox.setAttribute("NickName", IDs[i].NickName)
  297. wrapper.appendChild(checkbox)
  298. Bancontainer.appendChild(wrapper)
  299. checkbox.insertAdjacentHTML('afterend', "&nbsp;&nbsp;" + IDs[i].NickName)
  300. }
  301.  
  302. }
  303.  
  304. $(".BanListClose").click(function(){
  305. $(".BanList").slideUp(function() {
  306. $(".BanButton").slideDown()
  307. ShowHide = 'Hide'
  308. GM_setValue("ShowHide", ShowHide)
  309. })
  310. })
  311.  
  312. $(".BanButtonIcon").click(function(){
  313. $(".BanButton").slideUp(function() {
  314. $(".BanList").slideDown()
  315. ShowHide = 'Show'
  316. GM_setValue("ShowHide", ShowHide)
  317. })
  318. })
  319.  
  320.  
  321. let AddBanIcon = document.querySelectorAll('.AddBan')
  322. let AddBanNotice = document.querySelectorAll('.BanNotice')
  323.  
  324. for (let i = 0; i < AddBanIcon.length; i++) {
  325. AddBanIcon[i].addEventListener("click", function(e){
  326. let getinfo = AddBanIcon[i].previousElementSibling.getAttribute('onclick')
  327. let GetNickName = AddBanIcon[i].previousElementSibling.textContent
  328. let GetID = getinfo.match(/showSideView\(this, (\'[\w]+\')/)[1]
  329. BanList(GetID, GetNickName, AddBanNotice[i])
  330. AddBanIcon[i].childNodes[0].style = "color: Indigo !important;"
  331. })
  332. }
  333.  
  334. MakeList()
  335.  
  336. function togglebbtn(e){
  337. var bbtn = e.currentTarget.querySelector('.fa-user-slash');
  338. if (bbtn){
  339. if (e.type == "mouseover") bbtn.style.visibility = "visible";
  340. else bbtn.style.visibility = "hidden";
  341. }
  342. }
  343.  
  344. })

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址