March 28, 2024, 04:12:11 pm
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome to Revolution X, where Coding meets Graphics.
 
  Home Help Search Arcade Affiliates Staff List Calendar Members Login Register  

Alert on Logout

Pages: [1]   Go Down
  Print  
Author Topic: Alert on Logout  (Read 1785 times)
0 Members and 1 Guest are viewing this topic.
Agent Moose
Administrator
Adminitrator
Offline Offline

Gender: Male
Posts: 1,470



View Profile WWW
Badges: (View All)
Tenth year Anniversary Nineth year Anniversary Search
« on: April 21, 2009, 04:59:44 pm »

Footers:
Code:
<script type="text/javascript">
var Leave = "YOUR TEXT";

var name = document.getElementsByTagName("span");
//Created by Agent Moose (revolutionx.smfforfree.com)
for(v=0;v<name.length;v++){
if(name[v].innerHTML.match(/Hello <b>(.*)<\/b>/i)){
var username = RegExp.$1;
};};
var Logout = document.links;
for(c=0;c<Logout.length;c++){
if(Logout[c].href.match(/action=logout/i) && Logout[c].parentNode.className == "maintab_back"){
Logout[c].onclick = function(){ if(confirm(Leave) == true) { window.location.href = smf_scripturl + "?action=logout"; } else { return false; } };
};};
if(Leave.match(/{user}/i)) Leave = Leave.replace(/{user}/i,username);
</script>
Original Request: http://revolutionx.smfforfree3.com/index.php/topic,429.0.html

When this code is added to your forum, a pop-up box will appear when you click the "Logout" tab.

YOUR TEXT = The text the message will show.
If you want to show the user's name in the message, put {user}.

Enjoy Smiley
« Last Edit: April 30, 2009, 09:09:57 pm by Agent Moose » Report Spam   Logged


Share on Facebook Share on Twitter

code learner
Newcomers!
Newcomers!
Offline Offline

Gender: Male
Posts: 2


View Profile
Badges: (View All)
« Reply #1 on: April 21, 2009, 08:01:45 pm »

thanks really needed this one thank you moose love it  Afro
Report Spam   Logged
Andrew
Exclusive
Exclusive
Offline Offline

Gender: Male
Posts: 539



View Profile WWW
Badges: (View All)
Combination Topic Starter Poll Voter
« Reply #2 on: April 22, 2009, 06:44:11 pm »

Love it moose! using it now.
Report Spam   Logged

Vitality
Exclusive
Exclusive
Offline Offline

Gender: Male
Posts: 154



View Profile
Badges: (View All)
« Reply #3 on: April 22, 2009, 08:04:44 pm »

Good to see you've been using classic JS. I have to break out of my jQuery phase right now  Grin
Nice work Moose
Report Spam   Logged


CODE
Agent Moose
Administrator
Adminitrator
Offline Offline

Gender: Male
Posts: 1,470



View Profile WWW
Badges: (View All)
Tenth year Anniversary Nineth year Anniversary Search
« Reply #4 on: April 23, 2009, 04:21:37 pm »

Glad you all like it Smiley

Good to see you've been using classic JS. I have to break out of my jQuery phase right now  Grin
Nice work Moose

I know how it is with jquery man Tongue  I've been using classic JS because it looks better, and it looks more profesional Tongue

Mind you, there are still some things I use jquery on, mainly if I get lazy, or if it is a code I don't know how to do without it Tongue
Report Spam   Logged


Andrew
Exclusive
Exclusive
Offline Offline

Gender: Male
Posts: 539



View Profile WWW
Badges: (View All)
Combination Topic Starter Poll Voter
« Reply #5 on: April 24, 2009, 05:37:13 pm »

Theres only one problem with this, When I tried to X out of the alert that comes up, it logs my out anyway  Shocked
Report Spam   Logged

Agent Moose
Administrator
Adminitrator
Offline Offline

Gender: Male
Posts: 1,470



View Profile WWW
Badges: (View All)
Tenth year Anniversary Nineth year Anniversary Search
« Reply #6 on: April 25, 2009, 07:09:28 am »

I shall fix that later.  I guess I should of used a confirm box Tongue
Report Spam   Logged


Agent Moose
Administrator
Adminitrator
Offline Offline

Gender: Male
Posts: 1,470



View Profile WWW
Badges: (View All)
Tenth year Anniversary Nineth year Anniversary Search
« Reply #7 on: April 27, 2009, 06:42:52 am »

I hadn't tested this code yet, but it should work.  When someone tests it, I will edit the first post:
Code:
<script type="text/javascript">
var Leave = "YOUR TEXT";

var name = document.getElementsByTagName("span");
for(v=0;v<name.length;v++){
if(name[v].innerHTML.match(/Hello <b>(.*)<\/b>/i)){
var username = RegExp.$1;
};};
var Logout = document.links;
for(c=0;c<Logout.length;c++){
if(Logout[c].href.match(/action=logout/i) && Logout[c].parentNode.className == "maintab_back"){
Logout[c].onclick = function(){ if(confirm(Leave) == true) window.location.href = smf_scripturl + "?action=logout"; };
};};
if(Leave.match(/{user}/i)) Leave = Leave.replace(/{user}/i,username);
</script>
Report Spam   Logged


Andrew
Exclusive
Exclusive
Offline Offline

Gender: Male
Posts: 539



View Profile WWW
Badges: (View All)
Combination Topic Starter Poll Voter
« Reply #8 on: April 30, 2009, 07:58:11 am »

I just tried that one, it has the "OK" and "Cancel" buttons, but they do the same thing as the last one. Even if I would click "Cancel" it would log me out.
Report Spam   Logged

Celebrus
Artificially Conscious
Administrator
Adminitrator
Offline Offline

Gender: Male
Posts: 626



View Profile WWW
Badges: (View All)
Apple User
« Reply #9 on: April 30, 2009, 08:55:16 am »

Try this:
Code:
<script type="text/javascript">
var Leave = "YOUR TEXT";

var name = document.getElementsByTagName("span");
for(v=0;v<name.length;v++){
if(name[v].innerHTML.match(/Hello <b>(.*)<\/b>/i)){
var username = RegExp.$1;
};};
var Logout = document.links;
for(c=0;c<Logout.length;c++){
if(Logout[c].href.match(/action=logout/i) && Logout[c].parentNode.className == "maintab_back"){
Logout[c].onclick = function(){ if(confirm(Leave) == true) { window.location.href = smf_scripturl + "?action=logout"; } else { return false; } };
};};
if(Leave.match(/{user}/i)) Leave = Leave.replace(/{user}/i,username);
</script>

I basically just got what Agent wrote to return false.
Report Spam   Logged

Andrew
Exclusive
Exclusive
Offline Offline

Gender: Male
Posts: 539



View Profile WWW
Badges: (View All)
Combination Topic Starter Poll Voter
« Reply #10 on: April 30, 2009, 09:35:59 am »

Try this:
Code:
<script type="text/javascript">
var Leave = "YOUR TEXT";

var name = document.getElementsByTagName("span");
for(v=0;v<name.length;v++){
if(name[v].innerHTML.match(/Hello <b>(.*)<\/b>/i)){
var username = RegExp.$1;
};};
var Logout = document.links;
for(c=0;c<Logout.length;c++){
if(Logout[c].href.match(/action=logout/i) && Logout[c].parentNode.className == "maintab_back"){
Logout[c].onclick = function(){ if(confirm(Leave) == true) { window.location.href = smf_scripturl + "?action=logout"; } else { return false; } };
};};
if(Leave.match(/{user}/i)) Leave = Leave.replace(/{user}/i,username);
</script>

I basically just got what Agent wrote to return false.

Thanks Cele! It worked right Smiley

Report Spam   Logged

Mojobojo82
MVP
MVP
Offline Offline

Gender: Male
Posts: 838


View Profile
Badges: (View All)
« Reply #11 on: June 17, 2009, 05:48:41 am »

Thanks Moose, Works nice and soothe Smiley
Report Spam   Logged






Santadomin
Newcomers!
Newcomers!
Offline Offline

Gender: Male
Posts: 7


View Profile
Badges: (View All)
« Reply #12 on: August 15, 2009, 10:23:33 pm »

Nice code, i'm using it right now  Afro
Report Spam   Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Bookmark this site! | Upgrade This Forum
SMF For Free - Create your own Forum

Powered by SMF | SMF © 2016, Simple Machines
Privacy Policy