PLITT

allow visiting search result without the redirection overhead

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name  PLITT
// @version    1.0
// @namespace  ryenus.toys
// @include    http://www.google.tld/*
// @include    https://www.google.tld/*
// @include    http://www.google.co.tld/*
// @include    https://www.google.co.tld/*
// @include    http://www.google.com.tld/*
// @include    https://www.google.com.tld/*
// @description allow visiting search result without the redirection overhead
// ==/UserScript==

(function(d, t) {
  if (! (d.forms[0] && d.forms[0].action.match(/search/))) return;
  d.addEventListener('DOMSubtreeModified', function() {
    if (t == 0) t = setTimeout(function() {
      var r = d.getElementsByClassName('r'), n = r.length;
      if (n > d.getElementsByClassName('plitt').length) {
        while(n--) {
          var l = r[n].lastChild;
          l.insertAdjacentHTML("beforebegin",
            "<a href='" + l.href + "' target='_blank' class='plitt'>[#]</a> ");
        }
      }
      t = 0;
    }, 500);
  }, false);
})(document, 0);