DinoDevs / GladiatusCrazyAddon

This was "A browser addon for the Gladiatus browser game."
https://gladiatus.dinodevs.com
GNU General Public License v3.0
41 stars 30 forks source link

Pinned Guild Messages #348

Closed Elderly-Emre closed 2 years ago

Elderly-Emre commented 2 years ago

i have an idea. we need to pinned guild messages. sometimes we need a lot. Instead of sharing a message over and over at different times, something like this is very useful.

FrutyX commented 2 years ago

But doesn't Vox Logus (Bathouse) exists for such things?

GreatApo commented 2 years ago

But doesn't Vox Logus (Bathouse) exists for such things?

True...

Elderly-Emre commented 2 years ago

most people don't use the (vox logus) hamam. You know this too.

FrutyX commented 2 years ago

Nonsense, on every server I've played, all useful info was always in Vox Logus for all to see.

If your players are not using it, it's their fault and own mistake. Now to the feature request, I see a different option, one more realistic - add a "Share" button to Vox Logus messages, when you click on it, it will copy the Vox Logus message and send it as a guild message, so you can easily share any messages directly from Vox Logus.

The original idea with "pinned messages" isn't that much possible, because you have to store the message somewhere, and you can't use your browser memory because everyone has to see it (which is the main idea here), it would be only possible with a remote server (with stored messages) and you don't want that, because who will pay for the servers (also it's too much work for such a small feature) ?

GramThanos commented 2 years ago

We can mix them maybe. We can add a feature to check Vox Logus (every 1 or 2 hours) for a special message and pin it at the top of the messages (anyone with write access to Vox Logus would be able to pin a message.

But keep in mind that this addon servers the players, not the guilds, so it cant enforce features related to guilds. Additionally, this would most probably be disabled by default as most guilds would not use it (maybe we can propose to the user to enable it if such a message is found when he visits the Vix Logus).

Still, this maybe a bit problematic.

Elderly-Emre commented 2 years ago

When a new member comes to a guild, he introduces himself on the vox logus. but after that vox logus never looks again. same goes for me. GramThanos' idea looks very good

GreatApo commented 2 years ago

Go to guild bath room 1, write a post, click the pin button and then submit it (you need to have authorization to delete any messages and post for the button to show). Based on your refresh interval (in GCA global options, the interval that used to be only for guild applications) the message will show up at the top of the messages.

Caution: The algorithm searches for a message with "[⚲]" at the start, so every player with write access can bypass the disabled button.

SleepingShadow-bit commented 2 years ago

Really Nice =)

FrutyX commented 2 years ago

Eh, a button you say? Maybe I am doing something wrong, no console errors.

huh

GreatApo commented 2 years ago

Eh, a button you say? Maybe I am doing something wrong, no console errors.

That should have worked. The authorization is checking if the messages are more than the delete message links.

// Check if admin by checking if you can delete all messages
let numberOfMessages = document.getElementById('content').getElementsByTagName('tr').length/4;
let links = document.getElementById('content').getElementsByTagName('a');
let numberOfDeleteLinks = 0;
for (var i=0; i<links.length; i++) {
    let href = links[i].getAttribute('href');
    if ( href.match('&den=') )
        numberOfDeleteLinks++;
}
if(numberOfMessages > numberOfDeleteLinks){
    console.log('[GCA] Not authorized to pin messages');
    return;
}

Can you test in your console what number the document.getElementById('content').getElementsByTagName('tr').length/4 gives you compared to the delete links found (code in the loop)?

FrutyX commented 2 years ago

It always give me the right number of delete buttons that exist, if I understand you right.

SleepingShadow-bit commented 2 years ago

What u mean about "you need to have delete all messages..." I don't delete message and i see the pin and works.

IMG_20220626_171146

Online with kiwi browser mobile

FrutyX commented 2 years ago

I got confused about that part too :D.

GreatApo commented 2 years ago

Sorry, I rephrased that: if you can post and you can delete any post, then the button will appear I am basically trying to recognize if the player is an "admin" or has more rights than a normal member (delete posts)

The last commit post on the console if you have no rights

FrutyX commented 2 years ago

You sure it will work for me where there are no other messages from other players, only from me, so GCA isn't sure about it?

That's probably why it does not show, solo guild, so it's not a bug + you probably don't need to pin messages in a one man guild.

I currently don't have an another account to test this...

GreatApo commented 2 years ago

You sure it will work for me where there are no other messages from other players, only from me, so GCA isn't sure about it?

That's probably why it does not show, solo guild, so it's not a bug + you probably don't need to pin messages in a one man guild.

It should have been working. Do you get the no authorization in the console.log? Send me the page source code...

FrutyX commented 2 years ago

Nothing in the console, I've checked the source code before, there is nothing about the button, it does not exist.

GreatApo commented 2 years ago

Nothing in the console, I've checked the source code before, there is nothing about the button, it does not exist.

I have pushed a commit. If there is nothing, it's something else

FrutyX commented 2 years ago

Yes, I always update the folder to the latest commit. I am not aware why it's not showing tho.

GreatApo commented 2 years ago

Yes, I always update the folder to the latest commit. I am not aware why it's not showing tho.

Email me the html source code

FrutyX commented 2 years ago

I have a better idea, have you tried using Google Chrome (v103)?

SleepingShadow-bit commented 2 years ago

I have now deleted the Badehaus message. My countdown is at 2 minutes. Now after 15 minutes the message is still visible in the guild mail page!

Edit: Umlaut don't show right. My word "löschen" IMG_20220626_220057

SleepingShadow-bit commented 2 years ago

I have a better idea, have you tried using Google Chrome (v103)?

Now i am on v103. Pin Button is visible

GreatApo commented 2 years ago

@SleepingShadow-bit I fixed the mentioned problems. @FrutyX I have no idea why it doesn't work for you

FrutyX commented 2 years ago

Interesting.

So I tried Edge for example, it works there, I even uploaded my config with settings, it works.

I cleared all cookies and data including Gladiatus ones in Chrome, it still does not work. So I went to check Chrome Canary (it's the development version of Chrome, currently running on v105), even uploaded my config file and it works.

Why it does not show in my current stable Chrome version was simply a miracle for me. I tried all the basic stuff.

I have deleted the extension completely from the browser and added it back, it loaded...

So, it was on my side, but this is the first time I encountered this, every time I test some new commits, I just get the source folder and fully replace my old one (I did it at least five times today), it appears it does not worked this time and it needed to be completely removed/added.

Good experience, next time I'll know, sorry for the troubles.

GramThanos commented 2 years ago

Some parts of the extension are updated as soon as you change its file (e.g. each page's script). Other parts need (e.g. script loader) are reloaded when you reload the extension (restart browser).

Your browser may cached a script. Its always good to clear the cache after loading new code. Furthermore, you can clear temporary data form the addon's settings (this may reset some timers).

FrutyX commented 2 years ago

By the way, if you write normally, it's fine, but if you write it like an idiot, it's not complete, but perhaps if someone wanted to show something like a bulleted list of something, it will not work.

Nothing serious, but if you want to address it...

Watch:

msg msg2

FrutyX commented 2 years ago

Some parts of the extension are updated as soon as you change its file (e.g. each page's script). Other parts need (e.g. script loader) are reloaded when you reload the extension (restart browser).

Your browser may cached a script. Its always good to clear the cache after loading new code. Furthermore, you can clear temporary data form the addon's settings (this may reset some timers).

That's like the most generic answer that some support staff would write to you, did you even read what I wrote? I did restart the browser, I did cleared GCA&Gladiatus cookies, cache and data, that's why it is a miracle to me. And yes, I even tried it via GCA settings.

But let's just forget it, I am just glad it's solved.

GramThanos commented 2 years ago

Yes, I read your message. Sorry for not specifing it, my reply was more some general info and guessing on what may affect the behavior. I am as confused as you.

FrutyX commented 2 years ago

That's fine @GramThanos, don't get me wrong - thank you for trying to help anyway, not sure what went wrong, but it's gone now.

GreatApo commented 2 years ago

Thanos is right. I completely forgot that the baths.js was a new file and you need to refresh the addon so that is is recognized and it is loaded.

Well spot Thanos.

SleepingShadow-bit commented 2 years ago

If I missed it then sorry....

Is it possible to post a text with a paragraph as a pinned message? Screenshot_19

Screenshot_18

GreatApo commented 2 years ago

If I missed it then sorry....

Is it possible to post a text with a paragraph as a pinned message?

Fixed

SleepingShadow-bit commented 2 years ago

Thanks a lot. It works very well

SleepingShadow-bit commented 2 years ago

I would like to pass on a thank you from my guild members here. The feature is very well received!

FrutyX commented 2 years ago

Apo The Great 💪

Elderly-Emre commented 2 years ago

even though I deleted the message from the bathouse, still looks on message panel. I've been waiting for 2-3 hours, image

SleepingShadow-bit commented 2 years ago

Had the problem too and got it fixed (https://github.com/DinoDevs/GladiatusCrazyAddon/issues/348#issuecomment-1166598111 + https://github.com/DinoDevs/GladiatusCrazyAddon/issues/348#issuecomment-1166655486) .

Do you have the current version? Also doesn't it work with 1 minute (for testing)? Clear your gca addon cache and try again

FrutyX commented 2 years ago

I've checked it too and it has been fixed

Download it again with the latest commit, set it to 1 min for testing purposes and see if it's okay, if that does not work you can try deleting your gca data like Shadow said, as a last resort you can delete the extension from your browser completely and add it back again.

Elderly-Emre commented 2 years ago

uninstalling and reinstalling solved my problem

FrutyX commented 2 years ago

Awesome and interesting... I had to do the same in the end to make this work properly.

SleepingShadow-bit commented 2 years ago

Do you think it is possible to directly link a pinned hyperlink. As in the guild mails (see screen)

IMG_20220705_212855

FrutyX commented 2 years ago

Also, the pin/unpin button is only showing when creating a new message, but it's not showing when you are editing already existing message, so for example, if you want to remove your current pin, but not the message, you have to delete the symbol manually.

But maybe it's on purpose, I don't know.

SleepingShadow-bit commented 2 years ago

I think its ok. Because the pin/unpin button is only there to automatically insert the symbol [⚲]. If I edit the amount, I remove the symbol [⚲] and the pin is gone. And I can manually add the pin again at any time. Or do I misunderstand you

Edit: Now I understand you. It says Pin = works and Unpin = doesn't work automatically via the icon

If I edit a pinned post, the unpin icon should be visible

FrutyX commented 2 years ago

I see Apo added it. He scripted it from scratch and made it work in messages, thus I did not seen a reason why it should not be enabled while editing too.

GreatApo commented 2 years ago

Do you think it is possible to directly link a pinned hyperlink. As in the guild mails (see screen)

image

SleepingShadow-bit commented 2 years ago

Would it be possible to add a paragraph after the nickname for the sake of clarity?

IMG_20220812_133047

FrutyX commented 2 years ago

Implemented in v4.3.6, closing, re-open if needed.

SleepingShadow-bit commented 2 years ago

Does anyone know if my last comment was still implemented?

GramThanos commented 2 years ago

I don't think so. We have to move it to a new issue.