Gmail:Filter Query Area Expander (multi line text area)

Gmail filter query input box replace text area. So you can write down multi lines.Gmailのフィルタ機能で、マッチングルールを複数行のテキストエリアに置き換えます。

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Gmail:Filter Query Area Expander (multi line text area)
// @namespace    http://fruitriin.sakura.ne.jp/
// @version      1.00
// @description  Gmail filter query input box replace text area. So you can write down multi lines.Gmailのフィルタ機能で、マッチングルールを複数行のテキストエリアに置き換えます。
// @author       FruitRiin (果物リン)
// @match        http://mail.google.com/*
// @match        https://mail.google.com/*
// @require      http://code.jquery.com/jquery-2.1.4.min.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/autosize.js/3.0.8/autosize.js
// @grant        none
// ==/UserScript==


$(function(){
    expandFilterBox();
    $(document).on("focus","div.ZZ input",function(){
          expandFilterBox();
    });

    function expandFilterBox(){
        $("div.ZZ input[type=text]").each(function(i,e){
            if($(this).attr("class") == "nr") return true;
            var dir = "";
            if( $(this).attr("dir") !== undefined)
                dir =  "dir="+ $(this).attr("dir");
            $(this).replaceWith("<textarea id="+ $(this).attr("id") +" class=\""+ $(this).attr("class") +"\" "+dir+" style=max-height:140px; >" + $(this).attr("value") + "</textarea>");

        })
        autosize($("div.ZZ textarea"));
    }
    
});