]> git.ipfire.org Git - ipfire.org.git/blob - src/static/js/site.js
Make the navbar static and dark all the time
[ipfire.org.git] / src / static / js / site.js
1 $.query = function(name){
2 var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
3 return results[1] || 0;
4 }
5
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);
11 }
12 });
13 },
14 }); */
15
16 function getCookie(name) {
17 var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
18 return r ? r[1] : undefined;
19 }
20
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 + ")"));
26 }
27 });
28 };