Select2

The jQuery replacement for select boxes

2016/11/21のページです。最新版はこちら

スクリプトをインストールするには、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         Select2
// @namespace    https://select2.github.io/
// @version      0.1
// @description  The jQuery replacement for select boxes
// @author       t_liang
// @include      *:*
// @grant        none
// ==/UserScript==

(function() {
	var selects = document.getElementsByTagName('select');
	if (selects.length) {
		var protocol = location.protocol == 'https:' ? 'https:' : 'http:',
			jQueryOnload = function() {
				jQuery(function($) {
					$.getScript(protocol + '//cdn.bootcss.com/select2/4.0.3/js/select2.min.js', function() {
						$(document.head).append('<link href="' + protocol + '//cdn.bootcss.com/select2/4.0.3/css/select2.min.css" rel="stylesheet">');
						$(selects).filter(':visible').select2();
					});
				});
			};
		if (typeof jQuery == 'function') {
			var morethan = '1.6.2'.split('.', 3), version = jQuery.fn.jquery.split('.', 3);
			if (Number(morethan[0]) > require[0] || Number(morethan[1]) > require[1] || Number(morethan[2]) > require[2]) {
				jQueryOnload();
				return;
			}
		}
		// append jQuery
		var jQueryScript = document.createElement('SCRIPT');
		jQueryScript.src = protocol + '//cdn.bootcss.com/jquery/3.1.1/jquery.min.js';
		jQueryScript.onload = jQueryOnload;
		document.head.appendChild(jQueryScript);
	}
})();