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:
Locked Topic
[ C ] Custom colored topic titles
Topic Started: Apr 30 2012, 12:24 AM (779 Views)
Dannyy
Member Avatar
Member
[ *  * ]
Board Address: http://killorgy.com/index/
Board Software: ZetaBoards
Description: Code that allows custom coloring to topic titles

I would like to know if I could get a code, or be given an already existent one, that would allow permitted groups to append, perhaps, BBCode color tags to topic titles.

Concept:
Posted Image

Please help and thank you!
Offline Profile Goto Top
 
Joshua J
Member Avatar
Member
[ *  *  * ]
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board

Code:


<script type="text/javascript">
(function ($) {
$('a.c_last-title[title]:contains([/)').each(function () {
var title = $(this).attr('title');
$(this).text(title);
});

$('td.c_cat-title a, a.c_last-title, #nav li span, #topic_viewer thead th, table.posting thead th, div.search_results h3 a, table.search_results_post th a, #board_feed td a[href*="/topic"], div.portal_box h2 a').each(function () {
$(this).html($(this).html().replace(/\[color=(.+?)\](.+?)\[\/color]/gi, '<span style="color: $1">$2</span>').replace(/\[s\](.+?)\[\/s]/gi, '<del>$1</del>').replace(/\[b\](.+?)\[\/b]/gi, '<strong>$1</strong>').replace(/\[i\](.+?)\[\/i]/gi, '<em>$1</em>').replace(/\[u\](.+?)\[\/u]/gi, '<span style="text-decoration: underline">$1</span>'));
});

$('title:contains([/), #portal h4:contains([/)').each(function () {
$(this).html($(this).html().replace(/\[(.+?)\]/gi, ''));
});
})(jQuery);
</script>


then all they have to do is [ color=XXX] and [/color ] [/color]
Edited by Joshua J, Apr 30 2012, 06:25 AM.
Offline Profile Goto Top
 
Dannyy
Member Avatar
Member
[ *  * ]
WOW that is so legit. Thank you so much!

By the way, is there any way to make it so that only certain groups can use this feature?
Edited by Dannyy, Apr 30 2012, 08:37 PM.
Offline Profile Goto Top
 
Joshua J
Member Avatar
Member
[ *  *  * ]
Might want to ask Cory that as im not sure!
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
I made a snippet for admins-only in the original topic, but it appears you want to restrict the usage on a group basis, try this below the code:
Code:
 
<script type="text/javascript">
(function ($) {
if (location.href.indexOf('/post/?type=1') !== -1) {
function addGroup(groupName) {
$.get($('#top_info strong a').attr('href'), function (data) {
$('table.posting').closest('form').submit(function (event) {
var group = $('dl.user_info dt:contains(Group) + dd', data).html();
var value = $('input[name="title"]').val();
if (value.indexOf('[/') >= 0 && group === groupName) {
event.preventDefault();
alert('Your group does not have permission to use BBCode in topic titles')
}
});
});
}

addGroup('GROUP_NAME');

}
})(jQuery);
</script>
Replace GROUP_NAME and repeat that line to restrict more groups from using BBCode in topic titles.
Offline Profile Goto Top
 
Dannyy
Member Avatar
Member
[ *  * ]
Wow, you have a topic about it already! I'm sorry! Thanks for the code.
Cory
May 1 2012, 07:16 PM
I made a snippet for admins-only in the original topic, but it appears you want to restrict the usage on a group basis, try this below the code:
Code:
 
<script type="text/javascript">
(function ($) {
if (location.href.indexOf('/post/?type=1') !== -1) {
function addGroup(groupName) {
$.get($('#top_info strong a').attr('href'), function (data) {
$('table.posting').closest('form').submit(function (event) {
var group = $('dl.user_info dt:contains(Group) + dd', data).html();
var value = $('input[name="title"]').val();
if (value.indexOf('[/') >= 0 && group === groupName) {
event.preventDefault();
alert('Your group does not have permission to use BBCode in topic titles')
}
});
});
}

addGroup('GROUP_NAME');

}
})(jQuery);
</script>
Replace GROUP_NAME and repeat that line to restrict more groups from using BBCode in topic titles.
Would this go below the board as well?
Edited by Dannyy, May 1 2012, 10:48 PM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Yes, that will be fine.
Offline Profile Goto Top
 
Dannyy
Member Avatar
Member
[ *  * ]
Nevermind my above post, I've tried it and it works! Interestingly.

So I have to add all of the groups that I don't want to be able to use BBCode?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
That is correct.
Offline Profile Goto Top
 
Dannyy
Member Avatar
Member
[ *  * ]
Thank you so much! It works perfectly.

You can close this.
Offline Profile Goto Top
 
Eccentric Feline
Member Avatar
梦想
[ *  *  *  *  *  *  *  * ]
Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
DealsFor.me - The best sales, coupons, and discounts for you
« Previous Topic · Closed Requests · Next Topic »
Locked Topic