From e9a305b5731db8292110f37b3c4de34656570fa3 Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 7 Sep 2017 13:55:40 +0630 Subject: [PATCH] remove auto refresh in origami --- app/views/origami/home/index.html.erb | 128 +++++++++++++------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 9eb16a30..309caa50 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -98,13 +98,13 @@ <% end %> - +
- + @@ -146,72 +146,72 @@ $(document).ready(function(){ }) }); -$(function() { - var timer; +// $(function() { +// var timer; - function start() { - timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 10000); //10000 - }; +// function start() { +// timer = setTimeout(function() { console.log("refresh");window.location.reload()}, 10000); //10000 +// }; - function stop() { - clearTimeout(timer); - }; +// function stop() { +// clearTimeout(timer); +// }; - if(localStorage.getItem("refreshflag") != null){ - if (localStorage.getItem("refreshflag") == 0) { - $('#refreshbutton').html("Refresh off"); - $('#refreshbutton').css("background-color","red"); - stop(); - } - else{ - $('#refreshbutton').html("Refresh on"); - $('#refreshbutton').css("background-color","green"); - start(); - } - } - else{ - localStorage.setItem("refreshflag", 0); - } - var url = location.href; - if (location.href.slice(-1) == "/"){ - url = url.substring(0, url.length - 1); - } - var arr = url.split("/"); +// if(localStorage.getItem("refreshflag") != null){ +// if (localStorage.getItem("refreshflag") == 0) { +// $('#refreshbutton').html("Refresh off"); +// $('#refreshbutton').css("background-color","red"); +// stop(); +// } +// else{ +// $('#refreshbutton').html("Refresh on"); +// $('#refreshbutton').css("background-color","green"); +// start(); +// } +// } +// else{ +// localStorage.setItem("refreshflag", 0); +// } +// var url = location.href; +// if (location.href.slice(-1) == "/"){ +// url = url.substring(0, url.length - 1); +// } +// var arr = url.split("/"); - if(arr[arr.length-1] != "origami"){ - stop(); - } - $('#refreshbutton').bind("click", function(){ - if(localStorage.getItem("refreshflag") == "0"){ - localStorage.setItem("refreshflag", 1); - $(this).html("Refresh on"); - $(this).css("background-color","green"); - // $(this).html("Auto Refresh on"); - start(); - } - else{ - stop(); - localStorage.setItem("refreshflag", 0); - $(this).html("Refresh off"); - $(this).css("background-color","red"); - } - }); - function refreshing(){ - if(localStorage.getItem("refreshflag") == "0"){ - localStorage.setItem("refreshflag", 1); - $(this).html("Refresh on"); - $(this).css("background-color","green"); - // $(this).html("Auto Refresh on"); - start(); - } - else{ - stop(); - localStorage.setItem("refreshflag", 0); - $(this).html("Refresh off"); - $(this).css("background-color","red"); - } - } -}); +// if(arr[arr.length-1] != "origami"){ +// stop(); +// } +// $('#refreshbutton').bind("click", function(){ +// if(localStorage.getItem("refreshflag") == "0"){ +// localStorage.setItem("refreshflag", 1); +// $(this).html("Refresh on"); +// $(this).css("background-color","green"); +// // $(this).html("Auto Refresh on"); +// start(); +// } +// else{ +// stop(); +// localStorage.setItem("refreshflag", 0); +// $(this).html("Refresh off"); +// $(this).css("background-color","red"); +// } +// }); +// function refreshing(){ +// if(localStorage.getItem("refreshflag") == "0"){ +// localStorage.setItem("refreshflag", 1); +// $(this).html("Refresh on"); +// $(this).css("background-color","green"); +// // $(this).html("Auto Refresh on"); +// start(); +// } +// else{ +// stop(); +// localStorage.setItem("refreshflag", 0); +// $(this).html("Refresh off"); +// $(this).css("background-color","red"); +// } +// } +// }); $('#cash_in').on('click',function(){ window.location.href = '/origami/cash_ins/new';