Add @ button on phpBB3
Posted October 23rd 2011, 10:02am
Using Dion's script from here: http://www.diondesigns.org/t8401-signature-separator#9964 I made this script.

    var x=$('.signature_div').get();

    for (i=0; i<x.length; i++) {
      var y=$(x[i].parentNode.nextSibling).find('dt').text();
      $(x[i]).after('<br/><p class="right"><input class="button2" value="@" onclick="bbfontstyle('[b]@'+y+'[/b] ','');return false" type="button" style="height: 22px;"></p>');
}


It automatically add @ button after signature in right side. I just edited script, it's not fully mine.
φ
Posts: 37
Joined: August 27th 2011, 11:00pm
Location: Србија/Serbia
Likes Given: 4
Likes Received: 2
Add @ button on phpBB3
Posted October 23rd 2011, 10:16am
Small thing, people with no signature. Poeple without a signature won't have a signature DIV under their posts. And so the loop will skip them.

Therefore not adding the '@' button to those posts.


This will ensure it adds the button to all posts as it grabs name from the author. Not all posts have a signature, but all posts have an author.

$(function(){
    var x=$('.postbody').get();
    var a=$('.profile-icons').get();
    for (i=0; i<x.length; i++) {
      var z=$(x[i]).find('p')[0];
      var y=$(z).find('a').text();
      $(a[i]).prepend('<input class="button2" value="@" onclick="bbfontstyle('[b]@'+y+'[/b] ','');return false" type="button" style="height: 22px;">');
});

It is for phpbb3 and adds the button next to 'quote' and 'edit' etc.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Add @ button on phpBB3
Posted October 23rd 2011, 11:23am
By @ button what do you mean???
φ
Posts: 71
Joined: October 14th 2011, 11:00pm
Location: CompuTalks
Likes Given: 1
Add @ button on phpBB3
Posted October 23rd 2011, 11:58am
Using the "p.author" element for the poster's name will not work for guests, since the author is simple text for guests and not a link, and there is additional unwanted text in that element...
φ
Posts: 1551
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 354
Add @ button on phpBB3
Posted October 23rd 2011, 1:39pm
For me anyway, no guests will be posting, and will not be needing an @ function. :P

To the author, three options to think about.
1. guests do not post... problem sorted.
2. take the posters name from the post profile rather than author string.
3. Look at example 9, add an IF(){} to only display this code for members.

And to Raze, we mean the '@' button like what you see in the DD-Edit Text Editor here.

As a side note:
The thing i am jealous of in the DD-Edit Text Editor, i must say is the QUOTE feature. To be able to highlight any text on the page and click quote.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
Add @ button on phpBB3
Posted October 23rd 2011, 3:05pm
LGforum said:
For me anyway, no guests will be posting, and will not be needing an @ function.

It isn't a matter of guests posting...if you are reading the post as a guest, your script would abort because a link would not exist in the "p.author" element.

Your #3 option above solves this problem, though.
φ
Posts: 1551
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 354
Add @ button on phpBB3
Posted October 24th 2011, 7:23am
Hmm, yes.
if(document.getElementById('i_icon_mini_logout')) {
script here
}


Solved. Image
φ
Posts: 37
Joined: August 27th 2011, 11:00pm
Location: Србија/Serbia
Likes Given: 4
Likes Received: 2
Add @ button on phpBB3
Posted October 24th 2011, 12:17pm
if(document.getElementById('logout')) {


will also work
φ
Posts:
Avatar
Guest
Add @ button on phpBB3
Posted January 11th 2012, 9:59am
Sorry but i didn't understand what it is for... :(
φ
Posts:
Avatar
Guest
Add @ button on phpBB3
Posted January 11th 2012, 10:24am
when click the "@" symbol upon clicking "reply" it'll go @Niko:
φ
Posts: 237
Joined: October 29th 2011, 11:00pm
Location: england, united kingdom, stoke on trent
Likes Given: 20
Likes Received: 4
Add @ button on phpBB3
Posted January 15th 2012, 7:54pm
May you show me a preview please ?
φ
Posts: 15
Joined: September 22nd 2011, 11:00pm
Location: Yoshi's Island
Add @ button on phpBB3
Posted June 18th 2013, 6:50pm
GH~ said:
Hmm, yes.
if(document.getElementById('i_icon_mini_logout')) {
script here
}
Why don't you do this instead?

<!-- IF S_USER_LOGGED_IN -->
Whatever you want to be do only if the person is a member goes in here.
<!-- ENDIF -->
φ
Posts: 263
Joined: October 2nd 2011, 11:00pm
Likes Given: 25
Likes Received: 3
Post a reply
12 posts

Who is online

Users browsing this forum: No registered users and 0 guests