Topic Prefix for phbb2
2 posters
Page 1 of 1
Topic Prefix for phbb2
Hello forumotion, just gonna ask if a phbb2 has a possibility to have a Topic Prefix? Cause I have already search some prefix related in here but the only forum version I see is phbb3,punbb and Invision. If there was a code for it can you post it here? I need your help guys and If it has, how can I modify it with a color?
Thanks in advance.
Edited:
I have search in the forum and saw this code for the prefix but it didn't function in my forum
Forum link: http://www.rl-rp.board.st
Forum Version: phbb2
Thanks in advance.
Edited:
I have search in the forum and saw this code for the prefix but it didn't function in my forum
Forum link: http://www.rl-rp.board.st
Forum Version: phbb2
- Code:
var prefixes = ["PENDING", "ACCEPTED", "DENIED", "PENDING ADMIN", "PENDING INV", "APPROVED"];
var _pm = false;
var chk = false;
function toMenu(a) {
var htmlpre = '<select style="margin-right:5px" id="prefix" size="1"><option value="">(None)</option>';
for (i in a)
htmlpre += '<option value="' + a[i] + '">' + a[i] + '</option>';
htmlpre += '</select>';
return htmlpre;
}
function checkpre(ar, input) {
for (i in ar) {
var p = new RegExp("" + ar[i], "g");
var title = input.substr(0, input.indexOf(']'));
if (p.test(title)) return ar[i];
}
return "";
}
$(function () {
if (_pm) chk = /\privmsg/.test(location.href);
if (/\/post/.test(location.href) || chk) {
$(toMenu(prefixes)).insertBefore("input[name='subject'][type='text']");
var mw = $("#prefix").width() + 5;
$("input[name='subject']").css("width", $("input[name='subject']").width() - mw);
var t = $("[name='subject']").val();
var cur = checkpre(prefixes, t);
if (cur != "") {
$("[value=" + cur + "]").attr("selected", "selected");
$("input[name='subject']").val(t.replace('[' + cur + ']', '').trim())
}
$("input[name='post']").click(function () {
var sub = $("input[name='subject']").val().trim();
if (sub != "" && $("#prefix").val() != "") $("input[name='subject']").val("[" + $("#prefix").val() + "] " + sub)
})
}
});
Last edited by Babybok on November 10th 2016, 4:37 pm; edited 5 times in total
Re: Topic Prefix for phbb2
that code you posted, only works for add a prefix in the title when you create a new topic, you need this one.
Create a js new file into Administration panel, set it in all pages.
This code replace all your prefix like this: [css], [solvet], etc, any word into the brackets works
then you need add a CSS this is the base
if you have a prefix [sports] needs add this in your css panel
[pets]
etc, etc
you can see my demo here:
Create a js new file into Administration panel, set it in all pages.
- Code:
$.prefijos = function () {
var i, a = document.querySelectorAll('a, h1,.postdetails'),
copyright = 'Por Chalo, para http://www.opensourcephpbb3.com';
for (i = 0; i < a.length; i++) {
var b = a[i].innerHTML;
if (/\[([^\[\]]+)\]/.test(b)) {
var c = b.match(/\[(.*?)\]/)[1].toLowerCase().replace(/\W+/g, '-'),
d = b.match(/\[(.*?)\]/)[1].toLowerCase(),
e = b.replace(/^\[.*?\]/, '<span class="prefijo ' + c + '">' + d + '</span>');
a[i].innerHTML = e
}
}
};
$(function () {
$.prefijos()
});
This code replace all your prefix like this: [css], [solvet], etc, any word into the brackets works
then you need add a CSS this is the base
- Code:
.prefijo {
background: #ed7710;
color: #FFF;
border-radius: 2px;
display: inline-table!important;
line-height: 13px;
padding: 1px 4px 0;
font-weight: 700!important;
font-size: 8px!important;
text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
margin-left: 2px;
font-family: arial;
}
if you have a prefix [sports] needs add this in your css panel
- Code:
.prefijo.sports{
background: red!important
}
[pets]
- Code:
.prefijo.pets{
background: purple!important
}
etc, etc
you can see my demo here:
- Spoiler:
Last edited by Ch@lo Valdez on November 10th 2016, 1:27 pm; edited 1 time in total
Ch@lo Valdez- Forumember
- Posts : 138
Reputation : 50
Language : spanish
Re: Topic Prefix for phbb2
Hello @Ch@lo Valdez thanks for the help but is it for phpbb2 as well? and where to edit the brackets?
EDITED:
and If will put this into my js it never function but it replaces the log-out button to this
EDITED:
and If will put this into my js it never function but it replaces the log-out button to this
Re: Topic Prefix for phbb2
is fixed now:
please see my demo http://codelab.sitio-web.org/t25-soccer-ok-test#715 is phpbb2
in your forum have in the index a prefix [ch]
so, we have there .
custom color comes if you add in your css .
and ...
please see my demo http://codelab.sitio-web.org/t25-soccer-ok-test#715 is phpbb2
in your forum have in the index a prefix [ch]
so, we have there .
|
|
Ch@lo Valdez- Forumember
- Posts : 138
Reputation : 50
Language : spanish
Re: Topic Prefix for phbb2
Thanks @Ch@lo Valdez it worked perfectl However the text didn't capitalize. Is there any ways to capitaliz the text?
Edited: oh It's ok now, I've change the toLowerCase to toUpperCase.
And one thing mate the prefix doesn't appear in the topic, I mean when you click into the topic the title just show up with this " [NOTICE] Blablahblah" Without the style.
Edited: oh It's ok now, I've change the toLowerCase to toUpperCase.
And one thing mate the prefix doesn't appear in the topic, I mean when you click into the topic the title just show up with this " [NOTICE] Blablahblah" Without the style.
Re: Topic Prefix for phbb2
Babybok wrote:Thanks @Ch@lo Valdez it worked perfectl However the text didn't capitalize. Is there any ways to capitaliz the text?
Edited: oh It's ok now, I've change the toLowerCase to toUpperCase.
And one thing mate the prefix doesn't appear in the topic, I mean when you click into the topic the title just show up with this " [NOTICE] Blablahblah" Without the style.
please put again toLowerCase is for this reason you don`t get styles in your prefix, don't change anything
in css
|
Ch@lo Valdez- Forumember
- Posts : 138
Reputation : 50
Language : spanish
Re: Topic Prefix for phbb2
Ch@lo Valdez wrote:Babybok wrote:Thanks @Ch@lo Valdez it worked perfectl However the text didn't capitalize. Is there any ways to capitaliz the text?
Edited: oh It's ok now, I've change the toLowerCase to toUpperCase.
And one thing mate the prefix doesn't appear in the topic, I mean when you click into the topic the title just show up with this " [NOTICE] Blablahblah" Without the style.
please put again toLowerCase is for this reason you don`t get styles in your prefix, don't change anything
in css, capitalize is not possible;
- Code:
.prefijo{ add text-transform: lowercase or uppercase
It's all good now, with the text, the only problem I have now is the style in the topic section,the style doesn't work.
Re: Topic Prefix for phbb2
please try with this:
- Code:
$.prefijos = function () {
var i, a = document.querySelectorAll('a:not(#logout), h1,.postdetails,.cattitle'),
copyright = 'written by Chalo http://www.opensourcephpbb3.com';
for (i = 0; i < a.length; i++) {
var b = a[i].innerHTML;
if (/\[([^\[\]]+)\]/.test(b)) {
var c = b.match(/\[(.*?)\]/)[1].toLowerCase().replace(/\W+/g, '-'),
d = b.match(/\[(.*?)\]/)[1].toLowerCase(),
e = b.replace(/\[.*?\]/, '<span class="prefijo ' + c + '">' + d + '</span>');
a[i].innerHTML = e
}
}
};
$(function () {
$.prefijos()
});
Ch@lo Valdez- Forumember
- Posts : 138
Reputation : 50
Language : spanish
Re: Topic Prefix for phbb2
Ch@lo Valdez wrote:please try with this:
- Code:
$.prefijos = function () {
var i, a = document.querySelectorAll('a:not(#logout), h1,.postdetails,.cattitle'),
copyright = 'written by Chalo http://www.opensourcephpbb3.com';
for (i = 0; i < a.length; i++) {
var b = a[i].innerHTML;
if (/\[([^\[\]]+)\]/.test(b)) {
var c = b.match(/\[(.*?)\]/)[1].toLowerCase().replace(/\W+/g, '-'),
d = b.match(/\[(.*?)\]/)[1].toLowerCase(),
e = b.replace(/\[.*?\]/, '<span class="prefijo ' + c + '">' + d + '</span>');
a[i].innerHTML = e
}
}
};
$(function () {
$.prefijos()
});
Nice job, thanks for all the help. A thanked for you is so worth it. Thanks man.
And yeah just wanna ask this time. Is it a even possible to have diffent prefixes in different forum? Like example : [Banned] prefix can be only use in Forum1 Section and [Accepted] prefix can only be use in Forum2 section.
Is that even possible @Ch@lo Valdez
Cancelling the solve, just want to complete my problem..
Re: Topic Prefix for phbb2
My code is global, it works looking for square brackets transforming them into html, with this code is not possible do that you want sorry
Ch@lo Valdez- Forumember
- Posts : 138
Reputation : 50
Language : spanish
Similar topics
» Topic prefix
» Music Profile Song JS for PhBB2.
» Topic Prefix
» Topic prefix Button
» Prefix for topic titles
» Music Profile Song JS for PhBB2.
» Topic Prefix
» Topic prefix Button
» Prefix for topic titles
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum