Books/2013.09-GlassArmonica/Research/various/Barbieri_files/search.js
2026-06-30 08:19:02 -07:00

123 lines
3.9 KiB
JavaScript

////////////////////////////////////////////////////////////////////////////
// Global variables
////////////////////////////////////////////////////////////////////////////
// This gets set when a user clicks on a browse button on the search screen.
var sBrowsing = new String("");
// Record ID to use in OpenURL bookmarking.
var sOpenURLID = new String("");
// Bookmarking window.
var wBookmark = null;
////////////////////////////////////////////////////////////////////////////
// Support functions
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Externally used functions
////////////////////////////////////////////////////////////////////////////
//
// fnCheckForm(): This function checks the values of the search form
// and makes any necessary adjustments in case we're doing a full text
// or citation search ( i.e. in PCIFT ).
//
function fnCheckForm()
{
if(0 < sBrowsing.length)
{
// If we get to here then we're running under PCIFT
// and we need to dynamically swith browse lists
// depending the type of documents we're searching for.
if(document.main.SELECT_BROWSE)
document.main.SELECT_BROWSE.value = sBrowsing;
if(document.main.BrowseType)
document.main.BrowseType.value = sBrowsing;
if(document.main.XXBrowseType)
document.main.XXBrowseType.value = sBrowsing;
}
return true;
}
//
// fnDisplayInfoLink(): This function is used to display links
// to the publisher and journal information pages.
//
function fnDisplayInfoLink(sF002, sJID1, bWithAnchor)
{
if(("0" == sF002.substring(0, 1)) && (("2" == sF002.substring(2, 3)) || (("1" == sF002.substring(2, 3)) && ("2" == sF002.substring(4, 5)))))
{
var sAnchor = "";
var sLinkDisplay = "Publisher Information";
if(true == bWithAnchor)
{
sAnchor = "#" + sJID1;
sLinkDisplay = "Journal Information";
}
document.writeln(" <A HREF=\"search?source=pconfig.cfg&action=SearchOrBrowse&SEARCH=search&JID1=" + sJID1 + sAnchor + "\">" + sLinkDisplay + "</A>");
}
}
//
// fnBrowse(): The user has clicked a button on the search screen to
// go through to one of the browse screens. This is required when we're
// using 'selectable' browse lists ( i.e. in PCIFT ).
//
function fnBrowse(sBrowse)
{
sBrowse = new String(sBrowse);
// Clear any browse values which may have been set previously.
if(document.main)
{
for(i = 0; i < document.main.elements.length; i++)
{
if(document.main.elements[i].name && "B_" == document.main.elements[i].name.substring(0, 2))
{
document.main.elements[i].value = "";
}
}
}
// Then set the browse we actually want.
if("B_" == sBrowse.substring(0, 2))
{
sBrowsing = sBrowse.substring(2, sBrowse.length);
// Having found that we're unable to use <INPUT TYPE="IMAGE"...> tags
// due to Netscape limitations we have to set the "B_..." value
// ,which was previously associated with the INPUT element, manually.
document.main.elements[sBrowse].value = "Browse";
}
if(fnCheckForm())
{
document.main.submit();
}
}
function fnCopyToClipBoard()
{
Copied = document.forms[0].copytext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
}
//
// fnBookmark(): Pops up a dialog box which contains the OpenURL for the user
// to bookmark this current page with.
//
function fnBookmark(sOpenURL)
{
var nWindowWidth = document.layers ? 700 : 500 ;
if(0 < sOpenURLID.length)
{
sOpenURL += sOpenURLID;
}
if(!document.layers)
{
sOpenURL = escape(sOpenURL);
}
if(wBookmark)
{
wBookmark.close();
}
wBookmark = window.open("htxview?template=basic.htx&content=../iimp/bookmark.htx&BOOKMARK=" + sOpenURL, "bookmark", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" + nWindowWidth + ",height=110");
}