/*************************************************************************
* Copyright (c) 2011 im007boy@gmail.com. All rights reserved.            *
* Use of this source code is governed by a BSD-style license that can be *
* found in the LICENSE file.                                             *
*************************************************************************/
function convert(){
	var str = document.getElementById("link_input").value;
	var newstr;
	var links = [];
	do{
		newstr = decodeOnce(str);
		if (newstr.ifchange == 0)
			break;
		else{
			newstr.fromStr = newstr.fromStr.replace(/\+/g,'\\+');
			str = str.replace(new RegExp(newstr.fromStr,'g'),'');
			links.push(newstr.toStr);
		}
	}while(1);
	//out put links 
	var html = "";
	if (links.length == 0){
		html = "没有可转换的链接";
	}else{
		html = '<ul>';
		for (i = 0;i < links.length;i++){
			html += '<li><a href="'+links[i]+'">'+links[i]+'</a></li>'
		}
		html += '<ul>';
	}
	document.getElementById("link_output").innerHTML = html;
	chrome.extension.getBackgroundPage().ga_push("[PageEvent]","Click_破解",location.pathname,0);
}