Commit 4a19156a by Kálmán Viktor

dashboard: common getCookie js func

parent 56721df3
......@@ -62,3 +62,26 @@ function refreshSliders() {
$(this).parent('div').nextAll("span").html($(this).val());
});
}
// for AJAX calls
/**
* Getter for user cookies
* @param {String} name Cookie name
* @return {String} Cookie value
*/
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
......@@ -292,27 +292,3 @@ function vmCreateDiskLabel(pk, name) {
}
/* copied from /static/js/network.js
* we gonna need this anyways for ajax POSTs */
// for AJAX calls
/**
* Getter for user cookies
* @param {String} name Cookie name
* @return {String} Cookie value
*/
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
......@@ -128,19 +128,3 @@ function setRowColor(row) {
}
}
// TODO common getCookie
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment