📄 xbstyle-css.js
字号:
/* * xbStyle-css.js * $Revision: 1.2 $ $Date: 2003/02/07 16:04:21 $ * *//* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Netscape code. * * The Initial Developer of the Original Code is * Netscape Corporation. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): Bob Clary <bclary@netscape.com> * * ***** END LICENSE BLOCK ***** */// xbStyle.getClip()function cssStyleGetClip(){ var clip = this.getEffectiveValue('clip'); // hack opera if (clip == 'rect()') clip = ''; if (clip == '' || clip == 'auto') { clip = 'rect(0px, ' + this.getWidth() + 'px, ' + this.getHeight() + 'px, 0px)'; } else { clip = clip.replace(/px /g, 'px, '); } return clip;}// xbStyle.setClip()function cssStyleSetClip(sClipString){ this.styleObj.clip = sClipString;}// xbStyle.getClipTop()function cssStyleGetClipTop(){ var clip = this.getClip(); var rect = new xbClipRect(clip); return rect.top;}// xbStyle.setClipTop()function cssStyleSetClipTop(top){ var clip = this.getClip(); var rect = new xbClipRect(clip); rect.top = top; this.styleObj.clip = rect.toString();}// xbStyle.getClipRight()function cssStyleGetClipRight(){ var clip = this.getClip(); var rect = new xbClipRect(clip); return rect.right;}// xbStyle.setClipRight()function cssStyleSetClipRight(right){ var clip = this.getClip(); var rect = new xbClipRect(clip); rect.right = right; this.styleObj.clip = rect.toString();}// xbStyle.getClipBottom()function cssStyleGetClipBottom(){ var clip = this.getClip(); var rect = new xbClipRect(clip); return rect.bottom;}// xbStyle.setClipBottom()function cssStyleSetClipBottom(bottom){ var clip = this.getClip(); var rect = new xbClipRect(clip); rect.bottom = bottom; this.styleObj.clip = rect.toString();}// xbStyle.getClipLeft()function cssStyleGetClipLeft(){ var clip = this.getClip(); var rect = new xbClipRect(clip); return rect.left;}// xbStyle.setClipLeft()function cssStyleSetClipLeft(left){ var clip = this.getClip(); var rect = new xbClipRect(clip); rect.left = left; this.styleObj.clip = rect.toString();}// xbStyle.getClipWidth()function cssStyleGetClipWidth(){ var clip = this.getClip(); var rect = new xbClipRect(clip); return rect.getWidth();}// xbStyle.setClipWidth()function cssStyleSetClipWidth(width){ var clip = this.getClip(); var rect = new xbClipRect(clip); rect.setWidth(width); this.styleObj.clip = rect.toString();}// xbStyle.getClipHeight()function cssStyleGetClipHeight(){ var clip = this.getClip(); var rect = new xbClipRect(clip); return rect.getHeight();}// xbStyle.setClipHeight()function cssStyleSetClipHeight(height){ var clip = this.getClip(); var rect = new xbClipRect(clip); rect.setHeight(height); this.styleObj.clip = rect.toString();}// the CSS attributes left,top are for absolutely positioned elements// measured relative to the containing element. for relatively positioned// elements, left,top are measured from the element's normal inline position.// getLeft(), setLeft() operate on this type of coordinate.//// to allow dynamic positioning the getOffsetXXX and setOffsetXXX methods are// defined to return and set the position of either an absolutely or relatively// positioned element relative to the containing element.////// xbStyle.getLeft()function cssStyleGetLeft(){ var left = this.getEffectiveValue('left'); if (typeof(left) == 'number') return left; if (left != '' && left.indexOf('px') == -1) { xbDEBUG.dump('xbStyle.getLeft: Element ID=' + this.object.id + ' does not use pixels as units. left=' + left + ' Click Ok to continue, Cancel to Abort'); return 0; } if (top == 'auto' && this.object && typeof(this.object.offsetTop) == 'number') { left = this.object.offsetTop + 'px'; } if (left == '') left = '0px'; return xbToInt(left);}// xbStyle.setLeft()function cssStyleSetLeft(left){ if (typeof(this.styleObj.left) == 'number') this.styleObj.left = left; else this.styleObj.left = left + 'px';}// xbStyle.getTop()function cssStyleGetTop(){ var top = this.getEffectiveValue('top'); if (typeof(top) == 'number') return top; if (top != '' && top.indexOf('px') == -1) { xbDEBUG.dump('xbStyle.getTop: Element ID=' + this.object.id + ' does not use pixels as units. top=' + top + ' Click Ok to continue, Cancel to Abort'); return 0; } if (top == 'auto' && this.object && typeof(this.object.offsetTop) == 'number') { top = this.object.offsetTop + 'px'; } if (top == '') top = '0px'; return xbToInt(top);}// xbStyle.setTop()function cssStyleSetTop(top){ if (typeof(this.styleObj.top) == 'number') this.styleObj.top = top; else this.styleObj.top = top + 'px';}// xbStyle.getPageX()function cssStyleGetPageX(){ var x = 0; var elm = this.object; var elmstyle; var position; //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the // effective position attribute , attempt to use offsetXXX if (typeof(elm.offsetLeft) == 'number') { while (elm) { x += elm.offsetLeft; elm = elm.offsetParent; } } else { while (elm) { if (elm.style) { elmstyle = new xbStyle(elm); position = elmstyle.getEffectiveValue('position'); if (position != '' && position != 'static') x += elmstyle.getLeft(); } elm = elm.parentNode; } } return x;}// xbStyle.setPageX()function cssStyleSetPageX(x){ var xParent = 0; var elm = this.object.parentNode; var elmstyle; var position; //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the // effective position attribute , attempt to use offsetXXX if (elm && typeof(elm.offsetLeft) == 'number') { while (elm) { xParent += elm.offsetLeft; elm = elm.offsetParent; } } else { while (elm) { if (elm.style) { elmstyle = new xbStyle(elm); position = elmstyle.getEffectiveValue('position'); if (position != '' && position != 'static') xParent += elmstyle.getLeft(); } elm = elm.parentNode; } } x -= xParent; this.setLeft(x);} // xbStyle.getPageY()function cssStyleGetPageY(){ var y = 0; var elm = this.object; var elmstyle; var position; //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the // effective position attribute , attempt to use offsetXXX if (typeof(elm.offsetTop) == 'number') { while (elm) { y += elm.offsetTop; elm = elm.offsetParent; } } else { while (elm) { if (elm.style) { elmstyle = new xbStyle(elm); position = elmstyle.getEffectiveValue('position'); if (position != '' && position != 'static') y += elmstyle.getTop(); } elm = elm.parentNode; } } return y;}// xbStyle.setPageY()function cssStyleSetPageY(y){ var yParent = 0; var elm = this.object.parentNode; var elmstyle; var position; //xxxHack: Due to limitations in Gecko's (0.9.6) ability to determine the // effective position attribute , attempt to use offsetXXX if (elm && typeof(elm.offsetTop) == 'number') { while (elm) { yParent += elm.offsetTop; elm = elm.offsetParent; } } else { while (elm) { if (elm.style) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -