Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Guest Floating Banner for VB4 Details »»
Guest Floating Banner for VB4
Version: 1.00, by bcilloniz bcilloniz is offline
Developer Last Online: Jul 2015 Show Printable Version Email this Page

Category: Mini Mods - Version: 4.1.0 Rating:
Released: 12-14-2010 Last Update: Never Installs: 7
Template Edits
 
No support by the author.

Dear friends:

Trying to help some users, I copy the codes to have a guest floating banner like the one I got in my forum Agroforum.pe

The only problem is that when i scroll down the page, the banner goes down too and desappears from the screen, but this is a good mod to gain more users. It's in spanish right now, but yoy can put the message you want.

Paste this code at the begginig of HEADER:

Code:
<vb:if condition="$show['guest']"> 
<script type="text/javascript"> 
var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session 
var startX = 30 //set x offset of bar in pixels 
var startY = 90 //set y offset of bar in pixels 
var verticalpos="fromtop" //enter "fromtop" or "frombottom" 
function iecompattest(){ 
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 
} 
function get_cookie(Name) { 
var search = Name + "=" 
var returnvalue = ""; 
if (document.cookie.length > 0) { 
offset = document.cookie.indexOf(search) 
if (offset != -1) { 
offset += search.length 
end = document.cookie.indexOf(";", offset); 
if (end == -1) end = document.cookie.length; 
returnvalue=unescape(document.cookie.substring(offset, end)) 
} 
} 
return returnvalue; 
} 
function closebar(){ 
if (persistclose) 
document.cookie="remainclosed=1" 
document.getElementById("topbar").style.visibility="hidden" 
} 
function staticbar(){ 
barheight=document.getElementById("topbar").offsetHeight 
var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera; 
var d = document; 
function ml(id){ 
var el=d.getElementById(id); 
if (!persistclose || persistclose && get_cookie("remainclosed")=="") 
el.style.visibility="visible" 
if(d.layers)el.style=el; 
el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";}; 
el.x = startX; 
if (verticalpos=="fromtop") 
el.y = startY; 
else{ 
el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight; 
el.y -= startY; 
} 
return el; 
} 
window.stayTopLeft=function(){ 
if (verticalpos=="fromtop"){ 
var pY = ns ? pageYOffset : iecompattest().scrollTop; 
ftlObj.y += (pY + startY - ftlObj.y)/8; 
} 
else{ 
var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight; 
ftlObj.y += (pY - startY - ftlObj.y)/8; 
} 
ftlObj.sP(ftlObj.x, ftlObj.y); 
setTimeout("stayTopLeft()", 10); 
} 
ftlObj = ml("topbar"); 
stayTopLeft(); 
} 
if (window.addEventListener) 
window.addEventListener("load", staticbar, false) 
else if (window.attachEvent) 
window.attachEvent("onload", staticbar) 
else if (document.getElementById) 
window.onload=staticbar 
</script> 
<div id="topbar"><p align="right"><a href="" onClick="closebar(); return false"><img src="http://static.sunnypages.jp/img/map/close_icon.gif" border="0" /></a> 
  </p> 
<img src="http://www.vbhispano.com/foros/images/icons/icon4.png" /> <b>Hola invitado! Para tener acceso completo y sin publicidades <a href="registro/"><u>registrese gratuitamente!</u></a></b><br> 
Imagen publicidad 
</div></vb:if>

This is the code to redirect the image to close the banner:

Code:
<p align="right"><a href="" onClick="closebar(); return false"><img src="http://static.sunnypages.jp/img/map/close_icon.gif" border="0" /></a> 
  </p>
This is the message:

Code:
<img src="http://www.vbhispano.com/foros/images/icons/icon4.png" /> <b>Hola invitado! Para tener acceso completo y sin publicidades <a href="registro/"><u>registrese gratuitamente!</u></a></b>
CSS code of div topbar, add to additional.css to modify the banner caracteristics:

Code:
#topbar { 
-webkit-border-radius:4px; 
-moz-border-radius:4px 4px 4px 4px; 
-moz-box-shadow:1px 1px 1px #666666; 
background-color:#ef8d31; 
border:1px solid #4A4848; 
color:white; 
max-width:338px; 
min-height:310px; 
padding:0 5px 3px; 
position:fixed; 
right:5%; 
top:8%; 
z-index:1; 
}
I hope the instructions are clear, because I dont speak english very well. And let me know if theres something the make the banner stay in its position, when scrollo down the screen.

Bye

Bruno

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
Toorak Times

Comments
  #2  
Old 12-15-2010, 07:36 PM
ZomgStuff ZomgStuff is offline
 
Join Date: Feb 2007
Posts: 469
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should place your code in code tags as part of the TOS. This way unlicensed members cannot see it.
Reply With Quote
  #3  
Old 10-29-2011, 11:42 PM
Nocturnal222 Nocturnal222 is offline
 
Join Date: Dec 2006
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is this working?
Reply With Quote
  #4  
Old 12-02-2011, 04:14 PM
bcilloniz bcilloniz is offline
 
Join Date: Nov 2008
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Nocturnal222 View Post
is this working?
Yes, it's working... Try it, a tell me if you banner stays allways in its possition.

Luck
Reply With Quote
  #5  
Old 12-03-2011, 05:52 AM
bcilloniz bcilloniz is offline
 
Join Date: Nov 2008
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Picture of the mod...

It's not a very simple mod, but its the only one for vb4 -I think-.

Hope someone like it..:up:
Attached Images
File Type: jpg Guest Floating Banner.jpg (284.0 KB, 0 views)
Reply With Quote
  #6  
Old 02-15-2012, 06:12 AM
Toorak Times's Avatar
Toorak Times Toorak Times is offline
 
Join Date: Jan 2011
Posts: 436
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mate, ill put in soon.
Reply With Quote
  #7  
Old 08-22-2012, 10:18 AM
bnimbhal bnimbhal is offline
 
Join Date: Jul 2009
Posts: 29
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

Can you please let me know how to use it with Google Adsence.

Regards.
Bhanu
Reply With Quote
  #8  
Old 10-28-2012, 11:29 AM
ExcelFox ExcelFox is offline
 
Join Date: Apr 2011
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You seem to have stopped it from disappearing below when the page is scrolled down. Can you tell us how you managed to do that?
Reply With Quote
  #9  
Old 10-28-2012, 07:59 PM
ExcelFox ExcelFox is offline
 
Join Date: Apr 2011
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For those who are interested, here's how I solved it

HTML Code:
<vb:if condition="$show['guest']"> 
<script type="text/javascript"> 
var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session 
var startX = 1128 //set x offset of bar in pixels 
var startY = 54 //set y offset of bar in pixels 
var verticalpos="frombottom" //enter "fromtop" or "frombottom" 
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("topbar").style.visibility="hidden"
}

function staticbar(){
	barheight=document.getElementById("topbar").offsetHeight
	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	function ml(id){
		var el=d.getElementById(id);
		if (!persistclose || persistclose && get_cookie("remainclosed")=="")
		el.style.visibility="visible"
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function(){
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : iecompattest().scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml("topbar");
	stayTopLeft();
}

if (window.addEventListener)
window.addEventListener("load", staticbar, false)
else if (window.attachEvent)
window.attachEvent("onload", staticbar)
else if (document.getElementById)
window.onload=staticbar
</script>

<div id="topbar"><p align="right"><a href="" onClick="closebar(); return false"><img src="images/misc/exit_ico.jpg" border="0" /></a> 
  </p><font color="black"><b>Hello Guest! Have a question? <font color="green">ASK!</font></b><p>To post questions, download files and to provide solutions to queries <a href="register.php"><u>register for free!</u></a></p><p>Already a member? <a href="login.php?do=login"><u>Click here to sign in!</u></a></p></font><br>
</div></vb:if>
and

Code:
#topbar { 
border:0px solid #4A4848; 
background-color: rgb(255, 235, 144); 
opacity: 0.80;
color: white; 
max-width:265px; 
min-height:18px; 
padding: 10px 15px 0px 15px;
text-align: left;
position: absolute; 
right:0%; 
top: 80%; 
z-index:10;
box-shadow: 5px 5px 5px rgb(25, 25, 25);
visibility: hidden;
}
You can view the sample at http://www.excelfox.com/forum/forum.php
Reply With Quote
  #10  
Old 12-29-2012, 04:25 PM
S@NL - BlackBik's Avatar
S@NL - BlackBik S@NL - BlackBik is offline
 
Join Date: Jul 2004
Location: Netherlands
Posts: 307
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for sharing this.
I'm using it to show a cookie warning (EU based site).
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:19 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09648 seconds
  • Memory Usage 2,325KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (1)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete