jquery in confluence.

https://confluence.atlassian.com/confkb/how-to-use-javascript-in-confluence-313458839.html

https://answers.atlassian.com/questions/40807/use-of-jquery-in-confluence

<script>
AJS.toInit(function() {
var request=null;
var text;
if(window.XMLHttpRequest)
{
request=new XMLHttpRequest();
}else if(window.ActiveXObject)
{
request=new ActiveXObject("Microsoft.XMLHTTP");
}
if(request)
{
request.open("GET","/project.txt",true);
request.onreadystatechange=function()
{
if(request.readyState===4)
{
if (request.status == 200 || request.status == 0)
{
text = request.responseText;
console.log(text);
text = text.replace(/\t/g,'</td><td>');
text = text.replace(/\n/g,'</td></tr><tr><td>');
text = "<table class='NEWtable'><tr><td>"+text+"</table>";
console.log(text);
document.getElementById("text").innerHTML= text;
$('.NEWtable td').css('padding','0 2em');
}
}
}
request.send(null);
}else{
alert("error");
}
});
</script>
<a href="#" id="mylink">My Link</a>
<div id="text"></div>
上一篇:Greedy Gift Givers 贪婪的送礼者 USACO 模拟


下一篇:adb 的使用