세이프 서치 모드 > 코딩게시판

본문 바로가기
사이트 내 전체검색

코딩게시판

세이프 서치 모드

페이지 정보

작성자 익명 이름으로 검색  (192.2)
조회 5,361회 작성일 23-10-18 21:28

본문

신고

데이터 텍스트 파일 내의 단어와 페이지 내의 단어가 일치하면 페이지 블러처리

<?php
$words = file("data.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
?>
<script>
document.addEventListener("DOMContentLoaded", function() {
    var wordsToBlur = <?php echo json_encode($words); ?>;

    function createBlurredElement(originalElement) {
        // '세이프 서칭이 적용됐습니다.' 메시지를 추가
        var message = document.createElement("div");
        message.innerHTML = "세이프 서칭이 적용됐습니다.";
        
        // 완전한 블러 스타일 적용을 위한 spanWrapper 생성
        var blurredElement = originalElement.cloneNode(true);
        blurredElement.style.position = "relative";
        blurredElement.style.overflow = "hidden";
        blurredElement.style.filter = "blur(4px)"; // 블러 강도 조절 가능
        
        blurredElement.appendChild(message);

       return blurredElement;
    }

    function applyBlurToElements(element) {
      wordsToBlur.forEach(function(word) {
          if (element.textContent.includes(word)) {
              var blurredEl= createBlurredElement(element);
              element.replaceWith(blurredEl);
          }
      });

      for (var i=0; i<element.children.length; i++) { 
          applyBlurToElements(element.children[i]); 
      }
  }

  applyBlurToElements(document.body); 

});
</script>
url 복사카카오톡 공유라인 공유페이스북 공유트위터 공유

댓글목록

profile_image
profile_image
profile_image

bot님의 댓글

bot 쪽지보내기 자기소개 아이디로 검색 전체게시물 아이피 (222.2) 작성일

경제 (Economy)

profile_image

익명님의 댓글

익명 이름으로 검색 아이피 (192.2) 작성일

개발중

Total 184건 1 페이지
코딩게시판 목록
번호 제목 작성자 조회수 좋아요 싫어요 날짜
184 tak2 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 16 1 1 1일 전
183 익명 이름으로 검색 47 5 5 5일 전
182 익명 이름으로 검색 63 7 7 5일 전
181 tak2 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3052 28 27 1개월 전
180 tak2 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2364 27 19 1개월 전
179 tak2 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4 0 0 1개월 전
열람중 익명 이름으로 검색 5362 32 13 1개월 전
177 익명 이름으로 검색 4064 27 25 1개월 전
176 tak2 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9126 27 30 1개월 전
175 익명 이름으로 검색 3945 28 23 2개월 전
174 익명 이름으로 검색 5142 21 19 2개월 전
173 tak2 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3064 27 27 2개월 전
172 익명 이름으로 검색 1223 21 18 2개월 전
171 익명 이름으로 검색 6026 26 12 2개월 전
170 익명 이름으로 검색 2148 24 19 2개월 전

검색

갤러리


모바일버전서비스이용약관개인정보처리방침이메일 무단수집 거부
Copyright ©www.dsclub.kr All rights reserved.