dztimes
Regular Member
- Jan 12, 2010
- 203
- 134
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Article Spinner</title>
</head>
<body>
<div style="min-height:500px;">
<table cellpadding="5" cellspacing="5" border="0" align="center" width="800px">
<tr>
<td>
Spyntax content:<br />
<textarea id="textSpin" rows="10" style="width:100%;"></textarea>
<input id="chkNewLine" type="checkbox" />Convert newline to <br />
</td>
</tr>
<tr>
<td>
<input id="inpSpin" type="button" value="Next Spun" onclick="Spin();" /> <input id="inpHtml" type="button" value="Html Code" onclick="Html(this);" style="display:none;" />
</td>
</tr>
<tr>
<td>
<textarea id="textHtml" rows="10" style="width:100%;display:none;"></textarea>
<label id="lblSpin"></label>
</td>
</tr>
</table>
</div>
<div style="text-align:center;">Provided by <a href="http://www.weontech.com">www.WeOnTech.com</a> - Auto Blog Network - Blog Post SEO - LinkWheel SEO</div>
<script type="text/javascript">
function Html(obj) {
if (obj.value == 'Html Code') {
document.getElementById("textHtml").value = document.getElementById("lblSpin").innerHTML;
document.getElementById("textHtml").style.display = "block";
document.getElementById("lblSpin").style.display = "none";
document.getElementById("inpHtml").value = "Preview";
}
else {
document.getElementById("textHtml").style.display = "none";
document.getElementById("lblSpin").style.display = "block";
document.getElementById("inpHtml").value = "Html Code";
}
}
function Spin() {
var content = document.getElementById("textSpin").value.trim();
if (content == "") {
alert("Please input spyntax content!");
}
else if (content.split("{").length != content.split("}").length) {
alert("Incorrect spyntax in content! Please re-check it!");
}
else {
if (document.getElementById("chkNewLine").checked) {
var regX = /\n/gi;
content = content.replace(regX, "<br />");
}
document.getElementById("lblSpin").innerHTML = GetSpinContent(content);
document.getElementById("inpHtml").style.display = "";
if (document.getElementById("inpHtml").value == "Preview")
document.getElementById("textHtml").value = document.getElementById("lblSpin").innerHTML;
}
}
function GetSpinContent(text) {
var result = text;
var reg = new RegExp(/{([^{}]*)\}/i);
while (matches = reg.exec(result)) {
var array = new Array();
array = matches[1].split('|');
result = result.replace(matches[0], array[Math.floor(Math.random() * array.length)]);
}
reg = new RegExp(/\{\{([\s\S]*?)\}\}/i);
while (match = reg.exec(result)) {
var array = new Array();
array = match[1].split('||');
result = result.replace(match[0], array[Math.floor(Math.random() * array.length)]);
}
return result;
}
</script>
</body>
</html>
Supports nested spinning to infinite levels.
I wrote this myself and happy share it for BHW. Use it however you want.
Let me know if you have any questions.
P/S: I can't attach html file, so just replace ".doc" -> ".html" if you download from attachment