Commit c6a9918206ccbdfa42a5713c319004f64cbce96f
1 parent
1a71a3c0
Change colab_integration.js to use jquery
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com> Signed-off-by: Alexandre Barbosa <alexandrealmeidabarbosa@gmail.com>
Showing
1 changed file
with
10 additions
and
16 deletions
Show diff stats
colab/plugins/noosfero/static/noosfero/js/colab_integration.js
1 | 1 | ||
2 | -window.onload=transform_tag_Welcome(); | 2 | +window.onload=transform_tags(); |
3 | 3 | ||
4 | -function httpGet(theUrl) | 4 | +function transform_tags() |
5 | { | 5 | { |
6 | - var xmlHttp = new XMLHttpRequest(); | ||
7 | - xmlHttp.open( "GET", theUrl, false ); | ||
8 | - xmlHttp.send( null ); | ||
9 | - return xmlHttp.responseText; | ||
10 | -} | ||
11 | - | ||
12 | - | ||
13 | -function transform_tag_Welcome() | ||
14 | -{ | ||
15 | - var tag = document.getElementsByClassName('foswikiToc'); | ||
16 | - var text = httpGet('http://localhost:8000/spb/get_list/?list_name=ListB&MAX=5'); | ||
17 | - tag[0].innerHTML= text; | ||
18 | - | ||
19 | - var current = url = window.location.href | 6 | + var tag = $('.software-community-dashboard'); |
7 | + var url = $(location).attr('pathname'); | ||
8 | + var regex = new RegExp(/\/social\/(.+)\//g); | ||
9 | + var community = regex.exec(url)[1]; | ||
10 | + var MAX = '7' | ||
11 | + var request_path = '/spb/get_list/'+'?list_name='+community+'&'+'MAX='+MAX; | ||
12 | + | ||
13 | + tag.load(request_path) | ||
20 | } | 14 | } |