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 21 users online :: 0 Registered, 0 Hidden and 21 Guests :: 1 Bot

None

[ View the whole list ]


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

Script breaking menu and widget floating button

View previous topic View next topic Go down

dannig
dannig

Gender : Female
Age : 36
Posts : 36
Points : 2629
Reputation : 11
Location : Brazil
Language : English, Brazilian-Portuguese
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
http://www.novabrasilis.forumeiros.com https://www.facebook.com/dannielaaragao https://twitter.com/dannielagoes

Postdannig Sun 16 Apr 2017, 16:14

Good day!

I joined because I really liked the practicality that Edge offered and decided to give it a try. So far I'm enjoying it a lot! But sadly when I tried to ad a few simple codes on my forum they broke the floating buttons for the navigation and the widget. One of those codes is this one:

Javascript for all pages
Code:
$(function() {
 
    // CONTEÚDO POR GRUPO
    var PROFESSORES = 'Mensagem';
    var FUNCIONARIOS = 'Mensagem';
    var ESTUDANTES = 'Mensagem';
    var VESTIBULANDO = 'Mensagem';
    var MUNDOBRUXO = 'Mensagem';
 
    // Vars
    var idUser = _userdata["user_id"];
    console.log(idUser);
 
 
    // Escondido
    $('body').prepend('<div id="Hancki" style="display:none;"><span id="corUser"></span></div>');
 
    // Função
    $.get('/u' + idUser + '', {}, function(data) {
        $('#Hancki #corUser').html($(data).find('#navstrip li[style="float:none;"] span[style*="color"]'));
    }).done(function() {
        var corUsuario = $('#Hancki #corUser span').attr('style');
        console.log(corUsuario);
 
        // LISTAGEM DOS GRUPOS
        if (corUsuario == 'color:#9524FF') {
            // PROFESSORES
            console.log('Você é dos Professores.');
            $('#mensagemGrupo').html(PROFESSORES);
 
        } else if (corUsuario == 'color:#D630FF') {
            // FUNCIONÁRIOS
            console.log('Você é dos Funcionários.');
            $('#mensagemGrupo').html(FUNCIONARIOS);
 
        } else if (corUsuario == 'color:#42A819') {
            // ESTUDANTES
            console.log('Você é dos Estudantes.');
            $('#mensagemGrupo').html(ESTUDANTES);
 
        } else if (corUsuario == 'color:#DB2C72') {
            // VESTIBULANDO
            console.log('Você é do Vestibulando.');
            $('#mensagemGrupo').html(VESTIBULANDO);
 
        } else if (corUsuario == 'color:#2C9EDB') {
            // MUNDO BRUXO
            console.log('Você é do Mundo Bruxo.');
            $('#mensagemGrupo').html(MUNDOBRUXO);
 
        } else {
            console.log('Você é um Administrador!');
        }
 
    }).fail(function() {
        alert('A mensagem personalizada para os grupos não foi carregada. Contacte a administração.');
        $('#Hancki').remove();
    });
});

HTML for widget:
Code:
<div id="mensagemGrupo"></div>

Even if I don't publish the widget, the script break the floating buttons by itself.

The code above is meant to show messages in a widget by the group of the user who's reading it (a feature I don't know why the system doesn't have yet).

It seems for me that any code "adding" something on the page will break the buttons.


EDIT I've tried making this code work for 30 min now and out of nothing (even when I cleaned my cache every time I updated it) it seems to have stopped breaking things, right after I posted here. So delete my topic, please!


Last edited by dannig on Mon 17 Apr 2017, 14:35; edited 1 time in total
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12013
Reputation : 2375
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 Mon 17 Apr 2017, 14:33

Hi @dannig,

This is solved on your end now ?
dannig
dannig

Gender : Female
Age : 36
Posts : 36
Points : 2629
Reputation : 11
Location : Brazil
Language : English, Brazilian-Portuguese
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
http://www.novabrasilis.forumeiros.com https://www.facebook.com/dannielaaragao https://twitter.com/dannielagoes

Postdannig Mon 17 Apr 2017, 14:34

Yes! Either way the script didn't work, so I just removed it. I just didn't mark it because I have no solution for this, it just fixed itself.
Ange Tuteur
Ange Tuteur
Administrator
Gender : Male
Posts : 4741
Points : 12013
Reputation : 2375
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 Mon 17 Apr 2017, 14:55

Ah I see. It may be due to the script not supporting Forumactif Edge ; FAE uses a slightly different markup and selectors. The only notable thing that should be worth changing is this selector
Code:
#navstrip li[style="float:none;"] span[style*="color"]
. I think that targets the breadcrumbs, so you could us the
Code:
.breadcrumbs
class for FAE.

If the widgets, quick panel, and other plugins disappear or appear broken, it's usually do to a javascript error. Some errors, if severe, can halt all other scripts on the page. This typically happens with code executed within jQuery's document ready function, because jQuery queues any functions that are called with it. So if any script using document ready has an error, it'll prevent all other scripts in the queue from being executed.
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