FM Design
Would you like to react to this message? Create an account in a few clicks or log in to continue.

IMPORTANT

FM Design is in read-only mode, please click here for more information.

Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49

» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21

» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28

» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15

» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11

» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24

» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58

» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50

» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22

» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12

» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10

» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51

» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11

» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19

» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34

Recent Tutorials
Top posting users this month

Who is online?
In total there are 12 users online :: 0 Registered, 0 Hidden and 12 Guests :: 1 Bot

None

[ View the whole list ]


Most users ever online was 515 on Tue 14 Sep 2021, 15:24

[SOLVED] category toggle problem

View previous topic View next topic Go down

Ape
Ape

Gender : Male
Age : 49
Posts : 136
Points : 4033
Reputation : 29
Location : UK kent
Language : English i think
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://missingpeople.darkbb.com

PostApe Fri 15 Jul 2016, 06:52

Hello i have a small problem again LOL

i have installed the category toggle code and it was all working fine until the other day then Bam out of the blue it stopped working when i did a page refresh Then today i logged in and my toolbar was gone.

so after i cleared my browser the toolbar come back again. but the category toggle still don't work right.

and every time i use the category toggle it makes my toolbar go again.

can some one take a look at this for me please.

forum address : http://www.achatworld.com/

much thanks to any one that can fix this for me Smile
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12256
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Fri 15 Jul 2016, 13:10

@Ape there's definitely an error with the toggler itself.. Think

Have you tried replacing your current toggler with this one ?
Code:
$(function() {
  // start up variables
  var less = 'http://2img.net/i/fa/m/tabs_less1.gif', // - image
      more = 'http://2img.net/i/fa/m/tabs_more1.gif', // + image
     
      a = $('.forabg', document.getElementById('main-content'), i = 0, f, button, list, dd;
 
  for (; f = a[i]; i++) {
    // create and get the needed elements
    list = f.getElementsByTagName('UL'); // header[0] and category[1]
    button = document.createElement('IMG'); // toggler
    dd = document.createElement('DD'); // toggler container
   
    button.src = less;
    button.style.cursor = 'pointer';
    button.id = 'fa_toggle-' + i;
    list[1].id = 'fa_catg-' + i;
   
    // if the category is hidden in the cookie, we'll change the image and hide it
    if (my_getcookie('fa_catg-' + i) == 'hidden') {
      button.src = more;
      list[1].style.display = 'none';
    }
   
    // yummy toggle logic
    button.onclick = function() {
      // get the current id number and category for manipulation
      var id = this.id.replace(/.*?(\d+)/, '$1'), catg = document.getElementById('fa_catg-' + id);
     
      // if the category is hidden, we'll update the cookie and show it
      // the else statement does the opposite ;)
      if (/none/.test(catg.style.display)) {
        this.src = less;
        catg.style.display = 'block';
        my_setcookie('fa_catg-' + id, 'shown');
      } else {
        this.src = more;
        catg.style.display = 'none';
        my_setcookie('fa_catg-' + id, 'hidden');
      }
    };
   
    dd.appendChild(button); // add the button to its container
    list[0].firstChild.firstChild.appendChild(dd); // and finally add it to the category header
  }
});
// créé par ange tuteur
( It's the one I made for fm support ways back )
Ape
Ape

Gender : Male
Age : 49
Posts : 136
Points : 4033
Reputation : 29
Location : UK kent
Language : English i think
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://missingpeople.darkbb.com

PostApe Fri 15 Jul 2016, 18:31

I just added that code and now its gone i have no buttons at all Sad

its ok i have added this one for now

http://help.forumotion.com/t102749-category-toggle-all-forums?highlight=Category

just updated the icons to fit my forum
Ape
Ape

Gender : Male
Age : 49
Posts : 136
Points : 4033
Reputation : 29
Location : UK kent
Language : English i think
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://missingpeople.darkbb.com

PostApe Tue 19 Jul 2016, 11:40

ok i have now found a problem with my code i used on the last post

Now i have added this code
Code:
/**************************************************************************
 Category Toggle
 ***************************************************************************/

         
         
         
        /***
        * Application: toggle Category
        * Description: Show/hide categories!
        * Version: 0.02632015-jq1.9.1
        *        RC1 (Release candidate 1!) - Invision
        * Author: JScript - 2015/03/26 - based on Invision.js
        * This work is free. You can redistribute it and/or modify it
        * under the terms of the WTFPL, Version 2
        */
        $(function() {
          ("JScript <jscriptbrasil at live dot com>, based on Invision.js");
          var style = document.createElement("style"),
              /* Versions:|phpBB2----------------------------------------|  |phpBB3-------------|    |PunBB-----------------|  |Invision already have it!| */
              oCat = $('#content-container .three-col td:eq(1) .forumline, #main-content .forabg, #main-content .main-head'),
              oThis = null,
              oTemp = null,
              sEval = '';
       
          style.type = "text/css";
          style.innerHTML =
              '.contract, .expand {' +
              '  background: url("http://i35.servimg.com/u/f35/13/25/37/43/mine10.png") no-repeat scroll 50% 50% rgba(0, 0, 0, 0);' +
              '  cursor: pointer;' +
              '  float: right;' +
'  padding-right: 55px;' +
'  padding-top: 10px;' +
'  padding-bottom: 19px;' +
              '  margin-top: -35px;' +
              '}' +
              '.expand {' +
              '  background: url("http://i35.servimg.com/u/f35/13/25/37/43/add10.png") no-repeat scroll 50% 50% rgba(0, 0, 0, 0);' +
              '}';
          document.getElementsByTagName("head")[0].appendChild(style);
       
          switch (oCat[0].className) {
              case 'forumline': //phpBB2
                sEval = "oTemp = oThis.find('tr').first();oTemp.addClass('title-bar');" +
                    "oTemp.find('th:last').append('<div onclick=\"toggleCategory(\\'c' + i + '\\');\" id=\"bc' + i + '\" class=\"contract\" style=\"margin-top: -15px;\">&nbsp;&nbsp;&nbsp;</div>');" +
                    "oThis.find('tr').not('.title-bar').addClass('c' + i);";
                break;
              case 'forabg': //phpBB3
                sEval = "oThis.find('ul.topiclist:first dl.icon').append('<div onclick=\"toggleCategory(\\'c' + i + '\\');\" id=\"bc' + i + '\" class=\"contract\">&nbsp;&nbsp;&nbsp;</div>');" +
                    "oThis.find('ul.topiclist.forums').attr('id', 'c' + i);";
                break;
              case 'main-head': //PunBB
                sEval = "oThis.find('h2').append('<div onclick=\"toggleCategory(\\'c' + i + '\\');\" id=\"bc' + i + '\" class=\"contract\">&nbsp;&nbsp;&nbsp;</div>');" +
                    "oThis.next().attr('id', 'c' + i);";
                break;
          }
          for (var i = 0, len = oCat.length; i < len; i++) {
              oThis = $(oCat[i]);
              eval(sEval);
          }
       
          initCategories();
        });
        // by invision.js
        function initCategories() {
          var id;
          cookies = document.cookie.split('; ');
          for (var i = 0; i < cookies.length; i++) {
              if (cookies[i].charAt(0) == '_') {
                cookie = cookies[i].split('=');
                if (cookie[1] == '1') {
                    id = cookie[0].substring(1);
                    if (document.getElementById(id)) {
                      toggleCategory(id)
                    }
                }
              }
          }
        }
        // by invision.js, modified by JScript
        function toggleCategory(id) {
          var obj = document.getElementById(id);
          var button = document.getElementById('b' + id);
          if (obj) {
              var toggle = obj.style.display == 'none';
              obj.style.display = toggle ? '' : 'none';
          } else {
              var elems = document.getElementsByClassName(id);
              for (var i = 0, len = elems.length; i < len; i++) {
                var toggle = elems[i].style.display == 'none';
                elems[i].style.display = toggle ? '' : 'none';
              }
          }
          button.className = toggle ? 'contract' : 'expand';
          my_setcookie('_' + id, toggle ? '' : '1', true);
          return false
        }
       
        /*
        ▲ -> contract
        ▼ -> expand
        */

i have found that the mobile toggle is not on the home page so i can't log in unless i got to a topic then the little lines come up can some one fix this code please ?
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12256
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 19 Jul 2016, 11:42

@Ape is this script causing problems on mobile only or ? Let me know.
Ape
Ape

Gender : Male
Age : 49
Posts : 136
Points : 4033
Reputation : 29
Location : UK kent
Language : English i think
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://missingpeople.darkbb.com

PostApe Tue 19 Jul 2016, 11:47

the code works fine on the main forum right now on my laptop but when i go in to the mobile phone it makes the little tab on the top of the page go away [SOLVED] category toggle problem Screen12 as you can see in the screen shot there is no little lines to log in on the top right
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12256
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 19 Jul 2016, 11:57

I see. Wink

Find the first instance of :
Code:
$(function() {

and replace it with this :
Code:
$(function() {
  if (_userdata.page_desktop) return;

That should prevent the script from executing on the mobile version.
Ape
Ape

Gender : Male
Age : 49
Posts : 136
Points : 4033
Reputation : 29
Location : UK kent
Language : English i think
Browser : Browser : Mozilla Firefox Forum Version : Forum Version : phpBB3
http://missingpeople.darkbb.com

PostApe Tue 19 Jul 2016, 12:00

Yes that fixed it thank you again @Ange Tuteur your the best Smile

Solved with thanks Smile
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12256
Reputation : 2376
Location : Pennsylvania
Language : EN, JA, FR
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
https://sethclydesdale.github.io/ https://twitter.com/sethc1995

PostAnge Tuteur Tue 19 Jul 2016, 12:22

No problem Beer
Sponsored content

PostSponsored content

View previous topic View next topic Back to top

Create an account or log in to leave a reply

You need to be a member in order to leave a reply.

Create an account

Join our community by creating a new account. It's easy!


Create a new account

Log in

Already have an account? No problem, log in here.


Log in

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