<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs title="__MSG_title__"
    height="530"
    width="320"
    title_url="http://www.silviogarbes.com.br" 
    description="__MSG_description__"
    author="Silvio Garbes Lara" 
    author_email="silviogarbes@gmail.com"
    screenshot="__MSG_screenshot__"
    thumbnail="__MSG_thumbnail__">
    <Locale messages="http://hosting.gmodules.com/ig/gadgets/file/102772879044601058754/ALL_ALL.xml"/>
  </ModulePrefs>
  <Content type="html">
    <![CDATA[
 <script language="JavaScript">
 // Script manipulação de string desenvolvido por Silvio Garbes Lara
 // silviogarbes@gmail.com
 // versao 2010-11-27-09-58

 function contarPalavras(){
	document.formulario.texto2.value = document.formulario.texto1.value.length;
 }
 function minusculo(){
	document.formulario.texto2.value = document.formulario.texto1.value.toLowerCase();
 }
 function maiusculo(){
	document.formulario.texto2.value = document.formulario.texto1.value.toUpperCase();
 }
 function inverte(){
	var textoInverso = "";
	for (var i=document.formulario.texto1.value.length; i>-1; i--){
		textoInverso += document.formulario.texto1.value.charAt(i);
	}
	document.formulario.texto2.value = textoInverso;
 }
 function charToAscii(){
	document.formulario.texto2.value = document.formulario.texto1.value.charCodeAt(0);
 }
 function asciiToChar(){
	document.formulario.texto2.value = String.fromCharCode(document.formulario.texto1.value);
 }
 function encodeUri1(){
	document.formulario.texto2.value = encodeURI(document.formulario.texto1.value);
 }
 function decodeUri1(){
	document.formulario.texto2.value = decodeURI(document.formulario.texto1.value);
 }
 function encodeUriComponent1(){
	document.formulario.texto2.value = encodeURIComponent(document.formulario.texto1.value);
 }
 function decodeUriComponent1(){
	document.formulario.texto2.value = decodeURIComponent(document.formulario.texto1.value);
 }
 function escape1(){
	document.formulario.texto2.value = escape(document.formulario.texto1.value);
 }
 function unescape1(){
	document.formulario.texto2.value = unescape(document.formulario.texto1.value);
 }
 function eval1(){
	document.formulario.texto2.value = eval(document.formulario.texto1.value);
 }

// HTMLEncode - Encode HTML special characters.
// Por Thomas Peri
// Fonte: http://www.tumuski.com/code/htmlencode/
function htmlEncode(source, display, tabs) {
	var i, s, ch, peek, line, result,
		next, endline, push,
		spaces;

	// Stash the next character and advance the pointer
	next = function () {
		peek = source.charAt(i);
		i += 1;
	};

	// Start a new "line" of output, to be joined later by <br />
	endline = function () {
		line = line.join('');
		if (display) {
			// If a line starts or ends with a space, it evaporates in html
			// unless it's an nbsp.
			line = line.replace(/(^ )|( $)/g, '&nbsp;');
		}
		result.push(line);
		line = [];
	};

	// Push a character or its entity onto the current line
	push = function () {
		if (ch < ' ' || ch > '~') {
			line.push('&#' + ch.charCodeAt(0) + ';');
		} else {
			line.push(ch);
		}
	};

	// Use only integer part of tabs, and default to 4
	tabs = (tabs >= 0) ? Math.floor(tabs) : 4;

	result = [];
	line = [];

	i = 0;
	next();
	while (i <= source.length) { // less than or equal, because i is always one ahead
		ch = peek;
		next();

		// HTML special chars.
		switch (ch) {
		case '<':
			line.push('&lt;');
			break;
		case '>':
			line.push('&gt;');
			break;
		case '&':
			line.push('&amp;');
			break;
		case '"':
			line.push('&quot;');
			break;
		case "'":
			line.push('&#39;');
			break;
		default:
			// If the output is intended for display,
			// then end lines on newlines, and replace tabs with spaces.
			if (display) {
				switch (ch) {
				case '\r':
					// If this \r is the beginning of a \r\n, skip over the \n part.
					if (peek === '\n') {
						next();
					}
					endline();
					break;
				case '\n':
					endline();
					break;
				case '\t':
					// expand tabs
					spaces = tabs - (line.length % tabs);
					for (s = 0; s < spaces; s += 1) {
						line.push(' ');
					}
					break;
				default:
					// All other characters can be dealt with generically.
					push();
				}
			} else {
				// If the output is not for display,
				// then none of the characters need special treatment.
				push();
			}
		}
	}
	endline();

	// If you can't beat 'em, join 'em.
	result = result.join('<br />');

	if (display) {
		// Break up contiguous blocks of spaces with non-breaking spaces
		result = result.replace(/ {2}/g, ' &nbsp;');
	}

	// tada!
	return result;
};
function htmlEncode1(){
	document.formulario.texto2.value = htmlEncode(document.formulario.texto1.value, true, 4);
}


 </script>

<form name="formulario">
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__MSG_title__<br>
	<textarea rows="12" cols="38" name="texto1">Digite aqui seu texto</textarea><br>
	<input type="button" value="Contar palavras" onClick="contarPalavras()">
	<input type="button" value="Minusculo" onClick="minusculo()">
	<input type="button" value="Maiusculo" onClick="maiusculo()"><br>
	<input type="button" value="Inverte" onClick="inverte()">
	<input type="button" value="Cararctere para Ascii" onClick="charToAscii()">
	<input type="button" value="Ascii para Caractere" onClick="asciiToChar()"><br>
	<input type="button" value="Encode Uri" onClick="encodeUri1()">
	<input type="button" value="Decode Uri" onClick="decodeUri1()">
	<input type="button" value="Encode Uri Component" onClick="encodeUriComponent1()"><br>
	<input type="button" value="Decode Uri Component" onClick="decodeUriComponent1()">
	<input type="button" value="Escape" onClick="escape1()">
	<input type="button" value="Unescape" onClick="unescape1()"><br>
	<input type="button" value="Eval" onClick="eval1()">
	<input type="button" value="HTML Encode" onClick="htmlEncode1()"><br>
	<textarea rows="12" cols="38" name="texto2">Veja o resultado aqui</textarea><br>
</form>
    ]]>
  </Content>
</Module>