Ptite_Perle
A les clefs du forum
Je tiens le trousseau de clefs du forum
Fondatrice Messages : 5857 Venue : 27/06/2009 Je suis : Age : 60 Je vie à : Lyon Humeur : Bonne humeur Mes Points : 120037 Mentionner | | Coucou Tu as dit: Mentionner, mais ce quoi encore ce truc ? Mentionner un membre ou un ami via le profil des messages, dans votre message, sans l'écrire:[Vous devez être inscrit et connecté pour voir cette image] Nouveau javascript, coche toutes les pages: - Code:
-
/* FORUM VERSIONS * 0 = PHPBB2 * 1 = PHPBB3 * 2 = PUNBB * 3 = INVISION */ $(function() { var version = 0; if (/mode=reply/.test(window.location.search) && my_getcookie('fa_mention')) { document.post.message.value += '@"' + my_getcookie('fa_mention') + '" '; my_setcookie('fa_mention',''); } if (!/\/t\d+/.test(window.location.pathname)) return; for (var a = $(['.name strong a', '.postprofile dt strong a', '.username a', '.postprofile dt a ~ a'][version]), b, i = 0, j = a.length, t = document.getElementById('text_editor_textarea'); i<j; i++) { b = document.createElement('A'); b.title = 'Mentionner ' + $(a[i]).text(); b.style.marginRight = '3px'; b.className = 'fa-mention'; b.innerHTML = '@'; b.href = '#'; b.onclick = function() { var n = this.title.replace(/^.*?\s/,''); if ($.sceditor) t.insertText('@"' + n + '" '); else { my_setcookie('fa_mention', n); window.location.href = '/post?t=' + window.location.pathname.replace(/\/t(\d+)-.*/,'$1') + '&mode=reply'; } return false; }; a[i].parentNode.insertBefore(b, a[i]); } $(function(){ if (!$.sceditor) return; t=$(t).sceditor('instance'); }); }); Dans le CSS, si tu veux styliser l'arobase: - Code:
-
/* style par défaut */ a.fa-mention { color:#333; } /* style au survol */ a.fa-mention:hover { color:#666; } Ajoute le bouton mentionner dans l'option des messages:L'image du bouton peut être changer: la variable image au début du script. [Vous devez être inscrit et connecté pour voir cette image] Nouveau javascript, coche toutes les pages. - Code:
-
/* FORUM VERSIONS * 0 = PHPBB2 * 1 = PHPBB3 * 2 = PUNBB * 3 = INVISION */ $(function() { var version = 0, image = 'http://i19.servimg.com/u/f19/18/21/60/73/mentio10.png'; if (/mode=reply/.test(window.location.search) && my_getcookie('fa_mention')) { document.post.message.value += '@"' + my_getcookie('fa_mention') + '" '; my_setcookie('fa_mention',''); } if (!/\/t\d+/.test(window.location.pathname)) return; for (var a = $(['.post-options', '.profile-icons', '.post-options', '.posting-icons'][version]), b, c, d = ['.name strong a', '.author a', '.username a', '.author a'][version], e, i = 0, j = a.length, t = document.getElementById('text_editor_textarea'), l = version == 1 || version == 3; i<j; i++) { b = document.createElement('IMG'); b.src = image; b.alt = 'Mentionner'; b.title = 'Mentionner ' + $(a[i]).closest('.post').find(d + ':not(.fa-mention)').text(); b.className = 'i_icon_mention'; b.onclick = function() { var n = this.title.replace(/^.*?\s/,''); if ($.sceditor) t.insertText('@"' + n + '" '); else { my_setcookie('fa_mention', n); window.location.href = '/post?t=' + window.location.pathname.replace(/\/t(\d+)-.*/,'$1') + '&mode=reply'; } }; if (l) { c = document.createElement('LI'); c.appendChild(b); } a[i].insertBefore(l ? c : b, a[i].firstChild); } $(function(){ if (!$.sceditor) return; t=$(t).sceditor('instance'); }); }); Css pour changer le bouton: - Code:
-
/* image du bouton mentionner */ .sceditor-button-mention div { background-image:url(http://i19.servimg.com/u/f19/18/21/60/73/scemen10.png) !important } /* menu déroulant du bouton mentionner */ #fa-mention { background:url(http://i19.servimg.com/u/f19/18/21/60/73/scemen10.png) no-repeat 3px 50% #FFF; padding-left:22px; } Pour Mentionner un ami, il faut qu'il soit dans vos amis , bien entendu sinon ceci ne fonctionne pas. Voila, j'espère que ce tuto vous plaira, autant qu'il ma plu, vue que tu le trouve dans ta zone d'écrire un message. Amicalement |
| |