widget.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* CLOCK */
  2. var circle;
  3. function widget_clock_init(){
  4. circle = new ProgressBar.Circle('#clock', {
  5. color: '#50C8FB',
  6. duration: 3000,
  7. easing: 'easeInOut',
  8. text: {
  9. style : { fontSize : '38px'},
  10. value : '00:00:00'
  11. }
  12. });
  13. refresh_clock();
  14. setInterval(function(){
  15. refresh_clock();
  16. },1000);
  17. }
  18. function refresh_clock(){
  19. var d = new Date();
  20. var hour = d.getHours();
  21. var minut = ("00" + d.getMinutes()).slice(-2) ;
  22. var second = ("00" + d.getSeconds()).slice(-2) ;
  23. var year = d.getFullYear() ;
  24. var month = ("00" + (d.getMonth()+1)).slice(-2) ;
  25. var day = ("00" + d.getDate()).slice(-2) ;
  26. var days = ["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"];
  27. var monthName = ["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Décembre"];
  28. var dayName = days[d.getDay()];
  29. circle.setText(hour+':'+minut+':'+second+'<div class="dayName">'+dayName+'</div><div class="dayDate">'+day+' '+monthName[d.getMonth()]+' '+year+'</div>');
  30. circle.set(second/60);
  31. }
  32. /* PROFILE */
  33. function dashboard_widget_profile_configure_save(widget,modal){
  34. var data = $('#dashboard-widget-profile-form').toJson();
  35. data.action = 'dashboard_widget_profile_configure_save';
  36. data.id = modal.attr('data-widget');
  37. $.action(data,function(){
  38. $.message('success','Configuration enregistrée');
  39. dashboard_dashboardwidget_search();
  40. });
  41. }
  42. /* HTML */
  43. function dashboard_widget_html_configure_save(widget,modal){
  44. var data = $('#dashboard-widget-html-form').toJson();
  45. data.action = 'dashboard_widget_html_configure_save';
  46. data.id = modal.attr('data-widget');
  47. $.action(data,function(){
  48. $.message('success','Configuration enregistrée');
  49. dashboard_dashboardwidget_search();
  50. });
  51. }