Agent Moose
|
|
« on: April 21, 2009, 04:59:44 pm » |
|
Footers: <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.htmlWhen 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
|
|
« Last Edit: April 30, 2009, 09:09:57 pm by Agent Moose »
|
Report Spam
Logged
|
|
|
|
|
code learner
Newcomers!
Offline
Gender:
Posts: 2
Badges: (View All)
|
|
« Reply #1 on: April 21, 2009, 08:01:45 pm » |
|
thanks really needed this one thank you moose love it
|
|
|
|
|
Andrew
|
|
« Reply #2 on: April 22, 2009, 06:44:11 pm » |
|
Love it moose! using it now.
|
|
|
|
Vitality
Exclusive
Offline
Gender:
Posts: 154
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 Nice work Moose
|
CODE
|
|
|
Agent Moose
|
|
« Reply #4 on: April 23, 2009, 04:21:37 pm » |
|
Glad you all like it Good to see you've been using classic JS. I have to break out of my jQuery phase right now Nice work Moose I know how it is with jquery man I've been using classic JS because it looks better, and it looks more profesional 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
|
|
|
|
Andrew
|
|
« 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
|
|
|
|
Agent Moose
|
|
« Reply #6 on: April 25, 2009, 07:09:28 am » |
|
I shall fix that later. I guess I should of used a confirm box
|
|
|
|
Agent Moose
|
|
« 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: <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>
|
|
|
|
Andrew
|
|
« 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.
|
|
|
|
Celebrus
|
|
« Reply #9 on: April 30, 2009, 08:55:16 am » |
|
Try this: <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.
|
|
|
|
Andrew
|
|
« Reply #10 on: April 30, 2009, 09:35:59 am » |
|
Try this: <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
|
|
|
|
|
Santadomin
Newcomers!
Offline
Gender:
Posts: 7
Badges: (View All)
|
|
« Reply #12 on: August 15, 2009, 10:23:33 pm » |
|
Nice code, i'm using it right now
|
|
|
|
|
|