IMPORTANT

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

Latest topics
» 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

» Forumactif Edge - Releases
by Ange Tuteur Thu 14 Dec 2017, 11:25

» [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

» Numbering of messages in the topic
by SLGray Mon 04 Dec 2017, 22:40

Recent Tutorials
Top posting users this month
Who is online?
In total there are 2 users online :: 0 Registered, 0 Hidden and 2 Guests :: 1 Bot

None

[ View the whole list ]


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

Navbar Profile Tooltip Options

View previous topic View next topic Go down

avatar
Ace 1
Valued Member
Title :

Beta Tester
Gender : Unspecified
Age : 18
Posts : 2153
Points : 3025
Reputation : 92
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 Tue 15 Nov 2016, 13:08

This is just some small thing I made for the Profile link in the navbar. It gives a little tooltip with an extra option to view the profile.




Administration Panel > Modules > HTML & JS > JS codes management > Create a new javascript

Title: Navbar Profile Tooltip
Placement: In all the pages

Code:

Code:
$(function() {
  var lang = {
      profile_options: 'Profile Options',
      view_profile: 'View Profile',
      edit_profile: 'Edit Profile'
    },

    // -1 no default
    // 0 view profile default
    // 1 edit profile default
    default_path = 1,

    id = '/u' + _userdata.user_id,
    link = $('.navbar .mainmenu').filter(function() {
      return /\/profile\?mode=editprofile/.test(this.href)
    }),

    fm_profile_options = [];

  default_path == 1 ? '' : default_path == 0 ? link.attr('href', id) : link.removeAttr('href');

  link.tooltipster({
    animation: 'fade',
    interactive: true,
    contentAsHTML: true,
    minWidth: 150,
    maxWidth: 200,
    delay: 100,
    theme: 'tooltipster-default',
    arrowColor: "#EEE",
    autoClose: true,
    content: '<h2>' + lang.profile_options + '</h2>',
    functionBefore: function(origin, continueTooltip) {
      continueTooltip();

      if (origin.data('ajax') !== 'cached') {
        if (fm_profile_options[0] != undefined) {
          origin.tooltipster('content', fm_profile_options[0]).data('ajax', 'cached');
        } else {
          var URL = $(this).attr('href'),

            container = $('<div>' +
              '<div class = "fm_profile_options" > ' +
                '<h2 class="fm_profile_options_header">' + lang.profile_options + '</h2>' +
                (/\/u\d+/.test(URL) ? '' : '<p class="fm_view_profile"><a href="' + id + '">' + lang.view_profile + '</a></p>') +
                (/\/profile\?/.test(URL) ? '' : '<p class="fm_edit_profile"><a href="/profile?mode=editprofile">' + lang.edit_profile + '</a></p>') +
              '</div>' +
            '</div>');

          fm_profile_options[0] = container.html();
          origin.tooltipster('content', fm_profile_options[0]).data('ajax', 'cached');
        }
      }
    }
  });

  $('head').append(
    '<style type="text/css">' +
      '.mainmenu.tooltipstered { cursor: pointer; }' +
      '.fm_profile_options { font-family: Arial; font-size: 12px; margin-bottom: 5px; text-align: center; }' +
      '.fm_profile_options_header { font-size: 1.5em; margin: .66em .25em; }' +
      '.fm_profile_options p { margin: 3px; }' +
    '</style>'
  );
});


Here are some modifications:

lang - This is just the text that appears inside the tooltip.

Code:
  var lang = {
      profile_options: 'Profile Options',
      view_profile: 'View Profile',
      edit_profile: 'Edit Profile'
    },

default_path - This determines what link is followed when the user clicks "Profile" within the navbar.

Code:
    // -1 no default
    // 0 view profile default
    // 1 edit profile default
    default_path = 1,

Hope you guys like it; I have some more tutos on the way Rose
Credits to Ange's group preview tutorial for giving me something to work with.

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