Changing JavaScript from phpBB3 to punBB Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
4 posters

    Changing JavaScript from phpBB3 to punBB

    avatar
    ,dArkRay
    Forumember


    Posts : 98
    Reputation : 1
    Language : English | Portuguese

    Solved Changing JavaScript from phpBB3 to punBB

    Post by ,dArkRay September 22nd 2013, 9:16 pm

    Hey Guys,

    I had this Javascript to change the names in the menu of my forum:

    Code:
    $(function() {
            
     changemenu("Início", "INÍCIO");
     changemenu("Membros", "MEMBROS");
     changemenu("Perfil", "PERFIL");
     changemenu("Mensagens privadas", "MENSAGENS");
     changemenu("Sair", "SAIR");
     changemenu("Login", "ENTRAR");
     changemenu("Registrar-se", "CRIAR CONTA");
     
    function changemenu(oldtext, newtext){


    var selector = $("ul.linklist.navlinks li a");

     for(var i=0; i<selector.size(); i++){
    if (selector.eq(i).text()== oldtext){
         selector.eq(i).text(newtext);
         break;
     }
     }
    }
    });
    Unfortunently, it's not working in punBB, how can I change it so it works?


    Last edited by ,dArkRay on September 27th 2013, 5:33 pm; edited 1 time in total
    avatar
    Guest
    Guest


    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by Guest September 22nd 2013, 9:43 pm

    Is everything correct?

    No missing symbols or any other letter? Those problems are easy to look at if that doesn't work you could switch it's "forum" to another and try it there
    avatar
    ,dArkRay
    Forumember


    Posts : 98
    Reputation : 1
    Language : English | Portuguese

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by ,dArkRay September 22nd 2013, 10:34 pm

    RikudouSennin wrote:Is everything correct?

    No missing symbols or any other letter? Those problems are easy to look at if that doesn't work you could switch it's "forum" to another and try it there
    Hey RikudouSennin (I also like Naruto, it's very cool!),

    In tried in phpBB3 and now it's not working so something must be wrong
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by Ange Tuteur September 22nd 2013, 10:39 pm

    Hello ,dArkRay,

    If you're editing a script from phpbb3 to punbb you will most likely need to modify the selectors in it. Right now I am seeing this:

    'ul.linklist.navlinks li a' which should be '#pun-navlinks li a' for punbb

    Use the script I provided below, I tested it and it works on my punbb board. Please remember you'll just have to modify the rename content if you haven't yet to see any changes. (i.e. Home > Homepage)
    Code:
       $(function() {
              
        changemenu("Início", "INÍCIO");
         changemenu("Membros", "MEMBROS");
         changemenu("Perfil", "PERFIL");
         changemenu("Mensagens privadas", "MENSAGENS");
         changemenu("Sair", "SAIR");
         changemenu("Login", "ENTRAR");
         changemenu("Registrar-se", "CRIAR CONTA");
        
       function changemenu(oldtext, newtext){


        var selector = $("#pun-navlinks li a");

         for(var i=0; i<selector.size(); i++){
        if (selector.eq(i).text()== oldtext){
            selector.eq(i).text(newtext);
            break;
         }
         }
        }
        });
    avatar
    Guest
    Guest


    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by Guest September 22nd 2013, 10:49 pm

    ,dArkRay wrote:
    RikudouSennin wrote:Is everything correct?

    No missing symbols or any other letter? Those problems are easy to look at if that doesn't work you could switch it's "forum" to another and try it there
    Hey RikudouSennin (I also like Naruto, it's very cool!),

    In tried in phpBB3 and now it's not working so something must be wrong
    (I love naruto lol) but if the codes seth gave to you works just reply ok?
    avatar
    ,dArkRay
    Forumember


    Posts : 98
    Reputation : 1
    Language : English | Portuguese

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by ,dArkRay September 22nd 2013, 10:55 pm

    SethC1995 wrote:Hello ,dArkRay,

    If you're editing a script from phpbb3 to punbb you will most likely need to modify the selectors in it. Right now I am seeing this:

    'ul.linklist.navlinks li a' which should be '#pun-navlinks li a' for punbb

    Use the script I provided below, I tested it and it works on my punbb board. Please remember you'll just have to modify the rename content if you haven't yet to see any changes. (i.e. Home > Homepage)
    Code:
       $(function() {
              
        changemenu("Início", "INÍCIO");
         changemenu("Membros", "MEMBROS");
         changemenu("Perfil", "PERFIL");
         changemenu("Mensagens privadas", "MENSAGENS");
         changemenu("Sair", "SAIR");
         changemenu("Login", "ENTRAR");
         changemenu("Registrar-se", "CRIAR CONTA");
        
       function changemenu(oldtext, newtext){


        var selector = $("#pun-navlinks li a");

         for(var i=0; i<selector.size(); i++){
        if (selector.eq(i).text()== oldtext){
            selector.eq(i).text(newtext);
            break;
         }
         }
        }
        });
    Thank you Seth! Everything is working except the log out (sair),  tried to change my code but it didn't worked

    Code:
    $(function() {
             
        changemenu("Início", "INÍCIO");
        changemenu("Membros", "MEMBROS");
        changemenu("Perfil", "PERFIL");
        changemenu("Mensagens privadas", "MENSAGENS");
        changemenu("Sair [{USERNAME}]", "SAIR");
        changemenu("Login", "ENTRAR");
        changemenu("Registrar-se", "CRIAR CONTA");
       
      function changemenu(oldtext, newtext){


        var selector = $("#pun-navlinks li a");

        for(var i=0; i<selector.size(); i++){
        if (selector.eq(i).text()== oldtext){
            selector.eq(i).text(newtext);
            break;
        }
        }
        }
        });
    avatar
    ,dArkRay
    Forumember


    Posts : 98
    Reputation : 1
    Language : English | Portuguese

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by ,dArkRay September 24th 2013, 9:59 pm

    bump
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by Ange Tuteur September 25th 2013, 12:55 am

    I tried this on my forum with both variables, but no luck. However I used the full string and it did rename. You may have to do this for each user you have which would be tedious, unless of course there is a variable for the log out menu.

    EX:
    Code:
    changemenu("Log out [ Ange ]", "Log out");
    Sr.Smith
    Sr.Smith
    Forumember


    Posts : 94
    Reputation : 11
    Language : Spanish

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by Sr.Smith September 25th 2013, 6:43 pm

    Hi,  ,dArkRay, when I made that javascript I didn't think in this element of the general menu but I can arrange it now.

    Try with this other javascript.

    Code:
    $(function(){
    var user = $.trim($("a#logout.mainmenu").text().split("[ ")[1].replace("]",""));

    changemenu("Início","INÍCIO");
    changemenu("Membros","MEMBROS");
    changemenu("Perfil","PERFIL");
    changemenu("Mensagens privadas","MENSAGENS");
    changemenu("Sair [ " +user+" ]","SAIR [ " +user+" ]");
    changemenu("Login","ENTRAR");
    changemenu("Registrar-se","NOVO? REGISTA-TE AQUI!");

    function changemenu(oldtext,newtext){
        var selector=$("#pun-navlinks li a");
            for(var i=0;i<selector.size();i++){
            if(selector.eq(i).text().toLowerCase()==oldtext.toLowerCase()){
                selector.eq(i).text(newtext);
                break;
            }
            }
    }
    });
    I hope it helps you.
    avatar
    ,dArkRay
    Forumember


    Posts : 98
    Reputation : 1
    Language : English | Portuguese

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by ,dArkRay September 27th 2013, 5:31 pm

    Mr.Bond wrote:Hi,  ,dArkRay, when I made that javascript I didn't think in this element of the general menu but I can arrange it now.

    Try with this other javascript.

    Code:
    $(function(){
    var user = $.trim($("a#logout.mainmenu").text().split("[ ")[1].replace("]",""));

    changemenu("Início","INÍCIO");
    changemenu("Membros","MEMBROS");
    changemenu("Perfil","PERFIL");
    changemenu("Mensagens privadas","MENSAGENS");
    changemenu("Sair [ " +user+" ]","SAIR [ " +user+" ]");
    changemenu("Login","ENTRAR");
    changemenu("Registrar-se","NOVO? REGISTA-TE AQUI!");

    function changemenu(oldtext,newtext){
        var selector=$("#pun-navlinks li a");
            for(var i=0;i<selector.size();i++){
            if(selector.eq(i).text().toLowerCase()==oldtext.toLowerCase()){
                selector.eq(i).text(newtext);
                break;
            }
            }
    }
    });
    I hope it helps you.
    You are always great! Thank you pal!
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Changing JavaScript from phpBB3 to punBB

    Post by SLGray September 27th 2013, 7:24 pm

    Topic Solved & Locked



    Changing JavaScript from phpBB3 to punBB Slgray10

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