alex Fri Sep 14 15:18:27 2001 EDT
Added files:
/r2/binarycloud/user/htdocs/resources/js BaseLib.js
Removed files:
/r2/binarycloud/user/htdocs/resources/js base_lib.js
Log:
Renaming resource files
Index: r2/binarycloud/user/htdocs/resources/js/BaseLib.js
+++ r2/binarycloud/user/htdocs/resources/js/BaseLib.js
/*******************************************************************************
** -File $Id: BaseLib.js,v 1.1 2001/09/14 22:18:26 alex Exp $
** -License LGPL (http://www.gnu.org/copyleft/lesser.html)
** -Copyright 2001, The Turing Studio, Inc.
** -Author alex black, en...@tu...
******************************************************************************/
/**
* this function opens a popup window. use:
* open_window('http://www.yahoo.com','yahooWin','300','500');
*
* note that you can safely omit 'windowScrollbars'
*
* @author Alex Black
* @param windowURL the url to open in the new window
* @param windowName the name of the new window
* @param windowWidth the width in pixels of the new window
* @param windowHeight the height in pixels of the new window
* @param windowScrollbars can be set to yes|no|auto. controls the scrollbars
*/
function open_window(windowURL,windowName,windowWidth,windowHeight,windowScrollbars){
windowName=window.open(windowURL, windowName,"width="+windowWidth+",height="+windowHeight+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars="+windowScrollbars+",resizable=1,dependant");
windowName.focus();
}
/**
* this function sets the window's opener href to the url specified. if closeMe
* is set to 1, the window closes itself after setting the location.
*
* @author Alex Black
* @param url the url to set the parent's location to
* @param closeMe value can be 0 or 1
*/
function set_parent_location(url,closeMe) {
parent.opener.location.href = url;
parent.opener.focus();
if (closeMe == 1) {
window.close();
}
}
/**
* this is a generalized function for setting form focus.
* it takes the integer form index, and the element index to focus.
*
* @author Alex Black
* @param form_index the document.forms index (integer)
* @param element_index the form.elements index (integer)
*/
function setFocus(form_index, element_index) {
if (document.forms[form_index].elements[element_index]) {
document.forms[form_index].elements[element_index].focus();
}
}
/**
* this is part of a workaround to using images as submit buttons, but still
* having netscape submit the form when the user hits 'enter'.
* it scans all keys pressed - if the key is 'enter' is submits the form.
* right now, it can only be used on a form with an index of 0.
*
* the other bit of the code is:
*
* if (navigator.appName == "Netscape"){
* document.captureEvents(Event.KEYPRESS);
* document.onkeypress = checkInputKey;
* }
*
* @author Alex Black
* @param k the kay passed in to check
*/
function checkInputKey(k) {
var key = escape(k.which);
if ( key == '3'){
document.forms[0].submit();
}
}
/**
* these three functions are exactly the same, except for the string that is
* appended to the name.
*
* they accept a 'name' which is:
* -the "name" attribute in the image tag"
* -the base name of the image
*
* they also accept a base path, which is where the image variants are stored.
* these functions assume a naming convention:
*
* %name%_on.gif
* %name%_click.gif
* %name%_off.gif
*
* because of that, the function calls are simple, the the code is clean.
*
* wrote these because I dislike the dreamweaver functions. egh.
*
* img_on('reply_via_email','images/');
*
* @author Alex Black
* @param name the name of the image (see above)
* @param basepath the location in htdocs of the image
*/
function img_on(name,basepath) {
path=basepath+name+"_on.gif";
document.images[name].src= path;
}
function img_click(name, basepath) {
path=basepath+name+"_click.gif";
document.images[name].src= path;
}
function img_off(name, basepath) {
path=basepath+name+"_off.gif";
document.images[name].src= path;
}
/**
* This function will check all the checkboxes in a particular form. It has been
* abstracted to be used with any form, which means that you have to pass in
* everything:
*
* -ckval is the value to set the checkbox to, can be "true" or "false"
* -form_index is the integer index of the form. typically, this is 0, but if you
* have some other forms on your page before the checkbox form, you'll need this.
*
* example:
* checkTheBoxes('true', '25', '0');
*
* @author Alex Black
* @param ckval the value to set the element.checked attribute to
* @param form_index the integer index of the form to check all the boxes in
*/
function checkTheBoxes(ckval, form_index) {
var form_length = document.forms[form_index].elements.length;
if (form_length != 0) {
for (var i = 0; i <= form_length-1; ++i) {
if (document.forms[form_index].elements[i].type == "checkbox") {
document.forms[form_index].elements[i].checked = ckval;
}
}
}
}
|