Quick Escape button

Permalink
Hello all,
I am building a site for a Womens Shelter. The would like me to have the functionality of being able to hit the "escape" key, and that would take them to yahoo.com. Kind of like a panic button.

I have found some scripting that I think would work, and put it in the header for Slate Template I am using. I am running 5.4.2.1.

Here is the code I tried to use, but it is not doing anything. Any help would be greatly appreciated. I know very little about javascript. But pulled this from a site that uses it and it works.

thanks again.

<script type="text/javascript">
jQuery(document).ready(function($) {

$(document).keyup(function(event) {
if (event.keyCode == 27) {
$('#overlayAll').css("display",'block');
window.location='http://www.yahoo.com';
}
);
});

</script>

View Replies: View Best Answer
JohntheFish replied on at Permalink Reply
JohntheFish
Have a look in the developer console and see if your script is causing any errors - see last section of:

http://www.concrete5.org/documentation/how-tos/editors/getting-help...
julia replied on at Permalink Reply
julia
Hi ya, I once built a site for a government domestic violence office and implemented a similar escape button. Basically, we put a content block at the top of every page with content like this:

Safety Warning
Your computer use can be monitored by others! Consider using a public computer or a friend's computer. Please view more computer safety tips or escape to Google.

Then "more computer safety tips" linked to a page with details about browser history, cache, search history, etc. and "escape to Google" linked to Google.

There's no need to pop up a window over the site--it's best for the person to just click away.

I'd use concrete5 stacks to create a panic button block that can be put at the top of all pages.

Good luck with your project!
julia replied on at Permalink Reply
julia
I just noticed you aren't using version 5.5.1, so you won't have stacks. You can use scrapbooks instead.
chadmtate replied on at Permalink Reply
That is exactly what I am trying to build. But they want not only the link at the top of the page, but to leave the page if the "escape" button is pressed.

Tried this code:

<script type="text/javascript">
document.onkeydown = keyHit

function keyHit(evt) {
if(evt){
thisKey = evt.which;
}else{
thisKey = window.event.keyCode;
}
if(thisKey == '27'){
window.location = 'http://www.yahoo.com/';
}


</script>
in the header, and still no luck. Anyone have any other suggestions?
JohntheFish replied on at Permalink Reply
JohntheFish
You had some syntax errors and it didn't pass Lint, so I have done a little tidying up as well. The following code works (only quickly tested on Chrome on Windows, so please make sure it is good on IE, Firefox etc, and on a Mac).
document.onkeydown =  function (evt) {
  var thisKey;
  if(evt){
    thisKey = evt.which;
  }else{
    thisKey = window.event.keyCode;
  }
    if(thisKey == '27'){
    window.location = 'http://www.yahoo.com/';
  }
};


I am doing a quick hack of my loadUI addon to do this, struck me as a worthy thing to do. So keep your eyes peeled for a 'Panic Button' addon shortly. Maybe Julia can expedite its progress through the PRB.

Also, I will include with the addon the notes Julia has posted about browser history etc.
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Just submitted the add-on to the PRB. Works from 5.4.1.1 upwards and IE6 upwards. Have sent a copy by PM.

(The above javascript needed some further tweaking to get it to work on as many different browsers as possible)

EDIT
Addon at:
http://www.concrete5.org/marketplace/addons/panic-button/...
chadmtate replied on at Permalink Reply
Thanks to both of you for you help on this!

We have the information about internet usage, and how to cover you tracks on the site I am building.

But getting this to work was one the biggest hurdles I faced with this project.

Thanks again.
wagdi replied on at Permalink Reply
wagdi
Tested on Safari. Works fine!
julia replied on at Permalink Reply
julia
JohnTheFish - I gave you a gold star 3 badge for this small bit of heroism. :) Good work!
davepeters replied on at Permalink Reply
John,

I am interested in developing a more sophisticated Emergency Exit Website Button. If you would be interested in this project, please contact me for further discussion.
Thanks,
Dave Peters
karen45 replied on at Permalink Reply
hello i have a domestic violence page on fb and was wondering is there any way i can add a quick escape to the top of my page so my victims can get out quickly if they have to,,my page is Help Stop Abuse On Women if anyone can help me that would be great,,thanks alot,,karen
JohntheFish replied on at Permalink Reply
JohntheFish
Unless you are serving a Concrete5 page within your facebook page, the Concrete5 Panic Button addon will not be of use to you.

A good place to ask would be on Facebook's own developer's forum.
karen45 replied on at Permalink Reply
ok thank you very much