Furry stuff, oekaki stuff, and other stuff.
You are not logged in.
I have had multiple requests for a warning for navigating away from a drawing page, is there any way to do this so that you can't accidentally navigate away from the page, but still not get the warning upon a submit? I feel really bad when people come to me with things like this when they've worked for 2+ hours on something, only to lose it by accidentally navigating away from the page.
[Edit]POSSIBLY every time they navigate away from the page, it saves a temp picture for x amount of days in a safety folder, that way it can be recovered, and autoprune after so long?
Maybe a hacks option?
Last edited by Ashass (08-13-2008 10:47:36)
Offline
OK, I need some specific examples of what you mean by "navigating away". Does this mean clicking a link on the draw page, or accidentally hitting the "back" button in the navigation bar, or pressing the wrong key on the keyboard?
If anything, this would have to be done in JavaScript, and results would vary from browser to browser. There is nothing I can put into the PHP code to help with this.
It might be possible to catch an accidental key press, but I'm not totally sure how JavaScript handles these kinds of events and if it can interrupt the browser from processing the event. Browsers these days don't respect a lot of JavaScript requests, and will ignore many events that are often used by advertisers (key tracking can be a big security issue). I think preventing accidental key presses is doable, such as a JavaScript alert to catch pressing the backspace key, or Alt-R (refresh).
Images can only be saved if the applet sends data to one of the picture saving URLs, such as "shiget.php". The applet does this, not the web browser, so with regards to accidental navigation, saving images is not an option. It just doesn't work.
PaintBBS and ShiPainter have the ability to get the canvas back from the Java cache in the event of a redirect, but it doesn't always work. If you've ever tried to draw something, navigate away from the draw page, and go back to the applet, these two applets might ask something like "Is former data restored?". If so, click "OK", and the canvas should be restored. This only works if the canvas is the same size, though. If your original image was 400x300, you have to go back to the draw screen with the same applet and a 400x300 canvas.
Let me know about some of the biggest issues, and we'll work down from there. I'm not too familiar with JavaScript events, but I doubt it's that difficult. There are, after all, a lot of scripts out there to prevent right-clicks from working, so it can't be that hard.
Offline
Alt + R (refresh)
F5 (refresh)
backspace (when clicked on the web page and not the applet, this is go back)
Mouse...4 (generally intercepted as back)
Back button
Closing the window
Those are about all I can think of, all of which should have a warning -- something like "You are about to navigate away from the page, are you sure you want to do this? Yes/no"
Something like this should work (http://www.openjs.com/scripts/events/ex … mation.php)
function goodbye(e) { if(!e) e = window.event; //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'You sure you want to leave?'; //This is displayed on the dialog //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } } window.onbeforeunload=goodbye;
Offline
woot sounds great *clap*
will this be implented in the future versions?
(since I don't know which files to edit with this code and I don't want to destroy everything ><)
oh btw OffTopic @Waccoon
I read you're planning a completly new version of an oekaki board thingy
will we be able to update wacintaki to this new version?
Offline
where exactly would one add the code?
Offline
It should be added only to the applet screen, which means being put directly into "chibipaint.php", "paintBBS.php", and "shiBBS.php". It would be inserted as follows:
<link rel="stylesheet" type="text/css" href="<?=$cssinclude?>" title="<?=$template_name?>" /> <script type="text/javascript" src="Poteto.js"> </script> <script type="text/javascript"> function goodbye(e) { if(!e) e = window.event; //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } else { //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'Are you sure you want to leave?'; //This is displayed on the dialog } } window.onbeforeunload=goodbye; </script> </head>
Offline
Sorry for the late reply, works perfect, thanks!