Latest topics
» Recent Topic with Avatar problem
by Wolfuryo Today at 08:27

» Nicknames for @Mentions
by jucarese Today at 08:24

» FM Themes
by SLGray Yesterday at 21:48

» User - Made Creations
by SLGray Yesterday at 21:47

» Modify Category Tabs lead to a desired position and auto scroll click
by djblah Yesterday at 19:19

» [Bug] Missing username in Notifications
by Ape Yesterday at 17:44

» Dark Mode + Another Question
by Haggis Wed 16 Aug 2017, 18:11

» IconSkouliki
by skouliki Wed 16 Aug 2017, 14:52

» make the topic a color
by mr.blake214 Wed 16 Aug 2017, 12:06

» Forum text has changed to bold
by tillytiger99 Wed 16 Aug 2017, 05:02

» Request a Username Change
by mr.blake214 Wed 16 Aug 2017, 01:30

» Display a preview of the user profile on hover
by HoeGy48 Tue 15 Aug 2017, 16:51

» Hai Guys~
by mr.blake214 Tue 15 Aug 2017, 13:48

» Forumactif Messenger - Instant Message Application for Forumotion
by DDril Tue 15 Aug 2017, 10:25

» Donation Box
by Ange Tuteur Tue 15 Aug 2017, 09:59

Recent Tutorials
Who is online?
In total there are 5 users online :: 1 Registered, 0 Hidden and 4 Guests

snows

[ View the whole list ]


Most users ever online was 172 on Fri 19 Feb 2016, 05:17

Script breaking menu and widget floating button

View previous topic View next topic Go down

avatar
dannig

Title :
I always create, I never keep.
Gender : Female
Age : 29
Posts : 36
Points : 215
Reputation : 11
Location : Brazil
Language : English, Brazilian-Portuguese
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.novabrasilis.forumeiros.com https://www.facebook.com/https://www.facebook.com/dannielaaragao https://twitter.com/dannielagoes

Postdannig on 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
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9685
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on Mon 17 Apr 2017, 14:33

Hi @dannig,

This is solved on your end now ?
avatar
dannig

Title :
I always create, I never keep.
Gender : Female
Age : 29
Posts : 36
Points : 215
Reputation : 11
Location : Brazil
Language : English, Brazilian-Portuguese
Browser : Browser : Google Chrome Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile http://www.novabrasilis.forumeiros.com https://www.facebook.com/https://www.facebook.com/dannielaaragao https://twitter.com/dannielagoes

Postdannig on 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.
avatar
Ange Tuteur
Administrator
Title :
Coffee Addict
Gender : Male
Age : 21
Posts : 4675
Points : 9685
Reputation : 2331
Location : Macungie, PA
Language : EN10, FR5
Browser : Browser : Brave Forum Version : Forum Version : Forumactif Edge
Awards :
View all awards
View user profile https://github.com/SethClydesdale https://twitter.com/sethc1995

PostAnge Tuteur on 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.

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