![]() |
|
|
|
#1
|
|||
|
|||
|
Would it be possible to code a custom popup window module that would display a custom image/link inside it with the ability to turn it on/off by admins & mods?
I've always had to hard code the popup code/cookie code (that keeps the popup from appearing more than once every X minutes) and it's really hard for my mods to edit that code themselves (not being familiar with html/javascript, etc). So I'm wondering if it would be possible to create a module accessible by admins and mods that will define the following: - popup dimensions (width/height) - popup window title - image dimensions (width/height) (popup dimensions could be the same as this) - image alt/title - image source (maybe even ability to add the image/banner via attachments) - image link (pointing to a thread on the board or whatever other link it may be) - popup turned on/off I already have the javascript code that sets a cookie once the popup has been displayed and prevents it from showing up for another hour (time interval is customizable). Actually, here, I'll post all the files involved in this "manual process" here... flyer.php Code:
function flyer(){
window.open('http://www.mydomain.com/popup.html','MyDomain','width=400,height=499','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no');
}
flyer();
Code:
<HTML> <HEAD> <TITLE>This Friday!</TITLE> </HEAD> <CENTER> <BODY BGCOLOR=black leftMargin=0 topMargin=0> <IMG width="400" height="499" src="http://www.mydomain.com/images/popup_72.jpg" border="0"> </BODY> </HTML> Code:
var expMinutes = 60; // number of minutes the cookie should last
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expMinutes*60*1000));
function amt(){
var popup = GetCookie('popup')
if(popup == null) {
SetCookie('popup','1')
return 1
}
else {
var newpopup = parseInt(popup) + 1;
DeleteCookie('popup')
SetCookie('popup',newpopup,exp)
return popup
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function checkpopup() {
var popup = GetCookie('popup');
if (popup == null) {
popup=1;
SetCookie('popup', popup, exp);
document.write("<SCRIPT LANGUAGE=\"JavaScript\" src=\"http://www.mydomain.com/flyer.php\"></script>");
}
else {
popup++;
SetCookie('popup', popup, exp);
}
}
checkpopup();
|
|
#2
|
|||
|
|||
|
what, nobody found this valuable or interesting at least?
|
|
#3
|
||||
|
||||
|
DO YOU HAVE A DEMO WE COULD LOOK AT?
|
|
#4
|
|||
|
|||
|
I thinks this is a very good idea... would like to have that on!!
|
|
#5
|
|||
|
|||
|
I dislike popups of any sort honestly. Even those built in to vB I'd rather see migrated to another method.
|
|
#6
|
|||
|
|||
|
Quote:
|
|
#7
|
||||
|
||||
|
Quote:
I would like it if it can be used for my AMF Flashchat Rooms so u do not need to get another url page setup again. Mine always goes to AMF FlashChat but I want it to have the forum display so I can go back & forth. Last edited by LEAD_WEIGHT; 05-26-2005 at 08:40 AM. |
|
#8
|
|||
|
|||
|
Exactly what I was looking for, didnt' want to do this myself. I'll test it out now. :thumbs:
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [REQUEST] Will pay $$$ For Custom Skin | kderentz | Chit Chat | 1 | 01-13-2005 02:34 PM |
| [Request] How can I add a custom block that can pull posts from my forum? | Sal Collaziano | Add-On Modules & Modifications | 2 | 12-30-2004 10:03 AM |
| Custom Skin request. | 03GTFL | Troubleshooting / "How do I..." Questions | 3 | 06-28-2004 02:55 PM |