Prefixos Dom 13 Out 2013 - 2:10
Qual é minha questão:
Oie, fazia tempo que eu andava off, mas agora to on '-'
Eu achei esse código de prefixos do daemon perdido poraí, gostaria de pedir que adapte ele para funcionar no meu fórum...
Eu testei e tentei mudar algumas partes, mas não funcionou!
Se conseguirem vou agradecer muito xD
[Tens de ter uma conta e sessão iniciada para poderes visualizar este link]
Versão:
Phpbb3
Oie, fazia tempo que eu andava off, mas agora to on '-'
Eu achei esse código de prefixos do daemon perdido poraí, gostaria de pedir que adapte ele para funcionar no meu fórum...
Eu testei e tentei mudar algumas partes, mas não funcionou!
Se conseguirem vou agradecer muito xD
- Código:
var prefixes = ["prefix1","prefix2","prefix3","prefix4"];
var _pm = false;
var chk = false;
function toMenu(a) {
var htmlpre = '<select style="margin-right:5px" id="prefix" size="1"><option value="">(sem prefixo)</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);
});
}
});
[Tens de ter uma conta e sessão iniciada para poderes visualizar este link]
Versão:
Phpbb3