Application Private Messages Menu
3 posters
Page 1 of 1
Application Private Messages Menu
@what I was asking was too bothersome, consider it solved, ty.
Good everyone!
I've found this interesting code while I was searching for a good PM menu and I've tried it.
https://help.forumotion.com/t141662-application-popup-of-private-message-list
(also Rip Jscript, he made excelent codes )
I've made a widget on the right side of the forum that displays my Avatar and my Profile Link, and added a Link to the Inbox with it's respective Inbox PM's counter
This was the code I used on the widget:
Then added Jscript's code on the Javascript for every page
So Summing it up, Added that Widget to make a custom user Area (was going to add more links later, etc) and Added the javascript.
And I've 2 problems that I've noticed.
1st: The Counter doesn't Display the exact ammount of PM's in the inbox (I've none and it displays 1, and tried with a Dummy test forum, sent myself 5 pm's, deleted them all and in the end it displays 2).
2nd: When I click in "Messages" inside the Menu It simply closes the Menu and doesn't direct to the "inbox" (and before you ask, YES the path is correct).
This is the Dummy Forum where I'm testing it.
http://staiksdummy.forumeiros.com/
And I'm sorry I'm bringing this Code up, considering the obvious, but doesn't change the fact the guy was a genius compared to me and many others and since my knowledge is very limited don't want to put this Code to Waste, any help gentlemen?
Thank you very much in advance!
(NOTE: It's PunBB)
@EDIT Just realized the {USERCOUNPOST} is literally the ammount of posts my bad, being that so, is there one to count the pm's in the inbox?
Good everyone!
I've found this interesting code while I was searching for a good PM menu and I've tried it.
https://help.forumotion.com/t141662-application-popup-of-private-message-list
(also Rip Jscript, he made excelent codes )
I've made a widget on the right side of the forum that displays my Avatar and my Profile Link, and added a Link to the Inbox with it's respective Inbox PM's counter
- Code:
{USERCOUNTPOST}
This was the code I used on the widget:
- Widget:
- Code:
<span id="avatar"></span> <span style="font-size: 1.2em;" id="avatar"> <br /> <span style="font-size: 18px;"> <span id="un">{USERLINK} </span></span> <br /> <br /> <a title="Inbox" href="/privmsg?folder=inbox"><strong>Messages:</strong> {USERCOUNTPOST}</a><br /> </span>
<h3 style="border-color: #1675BC;">
</h3>
<script type="text/javascript">
//<![CDATA[
jQuery(function () {
jQuery('#avatar').html('<center>' + _userdata["avatar"] + '</center>');
});
//]]>
</script>
Then added Jscript's code on the Javascript for every page
- APPLICATION CODE - JAVASCRIPT:
- Code:
/***
* Application: Private Message list.
* Description: This application can displays the list of PM in related menus.
* Version: 1.03102014-jq1.9.1 - Hermes Kriophoros
* Made and Optimizations by JScript - 2014/03/10
* View more in: http://ajuda.forumeiros.com
* Copyright (c) 2013 JScript <jscriptbrasil at live dot com>
* This work is free. You can redistribute it and/or modify it
* under the terms of the WTFPL, Version 2
*/
jQuery(function () {
/***
* User Definition Variables
***/
/* Put here the amount number of PMs returned!!! */
var iAmount = 10;
/***
* System Defined Variables - Do not edit if you don't know!
***/
var oConfig = {
sInfo:
'<!--' +
'* Application: Private Message List.' +
'* Description: This application can displays the list of PM in related menus.' +
'* Version: 1.03102014-jq1.9.1 - Hermes Kriophoros' +
'* Made and Optimizations by JScript - 2014/03/10' +
'* View more in: http://codeforum.besaba.com/forum/index.php' +
'* Copyright (c) 2014 JScript <jscriptbrasil at live dot com>' +
'* This work is free. You can redistribute it and/or modify it' +
'* under the terms of the WTFPL, Version 2' +
'-->',
sContent:
'<div class="ipsHeaderMenu boxShadow" id="user_inbox_link_menucontent" style="display: none; width: 300px; position: absolute; z-index: 9999;">' +
'<h4 class="ipsType_sectiontitle">Inbox Messages' +
'<p class="ipsPad_half ipsType_smaller right">' +
'<a class="configure" href="/privmsg?folder=inbox">Messages</a> · <a href="/privmsg?mode=post" title="New message">New message</a>' +
'</p>' +
'</h4>' +
'<ul class="ipsList_withminiphoto"><img src="http://i55.servimg.com/u/f55/18/17/62/92/ajax-l10.gif" alt="- Load" style="display: block; margin-left: auto; margin-right: auto;"></ul>' +
'</div>',
sCSS:
'<style>' +
'.ipsHeaderMenu {' +
'background-color: #FFFFFF;' +
'border-radius: 0 0 6px 6px;' +
'overflow: hidden;' +
'padding: 10px;' +
'width: 340px;' +
'}' +
'.boxShadow {' +
'box-shadow: 0 12px 25px rgba(0, 0, 0, 0.58);' +
'}' +
'.ipsHeaderMenu .ipsType_sectiontitle {' +
'margin-bottom: 8px;' +
'}' +
'.ipsType_sectiontitle {' +
'border-bottom: 1px solid #ECECEC;' +
'color: #595959;' +
'font-size: 16px;' +
'font-weight: 400;' +
'padding: 5px 0;' +
'}' +
'.ipsType_smaller, .ipsType_smaller a {' +
'font-size: 11px !important;' +
'}' +
'.ipsPad_half {' +
'padding: 4px !important;' +
'}' +
'.right {' +
'float: right;' +
'}' +
'.ipsList_withminiphoto > li {' +
'margin-bottom: 8px;' +
'}' +
'.ipsType_small {' +
'font-size: 12px;' +
'}' +
'.ipsUserPhoto {' +
'background: none repeat scroll 0 0 #FFFFFF;' +
'border: 1px solid #D5D5D5 !important;' +
'box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);' +
'padding: 1px;' +
'}' +
'.ipsUserPhoto_mini {' +
'height: 30px;' +
'width: 30px;' +
'}' +
'.left {' +
'float: left;' +
'}' +
'.ipsList_withminiphoto > li .list_content {' +
'margin-left: 40px;' +
'}' +
'#user_inbox_link_menucontent ul.ipsList_withminiphoto {' +
'list-style: none outside none;' +
'padding-left: 0 !important;' +
'}' +
'.desc.lighter, .desc.lighter.blend_links a {' +
'color: #A4A4A4;' +
'}' +
'.ipsType_smaller, .ipsType_smaller a {' +
'font-size: 11px !important;' +
'}' +
'.menu_active {' +
'color: #595959 !important;' +
'background-color: #FFFFFF !important;' +
'background-position: center bottom;' +
'border-radius: 3px 3px 0 0;' +
'padding: 4px;' +
'}' +
'</style>',
sTarget: '',
sSearch: '',
sExpression0: '',
sExpression1: '',
sExpression2: '',
sGetIMG: ''
};
/* Add CSS */
/*document.head.insertAdjacentHTML('beforeEnd', oConfig.sCSS);*/
jQuery(oConfig.sCSS).insertBefore('body');
jQuery('body').append(oConfig.sInfo + oConfig.sContent);
/* Forum versions! */
var phpBB2 = jQuery('.bodyline');
var phpBB3 = jQuery('#wrap');
var punbb = jQuery('#pun-intro');
var invision = jQuery('#ipbwrapper');
if (phpBB2.length) {
oConfig.sSearch = 'form[name="privmsg_list"] .forumline tr';
oConfig.sTarget = 'tr';
oConfig.sExpression0 = 'memDiv.find("tr:first, tr:last").remove();';
oConfig.sExpression1 = 'jQuery(this).find("a.topictitle").html()';
oConfig.sExpression2 = 'jQuery(this).find("td .name").html() + " - " + jQuery(this).find("td .postdetails").html()';
oConfig.sGetIMG = ' #emptyidcc .row1.gensmall img:eq(0)';
} else if(phpBB3.length) {
oConfig.sSearch = '.topiclist.pmlist.bg_none li';
oConfig.sTarget = '.icon dt';
oConfig.sExpression1 = 'jQuery(this).find("a.topictitle")[0].outerHTML';
oConfig.sExpression2 = 'jQuery(this).find("em").html()';
oConfig.sGetIMG = ' #profile-advanced-right img:eq(0)';
} else if(punbb.length) {
oConfig.sSearch = '.main-content tr .tcl.tdtopics';
oConfig.sGetIMG = ' #profile-advanced-right .main-content img:first';
} else if(invision.length) {
oConfig.sSearch = '.borderwrap table.ipbtable tbody tr:not(":empty")';
oConfig.sTarget = 'tr';
oConfig.sExpression1 = 'var _tmp1 = jQuery(this).find("td:eq(2)");_tmp1.children("a.topictitle")[0].outerHTML';
oConfig.sExpression2 = '_tmp1.children("a.topictitle").remove();_tmp1.html()';
oConfig.sGetIMG = ' #profile-advanced-right .box-content.profile.center img:first';
};
jQuery('a[href*="/privmsg?folder=inbox"]').click(function () {
var oClicked = jQuery(this);
var oTarget = jQuery('#user_inbox_link_menucontent');
if (oTarget[0].style.display == 'none') {
oClicked.addClass('menu_active');
if ( !jQuery('#user_inbox_link_menucontent ul.ipsList_withminiphoto > li').length ) {
var memDiv = jQuery('<div>');
memDiv.load('/privmsg?folder=inbox ' + oConfig.sSearch + ':lt(' + iAmount + ')', function() {
if (punbb.length) {
memDiv
.html(
memDiv.html()
.replace(/\<\/a\> por/g, '</a></br><span class="ipsType_smaller desc lighter">')
.replace(/\<\/td\>/g, '</span></div></li>')
.replace(/\<td class="tcl tdtopics"\>/g, '<li class="ipsType_small clearfix"><img class="ipsUserPhoto ipsUserPhoto_mini left" alt="User image" src="http://i78.servimg.com/u/f78/18/17/62/92/defaul10.png"><div class="list_content">')
)
.find('span.status').remove();
} else {
if (oConfig.sExpression0) {
eval( oConfig.sExpression0 );
}
var sHtml = '';
oConfig.sTarget = memDiv.find(oConfig.sTarget);
jQuery.each(oConfig.sTarget, function( index, value ) {
sHtml +=
'<li class="ipsType_small clearfix">' +
'<img class="ipsUserPhoto ipsUserPhoto_mini left" alt="User image" src="http://i78.servimg.com/u/f78/18/17/62/92/defaul10.png">' +
'<div class="list_content">' +
eval( oConfig.sExpression1 ) + '<br>' +
'<span class="ipsType_smaller desc lighter">' + eval( oConfig.sExpression2 ) + '</span>' +
'</div>' +
'</li>';
});
memDiv.html(sHtml);
}
jQuery('#user_inbox_link_menucontent ul.ipsList_withminiphoto').html(memDiv.html());
var oImgTarget = oTarget.find('.ipsType_small.clearfix');
oImgTarget.each(function( index ) {
var UserURL = jQuery(this).find('.ipsType_smaller a, .list_content a:last');
if (UserURL.length) {
UserURL = UserURL.attr('href');
var oImgTag = jQuery(this).find('.ipsUserPhoto');
var UserIMG = sessionStorage.getItem(UserURL); /* Gets the avatar saved in local storage */
/* If avatar alread saved, then no request member profile! */
if(UserIMG) {
jQuery(this).find('img').attr('src', UserIMG);
} else {
/* if not, then only request per session!!! */
jQuery.get(UserURL, function(data){
var profile_img = jQuery(oConfig.sGetIMG, data).attr('src');
if (profile_img !== undefined) {
oImgTag.attr('src', profile_img);
/* Saves the member avatar in local storage */
sessionStorage.setItem(UserURL, profile_img);
}
});
}
}
});
});
}
oTarget
.css({
'left': (oClicked.offset().left + oClicked.outerWidth()) - oTarget.outerWidth(),
'top': oClicked.offset().top + oClicked.outerHeight()
})
.fadeIn(400);
jQuery(document).mousedown(function() {
if(!oTarget.is(":hover")) {
jQuery(document).unbind('mousedown');
oClicked.removeClass('menu_active');
oTarget.fadeOut(400);
}
});
} else {
oClicked.removeClass('menu_active');
oTarget.fadeOut(400);
}
return false;
});
});
So Summing it up, Added that Widget to make a custom user Area (was going to add more links later, etc) and Added the javascript.
And I've 2 problems that I've noticed.
1st: The Counter doesn't Display the exact ammount of PM's in the inbox (I've none and it displays 1, and tried with a Dummy test forum, sent myself 5 pm's, deleted them all and in the end it displays 2).
2nd: When I click in "Messages" inside the Menu It simply closes the Menu and doesn't direct to the "inbox" (and before you ask, YES the path is correct).
This is the Dummy Forum where I'm testing it.
http://staiksdummy.forumeiros.com/
And I'm sorry I'm bringing this Code up, considering the obvious, but doesn't change the fact the guy was a genius compared to me and many others and since my knowledge is very limited don't want to put this Code to Waste, any help gentlemen?
Thank you very much in advance!
(NOTE: It's PunBB)
@EDIT Just realized the {USERCOUNPOST} is literally the ammount of posts my bad, being that so, is there one to count the pm's in the inbox?
Last edited by daniloMD on May 1st 2017, 7:15 pm; edited 1 time in total
Re: Application Private Messages Menu
Are you sure this is for PM's, not the number of posts:
- Code:
{USERCOUNTPOST}
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Application Private Messages Menu
@EDIT Just realized the {USERCOUNPOST} is literally the ammount of posts my bad, being that so, is there one to count the pm's in the inbox?
@SLGray I've put it there mate
@SLGray I've put it there mate
Re: Application Private Messages Menu
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Application Private Messages Menu
@SLGray I was already aware of that, like I said it was a mistake, but the main point of the post remains.
How can I make that "messages" link on the JS work?
And how can I make a messages counter?
I've seen it in another forum a similar subject, even tho I can't associate it to this case bcz my JS knowledge is beyond sad.
That Script was roughly sth like this: GET$ ( link of the messages i think) -> count number of Images with the "X" link (the unread messages icon) and display the icon ammount as a number aka lenght if I'm not mistaken, this was the principle, I'm sorry for writting in a miserable non technical way, but yeah, any help with those?
@in the meantime found the code again
How can I make that "messages" link on the JS work?
And how can I make a messages counter?
I've seen it in another forum a similar subject, even tho I can't associate it to this case bcz my JS knowledge is beyond sad.
That Script was roughly sth like this: GET$ ( link of the messages i think) -> count number of Images with the "X" link (the unread messages icon) and display the icon ammount as a number aka lenght if I'm not mistaken, this was the principle, I'm sorry for writting in a miserable non technical way, but yeah, any help with those?
@in the meantime found the code again
- JAVASCRIPT:
- Code:
$(function() {
$.get('/privmsg?folder=inbox', function(data) {
var unread_image = 'http://i38.servimg.com/u/f38/18/44/35/81/offlin10.png';
var unread = $('.main-content .status img[src="' + unread_image + '"]', data).length;
$('.navbar ul li ul li a[href="http://fineryworkshop.forumotion.com/privmsg?folder=inbox"]').append(unread);
});
});
Re: Application Private Messages Menu
Problem solved & topic archived.
|
Similar topics
» Application: Popup of private message list.
» Private messages shows you have no new messages
» Private messages
» About Private Messages
» Private Messages
» Private messages shows you have no new messages
» Private messages
» About Private Messages
» Private Messages
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum