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.

about prefixes

View previous topic View next topic Go down

In progress about prefixes

Post by omarpop23 on June 14th 2016, 10:13 am

@Ange Tuteur
how can i make each of these prefixes has deference color
i using this JS code
Code:
var prefixes = ["prefix 1","prefix 2"];
        var _pm = false;
        var chk = false;
        function toMenu(a) {
          var htmlpre = '<select style="margin-right:5px" id="prefix" size="1"><option value=""> Prefixes </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 omarpop23 on June 15th 2016, 9:16 pm; edited 1 time in total

omarpop23
Forumember

Male Posts : 144
Reputation : 3
Language : Arabic
Location : Egypt

http://egyover.ahlamontada.com

Back to top Go down

In progress Re: about prefixes

Post by SLGray on June 14th 2016, 10:39 am

Would it not be easier just to use topic icons, like the solved one on the support forum? You can create just text images in different colors.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36663
Reputation : 2444
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

In progress Re: about prefixes

Post by omarpop23 on June 15th 2016, 9:15 pm

i need it text because searching in google be easy when some one writs the title

i cant explain well because my English is very weak sorry

omarpop23
Forumember

Male Posts : 144
Reputation : 3
Language : Arabic
Location : Egypt

http://egyover.ahlamontada.com

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