jsTraffup

jsTraffup v1.1 by delphijustin

Website: delphijustin.biz

E-mail:  admin@delphijustin.biz

 

What is this?

This is a script file used to tell traffup users how to revisit your Website. It has 3 modes:

JSTUP_MODE_HTML This puts a widget on to the page if it was referred by traffup, this is the recommended mode

JSTUP_MODE_POPUP Show a popup alert messagebox when a traffup users leaves the page(This doesn’t work on all browsers).

JSTUP_MODE_DISABLD This mode disables the script all together.

Function Parameters:

Mode: The Mode

Debug: For debugging jsTraffup, it should be false on a public page.

Left: Left position in pixels.

Right: Right position in pixels.

Version: This is for future versions; you should still use it, just set it to 1.1

The example code below shows you how to use it:
<script type="text/javascript" src="jsTraffup.js"></script>
<script type="text/javascript">
   initTraffup({Mode: JSTUP_MODE_HTML,
   Debug: false,
   Left: "0px",
   Top: "0px",
   Version: 1.1});
</script>

jsTraffup.js file

/* jsTraffup v1,1 By delphijustin
Not created by traffup

*/
const JSTUP_MODE_HTML=1;//This mode makes it write to the document instead of popup.
const JSTUP_MODE_DISABLED=0;
const JSTUP_MODE_POPUP=2;
const JSTUP_CURRENT_VERSION=1.1;
var JSTUP_CURRENT_CONFIG=0;

function initTraffup(config){
if(config.OverrideUnload){
document.onunload=CallTraffup;
}
JSTUP_CURRENT_CONFIG=config;
switch(config.Mode){
case JSTUP_MODE_HTML:
CallTraffup();
break;
case JSTUP_MODE_POPUP:
if((navigator.userAgent.indexOf("Firefox")>-1)||(navigator.userAgent.indexOf("Chrome")>-1)){JSTUP_CURRENT_CONFIG.Mode=JSTUP_MODE_HTML;return CallTraffup();}
window.onbeforeunload=CallTraffup;
break;
}
}

function CallTraffup(){
var S="To visit this site again goto "+location.href;
if(JSTUP_CURRENT_CONFIG.Debug||isTraffup(document.referrer)){
switch(JSTUP_CURRENT_CONFIG.Mode){
case JSTUP_MODE_HTML:
document.writeln(
'<DIV ID="jsTraffupDIV" STYLE="position:fixed; top:'+JSTUP_CURRENT_CONFIG.Top+'; left:'+JSTUP_CURRENT_CONFIG.Left+';"><TEXTAREA ROWS="1" COLS="'+S.length+'">'+
S+'</TEXTAREA><INPUT TYPE="BUTTON" VALUE="X" ONCLICK="CloseTraffup()"></DIV>');
break; 
case JSTUP_MODE_POPUP:
return S;
break;
}
}
}

function CloseTraffup(){
document.getElementById("jsTraffupDIV").innerHTML="";
}

function isTraffup(url){
var s=url.toLowerCase();
return s.indexOf('traffup.net/')>-1;
}

Published by Justin Roeder

I am an electronics engineer and computer programmer that has autism. I learned by myself

delphijustin Industries is an Autism Supported Business
Social Media Auto Publish Powered By : XYZScripts.com
All in one
Start
OVH Hosting 01 Singapore
Your cart is empty.
Loading...