search dashboard

shows only posts w specific word(s)

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name search dashboard
// @namespace Violentmonkey Scripts
// @author ghostplantss
// @grant none
// @match *://www.tumblr.com/*
// @description shows only posts w specific word(s)
// @version 1.1
// @require https://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==
// 
// 

var words = ["society"];
(
  function scroll (f) {
  var count = 0;
  window.addEventListener("scroll", ( //every time you scroll
  function fun() //it runs this function!
  {
    $("div.post").each(function() //for each post
    { 
      if(!$(this).hasClass('search'))//if it hasn't been checked already
       {
         count++;
         var boo=true;
         this.className += " search";
          var divs = this.getElementsByTagName('p');
         for(var i = 0; i< divs.length;i++)//it iterates through all paragraphs in the post 
          {
            for(var j = 0; j< words.length;j++)//iterates through the words you want to find
            {
              if(divs[i].innerHTML.indexOf(words[j]) !== -1){boo=false;}//if the word is in the post, you display it
              
             }
          }
         if(boo&&count>1)//make sure word is in post + there's still a post on the dashboard
           {
             $(this).css('display','none');//if the word isn't in the post you hide it 
           }
       }
    });
  }), false);//the end
}

)(window.jQuery);