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 26 users online :: 0 Registered, 0 Hidden and 26 Guests :: 2 Bots

None

[ View the whole list ]


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

How to change the default Edge theme?

View previous topic View next topic Go down

Anonymous
Guest
Guest

PostGuest 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
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5527
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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
Anonymous
Guest
Guest

PostGuest 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...
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5527
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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);
});
Anonymous
Guest
Guest

PostGuest Tue 27 Dec 2016, 05:25

Nope, that one falls back to the default color scheme, like on FMD ...
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5527
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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);
});
Anonymous
Guest
Guest

PostGuest 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);
        });

How to change the default Edge theme? D90f6eec71f04af48d709e405695ee95


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
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5527
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 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.
Anonymous
Guest
Guest

PostGuest 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
Ace 1
Ace 1
Valued Member
Gender : Unspecified
Age : 25
Posts : 2153
Points : 5527
Reputation : 95
Location : USA
Language : English ?
Browser : Browser : Google Chrome Forum Version : Forum Version : phpBB3
https://fmdesign.forumotion.com/u190

PostAce 1 Thu 29 Dec 2016, 07:19

Glad to help lol
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