The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Random Popup On Forum?

3 posters

Go down

Random Popup On Forum? Empty Random Popup On Forum?

Post by HogwartsAcademy December 7th 2012, 03: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

Random Popup On Forum? Hex_bm10
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 7th 2012, 23:21

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 8th 2012, 03: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.
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 8th 2012, 21: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?
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 9th 2012, 20:07

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by nextlevelgaming December 10th 2012, 01: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
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

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 10th 2012, 03: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?
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 11th 2012, 02:10

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 11th 2012, 02: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?
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 11th 2012, 05: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?
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 15th 2012, 21: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?
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 16th 2012, 19:21

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 17th 2012, 01: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?
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by nextlevelgaming December 17th 2012, 15: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
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

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 17th 2012, 23:45

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

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by nextlevelgaming December 17th 2012, 23: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
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

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 18th 2012, 00:50

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

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 19th 2012, 02:16

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by nextlevelgaming December 19th 2012, 06:14

Style it with background colors text colors and so forth. That is what we call styling Smile
nextlevelgaming
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

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 19th 2012, 22: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.
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 20th 2012, 23:43

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by nextlevelgaming December 21st 2012, 04: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
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

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 21st 2012, 05: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.
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 22nd 2012, 21:46

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 25th 2012, 11:41

bump
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by KingOfSpades December 25th 2012, 23: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
KingOfSpades
Forumember

Male Posts : 215
Reputation : 8
Language : EN

http://roleplaymachugas.forumotion.com/

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by nextlevelgaming December 26th 2012, 02: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
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

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by HogwartsAcademy December 26th 2012, 04:00

This doesn't help my solution..
avatar
HogwartsAcademy
Forumember

Posts : 474
Reputation : 1
Language : English

Back to top Go down

Random Popup On Forum? Empty Re: Random Popup On Forum?

Post by nextlevelgaming December 26th 2012, 07:40

"Well your CSS has issues and if rideens code is not working you should check your error console.
nextlevelgaming
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

Back to top

- Similar topics

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