The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Help with Prefix Script Tune up

View previous topic View next topic Go down

Help with Prefix Script Tune up

Post by FiskBlack on August 8th 2016, 10:06 pm

Hey there,

i'd like some help with a code for a Prefix/Tag system, it already works the way I want, but I'd like to add two more parts to it:

- Colorize the prefixes;
- Permission level, must be a moderator or an admin to use some of the prefixes.


Here is the code:
Code:

var PREFIJOS_TEMAS = [];

//########## ZONA EDITABLE #####################################
  PREFIJOS_TEMAS.push("[Music]");
  PREFIJOS_TEMAS.push("[Question]");
  PREFIJOS_TEMAS.push("[Solved]");
  PREFIJOS_TEMAS.push("[Event]");
  PREFIJOS_TEMAS.push("[Movie]");
  PREFIJOS_TEMAS.push("[Game]");
  PREFIJOS_TEMAS.push("[Tutorial]");
  //Añade más prefijos si quieres, simplemente añadiendo una línea igual:
  http://PREFIJOS_TEMAS.push("[Nuevo Prefijo]");
//########## FIN ZONA EDITABLE #####################################

$(function () {
  if(/^\/post\?f=\d+&mode=newtopic/.test($(location).attr('pathname') + $(location).attr('search'))){   
      var html_options_prefijo = "<select name='prefijos'><option value=''>--Seleccionar--</option>";
      for(var prefijo in PREFIJOS_TEMAS){
        html_options_prefijo += "<option value='" + PREFIJOS_TEMAS[prefijo] + "'>" + PREFIJOS_TEMAS[prefijo] + "</option>";
      }
      html_options_prefijo += "</select>";     
      $('input[name="subject"]').before(html_options_prefijo);       
      $("form[method='post']").submit(function() {
        $('input[name="subject"]').val(($('select[name="prefijos"]').val() ? $('select[name="prefijos"]').val() + " " : "") + $('input[name="subject"]').val());
      });
  }
});

And this is the topic of the creator: http://asistencia.foroactivo.com/t110856-sistema-de-prefijos-en-el-asunto-de-los-posts


Thank you for your help.
FiskBlack

FiskBlack
Forumember

Posts : 50
Reputation : 3
Language : English

http://otakunoheya.forumotion.co/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum