2009-07-04 08:27:49 +01:00
|
|
|
$(document).ready(function(){
|
2021-10-25 23:02:27 +01:00
|
|
|
/* This file is ONLY referred to in core/admin.py which configures the Django Admin control panel.
|
|
|
|
but the link is outdated and is not live . So whatever it does, is not active
|
|
|
|
the whole QM thing needs redesigning anyway, see https://expo.survex.com/handbook/troggle/scriptsqms.html */
|
|
|
|
|
2009-07-06 08:31:24 +01:00
|
|
|
/*begin ajax query stuff for getting next QM number*/
|
2009-07-04 08:27:49 +01:00
|
|
|
$('.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);
|
2009-07-06 08:31:24 +01:00
|
|
|
/*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*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-04 08:27:49 +01:00
|
|
|
|
|
|
|
});
|