Server IP : 202.29.229.35 / Your IP : 3.134.104.224 Web Server : Apache System : Linux aapanel2 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 User : www ( 1001) PHP Version : 5.5.38 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/www.ivecr2.ac.th/research/js/ |
Upload File : |
/*! * jQuery Yet Another Enter To Tab plugin * Version 0.9.6 * @requires jQuery v1.9 or later * * by Jeffrey Lee, http://blog.darkthread.net/ * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /* ver 0.9 2014-04-26 * initial version ver 0.9.5 2014-04-28 * focus loop grouping logic refactored * add options to enableEnterToTab() * add "captureTabKey" option to capture tab keydown event, prevent focus from going out of container var 0.9.6 2015-04-01 * add: simulate shift-tab reverse order behavior. [thanks for alannick's feedback] */ (function () { function focusPrev(pool) { var a = document.activeElement; if (!a || pool.index(a) == -1) { pool.first().focus(); return; } var currIdx = pool.index(a); if (currIdx > 0) pool.eq(currIdx - 1).focus(); else pool.last().focus(); }; function focusNext(pool) { var a = document.activeElement; if (!a || pool.index(a) == -1) { pool.first().focus(); return; } var currIdx = pool.index(a); if (currIdx < pool.length - 1) pool.eq(currIdx + 1).focus(); else pool.first().focus(); }; var INPUT_SELECTOR = "input,select,textarea,button", IGNORE_CSS = "e2t-ignore"; jQuery.fn.getFocusCandidates = function (tabRange) { return this.find(INPUT_SELECTOR).filter("[tabindex]:not([tabindex=-1])") //ignore disabled, readonly or invisible inputs .filter( ":not([disabled]):not([readonly]):visible" + //for enter key, e2t-ignore fields are excluded //for tab key, they are included (tabRange ? "" : ":not(." + IGNORE_CSS + ")") ) //order by tabindex .sort(function (a, b) { return a.tabIndex > b.tabIndex ? 1 : -1; }); }; var CONTAINER_CSS = "e2t-container", ACTIVE_CSS = "e2t-active"; jQuery.fn.enableEnterToTab = function (options) { var settings = $.extend({ //let ya-enter2tab control tab key behavior, prevent focus going outside of the container captureTabKey: false }, options); return this.each(function () { var $container = $(this); $container.addClass(CONTAINER_CSS) .on("keydown", "[tabindex]:not(textarea)", function (e) { var isTab = e.which == 9; var isRevTab = isTab && e.shiftKey; var isEnter = e.which == 13; var $fld = $(this); var isIgnore = $fld.is(".e2t-ignore"), isKeyOff = $fld.is(".e2t-keyoff"); if (isEnter && (isIgnore || isKeyOff)) return; if (isEnter || (settings.captureTabKey && isTab)) { e.preventDefault(); if (isRevTab) focusPrev($container.getFocusCandidates(isTab)); else focusNext($container.getFocusCandidates(isTab)); } }); }); }; })(jQuery);