Статистика профиля на AJAX

Статистика профиля на AJAX 1.1.0

Нет прав для скачивания
Совместимость
проверялся на совместимость
Изменения в БД
не требуются
Автор
Sprinx
Общественное достояние
да
Описание: добавляет вывод статистики профиля на AJAX, заменяя стандартный.
Инструкция по установке
PHP:
Все что находится в папке root, закинуть в корень сайта.

Открыть ajax.php

Найти

'gen_passkey'       => array('user'),

Ниже вставить

'user_modules'        => array('user'),

Найти

    function index_data()
    {
        require(AJAX_DIR .'index_data.php');
    }
   
Ниже втавить

    function user_modules()
    {
        require(AJAX_DIR .'user_modules.php');
    }

Окткрыть index.php

Найти и удалить

// Set tpl vars for bt_userdata
if ($bb_cfg['bt_show_dl_stat_on_index'] && !IS_GUEST)
{
    show_bt_userdata($userdata['user_id']);
}
   
Открыть main.js

Найти

//
// Menus
//

Выше добавить

//
// Slide Menus
//
var SlideMenu = {
    openSpeed          : 'slow',
    hideSpeed          : 'fast',
    getOffsetOptions   : { margin: true, border: true, padding: true, scroll: false },
    offsetCorrection_X : -4,
    offsetCorrection_Y : 2,
    iframeFix          : false,

    activeMenuId       : null,  //  currently opened menu (from previous click)
    clickedMenuId      : null,  //  menu to show up
    $root              : null,  //  root element for menu with "href = '#clickedMenuId'"
    $menu              : null,  //  clicked menu
    positioningType    : null,  //  reserved
    outsideClickWatch  : false, //  prevent multiple $(document).click binding

    clicked: function($root) {
        $root.blur();
        this.clickedMenuId = this.getMenuId($root);
        this.$menu = $(this.clickedMenuId);
        this.$root = $root;
        this.toggle();
    },

    getMenuId: function($el) {
        var click = $el.attr('click');
        return click.substr(click.indexOf('#'));
    },

    setLocation: function() {
        var CSS = this.$root.offset();
        CSS.top  += this.$root.height() + this.offsetCorrection_Y;
        CSS.left += this.offsetCorrection_X;
        this.$menu.css(CSS);
    },

    fixLocation: function() {
        var $menu = this.$menu;
        var curLeft = parseInt($menu.css('left'));
        var rCorner = $(document).scrollLeft() + $(window).width() - 6;
        var maxVisibleLeft = Math.min(curLeft, Math.max(0, rCorner - $menu.width()));
        if (curLeft != maxVisibleLeft) {
            $menu.css('left', maxVisibleLeft);
        }
        var curTop = parseInt($menu.css('top'));
        var tCorner = $(document).scrollTop() + $(window).height() - 20;
        var maxVisibleTop = Math.min(curTop, Math.max(0, tCorner - $menu.height()));
        if (curTop != maxVisibleTop) {
            $menu.css('top', maxVisibleTop);
        }
        if (this.iframeFix) {
            $('iframe.ie-fix-select-overlap', $menu).css({ width: $menu.width(), height: $menu.height() });
        }
    },

    toggle: function() {
        if (this.activeMenuId && this.activeMenuId !== this.clickedMenuId) {
            $(this.activeMenuId).slideUp(this.hideSpeed);
            this.$root.removeClass('active')
        }
        // toggle clicked menu
        if (this.$menu.is(':visible')) {
        }    else {
            this.showClickedMenu();
            if (!this.outsideClickWatch) {
                $(document).one('mousedown', function(e){ SlideMenu.hideClickWatcher(e); });
                this.outsideClickWatch = true;
            }
        }
    },

    showClickedMenu: function() {
        this.setLocation();
        this.$menu.slideDown(this.openSpeed);
        this.$root.addClass('active')
        this.fixLocation();
        this.activeMenuId = this.clickedMenuId;
    },

    // hide if clicked outside of menu
    hideClickWatcher: function(e) {
        this.outsideClickWatch = false;
        this.hide(e);
    },

    hide: function(e) {
        if (this.$menu) {
            this.$menu.slideUp(this.hideSpeed);
            this.$root.removeClass('active')
        }
        this.activeMenuId = this.clickedMenuId = this.$menu = null;
    }
};

$(document).ready(function(){
    // SlideMenus
    $('div#slideMenu').click(
        function(e)
        {
            SlideMenu.clicked($(this));
           
            var menuClick = true;
            $(document).bind("click",function (e)
            {
                if (!menuClick && $(e.target).closest('div.slideMenuBlock').length == 0)
                {
                    SlideMenu.clicked($(this));
                    $(document).unbind("click");
                }
                menuClick = false;
            });
        }
    );
    $('div.slideMenuBlock').mousedown(
        function(e)
        {
            e.stopPropagation();
        }
    )
    // Input hints
    $('input')
        .filter('.hint').one('focus', function()
        {
            $(this).val('').removeClass('hint');
        })
        .end()
        .filter('.error').one('focus', function()
        {
            $(this).removeClass('error');
        });
});   


Открыть templates/default/page_header.tpl

Найти

<link rel="stylesheet" href="{STYLESHEET}?v={$bb_cfg['css_ver']}" type="text/css">

Ниже добавить

<link rel="stylesheet" href="{TPL_DIR}/slide_menu.css?v={$bb_cfg['css_ver']}" type="text/css">

Найти

</head>

Выше втавить

<script type="text/javascript">
function user_modules(action, mode){
    ajax.exec({
        action  : 'user_modules',
        mode    : 'user_index_stats'
    });
    ajax.callback.user_modules = function(data) {
     $('#user_modules').html(data.html);
     }
   
}
</script>

Найти и удалить

     <!-- IF SHOW_BT_USERDATA --><div id="user_ratio">
      <h3>{L_USER_RATIO}</h3>
       <table cellpadding="0">
       <div align="center">{THIS_AVATAR}</div>
       <tr><td>{L_USER_RATIO}</td><td><!-- IF DOWN_TOTAL_BYTES gt MIN_DL_BYTES --><b>{USER_RATIO}</b><!-- ELSE --><b>{L_NONE}</b> (DL < {MIN_DL_FOR_RATIO})<!-- ENDIF --></td></tr>
       <tr><td>{L_DOWNLOADED}</td><td class="leechmed"><b>{DOWN_TOTAL}</b></td></tr>
       <tr><td>{L_UPLOADED}</td><td class="seedmed"><b>{UP_TOTAL}</b></td></tr>
       <tr><td>{L_RELEASED}</td><td class="seedmed">{RELEASED}</td></tr>
       <tr><td>{L_BONUS}</td><td class="seedmed">{UP_BONUS}</td></tr>
       <!-- IF $bb_cfg['seed_bonus_enabled'] --><tr><td>{L_SEED_BONUS}</td><td><a href="profile.php?mode=bonus"><span class="points bold">{POINTS}</span></a></td></tr><!-- ENDIF -->
       </table>
     </div><!-- ENDIF -->
    
Найти

<!-- IF LOGGED_IN -->
                <!-- IF HAVE_NEW_PM || HAVE_UNREAD_PM -->
                    <a href="{U_READ_PM}" class="new-pm-link"><b>{L_PRIVATE_MESSAGES}: {PM_INFO}</b></a>
                <!-- ELSE -->
                    <a href="{U_PRIVATEMSGS}"><b>{L_PRIVATE_MESSAGES}: {PM_INFO}</b></a>
                <!-- ENDIF -->
            <!-- ENDIF -->
        </td>

Ниже втавить       
    
<td width="120px">
    <div id="slideMenuLink">   
        <div id="slideMenu" class="tabMenu" click="#profile">
            <span id="SpNTit" onclick="user_modules(); return false;"><p class="floatR IMGslideMenu menu_profile">{L_PROFILE}</p></span>
            <div class="slideMenuBlock lEft" id="profile">       
                <div class="navPopup" style="margin: 0 -4px">
                    <div class="menuHeader primaryContent"><h4 class="tCenter">{L_PROFILE_USER}</h4></div>   
                    <div class="secondaryContent">
                        <div id="user_modules"></div>
                    </div>
                    <div class="sectionFooter">
                    <table cellpadding="0" width="100%">
                        <tr>
                            <td><a href="{U_CUR_DOWNLOADS}">{L_PROFILE}</a></td>           
                            <td><a href="{U_SEARCH_SELF_BY_LAST}">{L_SEARCH_SELF}</a></td>
                            <td><a class="floatLink" href="{U_OPTIONS}">{L_OPTIONS}</a></td>
                            </tr>
                    </table>
                    </div>
                </div>       
            </div>
        </div>
    </div>
</td>
  • W1Oq4jB.png
    W1Oq4jB.png
    160.8 KB · Просмотры: 715
Автор
Sprinx
Скачивания
86
Просмотры
167
Первый выпуск
Обновление
Оценка
5.00 звёзд 1 оценок

Другие ресурсы пользователя Sprinx

Последние обновления

  1. Обновление 1.1.0

    Обновлено описание ресурса Перепаковка в zip
Сверху