The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Random Popup On Forum?

View previous topic View next topic Go down

Random Popup On Forum?

Post by HogwartsAcademy on Fri 7 Dec - 2:36

Hello, my helpful, fellow forumotion users! I am yet again trying to find out how to go about making a very cool feature that will allow me to interact more with my members, but I don't know how to do it, which is why, ofcourse, I am here!

First off, what I am trying to accomplish is a popup box, that pops up randomly when you visit a random (not specific) forum on my site. This popup will just pop up, and even add a lightbox effect so the popup is more clearer, and the background is kind of blackened out. I want this so that when the popup pops out, it will say something like

"You have come across walking to ___ and turn your head and find 50$. Please PM an admin to receive your reward!" However, how can I make this?

An example is below, retrieved from www.HexRPG.com


HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Fri 7 Dec - 22:21

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Sat 8 Dec - 2:14

Yes, indeed I know that already, but I never knew how to put it together. Can you please, please use your brilliant mind and put the steps together for me to show me how to put it together so it shows the pop up on my forum - like creating the JS page, and how to add it to the forum, etc.

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Sat 8 Dec - 20:52

No, after clicking on a categorized forum, and make it so that it happens like once every 2 days to each IP or something possibly?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Sun 9 Dec - 19:07

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by nextlevelgaming on Mon 10 Dec - 0:57

IT may be possible, but this is not secure for you ya know. Once people hear of this, they are just going to PM you saying "Hey I found $50."

Instead maybe you should make it so that you send of the PM's

Creating a link with an ID and when clicked it'll pop up.

Just to provide you a more fair way of doing this...

Or you can create random numbers and whoever sends you the first correct one will get the points and then change them once they have been redeemed.

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Mon 10 Dec - 2:33

@nextlevelgaming wrote:IT may be possible, but this is not secure for you ya know. Once people hear of this, they are just going to PM you saying "Hey I found $50."

Instead maybe you should make it so that you send of the PM's

Creating a link with an ID and when clicked it'll pop up.

Just to provide you a more fair way of doing this...

Or you can create random numbers and whoever sends you the first correct one will get the points and then change them once they have been redeemed.

That is what I am doing, except keep in mind this doesn't include real money. It is payed in points. What happens is in the pop up I will put in a generated code and once the code is used once, I won't accept it again and make a new one. So does anyone know how I can go about doing this so it happens if they click on a forum but it's randomized so it doesn't open every time they click on that forum?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Tue 11 Dec - 1:10

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Tue 11 Dec - 1:30

Rideem3 wrote:I could provide you with a quick way:
Code:
var number = Math.floor(Math.random() * 2) + 1; //Random number between 1 and 2
if (number == 1 && /\/?f(\d+).*/.test(window.location.pathname)) alert('Your Text Here');

Where do I put this, mate?

I was thinking of something I could put into a javascript and set it in index only, and the code can include something that randomizes the factor of the popup.. like it includes that the popup opens on all the forums but doesn't happen everytime, do you know what I mean?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Tue 11 Dec - 4:15

Rideem3 wrote:What that script does, is when your browsing the topic list of a forum, if the random number is 1, then the message will display.

You would put it:
Admin Panel -> Modules -> JavaScript Codes Management -> Create New -> Select in All Pages

Which number should I keep it so that it is random every time and doesn't happen every say.. 10 minutes, maybe spread it between a few hours?

Also, I don't like the style that the button is in, can I make it in HTML so that the background is black, and I can add an image in it with colorful text, etc? Like in the example I put in the first post?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Sat 15 Dec - 20:21

I do not know how to do this because what I did is I made my whole popup in HTML, how can I style it in CSS if it's in HTML?

Here is the code for the pop up:

Code:
<html>
   <head>
      <title></title>
   </head>
   <body>
      <p>
         </p>
      <table bgcolor="#776952" border="0" cellpadding="5" cellspacing="1" style="color: rgb(216, 198, 163); font-family: verdana, arial, sans-serif;" width="420">
         <tbody>
            <tr bgcolor="#000000">
               <td align="center" style="font-size: 11px;" valign="middle" width="300">
                  Whilst flying past Hogwarts, Cupid was hit by a rogue bludger. Concussed and confused he flies to your window, professing his undying love for you. You take him to Madame Promfrey, who treats and discharges him that day. The next morning you find a single red rose on your window sill, with a note: I will never forget you - C</td>
               <td style="font-size: 11px;">
                  <img src="http://www.hexrpg.com/images/logo/hogwarts.gif" /></td>
            </tr>
         </tbody>
      </table>
      <p>
         </p>
   </body>
</html>

What can I do to put this as a popup?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Sun 16 Dec - 18:21

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Mon 17 Dec - 0:19

It is a popup that the graphic designer for the website I am using this off gave me, he told me that this was the HTML and I needed to convert it to CSS.. isn't there a way to put this in a widget or something so that it will show as html?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by nextlevelgaming on Mon 17 Dec - 14:45

HTML and CSS are two complete different things, though they go hand in hand together. CSS styles what the HTML will look like. Also you only need <head tags and <body tags if you are using it for an HTML page. If you are using it for a widget/editing templates you do not need those tags.

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Mon 17 Dec - 22:45

Do you know how I can convert this html to CSS?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by nextlevelgaming on Mon 17 Dec - 22:59

HogwartsAcademy you do not convert HTML to CSS! You use CSS to style the HTML you need both to have it work. HTML is ok, but without HTML CSS is nothing really. Use this code

Code:
<table id="popup_mess" border="0" cellpadding="5" cellspacing="1">
        <tbody>
            <tr>
              <td align="center">
                  Whilst flying past Hogwarts, Cupid was hit by a rogue bludger. Concussed and confused he flies to your window, professing his undying love for you. You take him to Madame Promfrey, who treats and discharges him that day. The next morning you find a single red rose on your window sill, with a note: I will never forget you - C</td>
              <td>
                  <img src="http://www.hexrpg.com/images/logo/hogwarts.gif" /></td>
            </tr>
        </tbody>
      </table>

CSS would be like so

Code:
#popup_mess{
background:#000;
color:#ff0000;
font-size: 12px;
font-family:Time New Roman;
}
#popup_mess tr{style inside brackets}
#popup_mess td{ style inside brackets}

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Mon 17 Dec - 23:50

What do I put in where it says "style inside brackets"?

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Wed 19 Dec - 1:16

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by nextlevelgaming on Wed 19 Dec - 5:14

Style it with background colors text colors and so forth. That is what we call styling Smile

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Wed 19 Dec - 21:53

Can you re-write the code for me using Rideem's way to make this and the popup that I am using with the rewritten code you gave me? I have so many information here it is hard to understand what to put and where to put it, this would be excellent. Thank you.

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Thu 20 Dec - 22:43

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by nextlevelgaming on Fri 21 Dec - 3:34

Sorry can not due, I am too busy on my own websites, and helping others on mine. HTML goes in HTML, CSS goes in CSS, and javascript goes in javascript Wink

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Fri 21 Dec - 4:32

Okay man, thank you.

Also, I did what you gave me, and it's not working for me. It could just be Rideem's code that may not work. I don't know. This is what I'm doing:

=====================================================


JAVASCRIPT CODE:

Code:
if (!my_getcookie('forum_popup') && /\/?f(\d+).*/.test(window.location.pathname)) {
var now = new Date();
var time = now.getTime();
time += 3600 * 10000;
now.setTime(time);
document.cookie =
    'forum_popup=true'; expires=' + now.toGMTString() +
    ';
document.getElementById('forum_popup').style.display="block";
}

FORUM WIDGET CODE

Code:
<div id="forum_popup" style="display: none;"><table id="popup_mess" border="0" cellpadding="5" cellspacing="1">
       
            <tr>
              <td align="center">
                  Whilst flying past Hogwarts, Cupid was hit by a rogue bludger. Concussed and confused he flies to your window, professing his undying love for you. You take him to Madame Promfrey, who treats and discharges him that day. The next morning you find a single red rose on your window sill, with a note: I will never forget you - C</td>
              <td>
                  <img src="http://www.hexrpg.com/images/logo/hogwarts.gif" /></td>
            </tr>
       
      </table></div>

CSS CODE

Code:
#forum_popup {
/*#popup_mess{
background:#000;
color:#ff0000;
font-size: 12px;
font-family:Time New Roman;
}
#popup_mess tr{style inside brackets}
#popup_mess td{ style inside brackets}*/
}

Rideem or anyone, can you make sure that this is right? Because it's been a few days after I published all these changes and nothing even popped up.

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Sat 22 Dec - 20:46

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Tue 25 Dec - 10:41

bump

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by KingOfSpades on Tue 25 Dec - 22:14

@nextlevelgaming wrote:Sorry can not due, I am too busy on my own websites, and helping others on mine. HTML goes in HTML, CSS goes in CSS, and javascript goes in javascript Wink
HTML and Java are the same.

KingOfSpades
Forumember

Male Posts : 215
Reputation : 8
Language : EN

http://roleplaymachugas.forumotion.com/

Back to top Go down

Re: Random Popup On Forum?

Post by nextlevelgaming on Wed 26 Dec - 1:42

LMAO!

1. It is called javascript, not Java, Java is a different programming.
2. HTML and Javascript ARE NOT the same coding.

So don't try to correct me thanks

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

Re: Random Popup On Forum?

Post by HogwartsAcademy on Wed 26 Dec - 3:00

This doesn't help my solution..

HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Re: Random Popup On Forum?

Post by nextlevelgaming on Wed 26 Dec - 6:40

"Well your CSS has issues and if rideens code is not working you should check your error console.

nextlevelgaming
Forumember

Male Posts : 989
Reputation : 38
Language : English|CSS|HTML5|javascript|
Location : New York

http://www.easybbtutorials.forumotion.com

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum