]>
git.ipfire.org Git - ipfire.org.git/blob - src/static/js/site.js
1 $.query = function(name
){
2 var results
= new RegExp('[\\?&]' + name
+ '=([^&#]*)').exec(window
.location
.href
);
3 return results
[1] || 0;
6 /* $(".planet-search-autocomplete").typeahead({
7 source: function(query, process) {
8 $.get("/api/planet/search/autocomplete", { q: query }, function(data) {
9 if (data.query == query) {
10 process(data.results);
16 function getCookie(name
) {
17 var r
= document
.cookie
.match("\\b" + name
+ "=([^;]*)\\b");
18 return r
? r
[1] : undefined;
21 jQuery
.postJSON = function(url
, args
, callback
) {
22 args
._xsrf
= getCookie("_xsrf");
23 $.ajax({url
: url
, data
: $.param(args
), dataType
: "text", type
: "POST",
24 success: function(response
) {
25 callback(eval("(" + response
+ ")"));