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.

New Post - Reply - Locked buttons with text instead of an image

3 posters

Go down

Solved New Post - Reply - Locked buttons with text instead of an image

Post by Kalopsia August 29th 2017, 6:52 am

Well, hello! I was surfing the web and found a JS code that allows to transform the topic buttons into text that can be stylized with CSS. Theorically this code was taken from here but I couldn't find the topic. The code in this case is:

Code:
jQuery(document).ready(function() {
$('.icon class').replaceWith('<div class="name of the div in the CSS">Text</div>');
});

So, I tested it with the New Topic and the Reply buttons, and it works magically. There's just one little thing that bugs me: I have no idea about how to make it change the Locked/Closed Theme button. When I took a look at the class of the icon I found that it's just the same as the New Topic or Reply one, so... I totally lost it. It's really not a hard issue but if there's any way to make it work...

Anyone has some idea that could help? I'm kind of a newbie in the area, so a little help would be appreciated.

I hope I'm being clear enough here. Thanks!


Last edited by Kalopsia on August 29th 2017, 7:06 pm; edited 1 time in total
Kalopsia
Kalopsia
New Member

Posts : 3
Reputation : 1
Language : English and spanish

http://hoodietrials.foroactivo.com

Back to top Go down

Solved Re: New Post - Reply - Locked buttons with text instead of an image

Post by Draxion August 29th 2017, 7:50 am

Hi there, what is your forum's version?
Draxion
Draxion
Helper
Helper

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

Back to top Go down

Solved Re: New Post - Reply - Locked buttons with text instead of an image

Post by Kalopsia August 29th 2017, 8:21 am

I use phpBB3!
Kalopsia
Kalopsia
New Member

Posts : 3
Reputation : 1
Language : English and spanish

http://hoodietrials.foroactivo.com

Back to top Go down

Solved Re: New Post - Reply - Locked buttons with text instead of an image

Post by Draxion August 29th 2017, 5:30 pm

You can make it something like this to notify when you are using the locked button instead of the post reply button by checking what the "alt" attribute says since the system doesn't have a specific class for locked buttons.
Code:
$(function() {
  $("img.i_post").replaceWith('<div class="image_post">Post</div>');
  var x = $("img.i_reply").attr("alt");

  // check for locked button
  if (x == "This topic is locked: you cannot edit posts or make replies.") {
    $("img.i_reply").replaceWith('<div class="image_locked">Locked</div>');
  } else {
    $("img.i_reply").replaceWith('<div class="image_reply">Reply</div>');
  }
});
Draxion
Draxion
Helper
Helper

Male Posts : 2518
Reputation : 321
Language : English
Location : USA

https://www.talesoftellene.com/

Back to top Go down

Solved Re: New Post - Reply - Locked buttons with text instead of an image

Post by Kalopsia August 29th 2017, 6:14 pm

Oh, I'll try this and edit this post to notify if it works or not, thank you!

EDIT: It worked! Bouncy You're a wonder! Bouncy Thank you veeeeeeeeeeeeery much!

For future investigators, this same code works for the quote/edit/delete/ip buttons, however, in my limited knowledge I couldn't make it work in the Reply PM button or the quote/edit PM buttons either. But to me this is solved, so I'll mark it.

Thanks again Draxion!
Kalopsia
Kalopsia
New Member

Posts : 3
Reputation : 1
Language : English and spanish

http://hoodietrials.foroactivo.com

Back to top Go down

Solved Re: New Post - Reply - Locked buttons with text instead of an image

Post by SLGray August 29th 2017, 7:18 pm

Problem solved & topic archived.
Please read our forum rules: ESF General Rules


New Post - Reply - Locked buttons with text instead of an image 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 : 51463
Reputation : 3519
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