From 2acbda882269ed5f33e631b2028a7c4c96f73acc Mon Sep 17 00:00:00 2001
From: Csók Tamás <godhak@gmail.com>
Date: Fri, 22 Aug 2014 14:16:21 +0200
Subject: [PATCH] dashboard.js: save cookie, an input handler, plus a function for ClientChecking page that uses the previous two function

---
 circle/dashboard/static/dashboard/dashboard.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/circle/dashboard/static/dashboard/dashboard.js b/circle/dashboard/static/dashboard/dashboard.js
index e0a529a..9ba1c08 100644
--- a/circle/dashboard/static/dashboard/dashboard.js
+++ b/circle/dashboard/static/dashboard/dashboard.js
@@ -583,6 +583,17 @@ function addModalConfirmation(func, data) {
   });
 }
 
+function addOnClickToInput(id, func, param) {
+    $('input,select').not('textarea').keypress(function(event) {if (event.keyCode == 13) {event.preventDefault();}})
+    $('#' + id).click(function(){func(param); return false;})
+}
+
+function clientInstalledAction(location) {   
+    setCookie('downloaded_client', true, 365 * 24 * 60 * 60);
+    window.location.href = location;
+    $('#confirmation-modal').modal("hide");
+}
+
 // for AJAX calls
 /**                                                                         
  * Getter for user cookies                                                  
@@ -605,6 +616,14 @@ function getCookie(name) {
   return cookieValue;                                                       
 }
 
+function setCookie(name,value,seconds) {
+  if (seconds!=null) {
+    var today = new Date();
+    var expire = new Date();
+    expire.setTime(today.getTime() + seconds);
+  }
+  document.cookie = name+"="+escape(value)+";expires="+expire.toUTCString();
+}
 
 /* no js compatibility */
 function noJS() {
--
libgit2 0.26.0