summaryrefslogtreecommitdiffstats
path: root/media/js/QM_helper.js
blob: 69b6ede1afda8bca4f40dc7b186717732e22f5e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
 $(document).ready(function(){

/*begin ajax query stuff for getting next QM number*/
$('.number:first').append("<a href='javascript:void(0)'  class='next_qm_link'>get next number</a>");

new_qm_link=function(e){
if ($('#id_cave:first')[0].value != "")
{

$.post('/newqmnumber/',{'cave':$('#id_cave')[0].value,'year':$('#id_expedition')[0].value}, function(data){
    $('#id_QMs_found-0-number')[0].value=data;
});
}
else {
alert('Please choose a cave and try again.')
};
};

$('.next_qm_link').bind("click", new_qm_link);
/*end ajax query stuff for getting next QM number*/

/*begin ajax query stuff for getting suggestions view*/



suggestions_query=function(){
slug=$('#id_slug')[0].value;
date=$('#id_date')[0].value;
$.post('/lbo_suggestions/',{'slug':slug,'date':date}, function(data){
    if ($('#suggestions').length>0){
    $('#suggestions').replaceWith(data);
    }
    else{
    $('#id_text').parent().append(data);
    }
});
};

$('#id_text').parent().append("<a href='javascript:void(0)'  class='update_suggestions'>get / update suggestions</a>");

$(".update_suggestions").bind("click", suggestions_query);

replace=function(from,to){
    $('#id_text').text($('#id_text').text().replace(from,to))
    $('[name=_continue]').click()
    
    }

suggestions_query();
/*end*/



/*begin reccomendations stuff*/


/*search for QMs
suspect_QMs=$('#id_text')[0].value.match(/\b(\d\d)-(\d\d\w?)\b/g);
linked_QMs=

$('#suggestions').append(
"\
<h2>May I reccomend:</h2>\
Putting in wikilinks for the following QMs:\
"
);
$('#suggestions').append('<li>'+suspect_QMs.join('</li><li>')+</li>);*/


/*end reccomendations stuff*/








 });