Author Topic: motdmenu.lua "back" button  (Read 5109 times)

0 Members and 2 Guests are viewing this topic.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
motdmenu.lua "back" button
« on: March 24, 2011, 01:41:20 PM »
Is there some (relatively simple) way for me to add a back button to this file?

I like that the menu allows for us to specify web pages, and I thought it would be nice to link to places like google from my main motd. This way the players on my server would have another option (other than steam's clunky browser), to browse the web.
My TTT server. Join the fun!

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: motdmenu.lua "back" button
« Reply #1 on: March 24, 2011, 01:50:40 PM »
There's some way to do it, if only using the javascript command for back. Otherwise I think you can catch each new page in a callback somewhere to store them.
Experiencing God's grace one day at a time.

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: motdmenu.lua "back" button
« Reply #2 on: March 25, 2011, 09:27:06 AM »
Yeah I thought of using a PHP or Java way to go about this, but I was getting confused, because I would have to run it in an iframe, if linking to Google, then I didn't know how to go about targeting the iframe with java/php
To clarify, I'm not looking to go back to the main motd page necessarily, I could do that with java/php no problem. But rather I am trying to be able to browse google and go back to your google search after visiting the desired page.

The Lua idea you mentioned sounds a bit more in-depth than I anticipated, having to store and callback pages

Thanks for the pointers though
My TTT server. Join the fun!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: motdmenu.lua "back" button
« Reply #3 on: March 25, 2011, 02:11:31 PM »
Though I don't know the javascript 'document' properties well enough to help directly, if you could find how to get javascript to act on 'targets', just as the HTML anchor tag can, I would think it possible to name the frame, and have the javascript perform the 'back' action on it.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: motdmenu.lua "back" button
« Reply #4 on: March 26, 2011, 10:42:49 AM »
Yeah, I'm not really a java guy either  ;D
If I come up with something I'll be sure to let everyone know
My TTT server. Join the fun!

Offline EraYaN

  • Newbie
  • *
  • Posts: 10
  • Karma: 1
  • -EraYaN-
    • EraYaN
Re: motdmenu.lua "back" button
« Reply #5 on: March 30, 2011, 11:11:23 AM »
if you use and iframe

for setting it
document.all.FrameName.src=url;

and for the back button
frames['framename'].history.back();

(you should give your iframe a name AND id
-EraYaN-

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: motdmenu.lua "back" button
« Reply #6 on: April 01, 2011, 06:14:58 PM »
Thank you! I will give it a try the next chance I get!
My TTT server. Join the fun!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: motdmenu.lua "back" button
« Reply #7 on: April 01, 2011, 06:55:27 PM »
I at least remembered it was going to be a 'document' property. See how helpful I was? :P (Yes folks, I'm joking)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: motdmenu.lua "back" button
« Reply #8 on: April 11, 2011, 05:48:31 PM »
Hmm, I'm sorry to have to come back and ask a very simple question, but I really do.
I've searched google for a working implementation of the provided code, and code's like it (thanks again EraYaN), but I couldn't find anything that worked. and I have exhausted my own knowledge.

I'm actually surprised with myself because I usually don't have this hard of a time implementing pre-made java/php on my sites, and I do it a lot.

If you, or anyone has an extra minute to show how it might look, it would be a terrific help. no need to add all the body/head elements, obviously.

No rush.
My TTT server. Join the fun!

Offline edk141

  • Newbie
  • *
  • Posts: 23
  • Karma: 5
Re: motdmenu.lua "back" button
« Reply #9 on: April 12, 2011, 02:06:07 AM »
This won't be right, but something like
Code: [Select]
<iframe id="browser" src="/frame.html"></iframe>
<a href="#" onclick="document.getElementById('browser').contentWindow.history.back();">go back</a>

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: motdmenu.lua "back" button
« Reply #10 on: April 13, 2011, 08:23:43 AM »
aaah ok, so thats how the link is set, thanks for pointing me in the right direction!
My TTT server. Join the fun!

Offline krooks

  • Sr. Member
  • ****
  • Posts: 382
  • Karma: 32
  • I don't like video games.
    • Diamond Krooks
Re: motdmenu.lua "back" button
« Reply #11 on: April 16, 2011, 12:03:51 PM »
edk141 I was still having issues with the code,  but thanks to you it gave me a starting point for my google searches.
I ended up using this code:
Code: [Select]
<input type='button' value='< BACK' onclick='Frame_Name.history.back()'>
<input type='button' value='FORWARD >' onclick='Frame_Name.history.forward()'>
and just gave the iframe a name (Frame_Name) and id that were the same.

So theres how ya do it folks! (for future reference)
My TTT server. Join the fun!