home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2012 January / maximum-cd-2012-01.iso / DiscContents / digsby_setup.exe / lib / plugins / digsby_about / res / infobox.js < prev    next >
Encoding:
Text File  |  2010-08-23  |  1.4 KB  |  54 lines

  1. function check_for_updates() {
  2.     show_update_section("checking");
  3.     D.rpc("check_for_updates", {},
  4.         function(args) {
  5.             if (args.update_required) {
  6.                 show_update_section("need-update");
  7.             } else {
  8.                 show_update_section("up-to-date");
  9.             }
  10.         },
  11.         function(error) {
  12.             if (error.message=="already checking") {
  13.                 //show_update_section("checking");
  14.             }
  15.         }
  16.     );
  17. }
  18.  
  19. function get_update_status() {
  20.     D.rpc("get_update_status", {},
  21.         function (args) {
  22.             console.log("updating? " + args.status);
  23.             if (args.status == "checking") {
  24.                 show_update_section("checking");
  25.             } else if ((args.status == "downloading") || (args.status == "filechecking")) {
  26.                 show_update_section("need-update");
  27.             } else {
  28.                 check_for_updates();
  29.             }
  30.         }
  31.     );
  32. }
  33.  
  34. function perform_update() {
  35.     D.rpc("show_filetransfer_window");
  36.     show_update_section("none");
  37. }
  38.  
  39. var update_sections = ["checking", "up-to-date", "need-update"];
  40.  
  41. function show_update_section(which) {
  42.     for (var i in update_sections) {
  43.         var name = update_sections[i];
  44.         var node = $("#update #" + name);
  45.         if (name == which) {
  46.             node.show();
  47.         } else {
  48.             node.hide();
  49.         }
  50.     }
  51. }
  52.  
  53. show_update_section("none");
  54.