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

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 : 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 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