We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
Topic Prefixes
Topic Started: Aug 13 2010, 11:32 AM (5,189 Views)
VMSimon
Member Avatar
#clowns {float:left;} #jokers {float:right;} #me, #you {position:static;text-align:center;margin:auto;}
[ *  *  * ]
Prefix Dropdown
Description: Adds a prefix dropdown select, and adds that in [] at the start of the topic title. Good for coding forums, for options such as [ZB] and [IF]. Default option is none.

Preview: http://s1.zetaboards.com/AeonSkins/topic/3692631/1/



The Code:
Code:
 
<script>
var prefixes = {
val1 : 'text1',
val2 : 'text2'
};
var forum=[1632776,1632777];
//END EDITING
if(/&f\=(\d+)$/.test(location.href) && (forum === "all" || jQuery.inArray(parseInt(RegExp.$1), forum) !== -1)) {
$('tr:contains("Topic Tags")').after("<tr><td class='c_desc'>Prefix</td><td><select name='prefix' id='prefix'><option val='0'>None</option></select></td></tr>");
$.each(prefixes, function(val, text) {
$('#prefix').append(
$('<option></option>').val(val).html(text)
);
});
$('button[name=post_submit]').click(function(event){
var original=$('input[name=title]').val();
var prefix=$('#prefix option:selected').text();
if(prefix!="None"){
$('input[name=title]').val('['+prefix+']'+original);
}
});
}
</script>


Extra Notes:
Place that in "Under the Board".
Edit:
Code:
 
var prefixes = {
val1 : 'text1',
val2 : 'text2'
};

just add more, like val3 : 'text3',.
Make sure all except the last one have , after them.
edit
Code:
 

var forum=[FORUM ID 1,FORUM ID2];

for the forums you want the code active in. If you want it active in all forums, change it to "all". Separate the id's with ",".
If you want to change the name of the option, find
Quote:
 
$('tr:contains("Topic Tags")').after("<tr><td class='c_desc'>Prefix</td><td><select name='prefix' id='prefix'><option val='0'>None</option></select></td></tr>");

and change the red part.
Edited by VMSimon, Aug 13 2010, 05:34 PM.
Offline Profile Quote Post Goto Top
 
Patrick
Member Avatar
PatrickFTW
[ *  *  *  *  * ]
Cool little code. Good post!
Offline Profile Quote Post Goto Top
 
Pescao6-ZNR
Member
[ * ]
Not bad; though you could probably do something similar with auto-tools. :P
Offline Profile Quote Post Goto Top
 
VMSimon
Member Avatar
#clowns {float:left;} #jokers {float:right;} #me, #you {position:static;text-align:center;margin:auto;}
[ *  *  * ]
Pescao6
Aug 13 2010, 02:31 PM
Not bad; though you could probably do something similar with auto-tools. :P
True, you could.
Offline Profile Quote Post Goto Top
 
DelicateGlow
Member Avatar
Member
[ * ]
Is it possible to make one of the prefixes to have color and bold?
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code:
 
<script type='text/javascript'>
$('.c_cat-title, th, .c_last, #nav span').each(function(){
$(this).html($(this).html().replace(/\[b](.+?)\[\/b\]/gi,"<strong>$1</strong>"));
$(this).html($(this).html().replace(/\[color=(.+?)](.+?)\[\/color\]/gi,"<span style='color: $1'>$2</span>"));
});
</script>
Use that, and use BBCode in the prefixes you insert in the code. There will be two issues with using that, the title of the page for the topic that has BBCode in it will appear as BBCode and BBCode will appear in the Prefix drop down.
Offline Profile Quote Post Goto Top
 
DelicateGlow
Member Avatar
Member
[ * ]
Thank you! :)
Offline Profile Quote Post Goto Top
 
phalen78
Member
[ * ]
hi guys!

sorry for the necro post :p

how do you add a space after the [prefix] ? ie. instead of [this]this i want [this] this

i tried adding spaces here: val('['+prefix+']'
but it didnt work :( i also tried the code   - didnt work either

any suggestions?
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Code:
 
'['+prefix+']
Add a space after that.
Offline Profile Quote Post Goto Top
 
phalen78
Member
[ * ]
you mean '['+prefix+']' > '['+prefix+']SPACE' ?

i did try that. it didnt work
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
That will add a space to new topic prefixes that are submitted, at least it did for me. If you want a space added to the preexisting prefixes you'll have to do it manually, I'm afraid.
Code:
 
<script>
var prefixes = {
val1 : 'text1',
val2 : 'text2'
};
var forum=[1632776,1632777];
//END EDITING
if(/&f\=(\d+)$/.test(location.href) && (forum === "all" || jQuery.inArray(parseInt(RegExp.$1), forum) !== -1)) {
$('tr:contains("Topic Tags")').after("<tr><td class='c_desc'>Prefix</td><td><select name='prefix' id='prefix'><option val='0'>None</option></select></td></tr>");
$.each(prefixes, function(val, text) {
$('#prefix').append(
$('<option></option>').val(val).html(text)
);
});
$('button[name=post_submit]').click(function(event){
var original=$('input[name=title]').val();
var prefix=$('#prefix option:selected').text();
if(prefix!="None"){
$('input[name=title]').val('['+prefix+'] '+original);
}
});
}
</script>
That's what worked for me.
Offline Profile Quote Post Goto Top
 
phalen78
Member
[ * ]
ok, thx - will try it
Offline Profile Quote Post Goto Top
 
extraordinary
Member
[ *  * ]
Wait.. where do we put the coding? Because this would come in MEGA handy on my board!!

And can we change the text1, text2 to our own titles?
Edited by extraordinary, Sep 29 2011, 10:22 PM.
Offline Profile Quote Post Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
The code can go here:

Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board

'text1' and 'text2' and the forum IDs is what you need to edit.
Offline Profile Quote Post Goto Top
 
extraordinary
Member
[ *  * ]
Cory
Sep 29 2011, 10:32 PM
The code can go here:

Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board

'text1' and 'text2' and the forum IDs is what you need to edit.
I'm dumb when it comes to these things, where is the edit for forum IDs? What exactly is forum ID? I'm slow when it comes to these things. =/ Sorry..

I put the code in "Below the Board," changed "text1" and added a third text and it's not working? It won't allow me to put a prefix?

edit; Also!! Is there anyway to NOT make it text like it is, but even more of a prefix like it's just black text or something that is NEXT to the title, but not apart of the title?
Edited by extraordinary, Sep 29 2011, 10:45 PM.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · ZetaBoards Codes & Modifications · Next Topic »
Add Reply
  • Pages:
  • 1