Jump to content


Rafael P L

Member Since 30/07/2011
Offline Last Active 01/12/2011, 21:03
-----

Posts I've Made

In Topic: Problema Com Loop

15/08/2011, 17:31

Meu camarada, deu certo. Qualquer coisa, se eu precisar de algo a mais eu posto. Segue o código funcionando como pensado inicialmente.

HTMLTextAreaElement.prototype.wordSelect = function()
{
	if(this.selectionStart !== this.selectionEnd){
		this.focus();
		return; //sai da função e não retorna nada
	}

	var startCursor = this.selectionStart;
	var endCursor = this.selectionEnd;
	var txt = this.value;
	
	while (startCursor >= 0 && txt.charAt(startCursor -1) != ' ' && txt.charAt(startCursor) != '\n' && !txt.charAt(startCursor -1).isPoint())
		startCursor--;

	while (endCursor <= txt.length && txt.charAt(endCursor) != ' ' && txt.charAt(endCursor) != '\n' && !txt.charAt(endCursor).isPoint())
		endCursor++;
	//alert(startCursor);

	this.selectionStart = startCursor;
	this.selectionEnd = endCursor;
	this.focus();
};

In Topic: Problema Com Loop

15/08/2011, 15:30

Huahuahuahua. Estou chorando aqui de rir. Gostei do "pelo amor de Deus". Vou testar.

Funcionou garotin. Se é baum mermo eim!!!

In Topic: Problema Com Loop

15/08/2011, 14:44

Mas aí é que está Henderson, por que para a direita, funciona perfeitamente, isto é, na etapa do endCursor?

In Topic: Problema Com Loop

15/08/2011, 14:33

Dá para anexar arquivos aqui no fórum?

In Topic: Problema Com Loop

15/08/2011, 13:58

Mas eu já estou fazendo isso, decrementando o startCursor, repare o interior do primeiro while.

IPB Skin By Virteq