Replace Full width bang to half width

Replace Full width bang! to half width!

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name    Replace Full width bang to half width
// @name:zh-CN   替换全角!到半角!
// @namespace https://github.com/fengkx/
// @match     https://duckduckgo.com/*
// @match     https://start.duckduckgo.com/*
// @version 0.1
// @description       Replace Full width bang! to half width!
// @description:en    Replace Full width bang! to half width!
// @description:zh    替换全角bang!到半角bang!
// @description:zh-CN 替换全角bang!到半角bang!
// @grant none
//@run-at             document-end
// ==/UserScript==

var $input = document.getElementById('search_form_input_homepage') || document.getElementById('search_form_input') ;
$input && $input.addEventListener('input', function (e) {
    if($input.value.search(/^!/) === 0) {
      var start = $input.selectionStart;
      var end = $input.selectionEnd;
      this.value = this.value.replace(/^!/, '!');
      $input.selectionStart=start;
      $input.selectionEnd=end;
    }
	
})