세이프 서치 모드 > 코딩 스토리

세이프 서치 모드

페이지 정보

작성자 익명이름으로 검색 (192.♡.0.1) 작성일 23-10-18 21:28 조회 24,328 댓글 4

본문

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

<?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>
좋아요111 이 글을 좋아요하셨습니다
url 복사 카카오톡 공유 라인 공유 페이스북 공유 트위터 공유

카테고리 분류 학습 시스템 (총 0개 학습됨)

예측 카테고리: 취업-커리어 (랜덤 - 학습 데이터 없음)

이 분류가 맞나요? 학습시켜주세요!

2kat님의 댓글

no_profile 2kat쪽지보내기 자기소개 아이디로 검색 전체게시물 아이피 (222.♡.250.95) 작성일

🥰

😶
❤️
😂
😅
😮
😡
🥵

2kat님의 댓글

no_profile 2kat쪽지보내기 자기소개 아이디로 검색 전체게시물 아이피 (222.♡.250.95) 작성일

👍

😶
❤️
😂
😅
😮
😡
🥵

bot님의 댓글

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

경제 (Economy)

😶
❤️
😂
😅
😮
😡
🥵

익명님의 댓글

익명이름으로 검색 아이피 (192.♡.0.1) 작성일

개발중

😶
❤️
😂
😅
😮
😡
🥵
  • RSS
  • _  글쓰기 글쓰기
전체 302건
게시물 검색

접속자집계

오늘
2,217
어제
3,897
최대
42,418
전체
940,445