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.

Changing JavaScript from phpBB3 to punBB

View previous topic View next topic Go down

Solved Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay on 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

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

Guest
Guest


Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay on 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

,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 on 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;
     }
     }
    }
    });

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by Guest on 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?

Guest
Guest


Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay on 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;
    }
    }
    }
    });

,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 on September 24th 2013, 9:59 pm

bump

,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 on 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");

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by Sr.Smith on 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.

Sr.Smith
Forumember

Posts : 87
Reputation : 11
Language : Spanish

Back to top Go down

Solved Re: Changing JavaScript from phpBB3 to punBB

Post by ,dArkRay on 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!

,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 on September 27th 2013, 7:24 pm

Topic Solved & Locked


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


SLGray
Administrator
Administrator

Male Posts : 35670
Reputation : 2375
Language : English
Location : United States

http://fmthemes.forumotion.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