Plugin Directory

Changeset 2732507


Ignore:
Timestamp:
05/27/2022 09:46:39 AM (4 years ago)
Author:
Access Keys
Message:
  • Added animation demo for menu label.
  • Minor bug fixes.
Location:
ap-mega-menu/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • ap-mega-menu/trunk/ap-mega-menu.php

    r2684307 r2732507  
    55  Plugin URI:  https://accesspressthemes.com/wordpress-plugins/ap-mega-menu/
    66  Description: Horizontal & Vertical layout Mega menu | Responsive & User friendly | Widgetized, Drag & Drop | Built-in and custom layouts
    7   Version:     3.0.8
     7  Version:     3.0.9
    88  Author:      AccessPress Themes
    99  Author URI:  http://accesspressthemes.com
     
    1313  Text Domain: ap-mega-menu
    1414 */
    15 defined( 'APMM_VERSION' ) or define( 'APMM_VERSION', '3.0.8' ); //plugin version
     15defined( 'APMM_VERSION' ) or define( 'APMM_VERSION', '3.0.9' ); //plugin version
    1616defined( 'APMM_TITLE' ) or define( 'APMM_TITLE', 'AP MEGA MENU' ); //plugin version
    1717defined( 'APMM_TD' ) or define( 'APMM_TD', 'ap-mega-menu' ); //plugin's text domain
     
    446446            if ( 'nav-menus.php' == $hooks ) {
    447447                wp_enqueue_style( 'wpmm-icon-picker-genericons',  APMM_CSS_DIR . '/wpmm-icons/genericons.css', true, APMM_TD );
     448
    448449                wp_enqueue_style( 'wpmm-icon-picker-font-awesome',  APMM_CSS_DIR . '/wpmm-icons/font-awesome/font-awesome.css', true, APMM_TD );
    449450                do_action( "wp_megamenu_nav_menus_scripts", $hooks );
  • ap-mega-menu/trunk/css/backend.css

    r2550291 r2732507  
    13211321    position: relative;
    13221322    background: none;
    1323     width: 50%;
     1323    width: 100%;
    13241324    font-size: 13px;
    13251325    border-radius: 3px;
     
    14061406=================
    14071407*/
     1408td.apmega-value
     1409{
     1410    width: 20%;
     1411}
    14081412.apmega-value input[type="text"] {
    1409     width: 50%;
     1413    width: 100%;
    14101414    height: 35px;
    14111415    border-radius: 3px;
     
    21442148    }
    21452149    .apmm-content .sbHolder {
    2146         width: 96%;
     2150        width: 100%;
    21472151    }
    21482152    .apmm-form-field #apmm-add-button,
     
    22572261    }
    22582262}
     2263.mlabel_animation_demo_label
     2264{
     2265   position:absolute;
     2266  bottom: 31px;
     2267    right: 25px;
     2268    background: yellow;
     2269    color: black;
     2270    font-weight: 500;
     2271    text-transform: uppercase;
     2272    font-size: 10px;
     2273    padding: 2px 6px;
     2274    border-radius: 3px;
     2275   webkit-animation-name: none;
     2276    animation-name:none ;
     2277    -webkit-transform-origin: center bottom;
     2278    transform-origin: center bottom;
     2279    -webkit-animation-duration: 4s;
     2280    -webkit-animation-delay: 2s;
     2281    -webkit-animation-iteration-count:20;
     2282}
     2283
     2284.mlabel_animation_demo_page
     2285{
     2286    width: 33%;
     2287    background: #00c0ef;
     2288    margin: 0 auto;
     2289    text-align: center;
     2290    color: white;
     2291    font-size: 1.2em;
     2292    font-family: sans-serif;
     2293    border-radius: 5px;
     2294    padding :7px;
     2295    position: relative;
     2296   
     2297}
     2298span.mlabel_animation_demo_label:before
     2299{
     2300    content: '';
     2301    position: absolute;
     2302    width: 0;
     2303    height: 0;
     2304    border-style: solid;
     2305    border-width: 7px 4.5px 0 4.5px;
     2306    border-color: yellow transparent transparent transparent;
     2307    bottom: -6px;
     2308    left: 0;
     2309    right: 0;
     2310    margin-left: auto;
     2311    margin-right: auto;
     2312}
     2313select.mlabel_animation_select
     2314{
     2315    width: 100%;
     2316   border: 1px solid #f7ae37;
     2317   border: 1px solid #f7ae37;
     2318    min-height: 35px;
     2319    padding: 0 10px;
     2320    position: relative;
     2321   
     2322    width: 100%;
     2323    font-size: 13px;
     2324    border-radius: 3px
     2325}
  • ap-mega-menu/trunk/inc/admin/menu_settings_class.php

    r2631320 r2732507  
    278278    wp_enqueue_style('wpmm-custom-select-css', APMM_CSS_DIR . '/jquery.selectbox.css', array(), APMM_TD);
    279279    wp_enqueue_style('wp_megamenu-admin-style', APMM_CSS_DIR . '/backend.css', false, APMM_TD);
    280 
     280    wp_enqueue_style( 'wpmm-animate-css', APMM_CSS_DIR . '/animate.css', false, APMM_TD );
    281281    wp_enqueue_script('wp_megamenu-color-alpha-scripts', APMM_JS_DIR . '/wp-color-picker-alpha.js', array('wp-color-picker'), false, APMM_TD);
    282282
  • ap-mega-menu/trunk/inc/backend/main_page.php

    r2631320 r2732507  
    2323$theme_object = new AP_Theme_Settings();
    2424$custom_theme = $theme_object->get_custom_theme_data('');
     25
    2526?>
    2627<div class="apmm-settings-main-wrapper">
  • ap-mega-menu/trunk/inc/backend/tabs/general-settings.php

    r2376438 r2732507  
    1 <?php defined('ABSPATH') or die("No script kiddies please!"); ?>
     1<?php defined('ABSPATH') or die("No script kiddies please!");
     2 
     3    ?>
     4
    25<div class="apmega_left_content_wrapper general_settings">
    36
     
    2730                        </td>
    2831                        <td class='apmega-value'>
    29                            <select name="mlabel_animation_type" class="wpmm-selection">
     32                           <select name="mlabel_animation_type" class="mlabel_animation_select" onchange="toggle(this)">
    3033                               <option value="none" <?php if($mlabel_animation_type == "none") echo "selected='selected'";?>><?php _e('None',APMM_TD);?></option>
    3134                               <option value="mybounce" <?php if($mlabel_animation_type == "mybounce") echo "selected='selected'";?>><?php _e('Bounce',APMM_TD);?></option>
     35
    3236                               <option value="flash" <?php if($mlabel_animation_type == "flash") echo "selected='selected'";?>><?php _e('Flash',APMM_TD);?></option>
    3337                               <option value="shake" <?php if($mlabel_animation_type == "shake") echo "selected='selected'";?>><?php _e('Shake',APMM_TD);?></option>
     
    4044                               <option value="slideInDown" <?php if($mlabel_animation_type == "slideInDown") echo "selected='selected'";?>><?php _e('SlideInDown',APMM_TD);?></option>
    4145                           </select>
    42                         </td>
     46
     47                        </td>
     48
     49                        <td class='apmega-value'>
     50
     51                           <div class="mlabel_animation_demo">
     52                            <p class="mlabel_animation_demo_page">HOME<span id="mlabel_animation_demo_label_id" class="mlabel_animation_demo_label">NEW</span></p>
     53                        </div>
     54                        </td>
     55
    4356                    </tr>
    4457
     
    235248
    236249</div>
     250 
     251<script type="text/javascript">
     252    anim_it=document.getElementsByName("animation_iteration_count")[0].addEventListener('change', change_count);
     253    anim_delay=document.getElementsByName("animation_delay")[0].addEventListener('change', change_delay);
     254    anim_dur=it_count=document.getElementsByName("animation_duration")[0].addEventListener('change', change_dur);
     255    elem = document.getElementById('mlabel_animation_demo_label_id');
     256    function toggle(el){
     257    var value = el.options[el.selectedIndex].value;
     258       
     259
     260    if (value === 'mybounce' ) {
     261        elem.style.animationName = 'bounce';
     262    }
     263    if (value === 'flash')
     264    {
     265        elem.style.animationName = 'flash';
     266    }
     267     if (value === 'shake')
     268    {
     269        elem.style.animationName = 'shake';
     270    }
     271     if (value === 'swing')
     272    {
     273        elem.style.animationName = 'swing';
     274    }
     275     if (value === 'tada')
     276    {
     277        elem.style.animationName = 'tada';
     278    }
     279      if (value === 'bounceIn')
     280    {
     281        elem.style.animationName = 'bounceIn';
     282    }
     283     if (value === 'flipInX')
     284    {
     285        elem.style.animationName ='flipInX';
     286    }
     287      if (value === 'flipInY')
     288    {
     289        elem.style.animationName = 'flipInY';
     290    }
     291      if (value === 'slideInUp')
     292    {
     293        elem.style.animationName = 'slideInUp';
     294    }
     295      if (value === 'slideInDown')
     296    {
     297        elem.style.animationName = 'slideInDown';
     298    }
     299      if (value === 'none')
     300    {
     301        elem.style.animationName = 'none';
     302    }
     303   
     304}
     305 
     306    function change_count()
     307    {
     308       elem.style.animationIterationCount=this.value+'s';
     309    }
     310    function change_delay()
     311    {
     312        elem.style.animationDelay=this.value+'s';
     313    }
     314    function change_dur()
     315    {
     316        elem.style.animationDuration=this.value+'s';
     317    }
     318</script>
  • ap-mega-menu/trunk/js/jquery.selectbox-0.2.min.js

    r2376438 r2732507  
    77 * Date: Tue Jul 17 19:58:36 2012 +0300
    88 */
    9 (function($,undefined){var PROP_NAME="selectbox",FALSE=false,TRUE=true;function Selectbox(){this._state=[];this._defaults={classHolder:"sbHolder",classHolderDisabled:"sbHolderDisabled",classSelector:"sbSelector",classOptions:"sbOptions",classGroup:"sbGroup",classSub:"sbSub",classDisabled:"sbDisabled",classToggleOpen:"sbToggleOpen",classToggle:"sbToggle",classFocus:"sbFocus",speed:200,effect:"slide",onChange:null,onOpen:null,onClose:null}}$.extend(Selectbox.prototype,{_isOpenSelectbox:function(target){if(!target){return FALSE}var inst=this._getInst(target);return inst.isOpen},_isDisabledSelectbox:function(target){if(!target){return FALSE}var inst=this._getInst(target);return inst.isDisabled},_attachSelectbox:function(target,settings){if(this._getInst(target)){return FALSE}var $target=$(target),self=this,inst=self._newInst($target),sbHolder,sbSelector,sbToggle,sbOptions,s=FALSE,optGroup=$target.find("optgroup"),opts=$target.find("option"),olen=opts.length;$target.attr("sb",inst.uid);$.extend(inst.settings,self._defaults,settings);self._state[inst.uid]=FALSE;$target.hide();function closeOthers(){var key,sel,uid=this.attr("id").split("_")[1];for(key in self._state){if(key!==uid){if(self._state.hasOwnProperty(key)){sel=$("select[sb='"+key+"']")[0];if(sel){self._closeSelectbox(sel)}}}}}sbHolder=$("<div>",{id:"sbHolder_"+inst.uid,"class":inst.settings.classHolder,tabindex:$target.attr("tabindex")});sbSelector=$("<a>",{id:"sbSelector_"+inst.uid,href:"#","class":inst.settings.classSelector,click:function(e){e.preventDefault();closeOthers.apply($(this),[]);var uid=$(this).attr("id").split("_")[1];if(self._state[uid]){self._closeSelectbox(target)}else{self._openSelectbox(target)}}});sbToggle=$("<a>",{id:"sbToggle_"+inst.uid,href:"#","class":inst.settings.classToggle,click:function(e){e.preventDefault();closeOthers.apply($(this),[]);var uid=$(this).attr("id").split("_")[1];if(self._state[uid]){self._closeSelectbox(target)}else{self._openSelectbox(target)}}});sbToggle.appendTo(sbHolder);sbOptions=$("<ul>",{id:"sbOptions_"+inst.uid,"class":inst.settings.classOptions,css:{display:"none"}});$target.children().each(function(i){var that=$(this),li,config={};if(that.is("option")){getOptions(that)}else{if(that.is("optgroup")){li=$("<li>");$("<span>",{text:that.attr("label")}).addClass(inst.settings.classGroup).appendTo(li);li.appendTo(sbOptions);if(that.is(":disabled")){config.disabled=true}config.sub=true;getOptions(that.find("option"),config)}}});function getOptions(){var sub=arguments[1]&&arguments[1].sub?true:false,disabled=arguments[1]&&arguments[1].disabled?true:false;arguments[0].each(function(i){var that=$(this),li=$("<li>"),child;if(that.is(":selected")){sbSelector.text(that.text());s=TRUE}if(i===olen-1){li.addClass("last")}if(!that.is(":disabled")&&!disabled){child=$("<a>",{href:"#"+that.val(),rel:that.val()}).text(that.text()).bind("click.sb",function(e){if(e&&e.preventDefault){e.preventDefault()}var t=sbToggle,$this=$(this),uid=t.attr("id").split("_")[1];self._changeSelectbox(target,$this.attr("rel"),$this.text());self._closeSelectbox(target)}).bind("mouseover.sb",function(){var $this=$(this);$this.parent().siblings().find("a").removeClass(inst.settings.classFocus);$this.addClass(inst.settings.classFocus)}).bind("mouseout.sb",function(){$(this).removeClass(inst.settings.classFocus)});if(sub){child.addClass(inst.settings.classSub)}if(that.is(":selected")){child.addClass(inst.settings.classFocus)}child.appendTo(li)}else{child=$("<span>",{text:that.text()}).addClass(inst.settings.classDisabled);if(sub){child.addClass(inst.settings.classSub)}child.appendTo(li)}li.appendTo(sbOptions)})}if(!s){sbSelector.text(opts.first().text())}$.data(target,PROP_NAME,inst);sbHolder.data("uid",inst.uid).bind("keydown.sb",function(e){var key=e.charCode?e.charCode:e.keyCode?e.keyCode:0,$this=$(this),uid=$this.data("uid"),inst=$this.siblings("select[sb='"+uid+"']").data(PROP_NAME),trgt=$this.siblings(["select[sb='",uid,"']"].join("")).get(0),$f=$this.find("ul").find("a."+inst.settings.classFocus);switch(key){case 37:case 38:if($f.length>0){var $next;$("a",$this).removeClass(inst.settings.classFocus);$next=$f.parent().prevAll("li:has(a)").eq(0).find("a");if($next.length>0){$next.addClass(inst.settings.classFocus).focus();$("#sbSelector_"+uid).text($next.text())}}break;case 39:case 40:var $next;$("a",$this).removeClass(inst.settings.classFocus);if($f.length>0){$next=$f.parent().nextAll("li:has(a)").eq(0).find("a")}else{$next=$this.find("ul").find("a").eq(0)}if($next.length>0){$next.addClass(inst.settings.classFocus).focus();$("#sbSelector_"+uid).text($next.text())}break;case 13:if($f.length>0){self._changeSelectbox(trgt,$f.attr("rel"),$f.text())}self._closeSelectbox(trgt);break;case 9:if(trgt){var inst=self._getInst(trgt);if(inst){if($f.length>0){self._changeSelectbox(trgt,$f.attr("rel"),$f.text())}self._closeSelectbox(trgt)}}var i=parseInt($this.attr("tabindex"),10);if(!e.shiftKey){i++}else{i--}$("*[tabindex='"+i+"']").focus();break;case 27:self._closeSelectbox(trgt);break}e.stopPropagation();return false}).delegate("a","mouseover",function(e){$(this).addClass(inst.settings.classFocus)}).delegate("a","mouseout",function(e){$(this).removeClass(inst.settings.classFocus)});sbSelector.appendTo(sbHolder);sbOptions.appendTo(sbHolder);sbHolder.insertAfter($target);$("html").on("mousedown",function(e){e.stopPropagation();$("select").selectbox("close")});$([".",inst.settings.classHolder,", .",inst.settings.classSelector].join("")).mousedown(function(e){e.stopPropagation()})},_detachSelectbox:function(target){var inst=this._getInst(target);if(!inst){return FALSE}$("#sbHolder_"+inst.uid).remove();$.data(target,PROP_NAME,null);$(target).show()},_changeSelectbox:function(target,value,text){var onChange,inst=this._getInst(target);if(inst){onChange=this._get(inst,"onChange");$("#sbSelector_"+inst.uid).text(text)}value=value.replace(/\'/g,"\\'");$(target).find("option[value='"+value+"']").attr("selected",TRUE);if(inst&&onChange){onChange.apply((inst.input?inst.input[0]:null),[value,inst])}else{if(inst&&inst.input){inst.input.trigger("change")}}},_enableSelectbox:function(target){var inst=this._getInst(target);if(!inst||!inst.isDisabled){return FALSE}$("#sbHolder_"+inst.uid).removeClass(inst.settings.classHolderDisabled);inst.isDisabled=FALSE;$.data(target,PROP_NAME,inst)},_disableSelectbox:function(target){var inst=this._getInst(target);if(!inst||inst.isDisabled){return FALSE}$("#sbHolder_"+inst.uid).addClass(inst.settings.classHolderDisabled);inst.isDisabled=TRUE;$.data(target,PROP_NAME,inst)},_optionSelectbox:function(target,name,value){var inst=this._getInst(target);if(!inst){return FALSE}inst[name]=value;$.data(target,PROP_NAME,inst)},_openSelectbox:function(target){var inst=this._getInst(target);if(!inst||inst.isOpen||inst.isDisabled){return }var el=$("#sbOptions_"+inst.uid),viewportHeight=parseInt($(window).height(),10),offset=$("#sbHolder_"+inst.uid).offset(),scrollTop=$(window).scrollTop(),height=el.prev().height(),diff=viewportHeight-(offset.top-scrollTop)-height/2,onOpen=this._get(inst,"onOpen");el.css({top:height+"px",maxHeight:(diff-height)+"px"});inst.settings.effect==="fade"?el.fadeIn(inst.settings.speed):el.slideDown(inst.settings.speed);$("#sbToggle_"+inst.uid).addClass(inst.settings.classToggleOpen);this._state[inst.uid]=TRUE;inst.isOpen=TRUE;if(onOpen){onOpen.apply((inst.input?inst.input[0]:null),[inst])}$.data(target,PROP_NAME,inst)},_closeSelectbox:function(target){var inst=this._getInst(target);if(!inst||!inst.isOpen){return }var onClose=this._get(inst,"onClose");inst.settings.effect==="fade"?$("#sbOptions_"+inst.uid).fadeOut(inst.settings.speed):$("#sbOptions_"+inst.uid).slideUp(inst.settings.speed);$("#sbToggle_"+inst.uid).removeClass(inst.settings.classToggleOpen);this._state[inst.uid]=FALSE;inst.isOpen=FALSE;if(onClose){onClose.apply((inst.input?inst.input[0]:null),[inst])}$.data(target,PROP_NAME,inst)},_newInst:function(target){var id=target[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:id,input:target,uid:Math.floor(Math.random()*99999999),isOpen:FALSE,isDisabled:FALSE,settings:{}}},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this selectbox"}},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]}});$.fn.selectbox=function(options){var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&options=="isDisabled"){return $.selectbox["_"+options+"Selectbox"].apply($.selectbox,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.selectbox["_"+options+"Selectbox"].apply($.selectbox,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.selectbox["_"+options+"Selectbox"].apply($.selectbox,[this].concat(otherArgs)):$.selectbox._attachSelectbox(this,options)})};$.selectbox=new Selectbox();$.selectbox.version="0.2"})(jQuery);
     9(function($, undefined) {
     10    var PROP_NAME = "selectbox",
     11        FALSE = false,
     12        TRUE = true;
     13
     14    function Selectbox() {
     15        this._state = [];
     16        this._defaults = {
     17            classHolder: "sbHolder",
     18            classHolderDisabled: "sbHolderDisabled",
     19            classSelector: "sbSelector",
     20            classOptions: "sbOptions",
     21            classGroup: "sbGroup",
     22            classSub: "sbSub",
     23            classDisabled: "sbDisabled",
     24            classToggleOpen: "sbToggleOpen",
     25            classToggle: "sbToggle",
     26            classFocus: "sbFocus",
     27            speed: 200,
     28            effect: "slide",
     29            onChange: null,
     30            onOpen: null,
     31            onClose: null
     32        }
     33    }
     34    $.extend(Selectbox.prototype, {
     35        _isOpenSelectbox: function(target) {
     36            if (!target) {
     37                return FALSE
     38            }
     39            var inst = this._getInst(target);
     40            return inst.isOpen
     41        },
     42        _isDisabledSelectbox: function(target) {
     43            if (!target) {
     44                return FALSE
     45            }
     46            var inst = this._getInst(target);
     47            return inst.isDisabled
     48        },
     49        _attachSelectbox: function(target, settings) {
     50            if (this._getInst(target)) {
     51                return FALSE
     52            }
     53            var $target = $(target),
     54                self = this,
     55                inst = self._newInst($target),
     56                sbHolder, sbSelector, sbToggle, sbOptions, s = FALSE,
     57                optGroup = $target.find("optgroup"),
     58                opts = $target.find("option"),
     59                olen = opts.length;
     60            $target.attr("sb", inst.uid);
     61            $.extend(inst.settings, self._defaults, settings);
     62            self._state[inst.uid] = FALSE;
     63            $target.hide();
     64
     65            function closeOthers() {
     66                var key, sel, uid = this.attr("id").split("_")[1];
     67                for (key in self._state) {
     68                    if (key !== uid) {
     69                        if (self._state.hasOwnProperty(key)) {
     70                            sel = $("select[sb='" + key + "']")[0];
     71                            if (sel) {
     72                                self._closeSelectbox(sel)
     73                            }
     74                        }
     75                    }
     76                }
     77            }
     78            sbHolder = $("<div>", {
     79                id: "sbHolder_" + inst.uid,
     80                class: inst.settings.classHolder,
     81                tabindex: $target.attr("tabindex")
     82            });
     83            sbSelector = $("<a>", {
     84                id: "sbSelector_" + inst.uid,
     85                href: "#",
     86                "class": inst.settings.classSelector,
     87                click: function(e) {
     88                    e.preventDefault();
     89                    closeOthers.apply($(this), []);
     90                    var uid = $(this).attr("id").split("_")[1];
     91                    if (self._state[uid]) {
     92                        self._closeSelectbox(target)
     93                    } else {
     94                        self._openSelectbox(target)
     95                    }
     96                }
     97            });
     98            sbToggle = $("<a>", {
     99                id: "sbToggle_" + inst.uid,
     100                href: "#",
     101                "class": inst.settings.classToggle,
     102                click: function(e) {
     103                    e.preventDefault();
     104                    closeOthers.apply($(this), []);
     105                    var uid = $(this).attr("id").split("_")[1];
     106                    if (self._state[uid]) {
     107                        self._closeSelectbox(target)
     108                    } else {
     109                        self._openSelectbox(target)
     110                    }
     111                }
     112            });
     113            sbToggle.appendTo(sbHolder);
     114            sbOptions = $("<ul>", {
     115                id: "sbOptions_" + inst.uid,
     116                "class": inst.settings.classOptions,
     117                css: {
     118                    display: "none"
     119                }
     120            });
     121            $target.children().each(function(i) {
     122                var that = $(this),
     123                    li, config = {};
     124                if (that.is("option")) {
     125                    getOptions(that)
     126                } else {
     127                    if (that.is("optgroup")) {
     128                        li = $("<li>");
     129                        $("<span>", {
     130                            text: that.attr("label")
     131                        }).addClass(inst.settings.classGroup).appendTo(li);
     132                        li.appendTo(sbOptions);
     133                        if (that.is(":disabled")) {
     134                            config.disabled = true
     135                        }
     136                        config.sub = true;
     137                        getOptions(that.find("option"), config)
     138                    }
     139                }
     140            });
     141
     142            function getOptions() {
     143                var sub = arguments[1] && arguments[1].sub ? true : false,
     144                    disabled = arguments[1] && arguments[1].disabled ? true : false;
     145                arguments[0].each(function(i) {
     146                    var that = $(this),
     147                        li = $("<li>"),
     148                        child;
     149                    if (that.is(":selected")) {
     150                        sbSelector.text(that.text());
     151                        s = TRUE
     152                    }
     153                    if (i === olen - 1) {
     154                        li.addClass("last")
     155                    }
     156                    if (!that.is(":disabled") && !disabled) {
     157                        child = $("<a>", {
     158                            href: "#" + that.val(),
     159                            rel: that.val()
     160                        }).text(that.text()).bind("click.sb", function(e) {
     161                            if (e && e.preventDefault) {
     162                                e.preventDefault()
     163                            }
     164                            var t = sbToggle,
     165                                $this = $(this),
     166                                uid = t.attr("id").split("_")[1];
     167                            self._changeSelectbox(target, $this.attr("rel"), $this.text());
     168                            self._closeSelectbox(target)
     169                        }).bind("mouseover.sb", function() {
     170                            var $this = $(this);
     171                            $this.parent().siblings().find("a").removeClass(inst.settings.classFocus);
     172                            $this.addClass(inst.settings.classFocus)
     173                        }).bind("mouseout.sb", function() {
     174                            $(this).removeClass(inst.settings.classFocus)
     175                        });
     176                        if (sub) {
     177                            child.addClass(inst.settings.classSub)
     178                        }
     179                        if (that.is(":selected")) {
     180                            child.addClass(inst.settings.classFocus)
     181                        }
     182                        child.appendTo(li)
     183                    } else {
     184                        child = $("<span>", {
     185                            text: that.text()
     186                        }).addClass(inst.settings.classDisabled);
     187                        if (sub) {
     188                            child.addClass(inst.settings.classSub)
     189                        }
     190                        child.appendTo(li)
     191                    }
     192                    li.appendTo(sbOptions)
     193                })
     194            }
     195            if (!s) {
     196                sbSelector.text(opts.first().text())
     197            }
     198            $.data(target, PROP_NAME, inst);
     199            sbHolder.data("uid", inst.uid).bind("keydown.sb", function(e) {
     200                var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0,
     201                    $this = $(this),
     202                    uid = $this.data("uid"),
     203                    inst = $this.siblings("select[sb='" + uid + "']").data(PROP_NAME),
     204                    trgt = $this.siblings(["select[sb='", uid, "']"].join("")).get(0),
     205                    $f = $this.find("ul").find("a." + inst.settings.classFocus);
     206                switch (key) {
     207                    case 37:
     208                    case 38:
     209                        if ($f.length > 0) {
     210                            var $next;
     211                            $("a", $this).removeClass(inst.settings.classFocus);
     212                            $next = $f.parent().prevAll("li:has(a)").eq(0).find("a");
     213                            if ($next.length > 0) {
     214                                $next.addClass(inst.settings.classFocus).focus();
     215                                $("#sbSelector_" + uid).text($next.text())
     216                            }
     217                        }
     218                        break;
     219                    case 39:
     220                    case 40:
     221                        var $next;
     222                        $("a", $this).removeClass(inst.settings.classFocus);
     223                        if ($f.length > 0) {
     224                            $next = $f.parent().nextAll("li:has(a)").eq(0).find("a")
     225                        } else {
     226                            $next = $this.find("ul").find("a").eq(0)
     227                        }
     228                        if ($next.length > 0) {
     229                            $next.addClass(inst.settings.classFocus).focus();
     230                            $("#sbSelector_" + uid).text($next.text())
     231                        }
     232                        break;
     233                    case 13:
     234                        if ($f.length > 0) {
     235                            self._changeSelectbox(trgt, $f.attr("rel"), $f.text())
     236                        }
     237                        self._closeSelectbox(trgt);
     238                        break;
     239                    case 9:
     240                        if (trgt) {
     241                            var inst = self._getInst(trgt);
     242                            if (inst) {
     243                                if ($f.length > 0) {
     244                                    self._changeSelectbox(trgt, $f.attr("rel"), $f.text())
     245                                }
     246                                self._closeSelectbox(trgt)
     247                            }
     248                        }
     249                        var i = parseInt($this.attr("tabindex"), 10);
     250                        if (!e.shiftKey) {
     251                            i++
     252                        } else {
     253                            i--
     254                        }
     255                        $("*[tabindex='" + i + "']").focus();
     256                        break;
     257                    case 27:F
     258                        self._closeSelectbox(trgt);
     259                        break
     260                }
     261                e.stopPropagation();
     262                return false
     263            }).delegate("a", "mouseover", function(e) {
     264                $(this).addClass(inst.settings.classFocus)
     265            }).delegate("a", "mouseout", function(e) {
     266                $(this).removeClass(inst.settings.classFocus)
     267            });
     268            sbSelector.appendTo(sbHolder);
     269            sbOptions.appendTo(sbHolder);
     270            sbHolder.insertAfter($target);
     271            $("html").on("mousedown", function(e) {
     272                e.stopPropagation();
     273                $("select").selectbox("close")
     274            });
     275            $([".", inst.settings.classHolder, ", .", inst.settings.classSelector].join("")).mousedown(function(e) {
     276                e.stopPropagation()
     277            })
     278        },
     279        _detachSelectbox: function(target) {
     280            var inst = this._getInst(target);
     281            if (!inst) {
     282                return FALSE
     283            }
     284            $("#sbHolder_" + inst.uid).remove();
     285            $.data(target, PROP_NAME, null);
     286            $(target).show()
     287        },
     288        _changeSelectbox: function(target, value, text) {
     289            var onChange, inst = this._getInst(target);
     290            if (inst) {
     291                onChange = this._get(inst, "onChange");
     292                $("#sbSelector_" + inst.uid).text(text)
     293            }
     294            value = value.replace(/\'/g, "\\'");
     295            $(target).find("option[value='" + value + "']").attr("selected", TRUE);
     296            if (inst && onChange) {
     297                onChange.apply((inst.input ? inst.input[0] : null), [value, inst])
     298            } else {
     299                if (inst && inst.input) {
     300                    inst.input.trigger("change")
     301                }
     302            }
     303        },
     304        _enableSelectbox: function(target) {
     305            var inst = this._getInst(target);
     306            if (!inst || !inst.isDisabled) {
     307                return FALSE
     308            }
     309            $("#sbHolder_" + inst.uid).removeClass(inst.settings.classHolderDisabled);
     310            inst.isDisabled = FALSE;
     311            $.data(target, PROP_NAME, inst)
     312        },
     313        _disableSelectbox: function(target) {
     314            var inst = this._getInst(target);
     315            if (!inst || inst.isDisabled) {
     316                return FALSE
     317            }
     318            $("#sbHolder_" + inst.uid).addClass(inst.settings.classHolderDisabled);
     319            inst.isDisabled = TRUE;
     320            $.data(target, PROP_NAME, inst)
     321        },
     322        _optionSelectbox: function(target, name, value) {
     323            var inst = this._getInst(target);
     324            if (!inst) {
     325                return FALSE
     326            }
     327            inst[name] = value;
     328            $.data(target, PROP_NAME, inst)
     329        },
     330        _openSelectbox: function(target) {
     331            var inst = this._getInst(target);
     332            if (!inst || inst.isOpen || inst.isDisabled) {
     333                return
     334            }
     335            var el = $("#sbOptions_" + inst.uid),
     336                viewportHeight = parseInt($(window).height(), 10),
     337                offset = $("#sbHolder_" + inst.uid).offset(),
     338                scrollTop = $(window).scrollTop(),
     339                height = el.prev().height(),
     340                diff = viewportHeight - (offset.top - scrollTop) - height / 2,
     341                onOpen = this._get(inst, "onOpen");
     342            el.css({
     343                top: height + "px",
     344                maxHeight: (diff - height) + "px"
     345            });
     346            inst.settings.effect === "fade" ? el.fadeIn(inst.settings.speed) : el.slideDown(inst.settings.speed);
     347            $("#sbToggle_" + inst.uid).addClass(inst.settings.classToggleOpen);
     348            this._state[inst.uid] = TRUE;
     349            inst.isOpen = TRUE;
     350            if (onOpen) {
     351                onOpen.apply((inst.input ? inst.input[0] : null), [inst])
     352            }
     353            $.data(target, PROP_NAME, inst)
     354        },
     355        _closeSelectbox: function(target) {
     356            var inst = this._getInst(target);
     357            if (!inst || !inst.isOpen) {
     358                return
     359            }
     360            var onClose = this._get(inst, "onClose");
     361            inst.settings.effect === "fade" ? $("#sbOptions_" + inst.uid).fadeOut(inst.settings.speed) : $("#sbOptions_" + inst.uid).slideUp(inst.settings.speed);
     362            $("#sbToggle_" + inst.uid).removeClass(inst.settings.classToggleOpen);
     363            this._state[inst.uid] = FALSE;
     364            inst.isOpen = FALSE;
     365            if (onClose) {
     366                onClose.apply((inst.input ? inst.input[0] : null), [inst])
     367            }
     368            $.data(target, PROP_NAME, inst)
     369        },
     370        _newInst: function(target) {
     371            var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, "\\\\$1");
     372            return {
     373                id: id,
     374                input: target,
     375                uid: Math.floor(Math.random() * 99999999),
     376                isOpen: FALSE,
     377                isDisabled: FALSE,
     378                settings: {}
     379            }
     380        },
     381        _getInst: function(target) {
     382            try {
     383                return $.data(target, PROP_NAME)
     384            } catch (err) {
     385                throw "Missing instance data for this selectbox"
     386            }
     387        },
     388        _get: function(inst, name) {
     389            return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name]
     390        }
     391    });
     392    $.fn.selectbox = function(options) {
     393        var otherArgs = Array.prototype.slice.call(arguments, 1);
     394        if (typeof options == "string" && options == "isDisabled") {
     395            return $.selectbox["_" + options + "Selectbox"].apply($.selectbox, [this[0]].concat(otherArgs))
     396        }
     397        if (options == "option" && arguments.length == 2 && typeof arguments[1] == "string") {
     398            return $.selectbox["_" + options + "Selectbox"].apply($.selectbox, [this[0]].concat(otherArgs))
     399        }
     400        return this.each(function() {
     401            typeof options == "string" ? $.selectbox["_" + options + "Selectbox"].apply($.selectbox, [this].concat(otherArgs)) : $.selectbox._attachSelectbox(this, options)
     402        })
     403    };
     404    $.selectbox = new Selectbox();
     405    $.selectbox.version = "0.2"
     406})(jQuery);
  • ap-mega-menu/trunk/readme.txt

    r2684307 r2732507  
    55Requires at least: 3.8
    66Tested up to: 5.9
    7 Stable tag: 3.0.8
     7Stable tag: 3.0.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    240240
    241241== Changelog ==
     242= 3.0.9 =
     243* Added  animation demo for menu label.
     244* Minor bug fixes.
     245
     246
    242247= 3.0.8 =
    243248* Minor bug fixes.
Note: See TracChangeset for help on using the changeset viewer.