@kangsicj/dcinsideenhancer 1.3.8 → 1.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  // @name DCInside Enhancer
3
3
  // @name:ko 디시 인핸서
4
4
  // @namespace https://github.com/kangsicj/DCInsideEnhancer
5
- // @version 1.3.8
5
+ // @version 1.3.9
6
6
  // @description DCInside filter & enhancer — mobile & PC. Block users/words/heads/notices/images & GIFs across posts, infinite list, zoom viewer, theme sync, encrypted multi-device sync (no account, no tracking).
7
7
  // @description:ko 디시인사이드 차단·편의 기능 (모바일·PC) - 유저·단어(제목/본문)·말머리·공지 차단, 같은/비슷한 이미지·움짤 모든 글 차단, 디시콘 제거, 차단 미디어 데이터 절약, 목록 자동 보충·무한 스크롤·뒤로 가기 위치 복원, 스크랩, 이미지 확대뷰 개선, 야간모드 자동 연동, 암호화 기기 간 동기화 (계정 없음·추적 없음)
8
8
  // @author kangsicj
@@ -2,7 +2,7 @@
2
2
  // @name DCInside Enhancer
3
3
  // @name:ko 디시 인핸서
4
4
  // @namespace https://github.com/kangsicj/DCInsideEnhancer
5
- // @version 1.3.8
5
+ // @version 1.3.9
6
6
  // @description DCInside filter & enhancer — mobile & PC. Block users/words/heads/notices/images & GIFs across posts, infinite list, zoom viewer, theme sync, encrypted multi-device sync (no account, no tracking).
7
7
  // @description:ko 디시인사이드 차단·편의 기능 (모바일·PC) - 유저·단어(제목/본문)·말머리·공지 차단, 같은/비슷한 이미지·움짤 모든 글 차단, 디시콘 제거, 차단 미디어 데이터 절약, 목록 자동 보충·무한 스크롤·뒤로 가기 위치 복원, 스크랩, 이미지 확대뷰 개선, 야간모드 자동 연동, 암호화 기기 간 동기화 (계정 없음·추적 없음)
8
8
  // @author kangsicj
@@ -37,7 +37,7 @@
37
37
  window.__dcInsideEnhancer = true;
38
38
  window.__dcRefinery = true;
39
39
 
40
- const SCRIPT_VERSION = '1.3.8';
40
+ const SCRIPT_VERSION = '1.3.9';
41
41
  const PROJECT_URL = 'https://github.com/kangsicj/DCInsideEnhancer';
42
42
  const DONATE_URL = 'https://fairy.hada.io/@kangsicj';
43
43
  const DONATE_URL_BMC = 'https://buymeacoffee.com/kangsicj';
@@ -849,6 +849,13 @@
849
849
  opacity: .5;
850
850
  }
851
851
 
852
+ .dc-media-hidden + .img-comment,
853
+ .dc-media-hidden + .btn-imgcomment,
854
+ .dc-media-hidden + .dc-media-tools + .img-comment,
855
+ .dc-media-hidden + .dc-media-tools + .btn-imgcomment {
856
+ display: none !important;
857
+ }
858
+
852
859
  .layer-zoom-popup .dc-media-tools {
853
860
  display: none !important;
854
861
  }
@@ -5889,10 +5896,10 @@
5889
5896
  tools._dcBox = box;
5890
5897
  }
5891
5898
 
5892
- if (!box && mediaEl.tagName === 'IMG') {
5893
- const width = Number(mediaEl.getAttribute('width')) || mediaEl.naturalWidth || 0;
5894
-
5895
- box = width > 40 ? { width, left: null } : null;
5899
+ if (IS_MOBILE_SITE) {
5900
+ tools.style.setProperty('width', '100%');
5901
+ tools.style.removeProperty('margin-left');
5902
+ return;
5896
5903
  }
5897
5904
 
5898
5905
  if (!box || !parent) {
@@ -5904,7 +5911,7 @@
5904
5911
  const parentRect = parent.getBoundingClientRect();
5905
5912
  const room = parent.clientWidth || parentRect.width;
5906
5913
  const width = Math.min(box.width, room || box.width);
5907
- let left = box.left === null ? 0 : box.left - parentRect.left - (parseFloat(getComputedStyle(parent).paddingLeft) || 0);
5914
+ let left = box.left - parentRect.left - (parseFloat(getComputedStyle(parent).paddingLeft) || 0);
5908
5915
 
5909
5916
  if (!(left > 0) || left + width > room + 1) {
5910
5917
  left = 0;
@@ -5948,6 +5955,45 @@
5948
5955
  }, 200);
5949
5956
  }, { passive: true });
5950
5957
 
5958
+ const hiddenImageComments = new Set();
5959
+ let imageCommentStyle = null;
5960
+
5961
+ const imageFileNo = (mediaEl, host) => {
5962
+ const own = mediaEl.getAttribute('data-fileno');
5963
+
5964
+ if (own) {
5965
+ return own;
5966
+ }
5967
+
5968
+ const holder = host.matches('[data-fileno]') ? host : host.querySelector('[data-fileno]');
5969
+
5970
+ return holder ? holder.getAttribute('data-fileno') : '';
5971
+ };
5972
+
5973
+ const setImageCommentHidden = (mediaEl, host, hidden) => {
5974
+ const fileNo = imageFileNo(mediaEl, host);
5975
+
5976
+ if (!/^\d+$/.test(fileNo) || hiddenImageComments.has(fileNo) === hidden) {
5977
+ return;
5978
+ }
5979
+
5980
+ if (hidden) {
5981
+ hiddenImageComments.add(fileNo);
5982
+ } else {
5983
+ hiddenImageComments.delete(fileNo);
5984
+ }
5985
+
5986
+ if (!imageCommentStyle || !imageCommentStyle.isConnected) {
5987
+ imageCommentStyle = document.createElement('style');
5988
+ imageCommentStyle.id = 'dc-img-comment-hide';
5989
+ (document.head || document.documentElement).appendChild(imageCommentStyle);
5990
+ }
5991
+
5992
+ imageCommentStyle.textContent = [...hiddenImageComments]
5993
+ .map(no => `#img_comment_div${no}, #img_comment_open_btn${no}, #img_comment_write_div${no}`)
5994
+ .join(',\n') + (hiddenImageComments.size ? ' { display: none !important; }' : '');
5995
+ };
5996
+
5951
5997
  const readToolIds = tools => (tools.dataset.dcMediaIds || '').split(',').filter(Boolean);
5952
5998
 
5953
5999
  const createTools = () => {
@@ -6054,6 +6100,7 @@
6054
6100
  }
6055
6101
 
6056
6102
  host.classList.toggle('dc-media-hidden', blocked || deferred);
6103
+ setImageCommentHidden(mediaEl, host, blocked);
6057
6104
 
6058
6105
  const tools = existing && existing.isConnected ? existing : createTools();
6059
6106
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangsicj/dcinsideenhancer",
3
- "version": "1.3.8",
3
+ "version": "1.3.9",
4
4
  "description": "DCInside filter & enhancer userscript for mobile and PC (디시인사이드 차단·편의 유저스크립트)",
5
5
  "license": "GPL-3.0-only",
6
6
  "author": "kangsicj",