All pastes #803420 Raw Edit

Stuff

public javascript v1 · immutable
·published 2007-12-01 05:37 UTC
rendered paste body
  editObject.prototype.getSelectedText=function() {    this.text=null;    this.obj=null;    if (window.getSelection) {      this.text=(window.getSelection()).toString();    }    if (document.getSelection) {      this.text=(document.getSelection()).toString();    }    if(this.text.length==0) {      /*var els = document.evaluate('.//textarea | .//input[@type="text" or not(@type)]',                                  document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);      for(var i=0; i < els.snapshotLength; i++) {        var el=els.snapshotItem(i);        if(!(el.form && el.form.style && el.form.style.display == 'none'))        if(0<(el.selectionEnd-el.selectionStart)) {          this.obj=el;          this.text=el.value.substring(el.selectionStart,el.selectionEnd);          break;        }      }*/		var el=document.getElementById('qqText');		if(!(el.form && el.form.style && el.form.style.display == 'none'))		if(0<(el.selectionEnd-el.selectionStart)) {		  this.obj=el;		  this.text=el.value.substring(el.selectionStart,el.selectionEnd);		}	      }    return this.text;  }