sessionemanager.htc
11917 단어 cssHTCperformance
<!-- ---------------------------------------------------------------------
//
// Copyright 2001 Chordiant Software. All Rights Reserved.
//
// File: sessionemanager.htc
//
// Auther: Ryan Carroll
// Created: 13/11/2001
//
// Description: Implements a manager for user session settings.
//
// Changes log:
//-------------------------------------------------------------------- -->
<PUBLIC:COMPONENT tagname="sessionmanager" lightWeight="true">
<!-- Public Properties -->
<!-- Public Methods -->
<METHOD NAME="setSessionSetting" />
<METHOD NAME="getSessionSetting" />
<METHOD NAME="removeSessionSetting" />
<METHOD NAME="clearSessionSettings" />
<METHOD NAME="getAllSessionSettings" />
<!-- Public Events -->
<EVENT NAME="onError" ID="error" />
<EVENT NAME="onSessionSettingChanged" ID="sessionSettingChanged" />
<!-- Private Event Listeners -->
<ATTACH EVENT="ondocumentready" HANDLER="setDefaults" />
// { start - performance fix
<ATTACH EVENT="ondetach" HANDLER="cleanUp" />
// } end - performance fix
</PUBLIC:COMPONENT>
<SCRIPT LANGUAGE="jscript">
//+----------------------------------------------------------------------------
//
// Global Variables
//
//-----------------------------------------------------------------------------
var sessionSettings = new Array();
// { start - performance fix
// Detach event handlers. This should always be done for event handlers that was attached with the attachEvent method.
function cleanUp() {
if (window)
window.detachEvent("onbeforeunload", cleanUp);
sessionSettings = null;
}
// } end - performance fix
function sessionSettingObject(sSessionSettingName, sSessionSettingValue)
{
this.sessionSettingName = sSessionSettingName;
this.sessionSettingValue = sSessionSettingValue;
}
////////////////////////////////////////////////////////////////////////////////
// Methods Section //
////////////////////////////////////////////////////////////////////////////////
//+----------------------------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------------------------------
//+----------------------------------------------------------------------------
//
// Function: setSessionSetting
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function setSessionSetting( sSessionSettingName, sSessionSettingValue ) {
var oSessionSetting;
var oEvent;
try {
for(var i=0; i < sessionSettings.length; i++){
if(sessionSettings[i].sessionSettingName == sSessionSettingName){
oSessionSetting = sessionSettings[i];
oSessionSetting.sessionSettingValue = sSessionSettingValue;
break;
}
}
if(oSessionSetting == null){
oSessionSetting = new sessionSettingObject(sSessionSettingName, sSessionSettingValue);
sessionSettings[sessionSettings.length] = oSessionSetting;
}
oEvent = createEventObject();
oEvent.setAttribute("sessionSettingData", oSessionSetting);
sessionSettingChanged.fire(oEvent);
} catch(e) {
returnError(e.toString());
} finally {
oSessionSetting = null;
oEvent = null;
sSessionSettingName = null;
sSessionSettingValue = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: getSessionSetting
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function getSessionSetting( sSessionSettingName ) {
try {
for(var i=0; i < sessionSettings.length; i++){
if(sessionSettings[i].sessionSettingName == sSessionSettingName){
return sessionSettings[i].sessionSettingValue;
}
}
return null;
} catch(e) {
returnError(e.toString());
return null;
} finally {
sSessionSettingName = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: removeSessionSetting
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function removeSessionSetting(sSessionSettingName) {
var oRemovedSessionSetting;
try {
for(var i=0; i < sessionSettings.length; i++){
if(sessionSettings[i].sessionSettingName == sSessionSettingName){
oRemovedSessionSetting = sessionSettings.splice(i,1);
return oRemovedSessionSetting;
}
}
return null;
} catch(e) {
returnError(e.toString());
return null;
} finally {
oRemovedSessionSetting = null;
sSessionSettingName = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: clearSessionSettings
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function clearSessionSettings() {
var oRemovedSessionSettings;
try {
oRemovedSessionSettings = sessionSettings.splice(0,sessionSettings.length);
} catch(e) {
returnError(e.toString());
} finally {
oRemovedSessionSettings = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: getAllSessionSettings
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function getAllSessionSettings() {
var oAllSessionSettings;
try {
oAllSessionSettings = new Array;
for(var i=0; i < sessionSettings.length; i++){
oAllSessionSettings[oAllSessionSettings.length] = sessionSettings[i];
}
return oAllSessionSettings;
} catch(e) {
returnError(e.toString());
return null;
} finally {
oAllSessionSettings = null;
}
}
//+----------------------------------------------------------------------------
//
// Private Methods
//
//-----------------------------------------------------------------------------
//+----------------------------------------------------------------------------
//
// Function: setDefaults
//
// Description: Called during the initialization of the behavior. Sets
// the required default settings, and attaches the
// onpropertychange event (not done in the header to prevent
// firing the event during initialization).
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function setDefaults()
{
if(element.document.media != "print") {
// Attach the onpropertychange event
attachEvent("onpropertychange", doPropChange);
}
// { start - performance fix
window.attachEvent("onbeforeunload", cleanUp);
// } end - performance fix
}
//+----------------------------------------------------------------------------
//
// Function: doPropChange
//
// Description: Runs on the onpropertychange event and calls the necessary
// functions to correctly handle the property that was just
// changed.
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function doPropChange()
{
var propertyName;
try {
propertyName = window.event.propertyName;
// Handle CSS property changes by calling necessary functions, setting
// variables, and/or setting styles
//
if (propertyName.substring(0,5) == "style")
{
// Handle Style changes
// switch(propertyName)
// {
// case "style.zIndex" :
// break;
// }
}
else
{
//
// Detach the onpropertychange event to prevent it from firing while
// the changes are handled
//
detachEvent("onpropertychange", doPropChange);
// Handle Property changes
switch(propertyName)
{
//case "leftBoundary" :
// leftBoundary = parseInt(leftBoundary);
// setLeftBoundary(leftBoundary);
// break;
default :
returnError(propertyName + " not a valid property");
break;
}
// Re-attach the onpropertychange event
attachEvent("onpropertychange", doPropChange);
}
} catch(e) {
returnError(e.toString());
} finally {
propertyName = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: returnError
//
// Description: Fires the error event, along with a descriptive text
// message.
//
// Arguments: sMsg - descriptive text message
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function returnError(sMsg)
{
var oEvent;
try {
oEvent = createEventObject();
oEvent.setAttribute("error", sMsg);
error.fire(oEvent);
//alert(sMsg);
} finally {
oEvent = null;
sMsg = null;
}
}
</SCRIPT>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
장치 너비가 특정 너비보다 크고 특정 너비보다 작을 때 웹 페이지 CSS 스타일을 변경하는 방법은 무엇입니까?장치 너비가 특정 너비보다 크고 특정 너비보다 작을 때 웹 페이지 CSS 스타일을 변경하려면 @media의 미디어 쿼리 구문을 사용한 다음 구문을 작성하여 스타일의 최소 너비를 정의해야 합니다. 적용된 후 and라는...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.