/** * Stylish Select 0.4.9 - jQuery plugin to replace a select drop down box with a stylable unordered list * http://github.com/scottdarby/Stylish-Select* * Requires: jQuery 1.3 or newer* * Contributions from Justin Beasley: http://www.harvest.org/ * Anatoly Ressin: http://www.artazor.lv/ Wilfred Hughes: https://github.com/Wilfred * Grigory Zarubin: https://github.com/Craigy- * modified by Samarth Salian * Dual licensed under the MIT and GPL licenses. */ (function(e){e("html").addClass("stylish-select");if(!Array.prototype.indexOf){Array.prototype.indexOf=function(e){if(this===void 0||this===null)throw new TypeError;var t=Object(this);var n=t.length>>>0;if(n===0)return-1;var r=0;if(arguments.length>0){r=Number(arguments[1]);if(r!==r)r=0;else if(r!==0&&r!==1/0&&r!==-(1/0))r=(r>0||-1)*Math.floor(Math.abs(r))}if(r>=n)return-1;var i=r>=0?r:Math.max(n-Math.abs(r),0);for(;i'+r+"").data({key:i,selected:e(t).is(":selected")}))}function b(){var t=o.offset().top,n=e(window).height(),s=e(window).scrollTop();if(m>parseInt(r.ddMaxHeight)){m=parseInt(r.ddMaxHeight)}t=t-s;if(t+m>=n){a.css({height:m});u.css({top:"-"+m+"px",height:m});i.onTop=true}else{a.css({height:m});u.css({top:g+"px",height:m});i.onTop=false}}function w(){o.css("position","relative")}function E(){o.css({position:"static"})}function S(e,t){if(e==true){l=f;i.change()}if(t==true){f=l;x(f)}u.hide();E()}function x(e,t){if(e==-1){s.text(r.defaultText);d.removeClass("hiLite")}else{d.removeClass("hiLite").eq(e).addClass("hiLite");var n=d.eq(e).text(),o=d.eq(e).parent().data("key");try{i.val(o)}catch(a){i[0].selectedIndex=e}s.text(n);if(t==true){l=e;i.change()}if(u.is(":visible")){try{d.eq(e).focus()}catch(a){}}}}function T(t){e(t).unbind("keydown.sSelect").bind("keydown.sSelect",function(e){var t=e.which;p=true;switch(t){case 40:case 39:N();return false;break;case 38:case 37:C();return false;break;case 33:case 36:k();return false;break;case 34:case 35:L();return false;break;case 13:case 27:S(true);return false;break;case 9:S(true);var n=false;if(document.getElementById("TranRequestManagerFG.INITOR_ACCOUNT")!=null||document.getElementById("VIEW_MINI_STATEMENT")!=null||document.getElementById("AuthenticationFG.USER_PRINCIPAL")!=null||"OpAccountSummary"==jQuery("[id='AccountSummaryFG.REPORTTITLE']").val()){if(e.shiftKey){n=true}else{}A(n)}else{O()}return false;break}keyPressed=String.fromCharCode(t).toLowerCase();var r=c.indexOf(keyPressed);if(typeof r!="undefined"){++f;f=c.indexOf(keyPressed,f);if(f==-1||f==null||h!=keyPressed){f=c.indexOf(keyPressed)}x(f);h=keyPressed;return false}})}function N(){if(f0){--f;x(f)}}function k(){f=0;x(f)}function L(){f=y-1;x(f)}function A(e){var t;if(jQuery("#Transaction").val()=="TPF"){t=jQuery("body").find("[id='TranRequestManagerFG.INITOR_ACCOUNT'],[id='TranRequestManagerFG.DESTINATION_DETAILS_STRING_P'],[id='TranRequestManagerFG.ENTRY_AMT'],[id='TranRequestManagerFG.ENT_REMARKS'],[id='TranRequestManagerFG.TXN_DATE'],[id='TranRequestManagerFG.FREQ_TYPE'],[id='TranRequestManagerFG.REC_FREQ'],[id='TranRequestManagerFG.TOT_NO_INST'],[id='CONTINUE_TRANSACTION'],[id='ADD_PAYEE']")}else if(jQuery("#Transaction").val()=="DFT"||jQuery("#Transaction").val()=="IFS"){t=jQuery("body").find("[id='TranRequestManagerFG.NWK_TYP']:checked,[id='TranRequestManagerFG.INITOR_ACCOUNT'],[id='TranRequestManagerFG.DESTINATION_DETAILS_STRING_S'],[id='TranRequestManagerFG.ENTRY_AMT'],[id='TranRequestManagerFG.ENT_REMARKS'],[id='TranRequestManagerFG.TXN_DATE'],[id='TranRequestManagerFG.FREQ_TYPE'],[id='TranRequestManagerFG.REC_FREQ'],[id='TranRequestManagerFG.TOT_NO_INST'],[id='TranRequestManagerFG.RTGS_PURPOSE'],[id='TranRequestManagerFG.RTGS_PRIORITY'],[id='CONTINUE_TRANSACTION'],[id='ADD_PAYEE']")}else if(document.getElementById("AuthenticationFG.USER_PRINCIPAL")!=null){t=jQuery("body").find("[id='AuthenticationFG.USER_PRINCIPAL'],[id='AuthenticationFG.ACCESS_CODE'],[id='AuthenticationFG.MENU_ID'],[id='AuthenticationFG.REMEMBER_USERID_CHECKBOX'],[id^=VALIDATE_CREDENTIALS],[id='Caption29543082']")}else if(jQuery("#Transaction").val()=="BLP"){t=jQuery("body").find("[id='TranRequestManagerFG.INITOR_ACCOUNT'],[id='TranRequestManagerFG.ENTRY_AMT'],[id='TranRequestManagerFG.ENT_REMARKS'],[id='TranRequestManagerFG.TXN_DATE'],[id='TranRequestManagerFG.FREQ_TYPE'],[id='TranRequestManagerFG.REC_FREQ'],[id='TranRequestManagerFG.TOT_NO_INST'],[id='BACK_FOR_CP'],[id='CONTINUE_TRANSACTION']")}else if("OpAccountSummary"==jQuery("[id='AccountSummaryFG.REPORTTITLE']").val()){t=jQuery("body").find("[id='AccountSummaryFG.SELECTED_INDEX'],[id^='HREF_actNicNameOutput'],[id='VIEW_MINI_STATEMENT'],[id='VIEW_TRANSACTION_HISTORY'],[id='AccountSummaryFG.NAVIGATION_OPTION__'],[id='Action.ACCESS_CONTROL_EVENT__']")}else if(jQuery("#Transaction").val()=="BSP"){t=jQuery("body").find("[id='TranRequestManagerFG.INITOR_ACCOUNT'],[id='TranRequestManagerFG.ENT_REMARKS'],[id='TranRequestManagerFG.TXN_DATE'],[id='CONTINUE_TRANSACTION']")}else if(jQuery("#Transaction").val()=="ICC"){t=jQuery("body").find("[id='TranRequestManagerFG.INITOR_ACCOUNT'],[id='TranRequestManagerFG.DESTINATION_DETAILS_STRING_S'],[id='TranRequestManagerFG.ENTRY_AMT'],[id='TranRequestManagerFG.ENT_REMARKS'],[id='TranRequestManagerFG.TXN_DATE'],[id='TranRequestManagerFG.FREQ_TYPE'],[id='TranRequestManagerFG.REC_FREQ'],[id='TranRequestManagerFG.TOT_NO_INST'],[id='BACK_FOR_CP'],[id='CONTINUE_TRANSACTION']")}else if(jQuery("#Transaction").val()=="VCC"){t=jQuery("body").find("[id='TranRequestManagerFG.INITOR_ACCOUNT'],[id='TranRequestManagerFG.DESTINATION_DETAILS_STRING_S'],[id='TranRequestManagerFG.ENTRY_AMT'],[id='TranRequestManagerFG.ENT_REMARKS'],[id='TranRequestManagerFG.TXN_DATE'],[id='BACK_FOR_CP'],[id='CONTINUE_TRANSACTION']")}if(e){t=t.get().reverse();t=M(t)}index=t.index(i);if(index>-1&&index+1-1&&index+1<=t.length){t.eq(0).focus()}return false}function O(){var t=e("body").find("button,input,textarea,select"),n=t.index(i);if(n>-1&&n+1'),o=e('
'),u=e(''),a=e('
    '),f=-1,l=-1,c=[],h=false,p=false,d;e(this).data("ssOpts",t);if(e(this).next(".newListSelected").length){return}o.insertAfter(i);o.attr("tabindex",i.attr("tabindex")||"0");s.prependTo(o);a.appendTo(o);a.wrap(u);u=a.parent();i.hide();if(i.is(":disabled")){return}s.data("ssReRender",!s.is(":visible"));i.children().each(function(){if(e(this).is("option")){v(this,a)}else{var t=e(this).attr("label"),n=e('
  • '+t+"
  • "),r=e("
      ");n.appendTo(a);r.appendTo(n);e(this).children().each(function(){v(this,r)})}});d=a.find("li a:not(.newListItemDisabled)").not(function(){return e(this).parents().hasClass("newListOptionDisabled")});d.each(function(t){if(e(this).parent().data("selected")){r.defaultText=e(this).html();f=l=t}});var m=a.height(),g=o.height(),y=d.length;if(f!=-1){x(f)}else{s.text(r.defaultText)}b();e(window).bind("resize.sSelect scroll.sSelect",b);s.bind("click.sSelect",function(t){t.stopPropagation();if(e(this).data("ssReRender")){m=a.height("").height();u.height("");g=o.height();e(this).data("ssReRender",false);b()}e(".SSContainerDivWrapper").not(e(this).next()).hide().parent().css("position","static").removeClass("newListSelFocus");u.toggle();w();if(f==-1)f=0;try{d.eq(f).focus()}catch(n){}});d.bind("click.sSelect",function(t){var n=e(t.target);f=d.index(n);p=true;x(f,true);S()});d.bind("mouseenter.sSelect",function(t){var n=e(t.target);n.addClass("newListHover")}).bind("mouseleave.sSelect",function(t){var n=e(t.target);n.removeClass("newListHover")});i.bind("change.sSelect",function(t){var n=e(t.target);if(p==true){p=false;return false}var r=n.find(":selected");f=n.find("option").index(r);x(f)});o.bind("click.sSelect",function(e){e.stopPropagation();T(this)});o.bind("focus.sSelect",function(){e(this).addClass("newListSelFocus");T(this)});o.bind("blur.sSelect",function(){e(this).removeClass("newListSelFocus")});e(document).bind("click.sSelect",function(){o.removeClass("newListSelFocus");if(u.is(":visible")){S(false,true)}else{S(false)}});i.focus(function(){i.next().focus()});s.bind("mouseenter.sSelect",function(t){var n=e(t.target);n.parent().addClass("newListSelHover")}).bind("mouseleave.sSelect",function(t){var n=e(t.target);n.parent().removeClass("newListSelHover")});u.css({left:"0",display:"none",visibility:"visible"})})}})(jQuery)