[Snippet] Fast addressing user in quick reply

Little Mods and Snips 1

[Snippet] Fast addressing user in quick reply

Postby Sekuro » 28 May 2012, 22:54

Fast addressing user in quick reply

Request by: FeyFre
Request topic: http://www.phpbb.com/community/viewtopi ... &t=2156740

Description:
"In viewtopic, each post author name becomes a link, which on click inserts this name to quick reply textarea surrounded by bold bb-code" (FeyFre)
With smooth jq scroll-to-bottom..

Demo:
subsilver2: http://4seven.bplaced.net/forum/media/viewto ... f=10&t=365
prosilver: http://4seven.bplaced.net/forum/media/viewto ... f=10&t=365
Guest-Names have no cursor:hand, but works onclick anyway.

phpBB-Version: phpBB 3.0.x
phpBB-Languages: en
phpBB-Styles: subsilver2 / prosilver

Instruction

Download:
Fast_addressing_user_in_quick_reply.zip
(2.17 KiB) Downloaded 142 times

open

styles/subsilver2/template/viewtopic_body.html

find

Code: Select all
<!-- BEGIN postrow -->


before add

Code: Select all
<!-- Fast addressing user in quick reply / 4_seven / 2012 -->
<!--
 IF S_QUICK_REPLY -->
<
script type="text/javascript">
// <![CDATA[ 
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
// ]]> 
</script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/scroll-startstop.events.jquery.js"></script>
<script>
// <![CDATA[
function go_qr(message)
{

var $elem = $('.ltr');
var box   = $("textarea[name=message]").val();

if (box !== ''){
var srg = '\r\n';
}
else{
var srg = '';
}

$('html, body').animate({scrollTop: $elem.height()}, 800);

$("textarea[name=message]").append(srg + message);

}
// ]]>
</script>  
<!-- ENDIF -->  
<!-- Fast addressing user in quick reply / 4_seven / 2012 -->


find

Code: Select all
<b class="postauthor"


replace with

Code: Select all
<b<!-- IF S_QUICK_REPLY --> onclick="go_qr('[b]{postrow.POST_AUTHOR}[/b]'); return false;"<!-- ENDIF --> class="postauthor"


open

styles/prosilver/template/viewtopic_body.html

find

Code: Select all
<!-- BEGIN postrow -->


before add

Code: Select all
<!-- Fast addressing user in quick reply / 4_seven / 2012 -->
<!--
 IF S_QUICK_REPLY -->
<
script type="text/javascript">
// <![CDATA[ 
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
// ]]> 
</script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/scroll-startstop.events.jquery.js"></script>
<script>
// <![CDATA[
function go_qr(message)
{

var $elem = $('#phpbb');
var box   = $("textarea[name=message]").val();

if (box !== ''){
var srg = '\r\n';
}
else{
var srg = '';
}

$('html, body').animate({scrollTop: $elem.height()}, 800);

if (document.getElementById('qr_editor_div').style.display == 'none'){
hide_qr(true); 
}

$("textarea[name=message]").append(srg + message);

}
// ]]>
</script>
<!-- ENDIF -->
<!-- Fast addressing user in quick reply / 4_seven / 2012 -->


find

Code: Select all
<strong>{postrow.POST_AUTHOR_FULL}</strong>


replace with

Code: Select all
<strong<!-- IF S_QUICK_REPLY --> onclick="go_qr('[b]{postrow.POST_AUTHOR}[/b]'); return false;"<!-- ENDIF -->>{postrow.POST_AUTHOR_FULL}</strong>


Note:
You can add multiple usernames by click. They will be inserted with a linebreak after each.
But, if you want do do so, click all usernames first, then write your answer or change the
content of the qr postbox. Otherwise the script stops and must be reactivated via strg + f5.
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Fast addressing user in quick reply - V2 - subsilver

Postby Sekuro » 29 May 2012, 12:42

Fast addressing user in quick reply - V2 - subsilver2

Light subsilver2 version without jquery scrool to bottom

Request by: FeyFre
Request topic: http://www.phpbb.com/community/viewtopi ... &t=2156740

Description:
"In viewtopic, each post author name becomes a link, which on click inserts this name to quick reply textarea surrounded by bold bb-code" (FeyFre)

Demo: none

phpBB-Version: phpBB 3.0.x
phpBB-Languages: en
phpBB-Styles: subsilver2 / prosilver

Instruction

open

styles/subsilver2/template/viewtopic_body.html

find

Code: Select all
<!-- BEGIN postrow -->


before add

Code: Select all
<!-- Fast addressing user in quick reply / 4_seven / 2012 -->
<!--
 IF S_QUICK_REPLY -->
<
script type="text/javascript">
// <![CDATA[ 
!window.jQuery && document.write('<script type="text\/javascript" src="http:\/\/code.jquery.com\/jquery.min.js"><\/script>');
// ]]> 
</script>
<script>
// <![CDATA[
function go_qr(message)
{

var box   = $("textarea[name=message]").val();

if (box !== ''){
var srg = '\r\n';
}
else{
var srg = '';
}

$("textarea[name=message]").append(srg + message);

}
// ]]>
</script>  
<!-- ENDIF -->  
<!-- Fast addressing user in quick reply / 4_seven / 2012 -->


find

Code: Select all
<b class="postauthor"


replace with

Code: Select all
<b<!-- IF S_QUICK_REPLY --> onclick="go_qr('[b]{postrow.POST_AUTHOR}[/b]'); return false;"<!-- ENDIF --> class="postauthor"


Note:
You can add multiple usernames by click. They will be inserted with a linebreak after each.
But, if you want do do so, click all usernames first, then write your answer or change the
content of the qr postbox. Otherwise the script stops and must be reactivated via strg + f5.
Mod-Bot / Service-Team
User avatar
Sekuro

Tiptop

Tiptop
 
Posts: 241
Joined: 11 Feb 2008, 11:49
 
Resolution: 1440x900



Return to Snip Cl@ss I

Who is online

Users browsing this forum: No registered users and 1 guest

cron