Advertise Here

Author Topic: [CODE] WARNING; Make a customised alert, with links and images! [QUB1]  (Read 1428 times)

0 Members and 1 Guest are viewing this topic.

Offline Qub1

  • SMF For Free Full Member
  • *
  • Posts: 149
    • View Profile
    • QUB1

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Forum Url: http://qub1.smfforfree.com
Hi, and good day to you all ;D. Today I present you one of my newest codes, it's a code witch allows you to create a alert of your choise! You can use it to report if a banned user has posted or anything else. There is a live preview of the code on the above site, this post can also be found there.

Ok, first this is the code:
Quote
<script LANGUAGE="JavaScript">
<!-- This script is made by Qub1. Find more scripts like this at http://qub1.smfforfree.com/ -->
 var qub1_mess = 'PUT THE TEXT YOU WANT TO APPEAR HERE';
var qub1_background = '#D8D8D8'
 var qub1_bordure = '#000000'
 var qub1_police = 'Verdana'
 var qub1_police_taille = '12'
 var qub1_police_color = '#000000'
 var qub1_hauteur = 120
 var qub1_largeur = 340
 var qub1_box2 = 1;


qub1_classe = 'border-color:'+qub1_bordure+';border-style:solid;border-width:1px;background:'+qub1_background+';font-family:'+qub1_police+';font-size:'+qub1_police_taille+'px;color:'+qub1_police_color;
 if(document.getElementById)
    {
    document.write('<DIV ID=qub1_box1 STYLE="position:absolute;visibility:hidden;'+qub1_classe+';width:20;height:'+(qub1_hauteur+20)+';z-index:10"></DIV>');
    document.write('<DIV ID=qub1_box2 STYLE="position:absolute;visibility:hidden;'+qub1_classe+';width:'+qub1_box2+';height:'+qub1_hauteur+';z-index:5');
    if(document.all)
       document.write(';padding:10');
    document.write('"></DIV>');
    document.write('<DIV ID=qub1_box3 STYLE="position:absolute;visibility:hidden;'+qub1_classe+';width:20;height:'+(qub1_hauteur+20)+';z-index:10"></DIV>');
    qub1_Y = document.body.clientHeight;
    qub1_X = document.body.clientWidth;
    qub1_posX = Math.round(qub1_X/2);
    qub1_posY = Math.round(qub1_Y/2)-Math.round(qub1_hauteur/2);
    }
 
 function qub1_deplace()
    {
    document.getElementById("qub1_box1").style.left = qub1_posX-20-(qub1_box2/2);
    document.getElementById("qub1_box3").style.left = qub1_posX+(qub1_box2/2);
    document.getElementById("qub1_box2").style.left = qub1_posX-(qub1_box2/2)-5;
    document.getElementById("qub1_box2").style.width = qub1_box2+10;
    qub1_box2 += 5;
    if(qub1_box2<qub1_largeur)
       setTimeout("qub1_deplace()",10);
    else
       {
       document.getElementById("qub1_box2").innerHTML = '<CENTER>'+qub1_mess+'<BR><BR><B><A HREF=javascript:qub1_close()><FONT COLOR='+qub1_police_color+'>Close Warning</FONT></A></B></CENTER>'
       }
    }
 
 function qub1_start()
    {
    if(document.getElementById)
       {   
       document.getElementById("qub1_box1").style.visibility = 'visible'   
       document.getElementById("qub1_box2").style.visibility = 'visible'   
       document.getElementById("qub1_box3").style.visibility = 'visible'   
       document.getElementById("qub1_box1").style.top = qub1_posY-10
       document.getElementById("qub1_box2").style.top = qub1_posY
       document.getElementById("qub1_box3").style.top = qub1_posY-10
       qub1_deplace();
       }
    }   
 
 function qub1_close()
    {
    if(document.getElementById)
       {   
       document.getElementById("qub1_box1").style.visibility = 'hidden'   
       document.getElementById("qub1_box2").style.visibility = 'hidden'   
       document.getElementById("qub1_box3").style.visibility = 'hidden'   
       document.getElementById("qub1_box1").style.top = -600
       document.getElementById("qub1_box2").style.top = -600
       document.getElementById("qub1_box3").style.top = -600
       qub1_deplace();
       }
    }   
    
 window.onload = qub1_start;
 </script>

Ok, now put the code in the footers, or if you would like to put it on a random page put it in your so called <body>.
If you want to use it as a warning for a user, or as a user alert as I did on my site, just put the BBC code for html before and after the code (like this "[htm]thecode[/htm]" (I left out the "l"s bacause else it would be a script) and put it in the signature.

Now this is what you need to edit:
You can replace the PUT THE TEXT YOU WANT TO APPEAR HERE text with your own. You can find it here:
Code: [Select]
var qub1_mess = 'PUT THE TEXT YOU WANT TO APPEAR HERE';^^ To edit the above, you need to have a little HTML knowledge. To go down one row, use " <br> ". To insert a Hyperlink, use "<a href="THE LINK HERE">YOUR HYPERLINK TEXT HERE</a>". If you want to insert something else, just ask, and I will give the code.
Oh, and if you need it, here are the codes I used for my site:
Banned User Warning:
Quote
var qub1_mess = '<b>~WARNING~</b> <br> You are on a page where a banned-user has posted. If there is any abusive content I cannot be held responsible. <br>  <br> <b>Users Information:</b> <br> Username: Banned <br>  <br> <b>What do you want to do?</b> <br> <a href="http://qub1.smfforfree.com/index.php?action=profile;u=2">Vieuw his Userpage</a> <br> <input TYPE="button" VALUE="Go back" onClick="history.go(-1);">';

Admin Menu Alert (this one has some bugs with the Fame |+| and Defame |-| options, if anyone would like to fix that ;)):
Quote
var qub1_mess = '<b><p style="color:gold">~Administrator~</p></b> <br> You are on a page where the Administrator has posted. <br>  <br> <b>Users Information:</b> <br> Username: Qub1 <br>  <br> <b>What do you want to do?</b> <br> <a href="http://qub1.smfforfree.com/index.php?action=profile;u=1">View Profile</a> <br> <a href="http://qub1.smfforfree.com/index.php?action=pm;sa=send;u=1">Send PM</a> <br> <a href="mailto:Qub1@hotmail.com">Send E-mail</a> <br> <a href="http://qub1.smfforfree.com/index.php?action=modifykarma;sa=applaud;uid=1">Fame |+|</a> <br> <a href="http://qub1.smfforfree.com/index.php?action=modifykarma;sa=smite;uid=1">Defame |-|</a> <br> <a href="http://qub1.smfforfree.com/index.php?action=comment;sa=add;u=1">Comment User</a> <br> <a href="http://qub1.smfforfree.com/index.php?action=profile;u=1;sa=showPosts">Show Posts</a> <br> <input TYPE="button" VALUE="Go back" onClick="history.go(-1);">';
You may edit them to fit your needs.

You will also need to edit the look of the alert. You may use my Hexadecimal Color Topic for the colors, located on my site, and the rest is kind of self explainatory. The part you need to edit looks like this:
Code: [Select]
var qub1_background = '#D8D8D8'
 var qub1_bordure = '#000000'
 var qub1_police = 'Verdana'
 var qub1_police_taille = '12'
 var qub1_police_color = '#000000'
 var qub1_hauteur = 120
 var qub1_largeur = 340

Now for the last little thing you can edit is the little text at the bottom of the alert witch will close the alert when it is clicked. You can find it here:
Quote
      document.getElementById("qub1_box2").innerHTML = '<CENTER>'+qub1_mess+'<BR><BR><B><A HREF=javascript:qub1_close()><FONT COLOR='+qub1_police_color+'>Close Warning</FONT></A></B></CENTER>'
Just edit the Red text to what you want.

If you have any questions or comments, please post, i am always open to new problems or solutions  ;D
Thanks for reading, and if you are going to use it, thanks for using!
~ Qub1
« Last Edit: February 27, 2009, 07:38:24 am by Qub1 »

Offline Jac

  • SMF For Free Newbie
  • *
  • Posts: 19
    • View Profile
    • Runewelcoming

  • Total Badges: 11
    Badges: (View All)
    Topic Starter Combination Level 2 Level 1 10 Posts
Re: [CODE] WARNING; Make a customised alert, with links and images! [QUB1]
« Reply #1 on: February 27, 2009, 07:46:33 am »
Cool, would be good if someone started a competition 'who can find the secret word'

Offline Qub1

  • SMF For Free Full Member
  • *
  • Posts: 149
    • View Profile
    • QUB1

  • Total Badges: 16
    Badges: (View All)
    Topic Starter Combination Level 3 Level 2 Level 1
Re: [CODE] WARNING; Make a customised alert, with links and images! [QUB1]
« Reply #2 on: February 27, 2009, 09:44:51 am »
you mean the other code on my site, or this one? Since the other one has a function that you need to find the secret word to open up a popup

 

Related Topics

  Subject / Started by Replies Last post
14 Replies
4261 Views
Last post July 31, 2007, 12:54:47 pm
by Kimmie
3 Replies
7518 Views
Last post February 26, 2008, 05:02:24 am
by Qub1
12 Replies
2921 Views
Last post March 17, 2008, 02:38:25 pm
by blahs
3 Replies
1780 Views
Last post February 01, 2009, 10:28:44 am
by Andrew
8 Replies
1948 Views
Last post June 25, 2009, 04:06:26 pm
by Jish