desktopmanager.htc
11873 단어 cssHTCperformance
<!-- ---------------------------------------------------------------------
//
// Copyright 2001 Chordiant Software. All Rights Reserved.
//
// File: desktopmanager.htc
//
// Auther: Ryan Carroll
// Created: 13/11/2001
//
// Description: Implements a manager for desktop specific items(settings)
//
// Changes log:
//-------------------------------------------------------------------- -->
<PUBLIC:COMPONENT tagname="desktopmanager" lightWeight="true">
<!-- Public Properties -->
<!-- Public Methods -->
<METHOD NAME="setDesktopSetting" />
<METHOD NAME="getDesktopSetting" />
<METHOD NAME="clearDesktopSettings" />
<METHOD NAME="getAllDesktopSettings" />
<METHOD NAME="removeDesktopSetting" />
<!-- Public Events -->
<EVENT NAME="onError" ID="error" />
<EVENT NAME="onDesktopSettingChanged" ID="desktopSettingChanged" />
<!-- 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 desktopSettings = new Array();
function desktopSettingObject(sSettingName, sSettingValue)
{
this.settingName = sSettingName;
this.settingValue = sSettingValue;
}
////////////////////////////////////////////////////////////////////////////////
// Methods Section //
////////////////////////////////////////////////////////////////////////////////
//+----------------------------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------------------------------
//+----------------------------------------------------------------------------
//
// Function: setDesktopSetting
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function setDesktopSetting( sSettingName, sSettingValue ) {
var oDesktopSetting;
var oEvent;
try {
for(var i=0; i < desktopSettings.length; i++){
if(desktopSettings[i].settingName == sSettingName){
oDesktopSetting = desktopSettings[i];
oDesktopSetting.settingValue = sSettingValue;
break;
}
}
if(oDesktopSetting == null){
oDesktopSetting = new desktopSettingObject(sSettingName, sSettingValue);
desktopSettings[desktopSettings.length] = oDesktopSetting;
}
oEvent = createEventObject();
oEvent.setAttribute("settingData", oDesktopSetting);
desktopSettingChanged.fire(oEvent);
} catch(e) {
returnError(e.toString());
} finally {
oDesktopSetting = null;
oEvent = null;
sSettingName = null;
sSettingValue = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: getDesktopSetting
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function getDesktopSetting( sSettingName ) {
try {
for(var i=0; i < desktopSettings.length; i++){
if(desktopSettings[i].settingName == sSettingName){
return desktopSettings[i].settingValue;
}
}
return null;
} catch(e) {
returnError(e.toString());
return null;
} finally {
sSettingName = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: clearDesktopSettings
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function clearDesktopSettings() {
var oRemovedDesktopSettings;
try {
oRemovedDesktopSettings = desktopSettings.splice(0,desktopSettings.length);
} catch(e) {
returnError(e.toString());
} finally {
oRemovedDesktopSettings = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: removeDesktopSetting
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function removeDesktopSetting(sSettingName) {
var oRemovedDesktopSetting;
try {
for(var i=0; i < desktopSettings.length; i++){
if(desktopSettings[i].settingName == sSettingName){
oRemovedDesktopSetting = desktopSettings.splice(i,1);
return oRemovedDesktopSetting;
}
}
return null;
} catch(e) {
returnError(e.toString());
return null;
} finally {
oRemovedDesktopSetting = null;
sSettingName = null;
}
}
//+----------------------------------------------------------------------------
//
// Function: getAllDesktopSettings
//
// Description:
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------------
function getAllDesktopSettings() {
var oAllDesktopSettings = new Array;
try {
for(var i=0; i < desktopSettings.length; i++){
oAllDesktopSettings[oAllDesktopSettings.length] = desktopSettings[i];
}
return oAllDesktopSettings;
} catch(e) {
returnError(e.toString());
return null;
} finally {
oAllDesktopSettings = 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
}
// { start - performance fix
function cleanUp() {
try {
if(element.document.media != "print") {
detachEvent("onpropertychange", doPropChange);
}
if (window)
window.detachEvent("onbeforeunload", cleanUp);
} catch(e) {
returnError(e.toString());
} finally {
// Make sure all module variables are freed
desktopSettings = null;
}
}
// } 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에 따라 라이센스가 부여됩니다.