EMCSA Plus

Enhance the Erotic Mind Control Stories Archive with some additional functionality

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name        EMCSA Plus
// @namespace   gkrishna.gent
// @match       https://mcstories.com/WhatsNew.html
// @grant       GM_getValue
// @version     0.5
// @author      Gopi Krishna
// @description Enhance the Erotic Mind Control Stories Archive with some additional functionality
// ==/UserScript==

function selectStoryByCond({authors_to_select=[]}) {
  var stories = document.getElementsByClassName("story");
  var wanted_stories = [];
  var matched_elements = [];

  storyloop: for (let story of stories) {
    subels = story.children;

    // validity check
    all_ok = true;
    if (subels.length != 3) { all_ok = false; }
    for (let se of subels) {
      if (se.nodeName != 'DIV') { all_ok = false; }
    }
    if (!all_ok) { 
      console.error("Page structure has changed, update the addon");
      return null;
    }

    author_els = subels[1].getElementsByTagName('a');
    for (let author_el of author_els) {
      for (let author of authors_to_select) {
        if (author_el.text.localeCompare(author, 'en', { sensitivity: 'base' }) == 0) {
          wanted_stories.push(story);
          matched_elements.push(author_el);
          continue storyloop;
        }
      }
    }
  }
  return [wanted_stories, matched_elements];
}


function hide_blocked_authors() {
  var authors_to_block = GM_getValue('authors_to_block', '');
  [stories_to_hide, ] = selectStoryByCond({authors_to_select: authors_to_block});
  for (let story of stories_to_hide) {
    console.log('Story '+story.children[0].children[0]+' '+
                story.children[1].textContent+' is hidden');
    story.style.display = 'none';
  }
}

function highlight_authors() {
  var authors_to_highlight = GM_getValue('authors_to_highlight', '');
  [, matched_authors] = selectStoryByCond({authors_to_select: authors_to_highlight});
  for (let author_el of matched_authors) {
    author_el.style.border = "medium solid lime";
  }
}

hide_blocked_authors();
highlight_authors();