Вход Регистрация
Файл: js/xenforo/full/permission.js
Строк: 126
<?php
/** @param {jQuery} $ jQuery Object */
!function($, windowdocument_undefined)
{
    
XenForo.PermissionChoicesOld = function($element) { this.__construct($element); };
    
XenForo.PermissionChoicesOld.prototype =
    {
        
__construct: function($form)
        {
            var 
$replaceBase_this$tooltipOptionsttOptions = {};

            
this.$form $form;
            
this.$selects $form.find('select.PermissionChoice');
            
this.$revokeOption $form.find('.RevokeOption input[type="checkbox"]');

            
$tooltipOptions $form.find('.PermissionTooltipOption');
            if (
$tooltipOptions.length)
            {
                
$tooltipOptions.each(function()
                {
                    var 
$this = $(this);
                    $(
$this.data('permissionstate').split(' ')).each(
                        function(
kv) { ttOptions[v] = $this; }
                    );
                });
            }
            
this.tooltipOptions ttOptions;

            
this.$revokeOption.click($.context(this'updateRevokeStatus'));
            
this.updateRevokeStatus(true);

            
_this this;

            
this.$selects.each(function()
            {
                var 
$this = $(this),
                    
$replaceCore,
                    
$tooltip;

                
$replaceCore = $('<span />')
                    .
click($.context(_this'handleClick'))
                    .
data('select'$this);

                
$tooltip = $('<div class="xenTooltip permissionTooltip" />').hide();

                
$this.hide()
                    .
before(
                        $(
'<div />').append($replaceCore).append($tooltip)
                    );

                
$replaceCore.attr('title'XenForo.htmlspecialchars($replaceCore.attr('title'))).tooltip({
                    
/*effect: 'slide',
                    slideInSpeed: 50,
                    slideOutSpeed: 50,*/
                    
offset: [-125],
                    
position'bottom right',
                    
relativetrue,
                    
onBeforeShow: function(e)
                    {
                        if (
this.getTip().is(':empty'))
                        {
                            
e.preventDefault();
                        }
                    }
                });
                
$replaceCore.data('tooltip'$tooltip);

                
_this.setReplaceState($replaceCore$this$tooltip);
            });
        },

        
handleClick: function(e)
        {
            var 
$replace = $(e.currentTarget),
                
$tooltip $replace.data('tooltip'),
                
$select $replace.data('select'),
                
select $select.get(0),
                
selectedIndex select.selectedIndex;

            if (
selectedIndex select.length)
            {
                
select.selectedIndex += 1;
            }
            else
            {
                
select.selectedIndex 0;
            }

            
this.setReplaceState($replace$select);
        },

        
setReplaceState: function($replace$select)
        {
            var 
val $select.val();

            
$replace.attr('class''permissionChoice permissionChoice_' val);
            
$replace.text($select.find(':selected').text());

            
this.setTooltipState($replace);
        },

        
setTooltipState: function($replace)
        {
            var 
$select $replace.data('select'),
                
val $select.val(),
                
$tooltip $replace.data('tooltip');

            if (
this.tooltipOptions[val])
            {
                
$tooltip.html(this.tooltipOptions[val].clone());
            }
            else
            {
                
$tooltip.empty();
            }
        },

        
updateRevokeStatus: function(instant)
        {
            var 
$options this.$form.find('.PermissionOptions');

            if (
this.$revokeOption.is(':checked'))
            {
                if (
instant === true)
                {
                    
$options.hide();
                }
                else
                {
                    
$options.xfSlideUp();
                }
            }
            else
            {
                
$options.xfSlideDown();
            }
        }
    };

    
XenForo.PermissionNeverWarning = function($form)
    {
        var 
$neverTooltip = $('#PermissionNeverTooltip');
        if (!
$neverTooltip.length)
        {
            return;
        }
        
$neverTooltip.appendTo(document.body);

        
$form.find('.permission td.deny').tooltip({
            
tip'#PermissionNeverTooltip',
            
position'center right',
            
offset: [05],
            
effect'fade',
            
predelay250
        
});
    };

    
XenForo.register('form.PermissionChoices''XenForo.PermissionNeverWarning');
    
//XenForo.register('form.PermissionChoices', 'XenForo.PermissionChoices');
}
(
jQuerythisdocument);
?>
Онлайн: 1
Реклама