WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Show div instead of pop up when new PM Empty Show div instead of pop up when new PM Sun Jan 09, 2011 2:33 am

Unknown Data

Unknown Data
Registered Member
Registered Member
Hi,

My plan was to make a div fixed to the top when you recieve a PM, instead of showing a pop up. But when I did that, the bar was only visible the first time a page got loaded, ie. when you clicked a link on the page, will the bar be hidden again.

Here is what I've done to my PunBB sourc:

Overall header template:
Code:
<div id="newmessage">There is a new message in your inbox, click <a href="../msg.forum?folder=inbox"><u>here</u></a> to see it.</div>

      <!-- BEGIN switch_enable_pm_popup -->
         pm = document.getElementById("newmessage").style.visibility = "visible";
         pm.focus();
      <!-- END switch_enable_pm_popup -->

Css:
Code:
#newmessage {
visibility : hidden;
padding : 10px;
border-bottom : 3px solid #FF902E;
background : #FFFFFF;
position : fixed;
top : 0px;
left : 0px;
width : 100%;
font-size : 13px;
}

Thanks. Very Happy



Last edited by Unknown Data on Fri Jan 14, 2011 6:13 pm; edited 1 time in total

http://woops.dk

Guest


Guest
Once the PM pop-up is activated, it will not be activated again because the PMs are no longer considered "new". So your idea, as it is, cannot work.

It CAN be made to work, however, through the use of cookies. Good luck!

Unknown Data

Unknown Data
Registered Member
Registered Member
Okay i'll try playing with the cookies, thanks for you reply and advice - it's much appreciated Very Happy

http://woops.dk

Kryptonian


Registered Member
Registered Member
You could also try Ajax...

I'd start with fetching the PM inbox page, and use RegExp, or "String.split()" method to count (or see if it finds one match) of the image for a new, unread PM. If it finds one or more matches, simply display the popup.



(Here's a untested attempt to make one for WebArtz, based on the HTML you supplied)
Code:
<script type="text/javascript">
jQuery.ajax({
 url: "/privmsg?folder=inbox",
 success: function(data){ if(data.split('<img src="http://i38.servimg.com/u/f38/15/18/69/86/newsma12.png" alt="" />').length >= 1){ jQuery("#newmessage").css('visibility','visible'); } },
 error: function(){ /* We failed to fetch the page... we could try a alternative route, or simply go on our jolly way */ }
});</script>
~You'll want to make sure you've got the right "Unread PM" image. Razz
-- This may not be the best method for older browsers. Its worth a shot though.



EDIT: That could be edited to run every 60 or so seconds to check for new mail...



Last edited by Kryptonian on Sun Jan 09, 2011 6:24 am; edited 1 time in total

http://www.scryptonite.com/

Guest


Guest
Krypt, I see you've learned a lot from looking at my code.

One problem with your method is that you have no idea whether the new messages in the Inbox just arrived, or whether the user chose to not read them. In both cases the messages would have the "new" tag. And I guarantee a user would be pretty angry if they were forced to look at a fixed-position DIV forever, just because they chose to not read a PM!

Kryptonian


Registered Member
Registered Member
(What code did I look at...? Sad ) I wasn't sure what the ".focus()" was for. I just added it. Razz // Removes from previous post....

It could be modified to ignore repeated checking. I chose to give the method only because I see no way of using cookies to check for new PM's. Since, forumotion boards (to my knowledge) do not set new cookies once a PM has arrived.





EDIT: It would only show the div telling the user that there is a new PM. It wouldn't jump to the PM... Razz

EDIT2: It would be checked on a specified interval. Your correct, it wouldn't know immediately when a PM arrived unless it was checking every single second.

EDIT3: (To many edits) I probably could've included some code that uses cookies to count the new PM's, and if the user wanted to ignore, they could click a button and it could only show that div again if the PM count was greater. (else if it was smaller, it could not alert at all and pretend that the user is already deleting/reading them)

http://www.scryptonite.com/

Guest


Guest
What code didn't you look at? Rolling Eyes

Anyway,

Kryptonian wrote:I chose to give the method only because I see no way of using cookies to check for new PM's.
Really? You need to think outside the box. Very Happy

I'll give you a hint. Set the cookie inside here:
Code:
<!-- BEGIN switch_enable_pm_popup -->
<!-- END switch_enable_pm_popup -->
and clear the cookie on the next visit to the PM Inbox page. Then use the cookie contents to determine whether to display the pop-up DIV. Simple yet effective.



Last edited by dion on Sun Jan 09, 2011 2:52 pm; edited 1 time in total

Kryptonian


Registered Member
Registered Member
Razz Not fair... Much simpler than my routine, but it still could've worked. XD

http://www.scryptonite.com/

Unknown Data

Unknown Data
Registered Member
Registered Member
Kryptonian wrote:You could also try Ajax...

I'd start with fetching the PM inbox page, and use RegExp, or "String.split()" method to count (or see if it finds one match) of the image for a new, unread PM. If it finds one or more matches, simply display the popup.



(Here's a untested attempt to make one for WebArtz, based on the HTML you supplied)
Code:
<script type="text/javascript">
jQuery.ajax({
 url: "/privmsg?folder=inbox",
 success: function(data){ if(data.split('<img src="http://i38.servimg.com/u/f38/15/18/69/86/newsma12.png" alt="" />').length >= 1){ jQuery("#newmessage").css('visibility','visible'); } },
 error: function(){ /* We failed to fetch the page... we could try a alternative route, or simply go on our jolly way */ }
});</script>
~You'll want to make sure you've got the right "Unread PM" image. Razz
-- This may not be the best method for older browsers. Its worth a shot though.



EDIT: That could be edited to run every 60 or so seconds to check for new mail...
I've tried it out, and it won't really work for me. The div is visible all the time, also when there isn't the new message image. Smile

dion wrote:Krypt, I see you've learned a lot from looking at my code.

One problem with your method is that you have no idea whether the new messages in the Inbox just arrived, or whether the user chose to not read them. In both cases the messages would have the "new" tag. And I guarantee a user would be pretty angry if they were forced to look at a fixed-position DIV forever, just because they chose to not read a PM!
It sounds a little bit wierd, but it's actually the way my members want it. xD

---

I'm also seaching for a notification beside a simple html div that say when a new message has arrived. Here is my div.
Code:
         <div id="minicontent">
 <div id="top"> Navigation </div>

<a href="../msg.forum?folder=inbox">Inbox</a>
         </div>

And when there is a new message, should it look like this.

Code:
         <div id="minicontent">
 <div id="top"> Navigation </div>

<a href="../msg.forum?folder=inbox">Inbox <span style="color:red;">New Message</span></a>
         </div>

Is that possible to with some innerhtml, ajax, or something else? Smile

http://woops.dk

10Show div instead of pop up when new PM Empty Re: Show div instead of pop up when new PM Mon Jan 10, 2011 1:00 am

Guest


Guest
Unknown Data wrote:I'm also seaching for a notification beside a simple html div that say when a new message has arrived.
Tell your members to look at the navbar. That's EXACTLY what the "Inbox" link does! Laughing

Actually, that's your solution. Display your pop-up based on the status of the "Inbox" link...

11Show div instead of pop up when new PM Empty Re: Show div instead of pop up when new PM Mon Jan 10, 2011 2:18 am

Unknown Data

Unknown Data
Registered Member
Registered Member
Haha I'll do that xD

Actually, that's your solution. Display your pop-up based on the status of the "Inbox" link...
Ohh didn't noticed that - thanks. Very Happy

http://woops.dk

12Show div instead of pop up when new PM Empty Re: Show div instead of pop up when new PM Fri Jan 14, 2011 6:12 pm

Unknown Data

Unknown Data
Registered Member
Registered Member
Thanks for the help Kryptonian and dion! Very Happy

Solved | Locked

http://woops.dk

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

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