Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4257
Latest: Alex998.
New This Month: 1
New This Week: 0
New Today: 0
Stats
Total Posts: 43295
Total Topics: 7523
Most Online Today: 191
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 219
Total: 220

Author Topic: Button  (Read 1141 times)

0 Members and 1 Guest are viewing this topic.

Offline PapaFrizArcade

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Button
« on: March 12, 2022, 09:56:01 am »
Remembering that I am a hack at best (yes,  I'm dangerous!)...

I've managed to add a button to the left side to view all ratings...



I even realized there are two spots that needed to be modified as the "button" that shows before rating a post is a different "button" that shows after...

However,  when I attempted to do the same input button command I used for the two View List buttons for the "Undo Rating" button I've failed over and over.  I would prefer the "Undo Rating" text that appears be in button format if possible. 

This is the code I am attempting to use that is failing:

document.getElementById("errrateawemsgid" + msgID).innerHTML = "<a href=\"#undorate\" onclick=\"return AweAjaxRatingUndo(" + msgID + ");\">' . '<input type="button" value="View List">' . '</a>";   

Now that portion I changed ('<input type="button" value="View List">') is all I added to the display.template and awesome2.templates to get the View List to work.  That said... I recognize they are in the template directory and the file I need to modify for Undo Rates is in the sources directory... which may or may not mean anything because like I said... I'm a hack and I have no idea.

NOW... I did just realize there is that little #undorate tag... which mean (I think) I can create specific css for that button... right? (I am JUST starting to learn css).  Is there a way to create the button via css or do I have to do it in the code directly?

ALTERNATIVELY ... to be honest... i wanted to load up an ICON rather than even the button in both the View List and Undo Ratings locations... I am guessing that would be pretty simple to do for something who knows what they are doing... for me?  I failed miserably... hence the reason I went with the button.    If you could provide the code to load up an image at both locations that would be even all the sweeter.  I was thinking I'd run a little crank image for the view list and maybe a "RATE" with a red circle/line through it for UNDO RATING or something.

Thank you for all you're help thus far...

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Button
« Reply #1 on: March 12, 2022, 10:44:32 pm »
I don't have much experience myself with css/styling I generally look at guides online and do very minimal css changes in all my mods. You can target items if they have a class or an id field with css.
Using an <input type="button" value="View List">' might be tricky i have hard time myself with those. I would look into maybe an image based button instead?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline PapaFrizArcade

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Button
« Reply #2 on: March 13, 2022, 03:08:01 am »
I've managed to get a "gear" icon to appear over in the View List section (both when you rate and after you've rated)... however,  like the BUTTON command,  when I attempt to switch over from loading up the text string from the language file for "UNDO RATING" by replacing the $txt['awe_text_undorating'] portion with <img src="https://www.xxxx.com/apricons/undo.png"> basically it breaks the ability to click the ratings.  It doesn't break the page,  I just can't select an icon.

That very same command worked for the VIEW LIST lines...

Any suggestions on how to display an image vs the text and still have the icons selectable?


Offline PapaFrizArcade

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Button
« Reply #3 on: March 13, 2022, 10:21:45 am »
It appears I get to try to learn how ajax works.  It appears I am doing it wrong as to how to make an image appear in an ajax function.   Everything I try breaks the function thus far...

Hmmm...

It completely breaks the function as even trying to rate a post that has already been rated produces no result.

Interesting.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Button
« Reply #4 on: March 13, 2022, 02:39:30 pm »
I would need to see what you are trying right now what breaks
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline PapaFrizArcade

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Button
« Reply #5 on: March 13, 2022, 03:32:55 pm »
Example of what worked:

Original code:

Code: [Select]
$data .= '<a href="' . $scripturl . '?action=awesome;sa=viewratings;msgid=' . $msgID . '" onclick="return reqWin(this.href, 600, 400, false);">' . $txt['awepost_text_viewlist'] . '</a>';
Modified code to add gear:

Code: [Select]
$data .= '<a href="' . $scripturl . '?action=awesome;sa=viewratings;msgid=' . $msgID . '" onclick="return reqWin(this.href, 600, 400, false);">' . '&nbsp;&nbsp;<img src="https://www.xxxx.com/apricons/gear.png">' . '</a><br>';

That works fantastically.


When I attempt to use the same method with the UNDO RATING it fails.

Here is the original code:

Code: [Select]
document.getElementById("errrateawemsgid" + msgID).innerHTML = "<a href=\"#undorate\" onclick=\"return AweAjaxRatingUndo(" + msgID + ");\">' . $txt['awe_text_undorating'] . '</a>";

Here is what I attempt to do:

Code: [Select]
document.getElementById("errrateawemsgid" + msgID).innerHTML = "<a href=\"#undorate\" onclick=\"return AweAjaxRatingUndo(" + msgID + ");\">' . '<img src="https://www.xxxx.com/apricons/undo.png">' . '</a>";
I've tried moving that IMG code around that line ... next to the </a> for example,  etc... fails each time.  Basically it breaks somewhere and doesn't allow a selection to happen.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Button
« Reply #6 on: March 13, 2022, 04:07:55 pm »
I would try added it to image itself the onclick
Code: [Select]
document.getElementById("errrateawemsgid" + msgID).innerHTML = "<a href=\"#undorate\" onclick=\"return AweAjaxRatingUndo(" + msgID + ");\">' . '<img src="https://www.xxxx.com/apricons/undo.png"  onclick=\"return AweAjaxRatingUndo(" + msgID + ");\">' . '</a>";
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline PapaFrizArcade

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Button
« Reply #7 on: March 13, 2022, 06:43:21 pm »
Unfortunately... same result.  Clicking ICON has no effect.

Thanks for the suggestion however.   


Offline PapaFrizArcade

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Button
« Reply #8 on: March 13, 2022, 08:01:48 pm »
My original attempt was so close...

Code: [Select]
document.getElementById("errrateawemsgid" + msgID).innerHTML = "<a href=\"#undorate\" onclick=\"return AweAjaxRatingUndo(" + msgID + ");\">' . '<img src="https://www.xxxx.com/apricons/undo.png">' . '</a>";
What worked:

Code: [Select]
document.getElementById("errrateawemsgid" + msgID).innerHTML = "<a href=\"#undorate\" onclick=\"return AweAjaxRatingUndo(" + msgID + ");\">' . '<img src=\"https://www.xxxx.com/apricons/undo.png\">' . '</a>";
It came down to two "\" ...

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16452
    • View Profile
Re: Button
« Reply #9 on: March 13, 2022, 08:04:42 pm »
Glad you have it figured out. A single character sometimes can cause the issue.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/
Like Like x 1 View List

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
3216 Views
Last post May 02, 2007, 01:26:07 am
by Chiprunner
2 Replies
5347 Views
Last post June 28, 2008, 10:51:56 pm
by rgsknr
Add a button

Started by rbh Support

0 Replies
4530 Views
Last post October 21, 2008, 10:58:05 am
by rbh
2 Replies
3862 Views
Last post July 14, 2009, 08:00:35 am
by SMFHacks
1 Replies
2865 Views
Last post September 21, 2013, 07:28:59 am
by SMFHacks

+- Recent Topics

Please Help! by SMFHacks
April 17, 2024, 08:04:55 am

Rate own images by fvlog19
April 11, 2024, 10:56:53 am

Tidy Child Boards on 2.1.4 by SMFHacks
April 04, 2024, 03:54:12 pm

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
March 30, 2024, 12:41:08 pm

Can't DROP 'id_member'; check that column/key exists Datei: by SMFHacks
March 30, 2024, 11:58:20 am

No thumbnails on new uploads by Tonyvic
March 29, 2024, 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

Powered by EzPortal