PDA

View Full Version : Panic Button 1.0.1


dsboyce8624
07-07-2005, 10:00 PM
This is a Panic Button (Should work in IE and FF) in case a member is worried about being on your site at a particular time, for example, at work.

The button defaults to staying glued to the lower right hand corner, but this can be changed in the CSS settings stated below.

The button can also be turned off by each member if they don't want to use it.

This is a hybrid of my Boss Button and yinyangs work to make the java right.

If you have the Custom Error Pages (https://vborg.vbsupport.ru/showthread.php?t=66305&highlight=custom+error) hack installed on a Windows server, you need to edit the settings to use URLs and not files or this will conflict.

The image I use is can obviously be substituted with anything else you like. Just be sure to name your image "panicbutton.gif".

This may be copied, reproduced or published anywhere without my permission.

vB 3.5 Beta Version (https://vborg.vbsupport.ru/showthread.php?threadid=91779)

Demo (http://forum.straychat.com) Please do not register.

Details
-------
2 Files to upload (1 Javascript File and 1 Panic Button image)
2 New Profile Field entries (Remember the Field ID# !!)
1 New CSS definition
1 Template Edit

You can change the placement of the image anywhere on the screen by editing the .panicbutton CSS.

dsboyce8624/yinyang

Changes:

7/8/5 - Updated instructions with note about case sensitivty of user field options and conditional code.

7/12/5 - Updated URLs for vBadvanced compatibility.

.

yoyoyoyo
07-08-2005, 09:47 PM
That's great! Thanks! Could this possibly be toggled on/off by the user?

dsboyce8624
07-08-2005, 09:49 PM
That's great! Thanks! Could this possibly be toggled on/off by the user?

Yes there is an option in the install for that.

yinyang
07-08-2005, 09:50 PM
That's great! Thanks! Could this possibly be toggled on/off by the user?

yup. the 2 new profile field entries allow the following 2 options:

1. Turn the Panic Button On/Off with On being the default
2. Allows each user to specify which URL for the panic button to send them to.

If someone wants, you can also add two more profile fields that controls a) top or bottom of screen and b) left or right. you would just substitute the corresponding profile field in the Panic Button CSS definitions.

yoyoyoyo
07-08-2005, 09:51 PM
yup. the 2 new profile field entries allow the following 2 options:

1. Turn the Panic Button On/Off with On being the default
2. Allows each user to specify which URL for the panic button to send them to.

If someone wants, you can also add two more profile fields that controls a) top or bottom of screen and b) left or right. you would just substitute the corresponding profile field in the Panic Button CSS definitions.Awesome!

dsboyce8624
07-08-2005, 09:52 PM
If someone wants, you can also add two more profile fields that controls a) top or bottom of screen and b) left or right. you would just substitute the corresponding profile field in the Panic Button CSS definitions.

Never thought of that. Cool idea.

yoyoyoyo
07-08-2005, 10:38 PM
This seems more like a "Misc. Option" Than a profile field :cross-eyed:

I hate to be a pain, but I installed this on a 3.0.7 forum, and it doesn't seem to be working for me. I triple-checked the edits, and css and also checked the proflile field ID in PHPMyAdmin to make sure that they were correct, but it still doesn't work. Yes, I also uploaded the javascript and image as mentioned in the read me. There are only a few steps, so I am at a loss to see what I did wrong.

dsboyce8624
07-08-2005, 10:42 PM
I suppose you could put the fields anywhere you like.

Open your site and do a veiw source. Search the source for panic.

Is everything there correct?

Look for the CSS entry first. Then look at the URL for the script, the destination URL for the button and the image file.

You may want to edit the code to show a full URL if they are not correct.

yoyoyoyo
07-08-2005, 11:03 PM
I suppose you could put the fields anywhere you like.

Open your site and do a veiw source. Search the source for panic.

Is everything there correct?

Look for the CSS entry first. Then look at the URL for the script, the destination URL for the button and the image file.

You may want to edit the code to show a full URL if they are not correct.

here is what I get when I view source, from the end of the CSS, where the location is defined, to right after the end of the panic button:
/* ***** Panic Button Location***** */
.panicbutton {
position: fixed;
position: expression("absolute");
right: 10px;
bottom: 10px;
-->
</style>

<!-- / CSS Stylesheet -->

<script type="text/javascript">
<!--
var SESSIONURL = "";
var IMGDIR_MISC = "images/misc";
// -->
</script>

<script type="text/javascript" src="clientscript/vbulletin_global.js"></script>
<script type="text/javascript" src="clientscript/vbulletin_menu.js"></script>
</head>
<body onload="editInit();">
<!-- PANIC BUTTON -->

<!-- END PANIC BUTTON -->
<!-- logo -->
<a name="top"></a><CENTER>
<table border="1" width="100%" cellpadding="0" cellspacing="0" align="center">
<tr>It doesn't seem to be pulling the javascript in from the script. Here is a screen shot of the file uploaded to my ftp:

dsboyce8624
07-08-2005, 11:05 PM
Show me the code you have in the header, it seems to be missing.

Give me a few lines after as well.

Mine shows this in view source:
<!-- BEGIN TEMPLATE: header -->
<!-- PANIC BUTTON 1.00 for vBulletin 3.5.0 beta by YinYang/dsboyce8624-->

<!--[if lt IE 7]><script src="http://damn.that-sucks.net/clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.yahoo.com"><img src="http://damn.that-sucks.net/images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>
<!-- END PANIC BUTTON 1.00 for vBulletin 3.5.0 beta by YinYang/dsboyce8624-->
<!-- logo -->

yoyoyoyo
07-08-2005, 11:09 PM
Show me the code you have in the header, it seems to be missing.

Give me a few lines after as well.


here goes from the top of the header template:<!-- PANIC BUTTON -->
<if condition="$bbuserinfo[field6] == yes">
<!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="$bbuserinfo[field5]"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div></if>
<!-- END PANIC BUTTON -->
<!-- logo -->
<a name="top"></a><CENTER>
<table border="1" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center">
<tr>

<table border="0" cellspacing="1" cellpadding="1" width="900">
<tr>

dsboyce8624
07-08-2005, 11:13 PM
What are your field numbers?

Guest190829
07-08-2005, 11:20 PM
Doesn't:

.panicbutton {
position: fixed;
position: expression("absolute");
right: 10px;
bottom: 10px;


need a } after all the properties are defined? That's probably what's causing the problem.

yoyoyoyo
07-08-2005, 11:20 PM
What are your field numbers?The same ones listed in the Read me:
Panic Button URL Redirect: ID 5
Turn "Panic Button" on?: ID 6

dsboyce8624
07-08-2005, 11:21 PM
Doesn't:

.panicbutton {
position: fixed;
position: expression("absolute");
right: 10px;
bottom: 10px;


need a } after all the properties are defined? That's probably what's causing the problem.

Yeah, got missed in the cut and paste. Try putting that in.

Although I don't see how that makes the code disappear. I assumed he failed the conditional by not editing the field numbers.

I guess you got lucky with the field numbers, mine are different.

Thought you forgot to change them.

yoyoyoyo
07-08-2005, 11:31 PM
Yeah, got missed in the cut and paste. Try putting that in.

Although I don't see how that makes the code disappear. I assumed he failed the conditional by not editing the field numbers.

I guess you got lucky with the field numbers, mine are different.

Thought you forgot to change them.Doh! I added the missing } and swapped the field ID's (I changed them earlier when I was checking to see if that was the error) Anyway- thanks much!

dsboyce8624
07-08-2005, 11:32 PM
No problem, glad to help.

akanevsky
07-08-2005, 11:41 PM
Is that a coincidence that the hack is "Panic Button 101"? Cause I don't see a reference to 1.0.0 anywhere... :P

yinyang
07-08-2005, 11:50 PM
Is that a coincidence that the hack is "Panic Button 101"? Cause I don't see a reference to 1.0.0 anywhere... :P

lol - Panic Button 101 ... i didn't even make the correlation.

anyhow, dsboyce8624 originated this hack and when I looked for a compliant script for xhtml, i coded it and placed it in the vB3.5 area ... even though it will work for all vb3.x.

so there is a genesis of 1.00 to 1.01 in the vB3.5 area which you can read here (https://vborg.vbsupport.ru/showthread.php?t=91779).

yoyoyoyo
07-09-2005, 12:10 AM
lol - Panic Button 101 ... i didn't even make the correlation.Thanks again for the help. Sorry to be such a dork, but maybe I will save someone else from making the same mistake

There's nothing like making stupid mistakes in public :D

dsboyce8624
07-09-2005, 01:11 AM
As long as it got fixed it doesn't matter.

akanevsky
07-09-2005, 01:27 AM
There's nothing like making stupid mistakes in public
Noo, it's good tho :) Should be kept as part of the title. :P

yoyoyoyo
07-09-2005, 01:39 AM
Noo, it's good tho :) Should be kept as part of the title. :PFor further 101-ing, I found out TRUE the source of the error:
Profile Field Type: Single-Selection Radio Buttons
Title: Turn "Panic Button" on?
Description: The Panic Button is an icon that resides in a fixed place of your choosing on your screen on your screen. Clicking the icon immediately sends you to another URL of your choice.
Options: Yes (carriage-return)
No
and<if condition="$bbuserinfo[field12] == yes">which should really be:<if condition="$bbuserinfo[field12] == Yes">(note the small/capital "y"?)

dsboyce8624
07-09-2005, 01:52 AM
For further 101-ing, I found out TRUE the source of the error:
Profile Field Type: Single-Selection Radio Buttons
Title: Turn "Panic Button" on?
Description: The Panic Button is an icon that resides in a fixed place of your choosing on your screen on your screen. Clicking the icon immediately sends you to another URL of your choice.
Options: Yes (carriage-return)
No
and<if condition="$bbuserinfo[field12] == yes">which should really be:<if condition="$bbuserinfo[field12] == Yes">(note the small/capital "y"?)

I'll make a note of that in the file and reload.

Done.

Neal-UK
07-09-2005, 02:16 AM
well I can't get this to work on vb 3.0.7 and all files, paths, etc are correct.

Shame that, I could do with it on www.meeting4fun.com (http://www.meeting4fun.com/)

dsboyce8624
07-09-2005, 02:43 AM
What problem did you have?

unkemone
07-09-2005, 08:47 AM
I have the same problem. im running a board with 3.0.7 and it just wont come up. i verified that the field #'s are correct and the capital and lowercase y correspond and it wont work.

yinyang
07-09-2005, 09:16 AM
I have the same problem. im running a board with 3.0.7 and it just wont come up. i verified that the field #'s are correct and the capital and lowercase y correspond and it wont work.

hmmm.

let's strip it and try it this way first before doing the profile fields.

1. add the new CSS definition
2. make sure the panicbutton.js and panicbutton.gif files are uploaded into the proper folders.
3. add this stripped down code to the beginning of your header:


<!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.google.com"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>

4. the panic button should show up on the bottom right of your screen and stay in a fixed position.

unkemone
07-09-2005, 09:25 AM
Thanks for your support but when i add that to the header i get this error

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/b/i/g/bigdog829/html/includes/adminfunctions_template.php(3096) : eval()'d code on line 104

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

dsboyce8624
07-09-2005, 01:11 PM
Thanks for your support but when i add that to the header i get this error



The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/b/i/g/bigdog829/html/includes/adminfunctions_template.php(3096) : eval()'d code on line 104

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.

Take the </if> off the end.

unkemone
07-09-2005, 03:19 PM
Yup now its working and at a fixed location with a fixed url what do you think the problem is?

yoyoyoyo
07-09-2005, 03:45 PM
Yup now its working and at a fixed location with a fixed url what do you think the problem is?It sounds as if you may have made a mistake when entering the User Profile Fields. Make sure that you have the "Field Editable by User" option set to YES

yinyang
07-09-2005, 04:15 PM
Take the </if> off the end.

doh! my bad. that's what happens when i offer support at 3:16AM los angeles time. :o

yoyoyoyo
07-09-2005, 04:35 PM
It sounds as if you may have made a mistake when entering the User Profile Fields. Make sure that you have the "Field Editable by User" option set to YESActually, when looking at his example he asked you to try:
<!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.google.com"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>it appears that he substituted the field ID's with the google URL. If you can get the above example to work, but can't get the hack to work then the problem has to be with your field ID's, since that is the only thing that was changed from the hack in his example. I suggest going in to phpMyAdmin and checking those field ID's to make sure that you have them right.

yinyang
07-09-2005, 05:07 PM
Actually, when looking at his example he asked you to try:
<!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.google.com"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>it appears that he substituted the field ID's with the google URL. If you can get the above example to work, but can't get the hack to work then the problem has to be with your field ID's, since that is the only thing that was changed from the hack in his example. I suggest going in to phpMyAdmin and checking those field ID's to make sure that you have them right.

yup! that's what i did. my apologies for not making it clearer :nervous: .

thanks yoyoyo - !

Neal-UK
07-09-2005, 05:36 PM
hmmm.

let's strip it and try it this way first before doing the profile fields.


Yup, now working 100%. Great little hack thanks!

dsboyce8624
07-09-2005, 05:42 PM
Yup, now working 100%. Great little hack thanks!

If you use it like that the on/off button will not work.

You need to put the <if . . . > </if> back around it and make sure you have the field numbers right. Seems you had a problem there the first time.

And please click Install.

yinyang
07-09-2005, 06:49 PM
Yup, now working 100%. Great little hack thanks!

if the stripped down version works, then it means your site will have no problem with the coding or javascript. as dsboyce8624 said, you should do the full install and make sure the profile field numbers are correct.

this will allow your users more flexibility and choices.

yoyoyoyo
07-11-2005, 08:16 PM
One suggestion:
change this<img src="images/misc/panicbutton.gif" border="0" alt="Panic Button">to<img src="$vboptions[bburl]/images/misc/panicbutton.gif" border="0" alt="Panic Button">
so this hack can be compatible with vBAdvanced CMPS and vBGallery users.

paul41598
07-11-2005, 08:28 PM
I dont get this hack. What does it do? Close down your browser with a click of a button?

yoyoyoyo
07-11-2005, 08:37 PM
I dont get this hack. What does it do? Close down your browser with a click of a button?No, it takes you to another web page that is user-defined (default set to google or whatever the admin chooses).

dsboyce8624
07-12-2005, 11:35 AM
One suggestion:
change this<img src="images/misc/panicbutton.gif" border="0" alt="Panic Button">to<img src="$vboptions[bburl]/images/misc/panicbutton.gif" border="0" alt="Panic Button">
so this hack can be compatible with vBAdvanced CMPS and vBGallery users.


File updated.

sketch42
07-19-2005, 03:23 AM
ok 2 things im running vb 3.0.7

1- after i finished the installation the option was set to yes but the deafult url was empty(even though i added it when making the profile field as per the instructions)

2- i fill in the url and than try the panic button .... and it tries going here http://www.wirelessolution.net/www.google.com

any ideas??

yinyang
07-19-2005, 04:06 AM
ok 2 things im running vb 3.0.7

1- after i finished the installation the option was set to yes but the deafult url was empty(even though i added it when making the profile field as per the instructions)

2- i fill in the url and than try the panic button .... and it tries going here http://www.wirelessolution.net/www.google.com

any ideas??

it sounds to me as the problem may be with #1 above. delete that profile field and rebuild it. you can change the default value of the URL to anything you want. in fact, try http://www.wirelesssolution.net .

make sure all the other "yes" and "no" fields are correct.

csidlernet
07-20-2005, 07:03 AM
/me comments on how nice a hack this is

o1dirtydog
08-16-2005, 11:47 PM
hmmm.

let's strip it and try it this way first before doing the profile fields.

1. add the new CSS definition
2. make sure the panicbutton.js and panicbutton.gif files are uploaded into the proper folders.
3. add this stripped down code to the beginning of your header:


<!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.google.com"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>

4. the panic button should show up on the bottom right of your screen and stay in a fixed position.



I was having a problem with this when I installed... it wouldn't show the button till I did this edit you posted to the header... it came right on.


Great job and great idea... thanks for the hard work and support! excellent hack

o1dirtydog
08-17-2005, 07:09 PM
okay I have a problem...

with the regular code in the install readme, the panic button will not show at all.

I thought I had it fixed when I used that other code that was posted in this thread, it worked.

My only problem here is that for some user on my site, they said it slowed down their loading of the site. When they would set the option to NO, it would still be there anyway.

There was no way to set the panic button on and off.

Can anyone fix the code for the header, and make it correct so this whole hack works? it's a great thing to add to mysite, but I don't want to put users who have slow connections or java problems out in the cold.

Thanks in advance.

dsboyce8624
08-21-2005, 04:49 PM
If it doesn't turn off you need to check the values and filed numbers for the yse and no option.

Remember they are case sensitive.

hotwheels
09-01-2005, 12:31 AM
<!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.google.com"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>
Turned it right on...........great hack

hotwheels
09-01-2005, 12:03 PM
It won't shut off........i have even set the default to no..........i rechecked my header and set the yes to capitol Yes........and still no go.....

this is what is in my header: <!-- PANIC BUTTON 1.0.1 for vBulletin 3.X by YinYang/dsboyce8624-->
<if condition="$bbuserinfo[field66] == Yes">
<!--[if lt IE 7]><script src="$vboptions[bburl]/clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="$bbuserinfo[field67]"><img src="$vboptions[bburl]/images/misc/panicbutton.gif" border="0" alt="Panic Button">
</div></if><!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.google.com"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>

this code above works, like i said, you just can't shut the panic button on/off.......please help. I have some member's that love this and some that hate it.........so on/off would be awesome.

hotwheels
09-01-2005, 11:31 PM
So has anybody running 3.07 actually have this script working?

yinyang
09-02-2005, 04:54 PM
this script works and has worked since the beginning.

please try and check to see if your capitalizations are correct. EVERYTHING is case sensitive.

hotwheels
09-03-2005, 06:52 PM
i will check it again......

hotwheels
09-04-2005, 12:53 AM
<!--[if lt IE 7]><script src="clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="http://www.google.com"><img src="images/misc/panicbutton.gif" border="0" alt="Panic Button"></a>
</div>
if i use this, it works, but you can't shut it off or turn it on.........

<!-- PANIC BUTTON 1.0.1 for vBulletin 3.X by YinYang/dsboyce8624-->
<if condition="$bbuserinfo[field66] == Yes">
<!--[if lt IE 7]><script src="$vboptions[bburl]/clientscript/panicbutton.js" type="text/javascript"></script><![endif]-->
<div class=panicbutton>
<a href="$bbuserinfo[field67]"><img src="$vboptions[bburl]/images/misc/panicbutton.gif" border="0" alt="Panic Button">
when i use this it doesn't work at all..............i have checked everything........and it still doesn't work........

I like the button idea, but my member's want to have the choice of turning it on and off...........

Please let me know what you would like to see from the code i installed and i will post it up...........

i just spent 2 hour's trying all kind's of different settings...........

hotwheels

tokenyank
09-04-2005, 04:51 PM
I can confirm the script works absolutly fine in itself, but the java script was conflicting with phpadsnew's java invocation code and was causing 20+sec page loads, even for people on 2mb lines. Although it was a good script, I've had to uninstall! :(

hotwheels
09-04-2005, 08:03 PM
That's a bummer......i was hoping to get this script up and running on my site......guess i may have to uninstall it too...

aladinliverpool
09-07-2005, 05:42 PM
only a little problem im encountering on 3.0.7

when the bit is added to the header.

you find that all your forum descriptions and all text within the forum has an underline in it.

how do ya stop that?

Mastar
09-24-2005, 09:09 PM
When you add </if> at the end it doesn't work but when you remove it it works but you can't get it to turn off. vb3.07

yinyang
09-25-2005, 09:58 PM
guys, sorry i haven't gotten here in awhile, just had our first newborn. trying to get sleep more than anything else.

anyhow, the javascript may and will conflict with other hacks and CSS. this javascript is far from perfect. however, it is the only javascript that i have found that will allow the autoscrolling/stationary button in XHTML.

therefore, please know that this was only tested on a clean test board and i guarantee you that it will work on a clean default board. other than that, there will be conflicts as evidenced.

i'm currently looking for a different javascript, so please bear with me.

thanks.

hotwheels
11-08-2005, 09:00 PM
dat's okay.....i am still trying to get it to work. Not sure what the error is, but it has something to do with my fieldnumbers...i believe.

SVTOA
11-12-2005, 01:50 AM
I have been able to make this work on my forum, but for some reason with one of my forum skins it causes the images to "double load" if the option is enabled in that skin. By double load, I mean the page loads fine, but then it "reloads" the images. It's kind of strange actually...
Wrks great in 4 other skins though... Nice work.

docvader
11-21-2005, 03:06 PM
I've gotten this to work also, and it works great, but in some of my more "advanced" skins, obtained through extremepixels.com, having the panic button turned on causes all the text on the page to be underlined. The standard styles work great.

Bizarre, not a problem, though it would be nice to understand why this happens.
http://x.russbo.com/vb/index.php

yinyang
11-22-2005, 03:42 AM
I've gotten this to work also, and it works great, but in some of my more "advanced" skins, obtained through extremepixels.com, having the panic button turned on causes all the text on the page to be underlined. The standard styles work great.

Bizarre, not a problem, though it would be nice to understand why this happens.
http://x.russbo.com/vb/index.php

i'm almost positive it is the javascript. although the js is open source, i am a lousy coder and never really looked at or altered it. it also messed up a lot of my CSS so i no longer use it.

Mosh
01-09-2006, 01:26 PM
The CSS definition does not validate as valid CSS in it's current form, it should be:

/* ***** Panic Button Location***** */
.panicbutton {
position: absolute;
position: fixed;
right: 10px;
bottom: 10px;
}

yinyang
01-10-2006, 06:29 AM
The CSS definition does not validate as valid CSS in it's current form, it should be:

/* ***** Panic Button Location***** */
.panicbutton {
position: absolute;
position: fixed;
right: 10px;
bottom: 10px;
}

thanks for the correction!

majorj0nny
07-12-2007, 05:24 PM
just to add - my problem was the use of the word "Yes" in the header ...

remember this must be EXACTLY what you wrote in the profile field..

i wrote "YES" ...