Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-01-2005, 10:00 PM
LEAD_WEIGHT LEAD_WEIGHT is offline
 
Join Date: Feb 2005
Location: Canada
Posts: 369
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How Do I Go About Entering JavaScript To Make Custom Template Work

How do I go about entering JavaScript to make custom template work in 'who's online line' and as well as 'navlink' plus just to make run on my custom template?

It did work in the instrution that Jake B. @ vbulletin.com provided by when I went and made a template for it, that is when it stop working.
http://www.vbulletin.com/forum/showthread.php?t=152916


Here is my Custom Template Code.
My link to page.
http://www.theundergroundsource.com/...hex_chart.php?

Code:
 

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body onload="capture()">
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
	<td class="tcat">Hex Colour Wheel & Chart</td>
</tr>

<div id=wheel style="position:absolute; visibility:visible; top:40px; left:120px;">
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<img src="http://www.theundergroundsource.com/website_images/colourwheel.jpg" width=256 height=256 border=0>
</td>
</tr>
<tr>
<td align="center">
<br>
<form name="f">
<input type="text" name="t" size=27>
</form>
</td>
</tr>
</table>
</div>
<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="<a href="http://javascriptsource.com">The">http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

                              <div align="center">
                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                  <tr>
                                    <td width="301px">
                                      <table cellpadding="2">
                                        <tbody>
                                          <tr>
                                            <td align="left">
                                              <p></p>
                                            </td>
                                          </tr>
                                        </tbody>
                                      </table>
                                      <div align="center">

                                        <table cellspacing="0" cellpadding="2" width="100%" bordercolorlight="#BBAC8C" border="1" bordercolordark="#FFFFFF">
                                          <tbody>
<tr>
 <td valign="top" align="left" width="25%">
 <!-- hex chart template -->
                                                <table cellspacing="0" cellpadding="2" width="100%">
                                                  <tbody>
                                                    <tr>
                                                      <div valign="top" align="center"><b><font face="Tahoma" size="1">PC & Mac Colour Safe Chart<img src=/images/new.gif> 
                                                     <td width="301px"><font face="Tahoma" size="1"><img class="image" src="http://www.theundergroundsource.com/website_images/colourchart.gif" width="300px" height="757"></font></td>
                                                            </font>
                                                        </b>

                                                      </div>
                                                    </tr>
                                                  </tbody>
                                                </table>
                                                <!-- END hex chart template -->
                                  </td>
                                </tr>
                             </table>
                             </center>
                           </div>

</table>

$footer
</body>
</html>


plus the .php code for template

PHP Code:

<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('THIS_SCRIPT''hex_colour_code'); // change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(
);
// get special data templates from the datastore
$specialtemplates = array(
);
// pre-cache templates used by all actions
$globaltemplates = array(
'hex_colour_code',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$navbits = array();
$navbits[$parent] = '';
$navbits construct_navbits($navbits);
 
eval(
'$navbar = "' fetch_template('navbar') . '";');
eval(
'print_output("' fetch_template('hex_colour_code') . '");');
 
?>

This is the instructions for code.

1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document


Code:
<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  D10n (biab@iinet.net.au) -->
<!-- Web Site:  http://www.iinet.net.au/~biab -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
addary = new Array();           //red
addary[0] = new Array(0,1,0);   //red green
addary[1] = new Array(-1,0,0);  //green
addary[2] = new Array(0,0,1);   //green blue
addary[3] = new Array(0,-1,0);  //blue
addary[4] = new Array(1,0,0);   //red blue
addary[5] = new Array(0,0,-1);  //red
addary[6] = new Array(255,1,1);
clrary = new Array(360);
for(i = 0; i < 6; i++)
for(j = 0; j < 60; j++) {
clrary[60 * i + j] = new Array(3);
for(k = 0; k < 3; k++) {
clrary[60 * i + j][k] = addary[6][k];
addary[6][k] += (addary[i][k] * 4);
   }
}
function capture() {
if(document.layers) {
layobj = document.layers['wheel'];
layobj.document.captureEvents(Event.MOUSEMOVE);
layobj.document.onmousemove = moved;
}
else {
layobj = document.all["wheel"];
layobj.onmousemove = moved;
   }
}
function moved(e) {
y = 4 * ((document.layers)?e.layerX:event.offsetX);
x = 4 * ((document.layers)?e.layerY:event.offsetY);
sx = x - 512;
sy = y - 512;
qx = (sx < 0)?0:1;
qy = (sy < 0)?0:1;
q = 2 * qy + qx;
quad = new Array(-180,360,180,0);
xa = Math.abs(sx);
ya = Math.abs(sy);
d = ya * 45 / xa;
if(ya > xa) d = 90 - (xa * 45 / ya);
deg = Math.floor(Math.abs(quad[q] - d));
n = 0;
sx = Math.abs(x - 512);
sy = Math.abs(y - 512);
r = Math.sqrt((sx * sx) + (sy * sy));
if(x == 512 & y == 512) {
c = "000000";
}
else {
for(i = 0; i < 3; i++) {
r2 = clrary[deg][i] * r / 256;
if(r > 256) r2 += Math.floor(r - 256);
if(r2 > 255) r2 = 255;
n = 256 * n + Math.floor(r2);
}
c = n.toString(16);
while(c.length < 6) c = "0" + c;
}
if(document.layers) {
document.layers["wheel"].document.f.t.value = "#" + c;
document.layers["wheel"].bgColor = "#" + c;
}
else {
document.all["wheel"].document.f.t.value = "#" + c;
document.all["wheel"].style.backgroundColor = "#" + c;
}
return false;
}
//  End -->
</script>
</head>
<!-- STEP TWO: Insert the onLoad event handler into your BODY tag  -->
<BODY onload="capture()">
<!-- STEP THREE: Copy this code into the BODY of your HTML document  -->
<div id=wheel style="position:absolute; visibility:visible; top:40px; left:120px;">
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td>
<img src="colorwheel.jpg" width=256 height=256 border=0>
</td>
</tr>
<tr>
<td align="center">
<br>
<form name="f">
<input type="text" name="t" size=27>
</form>
</td>
</tr>
</table>
</div>
<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="<A href="http://javascriptsource.com">The">http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size:  3.15 KB -->
Reply With Quote
  #2  
Old 09-02-2005, 01:11 AM
evil kev evil kev is offline
 
Join Date: May 2004
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

add a new line after $headinclude paste the bit with the script tags in. try make sure the tags are all in lowercase

and that is some old school javascript, i don't know if modern browsers will render that ok anymore it could do with some work really.
Reply With Quote
  #3  
Old 09-02-2005, 01:59 AM
LEAD_WEIGHT LEAD_WEIGHT is offline
 
Join Date: Feb 2005
Location: Canada
Posts: 369
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by evil kev
add a new line after $headinclude paste the bit with the script tags in. try make sure the tags are all in lowercase

and that is some old school javascript, i don't know if modern browsers will render that ok anymore it could do with some work really.
It does work but when I made a template for it, that is when it stop working.
Then if you just follow the instructions below it works but not what I wanted. It displays on top of forumhome page.
Code:
http://www.vbulletin.com/forum/showthread.php?t=152916
Yeh, it is five years old or more... I think I will give up on this and upgrade to 2004 script

Got something a little better plus I will be placing 16million color for paint/photoshop or what ever tool you use.
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 10:30 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.04154 seconds
  • Memory Usage 2,206KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete