vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Mini Mods - Guest Floating Banner for VB4 (https://vborg.vbsupport.ru/showthread.php?t=255266)

bcilloniz 12-14-2010 10:00 PM

Guest Floating Banner for VB4
 
1 Attachment(s)
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

ZomgStuff 12-15-2010 07:36 PM

You should place your code in code tags as part of the TOS. This way unlicensed members cannot see it.

Nocturnal222 10-29-2011 11:42 PM

is this working?

bcilloniz 12-02-2011 04:14 PM

Quote:

Originally Posted by Nocturnal222 (Post 2262797)
is this working?

Yes, it's working... Try it, a tell me if you banner stays allways in its possition.

Luck

bcilloniz 12-03-2011 05:52 AM

1 Attachment(s)
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:

Toorak Times 02-15-2012 06:12 AM

Nice mate, ill put in soon.

bnimbhal 08-22-2012 10:18 AM

Hi,

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

Regards.
Bhanu

ExcelFox 10-28-2012 11:29 AM

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?

ExcelFox 10-28-2012 07:59 PM

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

S@NL - BlackBik 12-29-2012 04:25 PM

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


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

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01051 seconds
  • Memory Usage 1,762KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete