📄 bs_slider.class.js
字号:
if (!Bs_Objects) {var Bs_Objects = [];};function Bs_Slider(theFieldnamePrefix) {this._objectId;this.fieldName;this.fieldName2;this._disabled = false;this.direction = 0;this.width = 100this.height = 20;this.minVal = 0;this.maxVal = 100;this.valueDefault = 0;this.arrowAmount = 1;this.arrowMouseOver = false;this.arrowKeepFiringTimeout = 10;this._stopFireArrowFlag = false;this.wheelAmount = 5;this.colorbar;this.colorbar2;this.baseZindex = 1000;this.moveX = 0;this.moveY = 0;this.imgBasePath;this.sliderValue1; this.sliderValue2; this.colIndex;this.sliderValueType;this.filterNameL;this.filterName;this.filterNameR;this.prefix;this.currentKnob;this.logCoord;this.imgDir = '/_bsJavascript/components/slider/img/';this._bgImgSrc;this._bgImgRepeat;this._bgImgCssStyle;this._bgImgLeftSrc;this._bgImgLeftWidth;this._bgImgLeftHeight;this._bgImgRightSrc;this._bgImgRightWidth;this._bgImgRightHeight;this._sliderImgSrc;this._sliderImgWidth;this._sliderImgHeight;this.styleContainerClass;this.styleValueFieldClass = 'smalltxt spanSliderField';this.styleValueFieldClass2 = 'smalltxt spanSliderField';this.styleValueTextClass = 'smalltxt spanSliderText';this.styleValueTextClass2 = 'smalltxt spanSliderText';this.bgColor;this._arrowIconLeftSrc;this._arrowIconLeftWidth = 0;this._arrowIconLeftHeight = 0;this._arrowIconLeftCssStyle = 0;this._arrowIconRightSrc;this._arrowIconRightWidth = 0;this._arrowIconRightHeight = 0;this._arrowIconRightCssStyle = 0;this.valueInterval = 1;this.valueInterval2 = 1;this.useInputField = 2;this.useInputField2 = 2;this.inputTextFieldEvent = 'over';this.useSecondKnob;this.preventValueCrossing;this.ctrl;this.ctrl2;this._valueInternal;this._valueInternal2;this._display = 2;this._arrowLeftContainerId;this._arrowLeftContainerObj;this._arrowLeftIconId;this._arrowLeftIconObj;this._arrowRightContainerId;this._arrowRightContainerObj;this._arrowRightIconId;this._arrowRightIconObj;this._valueContainerId;this._valueContainerObj;this._handleId;this._handleObj;this._valueFieldId;this._valueFieldObj;this._valueFieldObj2;this._valueTextId;this._valueTextObj;this._valueTextObj2;this._slideBarId;this._slideBarObj;this._colorbarId;this._colorbarObj;this._colorbarObj2;this._posUpperLeftX;this._posUpperLeftY;this._posSlideStart;this._posSlideEnd;this._slideWidth;this._attachedEvents;this.eventOnChange;this.slideStartCB;this.slideMoveCB;this.slideEndCB;this._constructor = function(theFieldnamePrefix) {this._id = Bs_Objects.length;Bs_Objects[this._id] = this;this._objectId = "Bs_Slider_"+this._id;this.objectName = this._objectId;if (typeof(theFieldnamePrefix) == 'string') {this.fieldName = theFieldnamePrefix + '_value';this.fieldName2 = theFieldnamePrefix + '2_value';this.objectName = theFieldnamePrefix;}}this._checkup = function() {if (typeof(this.minVal) == 'undefined') this.minVal = 0;if (typeof(this.maxVal) == 'undefined') this.maxVal = 10;if (typeof(this.valueDefault) == 'undefined') this.valueDefault = this.minVal;this._valueInternal = this.valueDefault;if (this.useSecondKnob) {if (typeof(this.minVal2) == 'undefined') this.minVal2 = 0;if (typeof(this.maxVal2) == 'undefined') this.maxVal2 = 10;if (typeof(this.valueDefault2) == 'undefined') this.valueDefault2 = this.maxVal2;this._valueInternal2 = this.valueDefault2;}if (typeof(this.imgBasePath) == 'string') this.imgDir = this.imgBasePath;}this.loadSkin = function(skinName) {switch (skinName) {case 'winxp':case 'winxp-scrollbar-horizontal':this.useInputField = 0;this.height = 16;this.imgDir = '/_bsJavascript/components/slider/img/winxp/';this.setSliderIcon('horizontal_scrollbar_knob.gif', 17, 16);this.setArrowIconLeft('horizontal_scrollbar_arrowLeft.gif', 17, 16);this.setArrowIconRight('horizontal_scrollbar_arrowRight.gif', 17, 16);break;case 'winxp-scrollbar-vertical':this.direction = 1;this.useInputField = 0;this.width = 16;this.imgDir = '/_bsJavascript/components/slider/img/winxp/';this.setSliderIcon('vertical_scrollbar_knob.gif', 16, 17);this.setArrowIconLeft('vertical_scrollbar_arrowUp.gif', 16, 17);this.setArrowIconRight('vertical_scrollbar_arrowDown.gif', 16, 17);break;case 'osx':case 'osx-horizontal':this.useInputField = 0;this.height = 21;this.imgDir = '/_bsJavascript/components/slider/img/osx/';this.setSliderIcon('horizontal_knob.gif', 17, 16);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setBackgroundImageLeft('horizontal_backgroundLeft.gif', 6, 21);this.setBackgroundImageRight('horizontal_backgroundRight.gif', 6, 21);break;case 'osx-scrollbar-horizontal':this.useInputField = 0;this.height = 15;this.imgDir = '/_bsJavascript/components/slider/img/osx/';this.setSliderIcon('horizontal_scrollbar_knobSmall.gif', 23, 15);this.setBackgroundImage('horizontal_scrollbar_background.gif', 'repeat');this.setArrowIconLeft('horizontal_scrollbar_arrowLeft.gif', 17, 15);this.setArrowIconRight('horizontal_scrollbar_arrowRight.gif', 17, 15);break;case 'osx-scrollbar-vertical':this.direction = 1;this.useInputField = 0;this.width = 15;this.imgDir = '/_bsJavascript/components/slider/img/osx/';this.setSliderIcon('vertical_scrollbar_knobSmall.gif', 15, 23);this.setBackgroundImage('vertical_scrollbar_background.gif', 'repeat');this.setArrowIconLeft('vertical_scrollbar_arrowUp.gif', 15, 17);this.setArrowIconRight('vertical_scrollbar_arrowDown.gif', 15, 17);break;case 'os9':case 'os9-horizontal':this.useInputField = 0;this.height = 16;this.imgDir = '/_bsJavascript/components/slider/img/os9/';this.setSliderIcon('horizontal_scrollbar_knob.gif', 17, 16);this.setBackgroundImage('horizontal_scrollbar_background.gif', 'repeat');this.setArrowIconLeft('horizontal_scrollbar_arrowLeft.gif', 16, 16);this.setArrowIconRight('horizontal_scrollbar_arrowRight.gif', 16, 16);break;case 'os9-vertical':this.direction = 1;this.useInputField = 0;this.width = 16;this.imgDir = '/_bsJavascript/components/slider/img/os9/';this.setSliderIcon('vertical_scrollbar_knob.gif', 16, 17);this.setBackgroundImage('vertical_scrollbar_background.gif', 'repeat');this.setArrowIconLeft('vertical_scrollbar_arrowUp.gif', 16, 16);this.setArrowIconRight('vertical_scrollbar_arrowDown.gif', 16, 16);break;case 'opera7':case 'opera7-horizontal':this.useInputField = 0;this.height = 16;this.imgDir = '/_bsJavascript/components/slider/img/opera7/';this.setSliderIcon('horizontal_knob.gif', 19, 16);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setArrowIconLeft('horizontal_arrowLeft.gif', 16, 16);this.setArrowIconRight('horizontal_arrowRight.gif', 16, 16);break;case 'opera7-vertical':this.direction = 1;this.useInputField = 0;this.width = 16;this.imgDir = '/_bsJavascript/components/slider/img/opera7/';this.setSliderIcon('vertical_knob.gif', 16, 19);this.setBackgroundImage('vertical_background.gif', 'repeat');this.setArrowIconLeft('vertical_arrowUp.gif', 16, 16);this.setArrowIconRight('vertical_arrowDown.gif', 16, 16);break;case 'bob':case 'bob-horizontal':this.height = 18;this.imgDir = '/_bsJavascript/components/slider/img/bob/';this.setBackgroundImage('background.gif', 'no-repeat');this.setSliderIcon('slider.gif', 13, 18);this.colorbar = new Object();this.colorbar['color'] = 'blue';this.colorbar['height'] = 5;this.colorbar['widthDifference'] = 0;this.colorbar['offsetLeft'] = 5;this.colorbar['offsetTop'] = 9;break;case 'burp':case 'burp-horizontal':this.useInputField = 0;this.height = 11;this.imgDir = '/_bsJavascript/components/slider/img/burp/';this.setSliderIcon('horizontal_knob.gif', 5, 11);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setArrowIconLeft('horizontal_arrowLeft.gif', 10, 11);this.setArrowIconRight('horizontal_arrowRight.gif', 10, 11);break;case 'burp-vertical':this.direction = 1;this.useInputField = 0;this.width = 11;this.imgDir = '/_bsJavascript/components/slider/img/burp/';this.setSliderIcon('vertical_knob.gif', 11, 5);this.setBackgroundImage('vertical_background.gif', 'repeat');this.setArrowIconLeft('vertical_arrowUp.gif', 11, 10);this.setArrowIconRight('vertical_arrowDown.gif', 11, 10);break;case 'ximian-industrial':case 'ximian-industrial-horizontal':this.useInputField = 0;this.height = 15;this.imgDir = '/_bsJavascript/components/slider/img/ximian_industrial/';this.setSliderIcon('horizontal_knob.gif', 31, 15);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setArrowIconLeft('horizontal_arrowLeft.gif', 15, 15);this.setArrowIconRight('horizontal_arrowRight.gif', 15, 15);break;case 'ximian-industrial-vertical':this.direction = 1;this.useInputField = 0;this.width = 15;this.imgDir = '/_bsJavascript/components/slider/img/ximian_industrial/';this.setSliderIcon('vertical_knob.gif', 15, 31);this.setBackgroundImage('vertical_background.gif', 'repeat');this.setArrowIconLeft('vertical_arrowUp.gif', 15, 15);this.setArrowIconRight('vertical_arrowDown.gif', 15, 15);break;case 'smoothstreak':case 'smoothstreak-horizontal':this.useInputField = 0;this.height = 15;this.imgDir = '/_bsJavascript/components/slider/img/smoothstreak/';this.setSliderIcon('horizontal_knob.gif', 31, 15);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setBackgroundImageLeft('horizontal_backgroundLeft.gif', 2, 15);this.setBackgroundImageRight('horizontal_backgroundRight.gif', 2, 15);this.colorbar = new Object();this.colorbar['color'] = '#736D6B';this.colorbar['height'] = 11;this.colorbar['widthDifference'] = 0;this.colorbar['offsetLeft'] = 0;this.colorbar['offsetTop'] = 2;break;case 'smoothstreak-vertical':this.direction = 1;this.useInputField = 0;this.width = 15;this.imgDir = '/_bsJavascript/components/slider/img/smoothstreak/';this.setSliderIcon('vertical_knob.gif', 15, 31);this.setBackgroundImage('vertical_background.gif', 'repeat');this.setBackgroundImageLeft('vertical_backgroundTop.gif', 15, 2);this.setBackgroundImageRight('vertical_backgroundBottom.gif', 15, 2);break;case 'aluminumalloyvolcanic':case 'aluminumalloyvolcanic-horizontal':this.useInputField = 0;this.height = 15;this.imgDir = '/_bsJavascript/components/slider/img/aluminumalloyvolcanic/';this.setSliderIcon('horizontal_knob.gif', 15, 19);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setBackgroundImageLeft('horizontal_backgroundLeft.gif', 2, 19);this.setBackgroundImageRight('horizontal_backgroundRight.gif', 2, 19);break;case 'yattacier3':case 'yattacier3-horizontal':this.useInputField = 0;this.height = 16;this.imgDir = '/_bsJavascript/components/slider/img/yattacier3/';this.setSliderIcon('horizontal_knob.gif', 30, 16);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setBackgroundImageLeft('horizontal_backgroundLeft.gif', 1, 16);this.setBackgroundImageRight('horizontal_backgroundRight.gif', 1, 16);break;case 'h2ogtk2':case 'h2ogtk2-horizontal':this.useInputField = 0;this.height = 17;this.imgDir = '/_bsJavascript/components/slider/img/h2ogtk2/';this.setSliderIcon('horizontal_knob.gif', 30, 17);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setBackgroundImageLeft('horizontal_backgroundLeft.gif', 7, 17);this.setBackgroundImageRight('horizontal_backgroundRight.gif', 7, 17);break;case 'h2ogtk2-scrollbar-horizontal':this.useInputField = 0;this.height = 17;this.imgDir = '/_bsJavascript/components/slider/img/h2ogtk2/';this.setSliderIcon('horizontal_knob.gif', 30, 17);this.setBackgroundImage('horizontal_background.gif', 'repeat');this.setArrowIconLeft('horizontal_arrowLeft.gif', 15, 17);this.setArrowIconRight('horizontal_arrowRight.gif', 15, 17);break;default:return false;}return true;}this.render = function(tagId) { this._checkup(); this._containerId = 'co' + tagId; this._handleId = 'po' + tagId; this._arrowLeftContainerId = 'alc' + tagId; this._arrowLeftIconId = 'ali' + tagId; this._arrowRightContainerId = 'arc' + tagId; this._arrowRightIconId = 'ari' + tagId; this._valueContainerId = 'vc' + tagId; this._valueFieldId = 'vf' + tagId; if (typeof(this.fieldName) == 'undefined') this.fieldName = tagId + '_value'; if (typeof(this.fieldName2) == 'undefined') this.fieldName = tagId + '2_value'; this._valueTextId = 'vt' + tagId; this._slideBarId = 'bar' + tagId; this._colorbarId = 'cb' + tagId; var divWidth = this.width; var divHeight = this.height; var out = new Array(); var outI = 0; var localOffset = 0; out[outI++] = '<div id="' + this._containerId + '"'; if (this.styleContainerClass) { out[outI++] = ' class="' + this.styleContainerClass + '"'; } out[outI++] = ' style="position:relative;'; if (this._display == 0) { out[outI++] = ' display:none;'; } else if (this._display == 1) { out[outI++] = ' visibility:hidden;'; } out[outI++] = ' onmousewheel="Bs_Objects['+this._id+'].onMouseWheel();return false;"'; out[outI++] = '">'; out[outI++] = '<div'; out[outI++] = ' onmousewheel="Bs_Objects['+this._id+'].onMouseWheel(); return false;"'; out[outI++] = ' style="position:absolute; left:' + this.moveX + '; top:' + this.moveY + ';">'; if (this.useSecondKnob) { out[outI++] = this._renderInputFieldAndText(localOffset, 1);localOffset += 0; } out[outI++] = '<div style="position:absolute; display:none; z-index:' + (this.baseZindex + 10) + ';" id="' + this._handleId + '">';out[outI++] = '<img name="poImg' + tagId + '" src="' + this.imgDir + this._sliderImgSrc + '" border=0 width=' + this._sliderImgWidth + ' height=' + this._sliderImgHeight + '>';out[outI++] = '</div>';if (this.useSecondKnob) {out[outI++] = '<div style="position:absolute; display:none; z-index:' + (this.baseZindex + 9) + ';" id="' + this._handleId + '2">';out[outI++] = '<img name="poImg' + tagId + '2" src="' + this.imgDir + this._sliderImgSrc + '" border=0 width=' + this._sliderImgWidth + ' height=' + this._sliderImgHeight + '>';out[outI++] = '</div>';}if ((this.arrowAmount > 0) && this._arrowIconLeftSrc) {out[outI++] = '<div id="' + this._arrowLeftContainerId + '" style="position:absolute; left:' + localOffset + '; top:0;">';out[outI++] = '<a href="javascript:void(false);"';if (this.arrowMouseOver) {out[outI++] = ' onMouseOver="Bs_Objects['+this._id+'].onChangeByArrow(false, true); return false;"';out[outI++] = ' onMouseOut="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';} else {out[outI++] = ' onMouseDown="Bs_Objects['+this._id+'].onChangeByArrow(false, true); return false;"';out[outI++] = ' onMouseUp="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';out[outI++] = ' onMouseOut="Bs_Objects['+this._id+'].stopFireArrow(); return false;"';}out[outI++] = '>';out[outI++] = '<img id="' + this._arrowLeftIconId + '" src="' + this.imgDir + this._arrowIconLeftSrc + '" border="0" width="' + this._arrowIconLeftWidth + '" height="' + this._arrowIconLeftHeight + '"';if (typeof(this.arrowIconLeftCssStyle) != 'undefined') {out[outI++] = ' style="' + this.arrowIconLeftCssStyle + '"';}out[outI++] = '>';out[outI++] = '</a></div>';localOffset += this._arrowIconLeftWidth;}if (typeof(this._bgImgLeftSrc) != 'undefined') {var tmpLeft = (this.direction == 0) ? localOffset : 0;var tmpTop = (this.direction == 0) ? 0 : localOffset;out[outI++] = '<div style="position:absolute; left:' + tmpLeft + '; top:' + tmpTop + ';">';out[outI++] = '<img src="' + this.imgDir + this._bgImgLeftSrc + '" width="' + this._bgImgLeftWidth + '" height="' + this._bgImgLeftHeight + '" border="0">';out[outI++] = '</div>';localOffset += (this.direction == 0) ? this._bgImgLeftWidth : this._bgImgLeftHeight;}if (this.colorbar) {out[outI++] = '<div id="' + this._colorbarId + '" onClick="Bs_Objects['+this._id+'].onChangeByClick(event);"';if (this.colorbar['cssClass']) {out[outI++] = ' class="' + this.colorbar['cssClass'] + '"';}out[outI++] = ' style="position:absolute; z-index:' + (this.baseZindex +5) + '; width:0;';if ('undefined' != typeof(this.colorbar['color'])) {out[outI++] = ' background-color:' + this.colorbar['color'] + ';';} else if ('undefined' == typeof(this.colorbar['cssClass'])) {out[outI++] = ' background-color:orange;';}if ('undefined' != typeof(this.colorbar['offsetLeft'])) {out[outI++] = ' left:' + (localOffset + this.colorbar['offsetLeft']) + 'px;';}if ('undefined' != typeof(this.colorbar['offsetTop'])) {out[outI++] = ' top:' + this.colorbar['offsetTop'] + 'px;';}if ('undefined' != typeof(this.colorbar['height'])) {out[outI++] = ' height:' + this.colorbar['height'] + 'px;';}out[outI++] = '">';out[outI++] = '<img src="/_bsImages/spacer.gif" width="1" height="5"></div>';}if (this.colorbar2) {out[outI++] = '<div id="' + this._colorbarId + '2" onClick="Bs_Objects['+this._id+'].onChangeByClick(event);"';if (this.colorbar2['cssClass']) {out[outI++] = ' class="' + this.colorbar2['cssClass'] + '"';}out[outI++] = ' style="position:absolute; z-index:' + (this.baseZindex +5) + '; width:0;';if ('undefined' != typeof(this.colorbar2['color'])) {out[outI++] = ' background-color:' + this.colorbar2['color'] + ';';} else if ('undefined' == typeof(this.colorbar2['cssClass'])) {out[outI++] = ' background-color:orange;';}if ('undefined' != typeof(this.colorbar2['offsetLeft'])) {out[outI++] = ' left:' + (localOffset + this.colorbar2['offsetLeft']) + ';';}if ('undefined' != typeof(this.colorbar2['offsetTop'])) {out[outI++] = ' top:' + this.colorbar2['offsetTop'] + ';';}if ('undefined' != typeof(this.colorbar2['height'])) {out[outI++] = ' height:' + this.colorbar2['height'] + ';';}out[outI++] = '">';out[outI++] = '<img src="/_bsImages/spacer.gif" width="1" height="5"></div>';}out[outI++] = '<div id="' + this._slideBarId + '" onClick="Bs_Objects['+this._id+'].onChangeByClick(event);"';var tmpLeft = (this.direction == 0) ? localOffset : 0;var tmpTop = (this.direction == 0) ? 0 : localOffset;out[outI++] = ' style="position:absolute; left:' + tmpLeft + '; top:' + tmpTop + '; width:' + divWidth + 'px; height: ' + divHeight + 'px; clip:rect(0 ' + divWidth + ' ' + divHeight + ' 0);';if (this.bgColor) {out[outI++] = 'background-color:' + this.bgColor + '; layer-background-color:' + this.bgColor + ';';}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -