The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How can I add minimize/maximize button in Forum Statistics?

View previous topic View next topic Go down

Solved How can I add minimize/maximize button in Forum Statistics?

Post by Van-Helsing on December 9th 2013, 11:29 am

Hi all,
How can I add this button http://prntscr.com/29tmiy in forum statistics in this position http://prntscr.com/29tmwq and will able to set the default value as minimized or maximized?

Best Regards,
Dark-Avenger


Last edited by Dark-Avenger on December 13th 2013, 12:52 pm; edited 1 time in total

Van-Helsing
Hyperactive

Male Posts : 2197
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add minimize/maximize button in Forum Statistics?

Post by Ange Tuteur on December 9th 2013, 11:52 am

Hello Dark-Avenger,

Please do the following

Administration Panel > Modules > Javascript codes management > Create a new script
Name : What you wish
Placement : In the homepage
Code:
$(function(){
                $('td.catHead:contains(Παρόντες χρήστες)').parent().append('<span class="stattoggle"><img src="http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png"/></span>');
                var heads = $('td.catHead:contains(Παρόντες χρήστες)').parent();
                for(var i=0;i<heads.length;i++){
                $(heads[i]).attr({
                id:'cat'+i,
                class: 'parent'
                });
                }
                var cookie = ReadCookie('catTog').split(',');
                for(var j=0;j<cookie.length;j++){
                $(cookie[j]).nextAll('tr').css('display', 'none');
                $(cookie[j]).find('.stattoggle').children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
                }
                $('.stattoggle').on('click',function() {
                var g = $(this).closest('.parent').nextAll('tr').css('display');
                cookieList = ReadCookie('catTog');
                if(g == "table-row") {
                var cid= $(this).closest('.parent').attr('id');
                $(this).closest('.parent').nextAll('tr').hide();
                SetCookie("catTog",cookieList+",#"+cid,1000);
                $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
                } else {
                KillCookie("catTog");
                var newCookie=[],
                a= $('.parent').nextAll('tr').filter(":hidden"),
                c = $.map(a,function(n,i){
                return "#"+$(a).closest('.parent').attr('id');
                });
                newCookie= c.join(',');
                    SetCookie('catTog',newCookie, 100);
                $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png').parent().parent().parent().children('tr').not(":eq(0)").show();
                }
                });
                });
                function SetCookie(cookieName,cookieValue,nDays) {
                var today = new Date();
                var expire = new Date();
                if (nDays===null || nDays===0) nDays=1;
                expire.setTime(today.getTime() + 3600000*24*nDays);
                document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
                }
                function ReadCookie(cookieName) {
                var theCookie=""+document.cookie;
                var ind=theCookie.indexOf(cookieName+"=");
                if (ind===-1 || cookieName==="") return "";
                var ind1=theCookie.indexOf(";",ind);
                if (ind1==-1) ind1=theCookie.length;
                return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
                }
                function KillCookie(cookieName){SetCookie(cookieName,"",-1);}

CSS :
Display > Colors > CSS stylesheet
Code:
.stattoggle{
position:absolute;
right:15px;
top:9px;
}

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I add minimize/maximize button in Forum Statistics?

Post by Van-Helsing on December 9th 2013, 12:01 pm

Its working, can how can I set it to show as minimized by default?

Van-Helsing
Hyperactive

Male Posts : 2197
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add minimize/maximize button in Forum Statistics?

Post by Van-Helsing on December 11th 2013, 2:27 pm

Bump

Van-Helsing
Hyperactive

Male Posts : 2197
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add minimize/maximize button in Forum Statistics?

Post by Van-Helsing on December 13th 2013, 2:32 am

Good morning dear all,
Can I set it to collapsed as default?

Best Regards,
Dark-Avenger

Van-Helsing
Hyperactive

Male Posts : 2197
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add minimize/maximize button in Forum Statistics?

Post by Ange Tuteur on December 13th 2013, 11:11 am

Try replacing with this :
Code:
    $(function(){
                    $('td.catHead:contains(Παρόντες χρήστες)').parent().append('<span class="stattoggle"><img src="http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png"/></span>');
                    var heads = $('td.catHead:contains(Παρόντες χρήστες)').parent();
                    for(var i=0;i<heads.length;i++){
                    $(heads[i]).attr({
                    id:'cat'+i,
                    class: 'parent'
                    });
                    }
                    var cookie = ReadCookie('catTog').split(',');
                    for(var j=0;j<cookie.length;j++){
                    $(cookie[j]).nextAll('tr').css('display', 'none');
                    $(cookie[j]).find('.stattoggle').children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
                    }
                    $('.stattoggle').closest('.parent').nextAll('tr').css('display', 'none');
                    $('.stattoggle').on('click',function() {
                    var g = $(this).closest('.parent').nextAll('tr').css('display');
                    cookieList = ReadCookie('catTog');
                    if(g == "table-row") {
                    var cid= $(this).closest('.parent').attr('id');
                    $(this).closest('.parent').nextAll('tr').hide();
                    SetCookie("catTog",cookieList+",#"+cid,1000);
                    $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_ma10.png');
                    } else {
                    KillCookie("catTog");
                    var newCookie=[],
                    a= $('.parent').nextAll('tr').filter(":hidden"),
                    c = $.map(a,function(n,i){
                    return "#"+$(a).closest('.parent').attr('id');
                    });
                    newCookie= c.join(',');
                        SetCookie('catTog',newCookie, 100);
                    $(this).children('img').attr('src','http://i57.servimg.com/u/f57/18/10/12/74/cat_mi10.png').parent().parent().parent().children('tr').not(":eq(0)").show();
                    }
                    });
                    });
                    function SetCookie(cookieName,cookieValue,nDays) {
                    var today = new Date();
                    var expire = new Date();
                    if (nDays===null || nDays===0) nDays=1;
                    expire.setTime(today.getTime() + 3600000*24*nDays);
                    document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
                    }
                    function ReadCookie(cookieName) {
                    var theCookie=""+document.cookie;
                    var ind=theCookie.indexOf(cookieName+"=");
                    if (ind===-1 || cookieName==="") return "";
                    var ind1=theCookie.indexOf(";",ind);
                    if (ind1==-1) ind1=theCookie.length;
                    return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
                    }
                    function KillCookie(cookieName){SetCookie(cookieName,"",-1);}


Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How can I add minimize/maximize button in Forum Statistics?

Post by Van-Helsing on December 13th 2013, 12:40 pm

Hi all,
Thank you very very much Sethc1995 it works :wouhou: 

Best Regards,
Dark-Avenger

Van-Helsing
Hyperactive

Male Posts : 2197
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: How can I add minimize/maximize button in Forum Statistics?

Post by Ange Tuteur on December 13th 2013, 1:10 pm

You're welcome

Topic solved and archived

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2683
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum