Minecraft PC IP: play.cubecraft.net

Priley

Forum Professional
Jul 6, 2015
4,119
16,204
679
21
reprotland
Hello, hi

I would like (to create) some kind of extension or script or I don't know how it's called, which would replace "Admin" with "Administrator", "Mod" with "Moderator" and "Sr. Mod" with "Senior Moderator"

But I have no idea on how to make this or even on how to get started on this, some help please

@zivdnaL
 

Abodz

Well-Known Member
May 14, 2018
269
237
119
21
Hello, hi

I would like (to create) some kind of extension or script or I don't know how it's called, which would replace "Admin" with "Administrator", "Mod" with "Moderator" and "Sr. Mod" with "Senior Moderator"

But I have no idea on how to make this or even on how to get started on this, some help please

@zivdnaL
Do you mean something change usernames that it shows for you like LabyMod, I can help with that
 

DrHam

Forum Veteran
Sep 15, 2015
3,615
4,166
518
Kepler-452b
Do you mean something change usernames that it shows for you like LabyMod, I can help with that
He means on the forums.
Hello, hi

I would like (to create) some kind of extension or script or I don't know how it's called, which would replace "Admin" with "Administrator", "Mod" with "Moderator" and "Sr. Mod" with "Senior Moderator"

But I have no idea on how to make this or even on how to get started on this, some help please

@zivdnaL
If you don’t know how it’s called or how you’d get started, then you should consider learning html and js first
 
  • Like
Reactions: Lilleh__

Priley

Forum Professional
Jul 6, 2015
4,119
16,204
679
21
reprotland
Do you mean something change usernames that it shows for you like LabyMod, I can help with that
Old (current):
kMdlil4.png


New (what I want):
Jh1fiwL.png
 
  • Like
Reactions: Dutudy and DrHam

DrHam

Forum Veteran
Sep 15, 2015
3,615
4,166
518
Kepler-452b
I don't think you will be able to do that
It is. Don’t bother replying if you don’t know the correct answer.
Something similar to this should do it (Not tested; haven’t used js in months)
Code:
function admin2admini(e) {
       $("body *").contents().each(function() {

               if (this.textContent.match(“admin”)) {
                   this.textContent = this.textContent.replace(“admin”, "administratir");
               }
           }
       });
}
 

Max ♠

Forum Expert
Feb 20, 2016
1,420
2,940
344
24
North pole
But I have no idea on how to make this or even on how to get started on this, some help please
If you know javascript, use a userscript manager like violentmonkey or greasemonkey (not for IE and safari)

Code:
function admin2admini(e) {
       $("body *").contents().each(function() {

               if (this.textContent.match(“admin”)) {
                   this.textContent = this.textContent.replace(“admin”, "administratir");
               }
           }
       });
}
Ignoring the fact that this wouldnt work at all due to you not being used to javascript
If someone said "admin" in a forum post, it would also change it
If someone said "administrator" it would become "administratiristrator"
(I didnt think about this either when making a mockup, welp)

If you're actually interested on how to get started with something like this:

1. Open the page you want to be edited
2. Open debug tools (element inspect)
3. Locate the container for all elements to be edited
upload_2018-9-21_22-22-9.png

4. Take a look at how the HTML of this element is layed out
upload_2018-9-21_22-24-0.png

The <li> tags are the ones containing the "Mod" or "Admin"
upload_2018-9-21_22-25-3.png

<div class="userTitle"> seems to be what you're after
5. Since there's no way (to my knowledge) to differentiate the tag containing "Helper" from "Mod" we'll be forced to use javascript, which loads a bit slower than CSS

6. Start off by getting all the elements you want to be edited in an array using document.querySelectorAll();
Code:
var staff_titles = document.querySelectorAll(".staffOnline .userTitle");

7. Then decide what values you want to change into what, put these into arrays as well
Code:
var original = ["Mod", "Sr. Mod", "Admin"];
var replace = ["Moderator", "Sr. Moderator", "Administrator"];

8. Time for some recursive for loops \o/ (not the most efficient but on this scale I honestly don't care about performance, it'll be easier to add extra tags later on)
Code:
for(var i = 0; i < staff_titles.length; i++) {
    for(var j = 0; j < original.length; j++) {
        if(staff_titles[i].innerHTML === original[j]) {
            staff_titles[i].innerHTML = replace[j];
        }
    }
}
9. Put all the code together into a userscript

10. ??

11. Profit

https://greasyfork.org/en/scripts/372443-new-userscript
 

Priley

Forum Professional
Jul 6, 2015
4,119
16,204
679
21
reprotland
If you know javascript, use a userscript manager like violentmonkey or greasemonkey (not for IE and safari)


Ignoring the fact that this wouldnt work at all due to you not being used to javascript
If someone said "admin" in a forum post, it would also change it
If someone said "administrator" it would become "administratiristrator"
(I didnt think about this either when making a mockup, welp)

If you're actually interested on how to get started with something like this:

1. Open the page you want to be edited
2. Open debug tools (element inspect)
3. Locate the container for all elements to be edited
View attachment 148705
4. Take a look at how the HTML of this element is layed out
View attachment 148707
The <li> tags are the ones containing the "Mod" or "Admin"
View attachment 148708
<div class="userTitle"> seems to be what you're after
5. Since there's no way (to my knowledge) to differentiate the tag containing "Helper" from "Mod" we'll be forced to use javascript, which loads a bit slower than CSS

6. Start off by getting all the elements you want to be edited in an array using document.querySelectorAll();
Code:
var staff_titles = document.querySelectorAll(".staffOnline .userTitle");

7. Then decide what values you want to change into what, put these into arrays as well
Code:
var original = ["Mod", "Sr. Mod", "Admin"];
var replace = ["Moderator", "Sr. Moderator", "Administrator"];

8. Time for some recursive for loops \o/ (not the most efficient but on this scale I honestly don't care about performance, it'll be easier to add extra tags later on)
Code:
for(var i = 0; i < staff_titles.length; i++) {
    for(var j = 0; j < original.length; j++) {
        if(staff_titles[i].innerHTML === original[j]) {
            staff_titles[i].innerHTML = replace[j];
        }
    }
}
9. Put all the code together into a userscript

10. ??

11. Profit

https://greasyfork.org/en/scripts/372443-new-userscript
Thank you so much for not only giving me such a detailed explanation, but also providing me a straight script and install link!
 

Fliqa

Forum Expert
Mar 13, 2017
672
2,381
323
20
Belgium
All of these were pointless posts, or posts that didn't contribute at all to the topic...
Yes, this is technically a pointless post, but ya'll shouldn't just say anything if you can't contribute to the topic...
I asked him why, he answered my question and I just said "Oh, makes sense." I honestly don't understand how that's not to the topic and 'useless'. Also, this isn't to the topic either. Don't see why you're commenting on this to tell this isn't to the topic while you're writing something totally off topic.
 
Members Online

Team online

Latest profile posts

How do you make spoilers with a name?
Reesle wrote on ZachTart26's profile.
Welcome to the Official Cubecraft Forums! If you need help with something, feel free to DM me or a staff member anytime! Have a great day! :D
Reesle wrote on CalvinxKlein's profile.
Happy Birthday! 🎂
Top Bottom