07a632321e4b1ea10355c7d5c984c25bd573a7e0.svn-base
6.13 KB
(function(b){b.eb=b.eb||{};b.eb.ie6=function(){return navigator.userAgent.toLowerCase().indexOf("msie 6.0")>-1};b.eb.color=function(){var c=function(e,d){var f="0";e=e+"";while(e.length<d){e=f+e}return e};this.changeColor=function(e,h,k){e=e.replace(/^\s*|\s*$/,"");e=e.replace(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i,"#$1$1$2$2$3$3");var j=Math.round(h*256)*(k?-1:1),f=e.match(new RegExp("^rgba?\\(\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\s*,\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])\\s*,\\s*(\\d|[1-9]\\d|1\\d{2}|2[0-4][0-9]|25[0-5])(?:\\s*,\\s*(0|1|0?\\.\\d+))?\\s*\\)$","i")),i=!!f&&f[4]!=null?f[4]:null,d=!!f?[f[1],f[2],f[3]]:e.replace(/^#?([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i,function(){return parseInt(arguments[1],16)+","+parseInt(arguments[2],16)+","+parseInt(arguments[3],16)}).split(/,/),g;return !!f?"rgb"+(i!==null?"a":"")+"("+Math[k?"max":"min"](parseInt(d[0],10)+j,k?0:255)+", "+Math[k?"max":"min"](parseInt(d[1],10)+j,k?0:255)+", "+Math[k?"max":"min"](parseInt(d[2],10)+j,k?0:255)+(i!==null?", "+i:"")+")":["#",c(Math[k?"max":"min"](parseInt(d[0],10)+j,k?0:255).toString(16),2),c(Math[k?"max":"min"](parseInt(d[1],10)+j,k?0:255).toString(16),2),c(Math[k?"max":"min"](parseInt(d[2],10)+j,k?0:255).toString(16),2)].join("")};this.lighten=function(d,e){return changeColor(d,e,false)};this.darken=function(d,e){return changeColor(d,e,true)};return this}();function a(g){var i=function(k){k.each(function(){var l=0;b(this).children("li").each(function(){var m=b(this).outerWidth();if(m>l){l=m}});b(this).width(l)})};if(b.eb.ie6()){g=g||b("html");b("a").bind("focus",function(){if(this.blur){this.blur()}});b('.row-fluid [class*="span"]:first-child, .row [class*="span"]:first-child').addClass("span-first-child");b(".dropdown-submenu > a",g).after('<span class="dropdown-tri"></span>');b(".dropdown-submenu.pull-left",g).removeClass("pull-left").addClass("dropdown-submenu-pull-left");i(b(".dropdown-menu:visible",g));var f=["btn-primary","btn-warning","btn-danger","btn-success","btn-info","btn-inverse"];var d=["btn-mini","btn-small","btn-large"];
b(".btn-group",g).parent().find(".btn-group:eq(0)").addClass("btn-group-first");b(".btn",g).parent().find(".btn:eq(0)").addClass("btn-first");b("body",g).on("mouseenter",".btn",function(){var k=b(this);var l="btn-hover";k.data("ie6hover",l);b.each(f,function(n,m){if(k.hasClass(m)){l=m+"-hover";k.data("ie6hover",l);return false}});k.addClass(l)}).on("mouseleave",".btn",function(){var k=b(this);var l=k.data("ie6hover");k.removeData("ie6hover");if(l){k.removeClass(l)}});b(".btn.dropdown-toggle",g).each(function(){var l=b(this);var k="btn-dropdown-toggle";l.addClass(k);k=null;b.each(f,function(n,m){if(l.hasClass(m)){k=m+"-dropdown-toggle";return false}});if(k){l.addClass(k)}k=null;b.each(d,function(n,m){if(l.hasClass(m)){k=m+"-dropdown-toggle";return false}});if(k){l.addClass(k)}});b(".btn + .btn.dropdown-toggle",g).each(function(){var k=b(this);var l=k.css("background-color");k.css("background-color",b.eb.color.darken(l,0.1))});var e=function(n){var l=b(this);var k=n.data.cls;var m=b(".dropdown-menu:visible",this);if(m.length){i(m)}if(l.hasClass("open")&&!l.hasClass(k+"-open")){l.addClass(k+"-open")}else{if(!l.hasClass("open")&&l.hasClass(k+"-open")){l.removeClass(k+"-open")}}l.one("propertychange",{cls:k},e)};b.each(["btn-group","dropdown"],function(m,l){b("."+l,g).one("propertychange",{cls:l},e)});b(".btn.disabled",g).addClass("btn-disabled");var j=function(m){var l=b(this);var k=m.data.cls;if(l.hasClass("disabled")&&!l.hasClass(k+"-disabled")){l.addClass(k+"-disabled")}else{if(!l.hasClass("disabled")&&l.hasClass(k+"-disabled")){l.removeClass(k+"-disabled")}}l.one("propertychange",{cls:k},j)};b.each(["btn"],function(m,l){b("."+l,g).one("propertychange",{cls:l},j)});b("table.table-hover",g).on("mouseenter","tr",function(){b(this).addClass("tr-hover")}).on("mouseleave","tr",function(){b(this).removeClass("tr-hover")});b('input[type="file"], input[type="image"], input[type="submit"], input[type="reset"], input[type="button"], input[type="radio"], input[type="checkbox"], input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"]',g).each(function(){var k=b(this);
k.addClass("input-"+k.attr("type"))});b(".form-horizontal .controls:first-child",g).addClass("controls-first-child");b(".checkbox.inline",g).addClass("checkbox-inline");b(".radio.inline",g).addClass("radio-inline");b("select[multiple]",g).addClass("select-multiple");b("select[size]",g).addClass("select-size");b("input[disabled], select[disabled], textarea[disabled]",g).each(function(){var k=b(this);k.addClass(k[0].tagName.toLowerCase()+"-disabled")});b("input[readonly], select[readonly], textarea[readonly]",g).each(function(){var k=b(this);k.addClass(k[0].tagName.toLowerCase()+"-readonly")});b('input[type="radio"][disabled], input[type="checkbox"][disabled]',g).each(function(){var k=b(this);k.addClass(k.attr("type").toLowerCase()+"-disabled")});b('input[type="radio"][readonly], input[type="checkbox"][readonly]',g).each(function(){var k=b(this);k.addClass(k.attr("type").toLowerCase()+"-readonly")});var c=["warning","success","error","info"];b.each(c,function(m,l){b(".control-group."+l,g).addClass("control-group-"+l)});var h=function(l){if(l.originalEvent.propertyName.toLowerCase()=="classname"){var k=b(this);b.each(c,function(n,m){var o="control-group-"+m;if(k.hasClass(m)){if(!k.hasClass(o)){k.addClass(o)}}else{if(k.hasClass(o)){k.removeClass(o)}}})}b(this).one("propertychange",h)};b(".control-group",g).one("propertychange",h);b(".pagination ul li:first-child",g).addClass("first-child");b('[class^="icon-"], [class*=" icon-"]').addClass("icon-xxx");b(".carousel-control.left",g).removeClass("left").addClass("carousel-control-left");b(".carousel-control.right",g).removeClass("right").addClass("carousel-control-right");b(".carousel-caption").each(function(){var k=b(this);var l=k.outerWidth()-k.width();k.width(k.parents(".carousel-inner .item").width()-l)})}}b.bootstrapIE6=a;b(document).ready(function(){a()})})(jQuery);