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.

Changing JavaScript from phpBB3 to punBB

4 posters

Go down

Solved Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay Sun 22 Sep - 21:16

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 Fri 27 Sep - 17:33; edited 1 time in total
avatar
,dArkRay
Forumember

Posts : 98
Reputation : 1
Language : English | Portuguese

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by Guest Sun 22 Sep - 21:43

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
Guest
Guest


Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay Sun 22 Sep - 22:34

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
avatar
,dArkRay
Forumember

Posts : 98
Reputation : 1
Language : English | Portuguese

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by Ange Tuteur Sun 22 Sep - 22:39

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;
     }
     }
    }
    });
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by Guest Sun 22 Sep - 22:49

,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
Guest
Guest


Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay Sun 22 Sep - 22:55

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

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay Tue 24 Sep - 21:59

bump
avatar
,dArkRay
Forumember

Posts : 98
Reputation : 1
Language : English | Portuguese

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by Ange Tuteur Wed 25 Sep - 0:55

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");
Ange Tuteur
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by Sr.Smith Wed 25 Sep - 18:43

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.
Sr.Smith
Sr.Smith
Forumember

Posts : 94
Reputation : 11
Language : Spanish

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay Fri 27 Sep - 17:31

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!
avatar
,dArkRay
Forumember

Posts : 98
Reputation : 1
Language : English | Portuguese

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by SLGray Fri 27 Sep - 19:24

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.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51555
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

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