| 1 |
/** |
| 2 |
* Javascript for search and check dialog in admin |
| 3 |
* |
| 4 |
* @package wp-forecast |
| 5 |
*/ |
| 6 |
|
| 7 |
/* add color picker */ |
| 8 |
jQuery( document ).ready( function($){ jQuery( '.fonticon_color' ).wpColorPicker(); } ); |
| 9 |
|
| 10 |
/* get the data for the new location */ |
| 11 |
function wpf_search() |
| 12 |
{ |
| 13 |
var searchterm = document.getElementById( "searchloc" ).value; |
| 14 |
var language = document.getElementById( "wpf_search_language" ).value; |
| 15 |
var wid = document.getElementById( "wpfcid" ).value; |
| 16 |
var nonce = document.getElementById( "wpf_nonce_3" ).value; |
| 17 |
|
| 18 |
jQuery.ajax( |
| 19 |
{ |
| 20 |
type: 'POST', |
| 21 |
url: ajaxurl, |
| 22 |
data: { |
| 23 |
action: 'wpf_search_ajax', searchterm: searchterm, language: language, wpfcid: wid, wpf_nonce_3: nonce }, |
| 24 |
success: function (data, textStatus, XMLHttpRequest) { |
| 25 |
jQuery( "div#search_results" ).html( data ); |
| 26 |
}, |
| 27 |
error: function (XMLHttpRequest, textStatus, errorThrown) { |
| 28 |
alert( errorThrown ); |
| 29 |
} |
| 30 |
} |
| 31 |
); |
| 32 |
} |
| 33 |
|
| 34 |
function wpf_set_loc( name, lat, lon ) { |
| 35 |
document.getElementById( "location" ).value = name.trim(); |
| 36 |
document.getElementById( "locname" ).value = name.trim(); |
| 37 |
document.getElementById( "loclatitude" ).value = lat; |
| 38 |
document.getElementById( "loclongitude" ).value = lon; |
| 39 |
document.getElementById( "searchloc" ).value = ''; |
| 40 |
jQuery( "div#search_results" ).html( '' ); |
| 41 |
tb_remove(); |
| 42 |
} |
| 43 |
|
| 44 |
/* get the data from the connection test */ |
| 45 |
function wpf_check() |
| 46 |
{ |
| 47 |
var wprovider = document.getElementById( "wprovider" ).value; |
| 48 |
var nonce = document.getElementById( "wpf_nonce_3" ).value; |
| 49 |
jQuery( "div#check_log" ).html( '' ); |
| 50 |
|
| 51 |
jQuery.ajax( |
| 52 |
{ |
| 53 |
type: 'POST', |
| 54 |
url: ajaxurl, |
| 55 |
data: { |
| 56 |
action: 'wpf_check_ajax', provider : wprovider, wpf_nonce_3: nonce }, |
| 57 |
success: function (data, textStatus, XMLHttpRequest) { |
| 58 |
jQuery( "div#check_log" ).html( data ); |
| 59 |
}, |
| 60 |
error: function (XMLHttpRequest, textStatus, errorThrown) { |
| 61 |
alert( errorThrown ); |
| 62 |
} |
| 63 |
} |
| 64 |
); |
| 65 |
} |
| 66 |
|