Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: A.M.A on April 10, 2004, 07:06:47 PM

Title: logout gray effect!
Post by: A.M.A on April 10, 2004, 07:06:47 PM
while surfing one of my favorites Arab VB's forums I've notice this feature, that will gray screen when clicking the logout button .. a similar effect found in windows XP when clicking  Log off.

in script.js add the following code at the end of the file:
// Logout effect like in WindowsXP gray logoff effect!
function log_out()
{
ht = document.getElementsByTagName("html");
ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
if (confirm('Are you sure you want to logout?'))
{
return true;
}
else
{
ht[0].style.filter = "";
return false;
}
}

in (index.template.php) look for
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
and replace it with:
<a onclick="return log_out()" href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
we just add this : onclick="return log_out()"

note that this will work only with IE.
Title: Re: logout gray effect!
Post by: Ben_S on April 10, 2004, 07:10:08 PM
Nice :)
Title: Re: logout gray effect!
Post by: Homie on April 10, 2004, 07:34:46 PM
WOW Awesome it worked for me YAYAYAYYYYYAAAAA  :o  :D GOOD Job A.M.A YOU Know Simple machines should ad this to there forum
Title: Re: logout gray effect!
Post by: Homie on April 16, 2004, 08:09:40 AM
I just found a forum with the Log Out Gray Effect Its Jin The MC Forum

http://www.holla-front.com/forum/index.php?
Title: Re: logout gray effect!
Post by: Ben_S on April 16, 2004, 12:28:02 PM
Homie, thats nice but its of no relevance, considering it's not even an SMF board.
Title: Re: logout gray effect!
Post by: Peter Duggan on April 16, 2004, 04:30:20 PM
Quote from: Homie on April 10, 2004, 07:34:46 PM
YOU Know Simple machines should ad this to there forum

Since you could have said 'could' but chose to say 'should', I should say you could be wrong there!
Title: Re: logout gray effect!
Post by: Oldiesmann on April 16, 2004, 05:05:07 PM
Interesting feature, but usually logging out happens pretty quickly (unless you're on a 56k modem ;)), so I don't know if that would be useful or not.
Title: Re: logout gray effect!
Post by: A.M.A on April 16, 2004, 07:36:10 PM
Quote from: Oldiesmann on April 16, 2004, 05:05:07 PM
Interesting feature, but usually logging out happens pretty quickly (unless you're on a 56k modem ;)), so I don't know if that would be useful or not.
Even if you got very fast connection .. you will *notice* this one, trust me  ;)
Title: Re: logout gray effect!
Post by: [Unknown] on April 16, 2004, 10:01:22 PM
Not in Firefox.  Unless it can work in Opera/Mozilla as well, I'm not interested :P.

-[Unknown]
Title: Re: logout gray effect!
Post by: vkot on December 03, 2004, 05:47:47 AM
I think it could be done using CSS & JavaScript...
The JS would have a loop that changes all the colors on the page little by little until everything is black.
Title: Re: logout gray effect!
Post by: Trekkie101 on December 03, 2004, 06:35:07 AM
If it doesnt work in firefox its not worth the trouble, plus i have Netscape, Opera, Mozilla Suite, Crazy Browser, Avant  just so i can make sure things work right for all. Im still trying to get Lynx to work, but god its hard! No installer file.
Title: Re: logout gray effect!
Post by: Webby on December 03, 2004, 08:44:31 AM
Nice trick ;)  Works like a charm !
Title: Re: logout gray effect!
Post by: npeelman on December 16, 2004, 09:44:55 AM
Quote from: [Unknown] on April 16, 2004, 10:01:22 PM
Not in Firefox.  Unless it can work in Opera/Mozilla as well, I'm not interested :P.

-[Unknown]

Since 'filters' are pretty much IE specific (maybe Mozilla) I doubt they would work in anything but IE.  Now maybe some Javascript with a DIV (tiled graphic). Have JS bring the DIV to the front then either change the colors of the graphic or whatever...

Norm
Title: Re: logout gray effect!
Post by: Jan on December 17, 2004, 11:36:43 PM
Nice effect  :)
Title: Re: logout gray effect!
Post by: mediman on February 05, 2005, 01:51:12 PM
Quote from: [Unknown] on April 16, 2004, 10:01:22 PM
Not in Firefox.  Unless it can work in Opera/Mozilla as well, I'm not interested :P.

-[Unknown]
:P
Title: Re: logout gray effect!
Post by: Elmacik on August 18, 2005, 02:21:59 AM
its been more than 120 days this topic is not replied :)
ok, maybe the posters still alive, i will try my chance.

when this hack is done, the grey fonts turn into green in internet explorer.
everything is ok in opera and firefox. but in ie, the greys turns to green :S
Title: Re: logout gray effect!
Post by: IncubuS on November 24, 2005, 08:55:44 PM
Just one wierd question , I cant find any script.js lol in all forum folder .
Title: Re: logout gray effect!
Post by: JayBachatero on November 24, 2005, 09:36:03 PM
It located in Themes/{your_theme}/script.js
Title: Re: logout gray effect!
Post by: Sheepy on November 25, 2005, 02:47:09 AM
Quote from: [Unknown] on April 16, 2004, 10:01:22 PM
Not in Firefox.  Unless it can work in Opera/Mozilla as well, I'm not interested :P.
Agree.  However perhaps we can do fade out instead by adding a semi-transparent png on these browsers? (However the png may have to be pre-loaded to guarentee it displays fast... when the mouse moves into logout command, at least, if you do not show a dialog like the original trick does)

If consistancy is in mind, Ie can also do fade out with filter.
Title: Re: logout gray effect!
Post by: CeZa on June 15, 2006, 04:55:00 AM
For RC2 ? ::)
Title: Re: logout gray effect!
Post by: Elmacik on June 15, 2006, 10:16:21 AM
It works for RC2 too. Just index.template.php changed a bit.
Code (Find) Select

<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>

Code (Replace) Select

<a onclick="return log_out()" href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
Title: Re: logout gray effect!
Post by: husmen73 (Gulhin) on June 20, 2006, 12:12:47 PM
Quote from: Elmacik on June 15, 2006, 10:16:21 AM
It works for RC2 too. Just index.template.php changed a bit.
Code (Find) Select

<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>

Code (Replace) Select

<a onclick="return log_out()" href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>

thanx Elmacik.

----------------------
thanx A.M.A
Title: Re: logout gray effect!
Post by: özgür şahin on January 19, 2007, 08:14:44 PM
for 1.1.1?
Title: Re: logout gray effect!
Post by: husmen73 (Gulhin) on January 21, 2007, 12:36:11 PM
osahin aynısını uygula. index.template.php'de ise kodları bulamazsan, benzer kodları ara ve değiştir. Herhangi bir problem çıkacağını sanmam. JS kodu ne de olsa.
Title: Re: logout gray effect!
Post by: özgür şahin on January 21, 2007, 01:13:34 PM
Olmuyor. Onun için sordum.
Title: Re: logout gray effect!
Post by: Alan S on January 24, 2007, 04:00:56 PM
Quote from: osahin on January 19, 2007, 08:14:44 PM
for 1.1.1?

Same code

Script.js


// Logout effect like in WindowsXP gray logoff effect!
function log_out()
{
ht = document.getElementsByTagName("html");
ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
if (confirm('Are you sure you want to logout?'))
{
return true;
}
else
{
ht[0].style.filter = "";
return false;
}
}


Index.template.php

Find

<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>


Replace With


<a onclick="return log_out()" href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
Title: Re: logout gray effect!
Post by: houston on January 26, 2007, 12:05:31 PM
Quote from: Alan S on January 24, 2007, 04:00:56 PM
Quote from: osahin on January 19, 2007, 08:14:44 PM
for 1.1.1?

Same code

Script.js


// Logout effect like in WindowsXP gray logoff effect!
function log_out()
{
ht = document.getElementsByTagName("html");
ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
if (confirm('Are you sure you want to logout?'))
{
return true;
}
else
{
ht[0].style.filter = "";
return false;
}
}


Index.template.php

Find

<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>


Replace With


<a onclick="return log_out()" href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>


Thanks for the code. It works great
Title: Re: logout gray effect!
Post by: teamvtec on January 26, 2007, 12:24:35 PM
Is it possible to delay the greyeffect like in windows?
Title: Re: logout gray effect!
Post by: eriktm on March 19, 2007, 12:28:01 PM
I don't know, but it's fantastic!

PS: I've tried it on v.1.1.2, it works ;)
Title: Re: logout gray effect!
Post by: dDOTr2 on April 02, 2007, 05:00:21 AM
really awesome. thanks for the code. tried and works on 1.1.2 with IE alone.
Title: Re: logout gray effect!
Post by: geniusrohit on April 25, 2007, 09:37:50 PM
Thanx its working fine and most of end users still choose bydefault browser i.e IE so still impressive
Title: Re: logout gray effect!
Post by: msvdm on June 08, 2007, 02:49:07 PM
i find some problem with this hack like Erik™ i put this in 1.1.2 work fine but when im login and pres logout it ask me i want to log out ore cancel when i press cancel it redirect me out from the forum dont redirect me back in the forum
Title: Re: logout gray effect!
Post by: John S on July 09, 2007, 01:39:02 PM
its too fast.. is it supposed to fade? because it doesnt 'fade' just turns grey.. how can i control the speed of the fade?
Title: Re: logout gray effect!
Post by: macuser9214 on July 15, 2007, 07:13:17 PM
not working for me. in the VB green theme, there was no script.js file, so I made one and it didn't work.
Title: Re: logout gray effect!
Post by: speak121 on July 15, 2007, 08:41:51 PM
Quote from: SimplMachnsforum_user on July 15, 2007, 07:13:17 PM
not working for me. in the VB green theme, there was no script.js file, so I made one and it didn't work.

Put on script.js of default theme.
Title: Re: logout gray effect!
Post by: diplomat. on July 16, 2007, 01:14:17 AM
Had this on my site for a while, sexy little addition (although I hardly ever log out ;))
Title: Re: logout gray effect!
Post by: asdas2 on August 22, 2007, 01:41:30 AM
this one working with default theme .... not the other theme that i m using riht now ... i m using dilber mc theme ....

help plzzzz
Title: Re: logout gray effect!
Post by: asdas2 on September 07, 2007, 03:02:03 PM
plzzz help :(
Title: Re: logout gray effect!
Post by: metallica48423 on October 06, 2007, 08:43:36 PM
Is this issue solved or do you still require assistance?

does that theme have its own script.js? Keep in mind this does NOT work in firefox.
Title: Re: logout gray effect!
Post by: asdas2 on October 07, 2007, 12:01:52 AM
No, its not solved yet

i m using INternet Explorer 7, and i m using Dilber Mc them, and smf 1.1.4

and i did not find any Script.js file in dilber mc folder.... so i guesss this theme dosent hov its own script.js


Title: Re: logout gray effect!
Post by: metallica48423 on October 07, 2007, 03:13:46 AM
and did you add it to the default theme's script.js?

do you get javascript errors on the page?
Title: Re: logout gray effect!
Post by: asdas2 on October 07, 2007, 10:37:22 AM
well, it works fine with dafault theme.
and i dun get any error on my dilber mc theeme
Title: Re: logout gray effect!
Post by: jagannath on October 16, 2007, 03:50:28 AM
ya it works well for me too in my new site www.techforums.in using the SoftMC Blue Theme
thanks for this tip.. even though this is small this is a great effect :D
Title: Re: logout gray effect!
Post by: Aileen on October 26, 2007, 11:19:51 AM
ths one is great
Title: Re: logout gray effect!
Post by: CultureGlue on January 18, 2010, 03:59:56 AM
Does this work on smf 1.1.11 ?
On 2.0RC2 ?

I tried to modify my index.template.php file but it is not actually the same..
Title: Re: logout gray effect!
Post by: frenki on April 27, 2010, 01:59:34 PM
i dont think it works for 2.0RC2 ,code is kinda completely different ?
Title: Re: logout gray effect!
Post by: Joe_Dean on September 26, 2010, 07:16:21 PM
This is sad - roughly ~33k users use IE. Learn to browse the web the right way people! Mozilla > all. There is no competition.
Title: Re: logout gray effect!
Post by: KensonPlays on September 30, 2010, 10:31:01 AM
Joe_Dean: yes there is compitition, Google Chrome
Title: Re: logout gray effect!
Post by: kysangel on October 04, 2010, 07:35:19 PM
Thanks for the help

kysangel
Title: Re: logout gray effect!
Post by: dzinerfusion on October 09, 2010, 10:48:52 PM
Does this work on the latest version of smf2?  :o
Title: Re: logout gray effect!
Post by: Masterd on October 22, 2010, 10:28:00 AM
I don't think that it will work.
Title: Re: logout gray effect!
Post by: waka_waka on November 13, 2010, 06:19:36 PM
nice inf
Title: Re: logout gray effect!
Post by: uninvited13th on March 24, 2011, 06:00:59 AM
2rc5 please.. :(
Title: Re: logout gray effect!
Post by: Arantor on March 24, 2011, 06:04:51 AM
Even if it were available for RC5, the code would need to be rewritten because right now it's IE only. Though there's code posted for RC2 which should work just as well.
Title: Re: logout gray effect!
Post by: desibees on April 05, 2011, 06:44:40 PM
I don't have
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
in my.... index.template.php

Im using RC5.

Custom template. ( i checked all template files)

help?
Title: Re: logout gray effect!
Post by: pearpandas on April 08, 2011, 09:15:17 AM
Love this trick thanks!
Title: Re: logout gray effect!
Post by: MotherBoard on April 11, 2011, 12:25:22 PM
wow...this is nice. Good find!
Title: Re: logout gray effect!
Post by: agent47 on April 11, 2011, 03:54:47 PM
Quote from: desibees on April 05, 2011, 06:44:40 PM
I don't have
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
in my.... index.template.php

Im using RC5.

Custom template. ( i checked all template files)

help?
We all don't because this is a really old topic and is probably written for SMF V1. Just stay put and maybe someone will take the liberty to re-write the code for the current SMF versions.
Title: Re: logout gray effect!
Post by: pearpandas on April 14, 2011, 02:53:10 PM
This is a really cool effect... thanks!