Template:Team:Paris-Saclay/left-column

From 2012.igem.org

(Difference between revisions)
Line 15: Line 15:
  </ul>
  </ul>
</div>
</div>
 +
<script type="text/javascript">
 +
$(document).ready(function() {
 +
    var url = document.location.href;
 +
    var idxPS = url.indexOf("Team:Paris-Saclay",0);
 +
    Title = url.substring(idxPS,url.length);
 +
    Category = "";
 +
   
 +
    $.ajax({
 +
    type: "GET",
 +
    url: "https://2012.igem.org/wiki/api.php", // name of file you want to parse
 +
    async : false,
 +
data:{
 +
format: 'xml',
 +
action: 'query',
 +
titles: Title,
 +
prop: 'categories'},
 +
    dataType: "xml", // type of file you are trying to read
 +
    success  : function(xmlData){
 +
$(xmlData).find('cl').each(function() {
 +
                Category = $(this).attr("title");
 +
                var idxCategory = Category.lastIndexOf("/");
 +
                var name = Category.substring(idxCategory+1);
 +
                $("h1#ctArticles").append("<h1>"+name+"</h1>");
 +
} )
 +
},
 +
error : function(){
 +
}
 +
});
 +
});
 +
 +
$(document).ready(function() {
 +
    $.ajax({
 +
    type: "GET",
 +
    url: "https://2012.igem.org/wiki/api.php", // name of file you want to parse
 +
    async : false,
 +
data:{
 +
format: 'xml',
 +
action: 'query',
 +
list: 'categorymembers',
 +
cmtitle: Category},
 +
    dataType: "xml", // type of file you are trying to read
 +
    success  : function(xmlData){
 +
$(xmlData).find('cm').each(function() {
 +
                var idxArticle = $(this).attr("title").lastIndexOf("/");
 +
                var Article = $(this).attr("title").substring(idxArticle+1);
 +
                var linkArticle = "https://2012.igem.org/"+$(this).attr("title");
 +
$("ul#ltArticles").append('<li>' + '<a href="' + linkArticle + '">' + Article + '</a></li>');
 +
} )
 +
},
 +
error : function(){
 +
}
 +
});
 +
});
 +
</script>
</div>
</div>
Line 37: Line 91:
<div id="tweetFeed">
<div id="tweetFeed">
-
<script>
+
<script type="text/javascript">
$(document).ready(function(){
$(document).ready(function(){
     $('#tweetFeed').jTweetsAnywhere({
     $('#tweetFeed').jTweetsAnywhere({

Revision as of 08:32, 21 August 2012

Related Items

Follow us !