PTH Collages on searchbar

Add a search box for collages to the search bar

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         PTH Collages on searchbar
// @version      0.4
// @description  Add a search box for collages to the search bar
// @author       Chameleon
// @include      http*://redacted.ch/*
// @grant        none
// @namespace https://greasyfork.org/users/87476
// ==/UserScript==

(function() {
  'use strict';

  if(window.localStorage.hideLog != "false")
    document.getElementById('searchbar_log').style.display='none';

  var li=document.createElement('li');
  li.setAttribute('id', 'searchbar_collages');
  var before=document.getElementById('searchbar_requests');
  before.parentNode.insertBefore(li, before);
  var form=document.createElement('form');
  li.appendChild(form);
  form.setAttribute('class', 'search_form');
  form.setAttribute('name', 'collages');
  form.setAttribute('action', 'collages.php');
  form.setAttribute('method', 'get');
  var input=document.createElement('input');
  form.appendChild(input);
  input.placeholder="Collages";
  input.value="Collages";
  input.setAttribute('name', 'search');
  input.setAttribute('size', 17);
  input.setAttribute('onfocus', "if (this.value == 'Collages') { this.value = ''; }");
  input.setAttribute('onblur', "if (this.value == '') { this.value = 'Collages'; }");
  input.setAttribute('type', 'text');
})();