evil kev
08-31-2005, 10:00 PM
just a quick modification that i made for my forum to change how quick reply works so the big box is by default always hidden and only shown if users want to use it. if you click on the quick reply link it says who you're quoting (and defaulty goes to quote if clicked from a message)
----------------------------
************************************************** *************************
Quick reply modification
hidden quick reply that shows who is being quoted
************************************************** *************************
How this is different to normal quick reply:
- hidden by default (shown as collapsed box)
- on clicking a quick reply icon automatically ticks quote box
- when someone is being quoted it says who and which post number
What is modified:
- SHOWTHREAD template
- vbulletin_quick_reply.js
How to install:
for SHOWTHREAD template:
change:
<a style="float:$stylevar[right]" href="#top" onclick="return <if condition="$show['wysiwyg'] == 2
AND !is_browser('ie')">editor_loaded ? false : </if> toggle_collapse('quickreply');"><img id="collapseimg_quickreply"
src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_quickreply].gif" alt="" border="0" /></a>
$vbphrase[quick_reply]
to:
<!--QR MOD1 -->
<a style="float:$stylevar[right]" href="#top" id="qr_hide" onclick="return false;"><img
src="$stylevar[imgdir_button]/collapse_tcat_collapsed.gif" alt="" border="0" /></a>
<span id="qr_name"><a
href="newreply.php?$session[sessionurl]do=newreply&noquote=1&p=$LASTPOSTID">$vbphrase[quick_reply]</a></span>
<script type="text/javascript">
<!--
//vbphrases can be added to vBeditTemplate[clientscript] put here for ease of modification access
//can be vbphrases if added
vbphrase["qr_quoting_post"] = 'Quoting Post #';
vbphrase["qr_by"] = ' by ';
//-->
</script>
<!-- /QR MOD1 -->
and
change:
<tbody id="collapseobj_quickreply" style="$vbcollapse[collapseobj_quickreply]">
to:
<!-- QR MOD2 -->
<tbody id="qr_obj" style="display:none;">
<!-- /QR MOD2 -->
save.
NOTE: if you wish to use vbphrases add the phrases you need and modify the 'Quoting Post #' and ' by ' bits to the vbphrase
names
in vbulletin_quick_reply.js
add at the top after the vb notice and before any script:
//qr modifications
//js addition 1
//variables used in mod
var oldlink,oldimg,newimg,scrollTop;
//set onclicks
fetch_tags(fetch_object('qr_name'), 'a')[0].onclick = qr_hide;
fetch_object('qr_hide').onclick = qr_hide;
/**
* hides or shows quick reply depending on its use
*/
function qr_hide(){
if(fetch_object('qr_obj').style.display == 'none'){
qr_show();
vB_Editor[QR_EditorID].check_focus();
if(!require_click)qr_active = true;
}else{
fetch_object('qr_obj').style.display = 'none';
fetch_object('qr_name').innerHTML = oldlink;
fetch_tags(fetch_object('qr_name'), 'a')[0].onclick = qr_hide;
fetch_tags(fetch_object('qr_hide'), 'img')[0].src = oldimg;
}
return false
}
/**
* shows quick reply box
*/
function qr_show(){
fetch_object('qr_obj').style.display = '';
oldlink = fetch_object('qr_name').innerHTML;
fetch_object('qr_name').innerHTML = fetch_tags(fetch_object('qr_name'), 'a')[0].innerHTML;
oldimg = fetch_tags(fetch_object('qr_hide'), 'img')[0].src;
newimg = '';
for(i=0;i<oldimg.length-14;i++){
newimg = newimg + oldimg.charAt(i);
}
fetch_tags(fetch_object('qr_hide'), 'img')[0].src = newimg + '.gif';
scrollTop = vB_Popup_Menu.prototype.fetch_offset(fetch_object( 'qrform'))['top'];
self.scrollTo(0,scrollTop);
}
/**
* hides the "quoting post" text if checkbox is unchecked and vice versa
*/
function qr_quoteManage(){
if(this.checked == true){
fetch_object('qr_quotetext').style.display = '';
}else{
fetch_object('qr_quotetext').style.display = 'none';
}
return true;
}
//end js addition 1
change:
function qr_disable_controls()
{
to:
function qr_disable_controls()
{
//qr modification
//js addition 2
if(fetch_object('qr_obj').style.display != 'none')qr_hide();
if(fetch_object('qr_quickreply').checked == true)fetch_object('qr_quickreply').checked = false;
fetch_object('qr_quotetext').style.display = 'none';
//end js addition 2
change:
function qr_activate(postid)
{
var qr_collapse = fetch_object('collapseobj_quickreply');
if (qr_collapse && qr_collapse.style.display == "none")
{
toggle_collapse('quickreply');
}
fetch_object('qr_postid').value = postid;
fetch_object('qr_preview').select();
fetch_object('qr_quickreply').disabled = false;
to:
function qr_activate(postid)
{
//code no longer used
/*var qr_collapse = fetch_object('collapseobj_quickreply');
if (qr_collapse && qr_collapse.style.display == "none")
{
toggle_collapse('quickreply');
}*/
//qr modification
//js addition 3
//if qr is hidden show it
fetch_object('qr_obj').style.display == 'none' ? qr_show(): self.scrollTo(0,scrollTop);
//end js addition 3
fetch_object('qr_postid').value = postid;
fetch_object('qr_preview').select();
fetch_object('qr_quickreply').disabled = false;
//js addition 4
//make quote as default
fetch_object('qr_quickreply').checked = true;
//set onclick to hide quote text when checkbox isn't checked
fetch_object('qr_quickreply').onclick = qr_quoteManage;
//get username
var quo_user = fetch_tags(fetch_object('postmenu_' + postid),'a')[0].innerHTML;
//get post number
//needs modifying if postnumber isnt in <strong> tags
var quo_no = fetch_tags(fetch_object('postcount' + postid),'strong')[0].innerHTML;
fetch_object('qr_quotetext').innerHTML = vbphrase["qr_quoting_post"] + quo_no + vbphrase["qr_by"] + quo_user;
//unhide quote if hidden
if(fetch_object('qr_quotetext').style.display == 'none')fetch_object('qr_quotetext').style.display = '';
//end js addition 4
save and upload (when testing using ctrl + f5 to force the browser to reload js files)
installation complete :)
Potential Problems:
i've tested this with ie6 and firefox and i havent had problems altho in some cases it could degrade poorly i havent looked at the fetch_tags() method yet to understand how it degrades but this should certainly work fine on most modern browsers.
there are still likely to be bugs in this as it has not been tested fully in an in-use forum.
--------------------
maybe someone will have a use for this like we do, maybe not :D
p.s. this is my first hack that i've wrote up for here so be gentle if i've done something wrong :)
----------------------------
************************************************** *************************
Quick reply modification
hidden quick reply that shows who is being quoted
************************************************** *************************
How this is different to normal quick reply:
- hidden by default (shown as collapsed box)
- on clicking a quick reply icon automatically ticks quote box
- when someone is being quoted it says who and which post number
What is modified:
- SHOWTHREAD template
- vbulletin_quick_reply.js
How to install:
for SHOWTHREAD template:
change:
<a style="float:$stylevar[right]" href="#top" onclick="return <if condition="$show['wysiwyg'] == 2
AND !is_browser('ie')">editor_loaded ? false : </if> toggle_collapse('quickreply');"><img id="collapseimg_quickreply"
src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_quickreply].gif" alt="" border="0" /></a>
$vbphrase[quick_reply]
to:
<!--QR MOD1 -->
<a style="float:$stylevar[right]" href="#top" id="qr_hide" onclick="return false;"><img
src="$stylevar[imgdir_button]/collapse_tcat_collapsed.gif" alt="" border="0" /></a>
<span id="qr_name"><a
href="newreply.php?$session[sessionurl]do=newreply&noquote=1&p=$LASTPOSTID">$vbphrase[quick_reply]</a></span>
<script type="text/javascript">
<!--
//vbphrases can be added to vBeditTemplate[clientscript] put here for ease of modification access
//can be vbphrases if added
vbphrase["qr_quoting_post"] = 'Quoting Post #';
vbphrase["qr_by"] = ' by ';
//-->
</script>
<!-- /QR MOD1 -->
and
change:
<tbody id="collapseobj_quickreply" style="$vbcollapse[collapseobj_quickreply]">
to:
<!-- QR MOD2 -->
<tbody id="qr_obj" style="display:none;">
<!-- /QR MOD2 -->
save.
NOTE: if you wish to use vbphrases add the phrases you need and modify the 'Quoting Post #' and ' by ' bits to the vbphrase
names
in vbulletin_quick_reply.js
add at the top after the vb notice and before any script:
//qr modifications
//js addition 1
//variables used in mod
var oldlink,oldimg,newimg,scrollTop;
//set onclicks
fetch_tags(fetch_object('qr_name'), 'a')[0].onclick = qr_hide;
fetch_object('qr_hide').onclick = qr_hide;
/**
* hides or shows quick reply depending on its use
*/
function qr_hide(){
if(fetch_object('qr_obj').style.display == 'none'){
qr_show();
vB_Editor[QR_EditorID].check_focus();
if(!require_click)qr_active = true;
}else{
fetch_object('qr_obj').style.display = 'none';
fetch_object('qr_name').innerHTML = oldlink;
fetch_tags(fetch_object('qr_name'), 'a')[0].onclick = qr_hide;
fetch_tags(fetch_object('qr_hide'), 'img')[0].src = oldimg;
}
return false
}
/**
* shows quick reply box
*/
function qr_show(){
fetch_object('qr_obj').style.display = '';
oldlink = fetch_object('qr_name').innerHTML;
fetch_object('qr_name').innerHTML = fetch_tags(fetch_object('qr_name'), 'a')[0].innerHTML;
oldimg = fetch_tags(fetch_object('qr_hide'), 'img')[0].src;
newimg = '';
for(i=0;i<oldimg.length-14;i++){
newimg = newimg + oldimg.charAt(i);
}
fetch_tags(fetch_object('qr_hide'), 'img')[0].src = newimg + '.gif';
scrollTop = vB_Popup_Menu.prototype.fetch_offset(fetch_object( 'qrform'))['top'];
self.scrollTo(0,scrollTop);
}
/**
* hides the "quoting post" text if checkbox is unchecked and vice versa
*/
function qr_quoteManage(){
if(this.checked == true){
fetch_object('qr_quotetext').style.display = '';
}else{
fetch_object('qr_quotetext').style.display = 'none';
}
return true;
}
//end js addition 1
change:
function qr_disable_controls()
{
to:
function qr_disable_controls()
{
//qr modification
//js addition 2
if(fetch_object('qr_obj').style.display != 'none')qr_hide();
if(fetch_object('qr_quickreply').checked == true)fetch_object('qr_quickreply').checked = false;
fetch_object('qr_quotetext').style.display = 'none';
//end js addition 2
change:
function qr_activate(postid)
{
var qr_collapse = fetch_object('collapseobj_quickreply');
if (qr_collapse && qr_collapse.style.display == "none")
{
toggle_collapse('quickreply');
}
fetch_object('qr_postid').value = postid;
fetch_object('qr_preview').select();
fetch_object('qr_quickreply').disabled = false;
to:
function qr_activate(postid)
{
//code no longer used
/*var qr_collapse = fetch_object('collapseobj_quickreply');
if (qr_collapse && qr_collapse.style.display == "none")
{
toggle_collapse('quickreply');
}*/
//qr modification
//js addition 3
//if qr is hidden show it
fetch_object('qr_obj').style.display == 'none' ? qr_show(): self.scrollTo(0,scrollTop);
//end js addition 3
fetch_object('qr_postid').value = postid;
fetch_object('qr_preview').select();
fetch_object('qr_quickreply').disabled = false;
//js addition 4
//make quote as default
fetch_object('qr_quickreply').checked = true;
//set onclick to hide quote text when checkbox isn't checked
fetch_object('qr_quickreply').onclick = qr_quoteManage;
//get username
var quo_user = fetch_tags(fetch_object('postmenu_' + postid),'a')[0].innerHTML;
//get post number
//needs modifying if postnumber isnt in <strong> tags
var quo_no = fetch_tags(fetch_object('postcount' + postid),'strong')[0].innerHTML;
fetch_object('qr_quotetext').innerHTML = vbphrase["qr_quoting_post"] + quo_no + vbphrase["qr_by"] + quo_user;
//unhide quote if hidden
if(fetch_object('qr_quotetext').style.display == 'none')fetch_object('qr_quotetext').style.display = '';
//end js addition 4
save and upload (when testing using ctrl + f5 to force the browser to reload js files)
installation complete :)
Potential Problems:
i've tested this with ie6 and firefox and i havent had problems altho in some cases it could degrade poorly i havent looked at the fetch_tags() method yet to understand how it degrades but this should certainly work fine on most modern browsers.
there are still likely to be bugs in this as it has not been tested fully in an in-use forum.
--------------------
maybe someone will have a use for this like we do, maybe not :D
p.s. this is my first hack that i've wrote up for here so be gentle if i've done something wrong :)