PageRenderTime 28ms CodeModel.GetById 13ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

/BMTmobile-master/assets/artx-Blue/script.js

https://gitlab.com/webservers/codeigniter_mobile_dev_server
JavaScript | 177 lines | 131 code | 26 blank | 20 comment | 38 complexity | f1c92ee5d24296cca63aa6153dc7dde5 MD5 | raw file
  1/* begin Page */
  2/* Created by Artisteer v3.1.0.48375 */
  3// css helper
  4(function($) {
  5    var data = [
  6        {str:navigator.userAgent,sub:'Chrome',ver:'Chrome',name:'chrome'},
  7        {str:navigator.vendor,sub:'Apple',ver:'Version',name:'safari'},
  8        {prop:window.opera,ver:'Opera',name:'opera'},
  9        {str:navigator.userAgent,sub:'Firefox',ver:'Firefox',name:'firefox'},
 10        {str:navigator.userAgent,sub:'MSIE',ver:'MSIE',name:'ie'}];
 11    for (var n=0;n<data.length;n++)	{
 12        if ((data[n].str && (data[n].str.indexOf(data[n].sub) != -1)) || data[n].prop) {
 13            var v = function(s){var i=s.indexOf(data[n].ver);return (i!=-1)?parseInt(s.substring(i+data[n].ver.length+1)):'';};
 14            $('html').addClass(data[n].name+' '+data[n].name+v(navigator.userAgent) || v(navigator.appVersion)); break;			
 15        }
 16    }
 17})(jQuery);
 18/* end Page */
 19
 20/* begin Menu */
 21jQuery(function () {
 22    if (!jQuery.browser.msie || parseInt(jQuery.browser.version) > 7) return;
 23    jQuery('ul.art-hmenu>li:not(:first-child)').each(function () { jQuery(this).prepend('<span class="art-hmenu-separator"> </span>'); });
 24    if (!jQuery.browser.msie || parseInt(jQuery.browser.version) > 6) return;
 25    jQuery('ul.art-hmenu li').each(function () {
 26        this.j = jQuery(this);
 27        this.UL = this.j.children('ul:first');
 28        if (this.UL.length == 0) return;
 29        this.A = this.j.children('a:first');
 30        this.onmouseenter = function () {
 31            this.j.addClass('art-hmenuhover');
 32            this.UL.addClass('art-hmenuhoverUL');
 33            this.A.addClass('art-hmenuhoverA');
 34        };
 35        this.onmouseleave = function() {
 36            this.j.removeClass('art-hmenuhover');
 37            this.UL.removeClass('art-hmenuhoverUL');
 38            this.A.removeClass('art-hmenuhoverA');
 39        };
 40    });
 41});
 42
 43jQuery(function() { setHMenuOpenDirection({container: "div.art-sheet-body", defaultContainer: "#art-main", menuClass: "art-hmenu", leftToRightClass: "art-hmenu-left-to-right", rightToLeftClass: "art-hmenu-right-to-left"}); });
 44
 45function setHMenuOpenDirection(menuInfo) {
 46    var defaultContainer = jQuery(menuInfo.defaultContainer);
 47    defaultContainer = defaultContainer.length > 0 ? defaultContainer = jQuery(defaultContainer[0]) : null;
 48
 49    jQuery("ul." + menuInfo.menuClass + ">li>ul").each(function () {
 50        var submenu = jQuery(this);
 51        var submenuWidth = submenu.outerWidth();
 52        var submenuLeft = submenu.offset().left;
 53
 54        var mainContainer = submenu.parents(menuInfo.container);
 55        mainContainer = mainContainer.length > 0 ? mainContainer = jQuery(mainContainer[0]) : null;
 56
 57        var container = mainContainer || defaultContainer;
 58        if (container != null) {
 59            var containerLeft = container.offset().left;
 60            var containerWidth = container.outerWidth();
 61
 62            if (submenuLeft + submenuWidth >=
 63                    containerLeft + containerWidth) 
 64                /* right to left */
 65                submenu.addClass(menuInfo.rightToLeftClass).find("ul").addClass(menuInfo.rightToLeftClass);
 66            if (submenuLeft <= containerLeft)
 67                /* left to right */
 68                submenu.addClass(menuInfo.leftToRightClass).find("ul").addClass(menuInfo.leftToRightClass);
 69        }
 70    });
 71}
 72/* end Menu */
 73
 74/* begin MenuSubItem */
 75jQuery(function () {
 76    jQuery("ul.art-hmenu ul li").hover(function () { jQuery(this).prev().children("a").addClass("art-hmenu-before-hovered"); }, 
 77        function () { jQuery(this).prev().children("a").removeClass("art-hmenu-before-hovered"); });
 78});
 79
 80jQuery(function () {
 81    if (!jQuery.browser.msie) return;
 82    var ieVersion = parseInt(jQuery.browser.version);
 83    if (ieVersion > 7) return;
 84
 85    /* Fix width of submenu items.
 86    * The width of submenu item calculated incorrectly in IE6-7. IE6 has wider items, IE7 display items like stairs.
 87    */
 88    jQuery.each(jQuery("ul.art-hmenu ul"), function () {
 89        var maxSubitemWidth = 0;
 90        var submenu = jQuery(this);
 91        var subitem = null;
 92        jQuery.each(submenu.children("li").children("a"), function () {
 93            subitem = jQuery(this);
 94            var subitemWidth = subitem.outerWidth();
 95            if (maxSubitemWidth < subitemWidth)
 96                maxSubitemWidth = subitemWidth;
 97        });
 98        if (subitem != null) {
 99            var subitemBorderLeft = parseInt(subitem.css("border-left-width"), 10) || 0;
100            var subitemBorderRight = parseInt(subitem.css("border-right-width"), 10) || 0;
101            var subitemPaddingLeft = parseInt(subitem.css("padding-left"), 10) || 0;
102            var subitemPaddingRight = parseInt(subitem.css("padding-right"), 10) || 0;
103            maxSubitemWidth -= subitemBorderLeft + subitemBorderRight + subitemPaddingLeft + subitemPaddingRight;
104            submenu.children("li").children("a").css("width", maxSubitemWidth + "px");
105        }
106    });
107
108    if (ieVersion > 6) return;
109    jQuery("ul.art-hmenu ul>li:first-child>a").css("border-top-width", "1px");
110});
111/* end MenuSubItem */
112
113/* begin Layout */
114jQuery(function () {
115     var c = jQuery('div.art-content');
116    if (c.length !== 1) return;
117    var s = c.parent().children('.art-layout-cell:not(.art-content)');
118
119
120    if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 8) {
121        jQuery(window).bind('resize', function() {
122            var w = 0;
123            c.hide();
124            s.each(function() { w += this.clientWidth; });
125            c.w = c.parent().width(); c.css('width', c.w - w + 'px');
126            c.show();
127        });
128    }
129
130    jQuery(window).trigger('resize');
131});/* end Layout */
132
133/* begin VMenu */
134jQuery(function() {
135    if (!jQuery('html').hasClass('ie7')) return;
136    jQuery('ul.art-vmenu li:not(:first-child),ul.art-vmenu li li li:first-child,ul.art-vmenu>li>ul').each(function () { jQuery(this).append('<div class="art-vmenu-separator"> </div><div class="art-vmenu-separator-bg"> </div>'); });
137});
138
139
140/* end VMenu */
141
142/* begin VMenuItem */
143
144
145jQuery(function() {
146    jQuery('ul.art-vmenu a').click(function () {
147        var a = jQuery(this);
148        a.parents('ul.art-vmenu').find("ul, a").removeClass('active');
149        a.parent().children('ul').addClass('active');
150        a.parents('ul.art-vmenu ul').addClass('active');
151        a.parents('ul.art-vmenu li').children('a').addClass('active');
152    });
153});
154/* end VMenuItem */
155
156/* begin Button */
157function artButtonSetup(className) {
158    jQuery.each(jQuery("a." + className + ", button." + className + ", input." + className), function (i, val) {
159        var b = jQuery(val);
160        if (!b.parent().hasClass('art-button-wrapper')) {
161            if (b.is('input')) b.val(b.val().replace(/^\s*/, '')).css('zoom', '1');
162            if (!b.hasClass('art-button')) b.addClass('art-button');
163            jQuery("<span class='art-button-wrapper'><span class='art-button-l'> </span><span class='art-button-r'> </span></span>").insertBefore(b).append(b);
164            if (b.hasClass('active')) b.parent().addClass('active');
165        }
166        b.mouseover(function () { jQuery(this).parent().addClass("hover"); });
167        b.mouseout(function () { var b = jQuery(this); b.parent().removeClass("hover"); if (!b.hasClass('active')) b.parent().removeClass('active'); });
168        b.mousedown(function () { var b = jQuery(this); b.parent().removeClass("hover"); if (!b.hasClass('active')) b.parent().addClass('active'); });
169        b.mouseup(function () { var b = jQuery(this); if (!b.hasClass('active')) b.parent().removeClass('active'); });
170    });
171}
172jQuery(function() { artButtonSetup("art-button"); });
173
174/* end Button */
175
176
177