Latest topics
» [HELP] About Profile Cover Code
by MaHwOs Yesterday at 18:54

» bloquer un membre
by berlingo Fri 17 Nov 2017, 18:19

» IconSkouliki Graphics
by skouliki Fri 17 Nov 2017, 03:54

» [IN PROGRESS] Can this code work on pun version
by skouliki Thu 16 Nov 2017, 03:50

» Auto-suggest @mentions as You Type
by skouliki Wed 15 Nov 2017, 14:56

» [TUTORIAL] [ALL VERSIONS] Warning before posting
by demon99 Wed 15 Nov 2017, 08:12

» About Add Reply & New Topic button (popup form)
by omarpop23 Mon 13 Nov 2017, 20:31

» Hello everyone this is Adam from France
by Adam Mon 13 Nov 2017, 13:32

» Add a login popup for the toolbar
by Ape Sun 12 Nov 2017, 18:41

» Post a message automatically when locking a topic
by ThunderTB Sun 12 Nov 2017, 13:51

» Control pannel issue
by Ange Tuteur Sun 12 Nov 2017, 09:49

» BUG... forum members birthday's
by Ape Sat 11 Nov 2017, 11:44

» Display a Preview of Groups on Hover
by ThunderTB Fri 10 Nov 2017, 21:56

» Search box only visible on hover
by Ange Tuteur Mon 06 Nov 2017, 09:57

» [GAME] Animal Game
by SLGray Sun 05 Nov 2017, 15:04

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

None

[ View the whole list ]


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

How to change the default Edge theme?

View previous topic View next topic Go down

avatar
Guest
Guest
View all awards

PostGuest on Sat 24 Dec 2016, 11:38

We've got plenty of themes to chosse from, one of which is now a custom 'KLM Flying Blue' theme. Say, what if we want to have for instance the default theme switched with the KLM one? What do we need to do? If been looking for an answer in the all.js but I couldn't find it. It's probably in some of the Edge CSS somewhere. And when the KLM has been made the default theme, will it still be visible in the theme list?

@Ange Tuteur, please shed a light on this question for us, thank you.


Last edited by Samantha on Thu 29 Dec 2016, 03:51; edited 3 times in total
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Sun 25 Dec 2016, 08:15

Here ya go @Samantha

Title: Default Theme Changer
Placement: All the pages
Code:
$(function() {
    var default_theme = 'Mine Shaft',
        visible_in_theme_list = true,

        option;

    (function changeDefaultTheme(theme) {
        if (!$('#fa_theme_selector > option[value="' + theme + '"]')[0]) {
            console.log('This is not a valid theme');
            return;
        }

        option = $('#fa_theme_selector > option[value="' + theme + '"]');

        $('#fa_theme_selector').val(theme).trigger('change');
        visible_in_theme_list ? option.detach().insertAfter('#fa_theme_selector > option:eq(1)') : option.remove();

        if (my_getcookie('fa_theme_color') != default_theme) my_setcookie('fa_theme_color', theme);
    })(default_theme);
});

You can change
Code:
default_theme
to your theme name (as long as it's already within the theme picker dropdown).

And if you want your theme to still be in the dropdown and show (as opposed to showing up as default theme), then don't change the
Code:
visible_in_theme_list
value.

Hope this works for ya
avatar
Guest
Guest
View all awards

PostGuest on Mon 26 Dec 2016, 21:17

Worked to near perfection, @Ace 1! TYVM! Smile However, when another theme has been chosen and the site reloads in the browser it gives me the default theme again. The cookie with the user's choice either had not been dropped or it wouldn't read it and it falls back to the default theme (the one that had been forced to be default using the script). Same thing when browsing the forums...
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Mon 26 Dec 2016, 23:18

Try replacing the script with this one:

Code:
$(function() {
    var default_theme = 'Mine Shaft',
        visible_in_theme_list = true,

        current_theme = my_getcookie('fa_theme_color'),
        option;

    (current_theme == 'Select a theme' || current_theme == default_theme) && (function changeDefaultTheme(theme) {
        if (!$('#fa_theme_selector > option[value="' + theme + '"]')[0]) {
            console.log('This is not a valid theme');
            return;
        }

        option = $('#fa_theme_selector > option[value="' + theme + '"]');

        $('#fa_theme_selector').val(theme).trigger('change');
        visible_in_theme_list ? option.detach().insertAfter('#fa_theme_selector > option:eq(1)') : option.remove();

        my_setcookie('fa_theme_color', theme);
    })(default_theme);
});
avatar
Guest
Guest
View all awards

PostGuest on Tue 27 Dec 2016, 05:25

Nope, that one falls back to the default color scheme, like on FMD ...
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Wed 28 Dec 2016, 07:10

@Samantha This should work.

Code:
$(function() {
    var default_theme = 'Mine Shaft',
        visible_in_theme_list = true,

        current_theme = my_getcookie('fa_theme_color'),
        option;

    (current_theme == 'Select a theme' || current_theme == default_theme) && (function changeDefaultTheme(theme) {
        if (!$('#fa_theme_selector > option[value="' + theme + '"]')[0]) {
            console.log('This is not a valid theme');
            return;
        }

        option = $('#fa_theme_selector > option[value="' + theme + '"]');

        $('#fa_theme_selector').val(theme).trigger('change');
        visible_in_theme_list ? option.detach().insertAfter('#fa_theme_selector > option:eq(1)') : option.css('display', 'none').parent().val('Default theme');

        my_setcookie('fa_theme_color', theme);

        !visible_in_theme_list && $('#fa_theme_selector').change(function() {
            if (this.value == 'Select a theme' || this.value == 'Default theme') {
                $('#fa_theme_selector').val(theme).trigger('change');
                $('#fa_theme_selector').val(!visible_in_theme_list ? 'Default theme' : theme);
            }
        });
    })(default_theme);
});
avatar
Guest
Guest
View all awards

PostGuest on Wed 28 Dec 2016, 11:23

Nope, not working again, Ken. I'm using this in All the Pages:

Code:
$(function() {
            var default_theme = 'KLM Flying Blue',
                visible_in_theme_list = true,
       
                current_theme = my_getcookie('fa_theme_color'),
                option;
       
            (current_theme == 'Select a theme' || current_theme == default_theme) && (function changeDefaultTheme(theme) {
                if (!$('#fa_theme_selector > option[value="' + theme + '"]')[0]) {
                    console.log('This is not a valid theme');
                    return;
                }
       
                option = $('#fa_theme_selector > option[value="' + theme + '"]');
       
                $('#fa_theme_selector').val(theme).trigger('change');
                visible_in_theme_list ? option.detach().insertAfter('#fa_theme_selector > option:eq(1)') : option.css('display', 'none').parent().val('Default theme');
       
                my_setcookie('fa_theme_color', theme);
       
                !visible_in_theme_list && $('#fa_theme_selector').change(function() {
                    if (this.value == 'Select a theme' || this.value == 'Default theme') {
                        $('#fa_theme_selector').val(theme).trigger('change');
                        $('#fa_theme_selector').val(!visible_in_theme_list ? 'Default theme' : theme);
                    }
                });
            })(default_theme);
        });




You can see the result for yourself on the test site. Could it be the language? Perhaps you should add some language vars ...

EDIT: I've taken the script offline again as started to annoy me lol
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Wed 28 Dec 2016, 21:39

lul it was the language haha

Code:
$(function() {
  var default_theme = 'Mine Shaft',
    default_text = ['Select a theme', 'Default theme'],
    show_name = true,

    current_theme = my_getcookie('fa_theme_color'),
    option;

  (function changeDefaultTheme(theme) {
    if (!$('#fa_theme_selector > option[value="' + theme + '"]')[0]) {
      console.error(theme + ': This is not a valid theme.');
      return;
    }

    if ($('#fa_theme_selector').val() == default_text[0]) {
      $('#fa_theme_selector').val(theme).trigger('change');
      my_setcookie('fa_theme_color', theme);
    }

    option = $('#fa_theme_selector > option[value="' + theme + '"]');
    option.detach().text(show_name ? theme : default_text[1]).insertBefore('#fa_theme_selector > option:eq(0)').next().remove();

    $('#fa_theme_selector').change(function() {
      this.firstChild.textContent = show_name ? theme : default_text[1];
      if ($(this).find('option:selected').index() == 0) $('#fa_theme_selector').val(theme).val(default_text[1]);
    });
  })(default_theme);
});

Now with this code I set up some variables.

Code:
  var default_theme = 'Mine Shaft',
    default_text = ['Select a theme', 'Default theme'],
    show_name = true,

default_theme - You know what this is.
default_text - This takes two values, the first being what you normally see and the second being what the first option of the theme picker is when you don't have the default one enabled.
show_name - When this is true, the forum will show the original name of the theme. Otherwise, it will appear as "Default theme".

Let me know how this works out.
avatar
Guest
Guest
View all awards

PostGuest on Thu 29 Dec 2016, 03:49

Yeah, now it's working alright! AND I noticed some EDGE language language update errors for the themes in ALL.JS, so I had to fix them first. It said 'Kies een thema ... ...' instead of 'Kies een thema ...' in several locations in that JS.

BIG THANKS to you, @Ace 1! Good
avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2151
Points : 2950
Reputation : 88
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
Awards :
View all awards
View user profile http://fmdesign.forumotion.com/u190

PostAce 1 on Thu 29 Dec 2016, 07:19

Glad to help lol

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