⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mozilla_to_ie.js

📁 TurboCWCShop v1.6.7 is make in the Utility-LAYer Framework.
💻 JS
字号:
//支持多浏览器
function initDom(objWin){
	if(objWin.Node==null)return;
	objWin.Node.prototype.removeNode=function(blnChild){
		if(blnChild!=true)blnChild=false;
		var objParent=this.parentNode;
		if(blnChild)objParent.removeChild(this);
		else{
			var objChilds=this.childNodes;
			var numLen=objChilds.length;
			for(var numI=0;numI<numLen;numI++){
				objParent.insertBefore(objChilds[numI],this);
			}
			objParent.removeChild(this);
		}
	}
	objWin.Node.prototype.swapNode=function(objNew){
		var objParent=objNew.parentNode;
		var objNext=objNew.nextSibling;
		if(objNext==this)objNext=objNew;
		this.parentNode.replaceChild(objNew,this);
		objParent.insertBefore(this,objNext);
		return this;
	}
	objWin.HTMLElement.prototype.contains=function(objE){
		var blnHave=false;
		while(objE){
			if(objE==this){
				blnHave=true;
				break;
			}
			objE=objE.parentNode;
		}
		return blnHave;
	}
	var objSel=objWin.getSelection();
	objWin.document.__proto__.__defineGetter__("selection",function(){return objSel;})
	var _Sel_proto_=objSel.__proto__;
	_Sel_proto_.clear=function(){}
	_Sel_proto_.createRange=function(){return this.getRangeAt(0);}
	_Sel_proto_.__defineGetter__("type",function(){
		if(objSel.rangeCount==0)return "None";
		else return "Text";
	})
	if(objSel.rangeCount>0){
		var objRange=objSel.getRangeAt(0);
		var _Range_proto_=objRange.__proto__;
		_Range_proto_.__defineGetter__("text",function(){
			var objE=this.parentElement();
			var strText;
			if(objE.value&&objE.selectionStart){
				var numStart=objE.selectionStart,numEnd=objE.selectionEnd;
				var strValue=objE.value;
				strText=strValue.substring(numStart,numEnd);
			}else{
				strText=objRange.toString();
			}
			return strText;
		})
		_Range_proto_.__defineSetter__("text",function(strContent){
			var objE=this.parentElement();
			if(objE.value){
				var numStart=objE.selectionStart,numEnd=objE.selectionEnd;
				var strValue=objE.value;
				var strSelected=strValue.substring(numStart,numEnd);
				objE.value=strValue.substring(0,numStart)+strContent+strValue.substring(numEnd);
			}else{
				objE.innerText=strContent;
			}
		})
		_Range_proto_.parentElement=function(){
			var objE=objRange.startContainer;
			if(objE.nodeType==1)objE=objE.firstChild;
			return objE;
		}
		_Range_proto_.pasteHTML=function(strContent){
			this.deleteContents();
			var objNode=objWin.document.createElement("span");
			objNode.innerHTML=strContent;
			var objChilds=objNode.childNodes;
			var numLen=objChilds.length;
			for(var numI=0;numI<numLen;numI++){
				this.insertNode(objChilds[numI]);
			}
		}
		_Range_proto_.duplicate=function(){return this.cloneRange();}
		_Range_proto_.moveToElementText=function(objNode){this.selectNode(objNode);}
		_Range_proto_.setEndPoint=function(strType,objRange){
			switch(strType){
				case "StartToEnd":
					var objT=objRange.endContainer;
					if(objT.nodeType==3)this.setStartAfter(objT);
					break;
				case "StartToStart":
					var objT=objRange.startContainer;
					if(objT.nodeType==3)this.setStartBefore(objT);
					break;
				case "EndToStart":
					var objT=objRange.startContainer;
					if(objT.nodeType==3)this.setEndBefore(objT);
					break;
				case "EndToEnd":
					var objT=objRange.endContainer;
					if(objT.nodeType==3)this.setEndAfter(objT);
					break;
			}
		}
		_Range_proto_.select=function(){
			with(objWin.getSelection()){
				removeAllRanges();
				addRange(this);
				collapseToEnd();
			}
		}
		_Range_proto_.findText=function(strText,numDirection,numFlag){
			var objE=this.parentElement();
			
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -