Neopets Autocomplete Disabler

Customizable. Disable autocomplete on various textboxes around the site.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Neopets Autocomplete Disabler
// @namespace    https://greasyfork.org/en/scripts/454043
// @version      0.2
// @description  Customizable. Disable autocomplete on various textboxes around the site.
// @author       Naud
// @license      MIT
// @match        *://www.neopets.com/*
// ==/UserScript==

// YOUR SETTINGS
// ----------------------------------------------------------------
// Enter "true" to allow the script to disable autocomplete on that item.
// Enter "false" to set the textbox back to its default behavior. (Your previous searches will still be there.)
var haggle =        true;       // Haggle box when you buy an item
var search =        true;       // Search bar
var bankDeposit =   true;       // Deposit box at the bank
var bankWithdraw =  true;       // Withdraw box at the bank
var yourShopPrice = true;       // Price box for your own shop items (Also affects Shop Till withdraw box)
var ssw =           true;       // Super Shop Wizard search box
// ----------------------------------------------------------------

var d = document;

// Haggle box when you buy an item
if (haggle) {
    var rsElement = d.getElementsByName("current_offer").item(0);
    if (rsElement) {
        rsElement.setAttribute("autocomplete", "off");
    }
}

// Search bar
if (search) {
    var searchElementList = d.getElementsByName("q");
    for (var i = 0; i < searchElementList.length; i++) {
        searchElementList.item(i).setAttribute("autocomplete", "off");
    }
}

// Deposit box at the bank
if (bankDeposit) {
    var depositFormElement = d.getElementById("frmDeposit");
    if (depositFormElement) {
        depositFormElement.setAttribute("autocomplete", "off");
    }
}

// Withdraw box at the bank
if (bankWithdraw) {
    var withdrawFormElement = d.getElementById("frmWithdraw");
    if (withdrawFormElement) {
        withdrawFormElement.setAttribute("autocomplete", "off");
    }
}

// Price box for your own shop items (Also affects Shop Till withdraw box)
if (yourShopPrice) {
    var shopFormElement = d.querySelector("form[action='process_market.phtml']");
    if (shopFormElement) {
        shopFormElement.setAttribute("autocomplete", "off");
    }
}

// Super Shop Wizard search box
if (ssw) {
    var sswElement = d.getElementById("searchstr");
    if (sswElement) {
        sswElement.setAttribute("autocomplete", "off");
    }
}