[jslint] Enable js lint and fix the errors.
authorHalton Huo <halton.huo@intel.com>
Fri, 6 Jun 2014 03:32:53 +0000 (11:32 +0800)
committerHalton Huo <halton.huo@intel.com>
Mon, 9 Jun 2014 01:52:34 +0000 (09:52 +0800)
13 files changed:
application/application_api.js
content/content_api.js
demos/system_info/js/system_info.js
demos/system_info/js/system_info_desktop.js
demos/system_info/js/system_info_mobile.js
demos/tizen/js/main.js
examples/js/js-test-post.js
examples/js/js-test-pre.js
filesystem/filesystem_api.js
power/power_api.js
tools/check-coding-style
tools/js_lint.sh [deleted file]
utils/utils_api.js

index 545cf7f..c9848af 100644 (file)
@@ -294,6 +294,6 @@ exports.getAppMetaData = function(appId) {
 
   var data = [];
   for (var i = 0, len = result.data.length; i < len; ++i)
-      data.push(new ApplicationMetaData(result.data[i]));
+    data.push(new ApplicationMetaData(result.data[i]));
   return data;
 };
index ed0b323..0491f93 100644 (file)
@@ -7,24 +7,24 @@ var _nextReplyId = 0;
 
 function getNextReplyId() {
   return _nextReplyId++;
-};
+}
 
 function postMessage(msg, callback) {
   var replyId = getNextReplyId();
   _callbacks[replyId] = callback;
   msg.replyId = replyId;
   extension.postMessage(JSON.stringify(msg));
-};
+}
 
 function sendSyncMessage(msg) {
   return extension.internal.sendSyncMessage(JSON.stringify(msg));
-};
+}
 
 extension.setMessageListener(function(msg) {
   var m = JSON.parse(msg);
   var replyId = m.replyId;
   var callback = _callbacks[replyId];
-  
+
   if (typeof(callback) === 'function') {
     callback(m);
     delete m.replyId;
@@ -43,7 +43,8 @@ function Folder(uri, id, type, title) {
   });
 }
 
-function Content(id, name, type, mimeType, title, contentURI, thumnailURIs, releaseDate, modifiedDate, size, description, rating) {
+function Content(id, name, type, mimeType, title, contentURI, thumnailURIs, releaseDate,
+                 modifiedDate, size, description, rating) {
   Object.defineProperties(this, {
     'id': { writable: false, value: id, enumerable: true },
     'name': { writable: false, value: name, enumerable: true },
@@ -56,11 +57,12 @@ function Content(id, name, type, mimeType, title, contentURI, thumnailURIs, rele
     'modifiedDate': { writable: false, value: modifiedDate, enumerable: true },
     'size': { writable: false, value: size, enumerable: true },
     'description': { writable: false, value: description, enumerable: true },
-    'rating': { writable: false, value: rating, enumerable: true },
+    'rating': { writable: false, value: rating, enumerable: true }
   });
 }
 
-function ContentAudio(obj, album, genres, artists, composer, copyright, bitrate, trackNumber, duration) {
+function ContentAudio(obj, album, genres, artists, composer, copyright,
+                      bitrate, trackNumber, duration) {
   Object.defineProperties(obj, {
     'album': { writable: false, value: album, enumerable: true },
     'genres': { writable: false, value: genres, enumerable: true },
@@ -69,7 +71,7 @@ function ContentAudio(obj, album, genres, artists, composer, copyright, bitrate,
     'copyright': { writable: false, value: copyright, enumerable: true },
     'bitrate': { writable: false, value: bitrate, enumerable: true },
     'trackNumber': { writable: false, value: trackNumber, enumerable: true },
-    'duration': { writable: false, value: duration, enumerable: true },
+    'duration': { writable: false, value: duration, enumerable: true }
   });
 }
 
@@ -77,7 +79,7 @@ function ContentImage(obj, width, height, orientation) {
   Object.defineProperties(obj, {
     'width': { writable: false, value: width, enumerable: true },
     'height': { writable: false, value: height, enumerable: true },
-    'orientation': { writable: false, value: orientation, enumerable: true },
+    'orientation': { writable: false, value: orientation, enumerable: true }
   });
 }
 
@@ -87,7 +89,7 @@ function ContentVideo(obj, album, artists, duration, width, height) {
     'artists': { writable: false, value: artists, enumerable: true },
     'duration': { writable: false, value: duration, enumerable: true },
     'width': { writable: false, value: width, enumerable: true },
-    'height': { writable: false, value: height, enumerable: true },
+    'height': { writable: false, value: height, enumerable: true }
   });
 }
 
@@ -98,13 +100,13 @@ ContentManager.prototype.update = function(content) {
   if (!xwalk.utils.validateArguments('o', arguments)) {
     throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR);
   }
-}
+};
 
 ContentManager.prototype.updateBatch = function(content, onsuccess, onerror) {
   if (!xwalk.utils.validateArguments('o?ff', arguments)) {
     throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR);
   }
-}
+};
 
 ContentManager.prototype.getDirectories = function(onsuccess, onerror) {
   if (!xwalk.utils.validateArguments('f?f', arguments)) {
@@ -112,114 +114,115 @@ ContentManager.prototype.getDirectories = function(onsuccess, onerror) {
   }
 
   postMessage({
-      cmd: 'ContentManager.getDirectories',
-    }, function(result) {
-      if (result.isError) {
-        if (onerror)
-          onerror(new tizen.WebAPIError(result.errorCode));
-      } else if (onsuccess) {
-        var folders = [];
-
-        for (var i = 0; i < result.value.length; i++) {
-          var folder = result.value[i];
-          var jsonFolder = new Folder(folder.directoryURI,
-              folder.id,
-              folder.storageType,
-              folder.title);
-          folders.push(jsonFolder)
-        }
-        onsuccess(folders);
+    cmd: 'ContentManager.getDirectories'
+  }, function(result) {
+    if (result.isError) {
+      if (onerror)
+        onerror(new tizen.WebAPIError(result.errorCode));
+    } else if (onsuccess) {
+      var folders = [];
+
+      for (var i = 0; i < result.value.length; i++) {
+        var folder = result.value[i];
+        var jsonFolder = new Folder(folder.directoryURI,
+            folder.id,
+            folder.storageType,
+            folder.title);
+        folders.push(jsonFolder);
       }
+      onsuccess(folders);
+    }
   });
-}
+};
 
-ContentManager.prototype.find = function(onsuccess, onerror, directoryId, filter, sortMode, count, offset) {
+ContentManager.prototype.find = function(onsuccess, onerror, directoryId,
+    filter, sortMode, count, offset) {
   if (!xwalk.utils.validateArguments('f?fsoonn', arguments)) {
     throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR);
   }
 
   postMessage({
-      cmd: 'ContentManager.find',
-      directoryId: directoryId,
-      filter: filter,
-      sortMode: sortMode,
-      count: count,
-      offset: offset,
-    }, function(result) {
-      if (result.isError) {
-        if (onerror)
-          onerror(new tizen.WebAPIError(result.errorCode));
-      } else if (onsuccess) {
-        var contents = [];
-        for (var i = 0; i < result.value.length; i++) {
-          var content = result.value[i];
-          var jsonContent = new Content(content.id, 
-              content.name,
-              content.type,
-              content.mimeType,
-              content.title,
-              content.contentURI,
-              content.thumnailURIs,
-              content.releaseDate,
-              content.modifiedDate,
-              content.size,
-              content.description,
-              content.rating);
-
-          if (content.type == "AUDIO") {
-            ContentAudio(jsonContent,
-                content.album,
-                content.genres,
-                content.artists,
-                content.composer,
-                content.copyright,
-                content.bitrate,
-                content.trackNumber,
-                content.duration);
-          } else if (content.type == "IMAGE") {
-            ContentImage(jsonContent,
-                content.width,
-                content.height,
-                content.orientation);
-          } else if (content.type == "VIDEO") {
-            ContentImage(jsonContent,
-                content.album,
-                content.artists,
-                content.duration,
-                content.width,
-                content.height);
-          }
-          contents.push(jsonContent);
-        }     
-        onsuccess(contents);
+    cmd: 'ContentManager.find',
+    directoryId: directoryId,
+    filter: filter,
+    sortMode: sortMode,
+    count: count,
+    offset: offset
+  }, function(result) {
+    if (result.isError) {
+      if (onerror)
+        onerror(new tizen.WebAPIError(result.errorCode));
+    } else if (onsuccess) {
+      var contents = [];
+      for (var i = 0; i < result.value.length; i++) {
+        var content = result.value[i];
+        var jsonContent = new Content(content.id,
+            content.name,
+            content.type,
+            content.mimeType,
+            content.title,
+            content.contentURI,
+            content.thumnailURIs,
+            content.releaseDate,
+            content.modifiedDate,
+            content.size,
+            content.description,
+            content.rating);
+
+        if (content.type == 'AUDIO') {
+          ContentAudio(jsonContent,
+              content.album,
+              content.genres,
+              content.artists,
+              content.composer,
+              content.copyright,
+              content.bitrate,
+              content.trackNumber,
+              content.duration);
+        } else if (content.type == 'IMAGE') {
+          ContentImage(jsonContent,
+              content.width,
+              content.height,
+              content.orientation);
+        } else if (content.type == 'VIDEO') {
+          ContentImage(jsonContent,
+              content.album,
+              content.artists,
+              content.duration,
+              content.width,
+              content.height);
+        }
+        contents.push(jsonContent);
       }
+      onsuccess(contents);
+    }
   });
-}
+};
 
 ContentManager.prototype.scanFile = function(contentURI, onsuccess, onerror) {
   if (!xwalk.utils.validateArguments('s?ff', arguments)) {
     throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR);
   }
   postMessage({
-      cmd: 'ContentManager.scanFile',
-      contentURI: contentURI
-    }, function(result) {
-      if (result.isError) {
-        if (onerror)
-          onerror(new tizen.WebAPIError(result.errorCode));
-      } else if (onsuccess) {
-        onsuccess(contentURI);
-      }
+    cmd: 'ContentManager.scanFile',
+    contentURI: contentURI
+  }, function(result) {
+    if (result.isError) {
+      if (onerror)
+        onerror(new tizen.WebAPIError(result.errorCode));
+    } else if (onsuccess) {
+      onsuccess(contentURI);
+    }
   });
-}
+};
 
 ContentManager.prototype.setChangeListener = function(onchange) {
   if (!xwalk.utils.validateArguments('f', arguments)) {
     throw new tizen.WebAPIException(tizen.WebAPIException.TYPE_MISMATCH_ERR);
   }
-}
+};
 
 ContentManager.prototype.unsetChangeLIstener = function() {
-}
+};
 
 exports = new ContentManager();
index 7169969..4a11cde 100644 (file)
@@ -1,10 +1,6 @@
-/**********************************************************
- *
- * @module: system_info.js
- * @version: 1.0
- * @copyright: © 2013 Intel
- * 
- **********************************************************/
+// Copyright (c) 2013 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
 
 function BatteryInfo() {
   this.level = $('<p></p>').addClass('center');
@@ -22,20 +18,20 @@ function BatteryInfo() {
 
   this.getInfo = function getInfo(BATTERY) {
     tizen.systeminfo.getPropertyValue(
-      "BATTERY",
-      function(battery) {
-        BATTERY.draw_graph(battery);
-        BATTERY.charging.text(battery.isCharging ? 'Charging':'No Charging');
-        BATTERY.level.text(battery.level * 100 + '%');
-      },
-      null);
+        'BATTERY',
+        function(battery) {
+          BATTERY.draw_graph(battery);
+          BATTERY.charging.text(battery.isCharging ? 'Charging' : 'No Charging');
+          BATTERY.level.text(battery.level * 100 + '%');
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "BATTERY",
-      function(battery) {
-        BATTERY.draw_graph(battery);
-        BATTERY.charging.text(battery.isCharging ? 'Charging':'No Charging');
-        BATTERY.level.text(battery.level * 100 + '%');
-      });
+        'BATTERY',
+        function(battery) {
+          BATTERY.draw_graph(battery);
+          BATTERY.charging.text(battery.isCharging ? 'Charging' : 'No Charging');
+          BATTERY.level.text(battery.level * 100 + '%');
+        });
   };
 }
 
@@ -47,25 +43,25 @@ function BuildInfo() {
 
   this.getInfo = function getInfo(BUILD) {
     tizen.systeminfo.getPropertyValue(
-      "BUILD",
-      function(build) {
-        BUILD.model.text("MODEL: " + build.model);
-        BUILD.manufacturer.text("MANUFACTURE: " + build.manufacturer);
-        BUILD.build_version.text("BUILDVERSION: " + build.buildVersion);
-      },
-      null);
+        'BUILD',
+        function(build) {
+          BUILD.model.text('MODEL: ' + build.model);
+          BUILD.manufacturer.text('MANUFACTURE: ' + build.manufacturer);
+          BUILD.build_version.text('BUILDVERSION: ' + build.buildVersion);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "BUILD",
-      function(build) {
-        BUILD.model.text("MODEL: " + build.model);
-        BUILD.manufacturer.text("MANUFACTURE: " + build.manufacturer);
-        BUILD.build_version.text("BUILDVERSION: " + build.buildVersion);
-      });
+        'BUILD',
+        function(build) {
+          BUILD.model.text('MODEL: ' + build.model);
+          BUILD.manufacturer.text('MANUFACTURE: ' + build.manufacturer);
+          BUILD.build_version.text('BUILDVERSION: ' + build.buildVersion);
+        });
   };
 }
 
 function CellularNetworkInfo() {
-  this.status = $('<p></p>').text("CELLULAR is OFF");
+  this.status = $('<p></p>').text('CELLULAR is OFF');
   this.apn_imei = $('<p></p>');
   this.ip_address = $('<p></p>');
   this.ipv6_address = $('<p></p>');
@@ -77,34 +73,34 @@ function CellularNetworkInfo() {
 
   this.change_cellular = function change_cellular(cellular) {
     if (cellular.status == 'ON') {
-      this.status.text("CELLULAR: " + cellular.status);
-      this.apn_imei.text("APN: " + cellular.apn + "  " +
-                         "IMEI: " + cellular.imei);
-      this.ip_address.text("IP ADDRESS: " + cellular.ipAddress);
-      this.ipv6_address.text("IPV6 ADDRESS: " + cellular.ipv6Address);
-      this.short_info.text("MCC: " + cellular.mcc + "  " +
-                           "MNC: " + cellular.mnc + "  " +
-                           "CELLID: " + cellular.cellId + "  " +
-                           "LAC: " + cellular.lac);
-      this.bool_info.text(cellular.isRoaming? "Roaming":"NoRoaming" +
-                          cellular.isFlightMode? "Flight":"NoFlight");
+      this.status.text('CELLULAR: ' + cellular.status);
+      this.apn_imei.text('APN: ' + cellular.apn + '  ' +
+                         'IMEI: ' + cellular.imei);
+      this.ip_address.text('IP ADDRESS: ' + cellular.ipAddress);
+      this.ipv6_address.text('IPV6 ADDRESS: ' + cellular.ipv6Address);
+      this.short_info.text('MCC: ' + cellular.mcc + '  ' +
+                           'MNC: ' + cellular.mnc + '  ' +
+                           'CELLID: ' + cellular.cellId + '  ' +
+                           'LAC: ' + cellular.lac);
+      this.bool_info.text(cellular.isRoaming ? 'Roaming' : 'NoRoaming' +
+                          cellular.isFlightMode ? 'Flight' : 'NoFlight');
     } else {
-      this.status.text("CELLULAR IS OFF!");
+      this.status.text('CELLULAR IS OFF!');
     }
   };
 
   this.getInfo = function getInfo(CELLULAR) {
     tizen.systeminfo.getPropertyValue(
-      "CELLULAR_NETWORK",
-      function(cellular) {
-        CELLULAR.change_cellular(cellular);
-      },
-      null);
+        'CELLULAR_NETWORK',
+        function(cellular) {
+          CELLULAR.change_cellular(cellular);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "CELLULAR_NETWORK",
-      function(cellular) {
-        CELLULAR.change_cellular(cellular);
-      });
+        'CELLULAR_NETWORK',
+        function(cellular) {
+          CELLULAR.change_cellular(cellular);
+        });
   };
 }
 
@@ -121,11 +117,11 @@ function CPUInfo() {
       show: true,
       fill: true,
       fillColor: {
-      colors: ['#f00', '#fdd'],
+        colors: ['#f00', '#fdd'],
         getInfo: 'top',
-        end: 'bottom',
+        end: 'bottom'
       },
-      fillOpacity: 1,
+      fillOpacity: 1
     }
   };
   this.graph_yaxis = {
@@ -135,20 +131,20 @@ function CPUInfo() {
     max: 100,
     min: -5,
     color: '#fff',
-    autoScale: true,
+    autoScale: true
   };
   this.graph_xaxis = {
     title: 'TIME',
     noTicks: true,
-    ticks: [[0, "PAST"], [200, "FUTURE"]],
+    ticks: [[0, 'PAST'], [200, 'FUTURE']],
     max: 200,
-    min: 0,
+    min: 0
   };
   this.graph_grid = {
     backgroundColor: {
       colors: [[0, '#fff'], [1, '#bbb']],
       getInfo: 'top',
-      end: 'bottom',
+      end: 'bottom'
     }
   };
 
@@ -170,38 +166,38 @@ function CPUInfo() {
     }
 
     CPU.cpu_graph = Flotr.draw(CPU.cpu_container,
-      [CPU.graph_lines], {
-        title: CPU.cpu_data[length - 1] + '%',
-        yaxis: CPU.graph_yaxis,
-        xaxis: CPU.graph_xaxis,
-        grid: CPU.graph_grid,
-        legend: {position: 'nw'},
-      }
-    );
+        [CPU.graph_lines], {
+          title: CPU.cpu_data[length - 1] + '%',
+          yaxis: CPU.graph_yaxis,
+          xaxis: CPU.graph_xaxis,
+          grid: CPU.graph_grid,
+          legend: {position: 'nw'}
+        }
+        );
 
     setTimeout(function() {
       CPU.cpu_animate(CPU, CPU.cpu_data.length);
-      }, 50);
+    }, 50);
   };
 
   this.getInfo = function getInfo(CPU) {
     tizen.systeminfo.getPropertyValue(
-      "CPU",
-      function(cpu) {
-        CPU.cpu_data.push((cpu.load * 100).toFixed(1));
-      },
-      null);
+        'CPU',
+        function(cpu) {
+          CPU.cpu_data.push((cpu.load * 100).toFixed(1));
+        },
+        null);
     CPU.cpu_animate(CPU, CPU.cpu_data.length);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "CPU",
-      function(cpu) {
-        if (CPU.cpu_data.length < CPU.cpu_data_size) {
-          CPU.cpu_data.push((cpu.load * 100).toFixed(1));
-        } else {
-          CPU.cpu_data.shift();
-          CPU.cpu_data.push((cpu.load * 100).toFixed(1));
-        }
-      });
+        'CPU',
+        function(cpu) {
+          if (CPU.cpu_data.length < CPU.cpu_data_size) {
+            CPU.cpu_data.push((cpu.load * 100).toFixed(1));
+          } else {
+            CPU.cpu_data.shift();
+            CPU.cpu_data.push((cpu.load * 100).toFixed(1));
+          }
+        });
   };
 }
 
@@ -211,26 +207,26 @@ function DeviceOrientationInfo() {
   $('#deviceorientation').append(this.status, this.auto_rotation);
 
   this.change_status = function change_status(status) {
-    switch(status) {
-      case "PORTRAIT_PRIMARY":
+    switch (status) {
+      case 'PORTRAIT_PRIMARY':
         $('#ball').css('-webkit-animation', 'jump-pp 1s infinite');
         $('#ball').css('animation', 'jump-pp 1.5s infinite');
         $('#ball').removeClass();
         $('#ball').addClass('ball-top');
         break;
-      case "PORTRAIT_SECONDARY":
+      case 'PORTRAIT_SECONDARY':
         $('#ball').css('-webkit-animation', 'jump-ps 1s infinite');
         $('#ball').css('animation', 'jump-ps 1.5s infinite');
         $('#ball').removeClass();
         $('#ball').addClass('ball-bottom');
         break;
-      case "LANDSCAPE_PRIMARY":
+      case 'LANDSCAPE_PRIMARY':
         $('#ball').css('-webkit-animation', 'jump-lp 1s infinite');
         $('#ball').css('animation', 'jump-lp 1.5s infinite');
         $('#ball').removeClass();
         $('#ball').addClass('ball-left');
         break;
-      case "LANDSCAPE_SECONDARY":
+      case 'LANDSCAPE_SECONDARY':
         $('#ball').css('-webkit-animation', 'jump-ls 1s infinite');
         $('#ball').css('animation', 'jump-ls 1.5s infinite');
         $('#ball').removeClass();
@@ -245,22 +241,22 @@ function DeviceOrientationInfo() {
 
   this.getInfo = function getInfo(DEVICEORIENTATION) {
     tizen.systeminfo.getPropertyValue(
-      "DEVICE_ORIENTATION",
-      function(deviceorientation) {
-        DEVICEORIENTATION.change_status(deviceorientation.status);
-        DEVICEORIENTATION.status.text("STATUS: " + deviceorientation.status);
-        DEVICEORIENTATION.auto_rotation.text(deviceorientation.isAutoRotation ?
-                                             "AUTOROTATION":"NO AUTOROTATION");
-      },
-      null);
+        'DEVICE_ORIENTATION',
+        function(deviceorientation) {
+          DEVICEORIENTATION.change_status(deviceorientation.status);
+          DEVICEORIENTATION.status.text('STATUS: ' + deviceorientation.status);
+          DEVICEORIENTATION.auto_rotation.text(deviceorientation.isAutoRotation ?
+              'AUTOROTATION' : 'NO AUTOROTATION');
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "DEVICE_ORIENTATION",
-      function(deviceorientation) {
-        DEVICEORIENTATION.change_status(deviceorientation.status);
-        DEVICEORIENTATION.status.text("STATUS: " + deviceorientation.status);
-        DEVICEORIENTATION.auto_rotation.text(deviceorientation.isAutoRotation ?
-                                             "AUTOROTATION":"NO AUTOROTATION");
-      });
+        'DEVICE_ORIENTATION',
+        function(deviceorientation) {
+          DEVICEORIENTATION.change_status(deviceorientation.status);
+          DEVICEORIENTATION.status.text('STATUS: ' + deviceorientation.status);
+          DEVICEORIENTATION.auto_rotation.text(deviceorientation.isAutoRotation ?
+              'AUTOROTATION' : 'NO AUTOROTATION');
+        });
   };
 }
 
@@ -274,15 +270,15 @@ function DisplayInfo() {
                               this.screen, this.physical, this.brightness);
 
   this.change_display = function change_display(display) {
-    this.dots_perinch_width.text("DOS PER INCH WIDTH: " +
+    this.dots_perinch_width.text('DOS PER INCH WIDTH: ' +
         display.dotsPerInchWidth.toFixed(2));
-    this.dots_perinch_height.text("DOS PER INCH HEIGTH: " +
+    this.dots_perinch_height.text('DOS PER INCH HEIGTH: ' +
         display.dotsPerInchHeight.toFixed(2));
-    this.screen.text("SCREEN: WIDTH(" + display.resolutionWidth +
-        ") HEIGHT(" + display.resolutionHeight + ")");
-    this.physical.text("PHYSICAL: WIDTH(" + display.physicalWidth +
-        ") HEIGHT(" + display.physicalHeight + ")");
-    this.brightness.text("BRIGHTNESS: " + display.brightness);
+    this.screen.text('SCREEN: WIDTH(' + display.resolutionWidth +
+        ') HEIGHT(' + display.resolutionHeight + ')');
+    this.physical.text('PHYSICAL: WIDTH(' + display.physicalWidth +
+        ') HEIGHT(' + display.physicalHeight + ')');
+    this.brightness.text('BRIGHTNESS: ' + display.brightness);
     var physicalTotal = display.physicalWidth + display.physicalHeight;
     var screenTotal = display.resolutionWidth + display.resolutionHeight;
     $('#display_physical').width(500 * display.physicalWidth /
@@ -298,16 +294,16 @@ function DisplayInfo() {
 
   this.getInfo = function getInfo(DISPLAY) {
     tizen.systeminfo.getPropertyValue(
-      "DISPLAY",
-      function(display) {
-        DISPLAY.change_display(display);
-      },
-      null);
+        'DISPLAY',
+        function(display) {
+          DISPLAY.change_display(display);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "DISPLAY",
-      function(display) {
-        DISPLAY.change_display(display);
-      });
+        'DISPLAY',
+        function(display) {
+          DISPLAY.change_display(display);
+        });
   };
 }
 
@@ -318,18 +314,18 @@ function LocaleInfo() {
 
   this.getInfo = function getInfo(LOCALE) {
     tizen.systeminfo.getPropertyValue(
-      "LOCALE",
-      function(locale) {
-        LOCALE.language.text("LANGUAGE: " + locale.language);
-        LOCALE.country.text("COUNTRY: " + locale.country);
-      },
-      null);
+        'LOCALE',
+        function(locale) {
+          LOCALE.language.text('LANGUAGE: ' + locale.language);
+          LOCALE.country.text('COUNTRY: ' + locale.country);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "LOCALE",
-      function(locale) {
-        LOCALE.language.text("LANGUAGE: " + locale.language);
-        LOCALE.country.text("COUNTRY: " + locale.country);
-      });
+        'LOCALE',
+        function(locale) {
+          LOCALE.language.text('LANGUAGE: ' + locale.language);
+          LOCALE.country.text('COUNTRY: ' + locale.country);
+        });
   };
 }
 
@@ -338,16 +334,16 @@ function NetworkInfo() {
 
   this.getInfo = function getInfo(NETWORK) {
     tizen.systeminfo.getPropertyValue(
-      "NETWORK",
-      function(network) {
-        NETWORK.network_type.text("TYPE: " + network.type);
-      },
-      null);
+        'NETWORK',
+        function(network) {
+          NETWORK.network_type.text('TYPE: ' + network.type);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "NETWORK",
-      function(network) {
-        NETWORK.network_type.text("TYPE: " + network.type);
-      });
+        'NETWORK',
+        function(network) {
+          NETWORK.network_type.text('TYPE: ' + network.type);
+        });
   };
 }
 
@@ -357,18 +353,18 @@ function PeripheralInfo() {
 
   this.getInfo = function getInfo(PERIPHERAL) {
     tizen.systeminfo.getPropertyValue(
-      "PERIPHERAL",
-      function(peripheral) {
-        PERIPHERAL.video_output.text(peripheral.isVideoOutputOn ?
-                                     "VIDEOOUTPUT: ON":"VIDEOOUTPUT: OFF");
-      },
-      null);
+        'PERIPHERAL',
+        function(peripheral) {
+          PERIPHERAL.video_output.text(peripheral.isVideoOutputOn ?
+              'VIDEOOUTPUT: ON' : 'VIDEOOUTPUT: OFF');
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "PERIPHERAL",
-      function(peripheral) {
-        PERIPHERAL.video_output.text(peripheral.isVideoOutputOn ?
-                                     "VIDEOOUTPUT: ON":"VIDEOOUTPUT: OFF");
-      });
+        'PERIPHERAL',
+        function(peripheral) {
+          PERIPHERAL.video_output.text(peripheral.isVideoOutputOn ?
+              'VIDEOOUTPUT: ON' : 'VIDEOOUTPUT: OFF');
+        });
   };
 }
 
@@ -382,28 +378,28 @@ function SimInfo() {
                              this.short_info, this.msin_spn);
 
   this.change_sim = function change_sim(sim) {
-    this.state.text("STATE: " + sim.state);
-    this.operator_name.text("OPERATOR NAME: " + sim.operatorName);
-    this.msisdn_iccid.text("MSISDN: " + sim.msisdn + "  " +
-        "ICCID: " + sim.iccid);
-    this.short_info.text("MCC: " + sim.mcc + "  " +
-        "MNC: " + sim.mnc);
-    this.msin_spn.text("MSIN: " + sim.msin + "  " +
-        "SPN: " + sim.spn);
+    this.state.text('STATE: ' + sim.state);
+    this.operator_name.text('OPERATOR NAME: ' + sim.operatorName);
+    this.msisdn_iccid.text('MSISDN: ' + sim.msisdn + '  ' +
+        'ICCID: ' + sim.iccid);
+    this.short_info.text('MCC: ' + sim.mcc + '  ' +
+        'MNC: ' + sim.mnc);
+    this.msin_spn.text('MSIN: ' + sim.msin + '  ' +
+        'SPN: ' + sim.spn);
   };
 
   this.getInfo = function getInfo(SIM) {
     tizen.systeminfo.getPropertyValue(
-      "SIM",
-      function(sim) {
-        SIM.change_sim(sim);
-      },
-      null);
+        'SIM',
+        function(sim) {
+          SIM.change_sim(sim);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "SIM",
-      function(sim) {
-        SIM.change_sim(sim);
-      });
+        'SIM',
+        function(sim) {
+          SIM.change_sim(sim);
+        });
   };
 }
 
@@ -424,46 +420,46 @@ function StorageInfo() {
       Flotr.draw(containner, [
         {data: [data1], label: 'used'},
         {data: [data2], label: 'available'}
-        ], {
-          HtmlText: false,
-          title: 'TYPE:' + UNITS[i].type,
-          grid: {
-            verticalLines: false,
-            horizontalLines: false,
-            circular: true,
-          },
-          xaxis: {showLabels: false},
-          yaxis: {showLabels: false},
-          pie: {
-            show: true,
-            explode: 6,
-          },
-          mouse: {track: true},
-          legend: {
-            position: 'se',
-            backgroundColor: '#D2E8FF',
-          }
-        });
+      ], {
+        HtmlText: false,
+        title: 'TYPE:' + UNITS[i].type,
+        grid: {
+          verticalLines: false,
+          horizontalLines: false,
+          circular: true
+        },
+        xaxis: {showLabels: false},
+        yaxis: {showLabels: false},
+        pie: {
+          show: true,
+          explode: 6
+        },
+        mouse: {track: true},
+        legend: {
+          position: 'se',
+          backgroundColor: '#D2E8FF'
+        }
+      });
     }
   };
 
   this.getInfo = function getInfo(STORAGE) {
     tizen.systeminfo.getPropertyValue(
-      "STORAGE",
-      function(storage) {
-        STORAGE.draw_graph(storage.units);
-      },
-      null);
+        'STORAGE',
+        function(storage) {
+          STORAGE.draw_graph(storage.units);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "STORAGE",
-      function(storage) {
-        STORAGE.draw_graph(storage.units);
-      });
+        'STORAGE',
+        function(storage) {
+          STORAGE.draw_graph(storage.units);
+        });
   };
 }
 
 function WifiNetworkInfo() {
-  this.status = $('<p></p>').text("WIFI IS OFF!");
+  this.status = $('<p></p>').text('WIFI IS OFF!');
   this.ssid = $('<p></p>');
   this.ip_address = $('<p></p>');
   this.ipv6_address = $('<p></p>');
@@ -473,28 +469,28 @@ function WifiNetworkInfo() {
 
   this.change_wifi = function change_wifi(wifi) {
     if (wifi.status == 'ON') {
-      this.status.text("WIFI: " + wifi.status);
-      this.ssid.text("WIFI SSID: " + wifi.ssid);
-      this.ip_address.text("WIFI IP ADDRESS: " + wifi.ipAddress);
-      this.ipv6_address.text("WIFI IPV6 ADDRESS: " + wifi.ipv6Address);
-      this.signal_strength.text("WIFI SIGNAL STRENGTH: " +
+      this.status.text('WIFI: ' + wifi.status);
+      this.ssid.text('WIFI SSID: ' + wifi.ssid);
+      this.ip_address.text('WIFI IP ADDRESS: ' + wifi.ipAddress);
+      this.ipv6_address.text('WIFI IPV6 ADDRESS: ' + wifi.ipv6Address);
+      this.signal_strength.text('WIFI SIGNAL STRENGTH: ' +
                                 wifi.signalStrength);
     } else {
-      this.status.text("WIFI IS OFF!");
+      this.status.text('WIFI IS OFF!');
     }
   };
 
   this.getInfo = function getInfo(WIFI) {
     tizen.systeminfo.getPropertyValue(
-      "WIFI_NETWORK",
-      function(wifi) {
-        WIFI.change_wifi(wifi);
-      },
-      null);
+        'WIFI_NETWORK',
+        function(wifi) {
+          WIFI.change_wifi(wifi);
+        },
+        null);
     tizen.systeminfo.addPropertyValueChangeListener(
-      "WIFI_NETWORK",
-      function(wifi) {
-        WIFI.change_wifi(wifi);
-      });
+        'WIFI_NETWORK',
+        function(wifi) {
+          WIFI.change_wifi(wifi);
+        });
   };
 }
index 3b701f4..3996a64 100644 (file)
@@ -1,9 +1,9 @@
-$(document).ready(function () {
+$(document).ready(function() {
   $('#main').ascensor({
-    direction: "chocolate",
+    direction: 'chocolate',
     overflow: 'hidden',
     loop: true,
-    ascensorMap: [[0,0],[0,1],[0,2],[1,2],[1,1],[1,0]]
+    ascensorMap: [[0, 0], [0, 1], [0, 2], [1, 2], [1, 1], [1, 0]]
   });
 
   build_info = new BuildInfo();
index 2271697..6f45de4 100644 (file)
@@ -1,4 +1,4 @@
-$(document).ready(function () {
+$(document).ready(function() {
   $('#exit_btn').click(function() {
     // Open the local windows. To avoid window.close() invalid problem.
     window.open('', '_self', '');
@@ -6,10 +6,10 @@ $(document).ready(function () {
   });
 
   $('#main').ascensor({
-    direction: "chocolate",
+    direction: 'chocolate',
     overflow: 'hidden',
     loop: true,
-    ascensorMap: [[0,0],[0,1],[1,1],[1,0],[2,0],[2,1],[3,1],[3,0]]
+    ascensorMap: [[0, 0], [0, 1], [1, 1], [1, 0], [2, 0], [2, 1], [3, 1], [3, 0]]
   });
 
   battery_info = new BatteryInfo();
index 09b96a0..e1decd8 100644 (file)
 Number.prototype.format = function() {
-    if (this < 10)
-        return "0" + this;
-    return this;
-}
+  if (this < 10)
+    return '0' + this;
+  return this;
+};
 
 var blueApp = {};
 
+
 /**
  * Initializes the application data and settings.
  */
 blueApp.init = function() {
-    $("#return-btn").click(function(event) {
-        window.close();
-    });
+  $('#return-btn').click(function(event) {
+    window.close();
+  });
 
-    blueApp.cleanDeviceList();
+  blueApp.cleanDeviceList();
 
-    $("#paired-device-group").hide();
-    $("#visibility-toggle").click(blueApp.toggleVisibility);
+  $('#paired-device-group').hide();
+  $('#visibility-toggle').click(blueApp.toggleVisibility);
 
-    $("input[type=radio][name=visibility]").change(function() {
-        blueApp.changedVisibility();
-    });
+  $('input[type=radio][name=visibility]').change(function() {
+    blueApp.changedVisibility();
+  });
 
-    $("#scan-btn").click(blueApp.scan);
+  $('#scan-btn').click(blueApp.scan);
 
-    blueApp.bluetoothLoad();
+  blueApp.bluetoothLoad();
 
-    $("#bluetooth-toggle").change(blueApp.adapterStatusToggle);
+  $('#bluetooth-toggle').change(blueApp.adapterStatusToggle);
 };
 
+
 /**
  * On power setting success callback.
  */
 blueApp.adapterPowerSuccessCb = function() {
-    var status = $("#bluetooth-toggle").val();
+  var status = $('#bluetooth-toggle').val();
 
-    var noti = new tizen.StatusNotification("SIMPLE", "Bluetooth", {
-        content : "Successfully powered " + status + " bluetooth adapter."
-    });
-    tizen.notification.post(noti);
+  var noti = new tizen.StatusNotification('SIMPLE', 'Bluetooth', {
+    content: 'Successfully powered ' + status + ' bluetooth adapter.'
+  });
+  tizen.notification.post(noti);
 
-    if (blueApp.adapter.powered)
-        blueApp.discoverDevices();
+  if (blueApp.adapter.powered)
+    blueApp.discoverDevices();
 };
 
+
 /**
  * On power setting error callback.
  */
 blueApp.adapterPowerErrCb = function() {
-    var status = $("#bluetooth-toggle").val();
+  var status = $('#bluetooth-toggle').val();
 
-    var noti = new tizen.StatusNotification("SIMPLE", "Bluetooth", {
-        content : "Failed to power " + status + " bluetooth adapter."
-    });
-    tizen.notification.post(noti);
+  var noti = new tizen.StatusNotification('SIMPLE', 'Bluetooth', {
+    content: 'Failed to power ' + status + ' bluetooth adapter.'
+  });
+  tizen.notification.post(noti);
 };
 
+
 /**
  * Device buttom has been toggled.
  *
  * Powers down the bluetooth device.
  */
 blueApp.adapterStatusToggle = function() {
-    var status = $("#bluetooth-toggle").val() == 'on';
-
-    if (!status) {
-        blueApp.cleanDeviceList();
-        blueApp.adapter.stopDiscovery(function() {
-            blueApp.adapter.setPowered(status, blueApp.adapterPowerSuccessCb,
-                                       blueApp.adapterPowerErrCb);
-        });
-    } else {
-        blueApp.adapter.setPowered(status, blueApp.adapterPowerSuccessCb,
-                                   blueApp.adapterPowerErrCb);
-    }
+  var status = $('#bluetooth-toggle').val() == 'on';
+
+  if (!status) {
+    blueApp.cleanDeviceList();
+    blueApp.adapter.stopDiscovery(function() {
+      blueApp.adapter.setPowered(status, blueApp.adapterPowerSuccessCb,
+          blueApp.adapterPowerErrCb);
+    });
+  } else {
+    blueApp.adapter.setPowered(status, blueApp.adapterPowerSuccessCb,
+        blueApp.adapterPowerErrCb);
+  }
 };
 
+
 /**
  * Clean the device list.
  */
 blueApp.cleanDeviceList = function() {
-    $("#available-device-list").hide();
-    $("#available-device-list").html('');
+  $('#available-device-list').hide();
+  $('#available-device-list').html('');
 };
 
+
 /**
  * Scan for bluetooth devices.
  */
 blueApp.scan = function() {
-    if (!blueApp.adapter) return;
+  if (!blueApp.adapter) return;
 
-    blueApp.adapter.stopDiscovery(function() {
-        blueApp.cleanDeviceList();
-        blueApp.discoverDevices();
-    });
+  blueApp.adapter.stopDiscovery(function() {
+    blueApp.cleanDeviceList();
+    blueApp.discoverDevices();
+  });
 };
 
 blueApp.newDeviceEntry = function(device, list) {
-    var deviceStyle;
-    var deviceClass = device.deviceClass;
-    var deviceItem = "<li><div id='device-icon' ";
+  var deviceStyle;
+  var deviceClass = device.deviceClass;
+  var deviceItem = "<li><div id='device-icon' ";
 
-    if (!blueApp.adapter.powered) return;
+  if (!blueApp.adapter.powered) return;
 
-    switch (deviceClass.major) {
+  switch (deviceClass.major) {
     case tizen.bluetooth.deviceMajor.COMPUTER:
-        deviceStyle = "device-icon-computer";
-        break;
+      deviceStyle = 'device-icon-computer';
+      break;
     case tizen.bluetooth.deviceMajor.PHONE:
-        deviceStyle = "device-icon-telephone";
-        break;
+      deviceStyle = 'device-icon-telephone';
+      break;
     case tizen.bluetooth.deviceMajor.IMAGING:
-        if (deviceClass.minor == tizen.bluetooth.deviceMinor.PRINTER) {
-            deviceStyle = "device-icon-printer";
-        }
-        break;
-    }
-
-    deviceItem += "class='" + deviceStyle + "' />";
-    deviceItem += device.name;
-    deviceItem += "</li>";
-
-    $(list + "-group").show();
-    $(list + "-list").show();
-    $(list + "-list").append(
-      $(deviceItem).attr("class",
-                         "ui-li ui-li-static ui-btn-up-s ui-li-last").attr(
-                           "address", device.address));
-
-    return $(list + "-list li[address='"+device.address+"']");
-}
+      if (deviceClass.minor == tizen.bluetooth.deviceMinor.PRINTER) {
+        deviceStyle = 'device-icon-printer';
+      }
+      break;
+  }
+
+  deviceItem += "class='" + deviceStyle + "' />";
+  deviceItem += device.name;
+  deviceItem += '</li>';
+
+  $(list + '-group').show();
+  $(list + '-list').show();
+  $(list + '-list').append(
+      $(deviceItem).attr('class',
+                         'ui-li ui-li-static ui-btn-up-s ui-li-last').attr(
+                           'address', device.address));
+
+  return $(list + "-list li[address='" + device.address + "']");
+};
 
 blueApp.pairDevice = function() {
-    var deviceEntry = $(this);
-
-    blueApp.adapter.createBonding($(deviceEntry).attr("address"), function(device) {
-      $(deviceEntry).remove();
-      blueApp.newDeviceEntry(device, "#paired-device").click(blueApp.unpairDevice);
-    }, function(e) {
-      var noti = new tizen.StatusNotification("SIMPLE", "Bluetooth", {
-        content : "Failed pairing device."});
-      tizen.notification.post(noti);
-    });
+  var deviceEntry = $(this);
+
+  blueApp.adapter.createBonding($(deviceEntry).attr('address'), function(device) {
+    $(deviceEntry).remove();
+    blueApp.newDeviceEntry(device, '#paired-device').click(blueApp.unpairDevice);
+  }, function(e) {
+    var noti = new tizen.StatusNotification('SIMPLE', 'Bluetooth', {
+      content: 'Failed pairing device.'});
+    tizen.notification.post(noti);
+  });
 };
 
 blueApp.unpairDevice = function() {
-    var deviceEntry = $(this);
-    var address = $(this).attr("address");
-
-    blueApp.adapter.destroyBonding(address, function(device) {
-      $(deviceEntry).remove();
-      blueApp.newDeviceEntry(device, "#available-device").click(blueApp.pairDevice);
-
-      if (!$("#paired-device-list li").size())
-        $("#paired-device-group").hide();
-    }, function(e) {
-        var noti = new tizen.StatusNotification("SIMPLE", "Bluetooth", {
-            content : "Could not unpair bluetooth device."
-        });
-        tizen.notification.post(noti);
+  var deviceEntry = $(this);
+  var address = $(this).attr('address');
+
+  blueApp.adapter.destroyBonding(address, function(device) {
+    $(deviceEntry).remove();
+    blueApp.newDeviceEntry(device, '#available-device').click(blueApp.pairDevice);
+
+    if (!$('#paired-device-list li').size())
+      $('#paired-device-group').hide();
+  }, function(e) {
+    var noti = new tizen.StatusNotification('SIMPLE', 'Bluetooth', {
+      content: 'Could not unpair bluetooth device.'
     });
+    tizen.notification.post(noti);
+  });
 };
 
+
 /**
  * Efectively add new devices to devices list.
  */
 blueApp.addDevice = function(device) {
-    var clickCb = blueApp.pairDevice;
-    var deviceList = "#available-device";
+  var clickCb = blueApp.pairDevice;
+  var deviceList = '#available-device';
 
-    if (device.isBonded) {
-      deviceList = "#paired-device";
-      clickCb = blueApp.unpairDevice;
-    }
+  if (device.isBonded) {
+    deviceList = '#paired-device';
+    clickCb = blueApp.unpairDevice;
+  }
 
-    blueApp.newDeviceEntry(device, deviceList).click(clickCb);
+  blueApp.newDeviceEntry(device, deviceList).click(clickCb);
 };
 
+
 /**
  * Tizen bluetooth callbacs.
  */
 blueApp.discoverDevicesCb = {
-    onstarted: function() {
-        console.log("Discovery has started.");
-    },
-    ondevicefound : blueApp.addDevice,
-    ondevicedisappeared : function(address) {
-        $("#available-device-list li").each(function() {
-            if ($(this).attr("address") == address)
-                $(this).remove();
-        });
-    },
-    onfinished : function(devices) {
-        var noti = new tizen.StatusNotification("SIMPLE", "Bluetooth", {
-            content : "Finished bluetooth devices discovery."
-        });
-        tizen.notification.post(noti);
-    }
+  onstarted: function() {
+    console.log('Discovery has started.');
+  },
+  ondevicefound: blueApp.addDevice,
+  ondevicedisappeared: function(address) {
+    $('#available-device-list li').each(function() {
+      if ($(this).attr('address') == address)
+        $(this).remove();
+    });
+  },
+  onfinished: function(devices) {
+    var noti = new tizen.StatusNotification('SIMPLE', 'Bluetooth', {
+      content: 'Finished bluetooth devices discovery.'
+    });
+    tizen.notification.post(noti);
+  }
 };
 
+
 /**
  * Start the discover call and handle failure.
  */
 blueApp.discoverDevices = function() {
-    blueApp.adapter.discoverDevices(blueApp.discoverDevicesCb, function(e) {
-        var noti = new tizen.StatusNotification("SIMPLE", "Bluetooth", {
-            content : "Failed to discover bluetooth devices."
-        });
-        tizen.notification.post(noti);
+  blueApp.adapter.discoverDevices(blueApp.discoverDevicesCb, function(e) {
+    var noti = new tizen.StatusNotification('SIMPLE', 'Bluetooth', {
+      content: 'Failed to discover bluetooth devices.'
     });
+    tizen.notification.post(noti);
+  });
 };
 
+
 /**
  * Bluetooth initial data load.
  *
@@ -219,93 +229,97 @@ blueApp.discoverDevices = function() {
  * powered.
  */
 blueApp.bluetoothLoad = function() {
-    try {
-        blueApp.adapter = tizen.bluetooth.getDefaultAdapter();
-        $("#adapter-name").html(blueApp.adapter.name);
-    } catch(err) {
-        console.log("bluetooth is off");
-    }
-
-    if (blueApp.adapter.visible) {
-        $("#visibility-display").html("On");
-    }
-
-    $("#bluetooth-toggle").val(blueApp.adapter.powered ? 'on' : 'off');
-    $("#bluetooth-toggle").slider('refresh');
-
-    if (blueApp.adapter.powered)
-        blueApp.discoverDevices();
+  try {
+    blueApp.adapter = tizen.bluetooth.getDefaultAdapter();
+    $('#adapter-name').html(blueApp.adapter.name);
+  } catch (err) {
+    console.log('bluetooth is off');
+  }
+
+  if (blueApp.adapter.visible) {
+    $('#visibility-display').html('On');
+  }
+
+  $('#bluetooth-toggle').val(blueApp.adapter.powered ? 'on' : 'off');
+  $('#bluetooth-toggle').slider('refresh');
+
+  if (blueApp.adapter.powered)
+    blueApp.discoverDevices();
 };
 
+
 /**
  * Timer for setting the UI visible remaining time case a timeout has been set.
  */
 blueApp.setRemainingTime = function() {
-    var timeOut;
-    var delta;
-    var display;
-    var currTime = new Date().getTime() / 1000;
-    var visibilityTime = blueApp.visibilityTime;
-    var visibilityTimeout = blueApp.visibilityTimeout;
-
-    timeOut = visibilityTime + visibilityTimeout;
-    delta = timeOut - currTime;
-    display = Math.floor(delta / 60).format() + ":"
-        + Math.floor(delta % 60).format();
-
-    $("#visibility-display").html(display);
-
-    if (currTime < timeOut)
-        setTimeout(blueApp.setRemainingTime, 1000);
-    else
-        $("#visibility-display").html("Off");
+  var timeOut;
+  var delta;
+  var display;
+  var currTime = new Date().getTime() / 1000;
+  var visibilityTime = blueApp.visibilityTime;
+  var visibilityTimeout = blueApp.visibilityTimeout;
+
+  timeOut = visibilityTime + visibilityTimeout;
+  delta = timeOut - currTime;
+  display = Math.floor(delta / 60).format() + ':' + Math.floor(delta % 60).format();
+
+  $('#visibility-display').html(display);
+
+  if (currTime < timeOut)
+    setTimeout(blueApp.setRemainingTime, 1000);
+  else
+    $('#visibility-display').html('Off');
 };
 
+
 /**
  * On visibility setting success callback.
  */
 blueApp.visibilitySuccessCb = function() {
-    setTimeout(blueApp.setRemainingTime, 1000);
+  setTimeout(blueApp.setRemainingTime, 1000);
 };
 
+
 /**
  * On visibility setting error callback.
  */
 blueApp.visibilityErrorCb = function() {
-    var noti = new tizen.StatusNotification("SIMPLE", "Bluetooth", {
-        content : "Error on setting bluetooth visibility."
-    });
-    tizen.notification.post(noti);
-    $("#visibility-display").html("Off");
+  var noti = new tizen.StatusNotification('SIMPLE', 'Bluetooth', {
+    content: 'Error on setting bluetooth visibility.'
+  });
+  tizen.notification.post(noti);
+  $('#visibility-display').html('Off');
 };
 
+
 /**
  * Reset the visibility label.
  *
  * Sets the visibility label with the just selected visibility item.
  */
 blueApp.changedVisibility = function() {
-    var timeout = parseInt($("input[type=radio][name=visibility]:checked")
+  var timeout = parseInt($('input[type=radio][name=visibility]:checked')
                            .val(), 10);
-    var visibility = $("input[type=radio][name=visibility]:checked").attr(
-        "label");
-    blueApp.toggleVisibility();
-    $("#visibility-display").html(visibility);
-    blueApp.visibilityTime = 0;
-    blueApp.visibilityTimeout = 0;
-
-    if (timeout > 0) {
-        blueApp.visibilityTime = new Date().getTime() / 1000;
-        blueApp.visibilityTimeout = timeout;
-
-        blueApp.adapter.setVisible(true, blueApp.visibilitySuccessCb,
-                                   blueApp.visibilityErrorCb, timeout);
-    } else if (timeout == 0)
-        blueApp.adapter.setVisible(false);
-    else
-        blueApp.adapter.setVisible(true);
+  var visibility = $('input[type=radio][name=visibility]:checked').attr(
+      'label');
+  blueApp.toggleVisibility();
+  $('#visibility-display').html(visibility);
+  blueApp.visibilityTime = 0;
+  blueApp.visibilityTimeout = 0;
+
+  if (timeout > 0) {
+    blueApp.visibilityTime = new Date().getTime() / 1000;
+    blueApp.visibilityTimeout = timeout;
+
+    blueApp.adapter.setVisible(true, blueApp.visibilitySuccessCb,
+        blueApp.visibilityErrorCb, timeout);
+  } else if (timeout == 0)
+    blueApp.adapter.setVisible(false);
+  else
+    blueApp.adapter.setVisible(true);
 };
 
+
 /**
  * Toggle the device/adapter visibility.
  *
@@ -313,19 +327,19 @@ blueApp.changedVisibility = function() {
  * the item arrow(off/on).
  */
 blueApp.toggleVisibility = function() {
-    var vGroup = $("#visibility-group");
-    var display = "none";
-    var toggle = "visibility-on";
+  var vGroup = $('#visibility-group');
+  var display = 'none';
+  var toggle = 'visibility-on';
 
-    if (!blueApp.adapter) return;
+  if (!blueApp.adapter) return;
 
-    if (vGroup.css("display") == "none") {
-        display = "block";
-        toggle = "visibility-off";
-    }
+  if (vGroup.css('display') == 'none') {
+    display = 'block';
+    toggle = 'visibility-off';
+  }
 
-    vGroup.css("display", display);
-    $("#visibility-toggle-icon").attr("class", toggle);
+  vGroup.css('display', display);
+  $('#visibility-toggle-icon').attr('class', toggle);
 };
 
 $(document).ready(blueApp.init);
index cb6f5a6..9218c56 100644 (file)
@@ -21,7 +21,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 wasPostTestScriptParsed = true;
index 93d5e6b..3a2d181 100644 (file)
@@ -21,7 +21,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump text + pixel results
@@ -29,77 +29,85 @@ var description, debug, successfullyParsed, errorMessage;
 
 (function() {
 
-    function getOrCreate(id, tagName)
-    {
-        var element = document.getElementById(id);
-        if (element)
-            return element;
-
-        element = document.createElement(tagName);
-        element.id = id;
-        var refNode;
-        var parent = document.body || document.documentElement;
-        if (id == "description")
-            refNode = getOrCreate("console", "div");
-        else
-            refNode = parent.firstChild;
-
-        parent.insertBefore(element, refNode);
-        return element;
-    }
+  function getOrCreate(id, tagName)
+  {
+    var element = document.getElementById(id);
+    if (element)
+      return element;
+
+    element = document.createElement(tagName);
+    element.id = id;
+    var refNode;
+    var parent = document.body || document.documentElement;
+    if (id == 'description')
+      refNode = getOrCreate('console', 'div');
+    else
+      refNode = parent.firstChild;
 
-    description = function description(msg, quiet)
-    {
-        // For MSIE 6 compatibility
-        var span = document.createElement("span");
-        if (quiet)
-            span.innerHTML = '<p>' + msg + '</p><p>On success, you will see no "<span class="fail">FAIL</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
-        else
-            span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>';
-
-        var description = getOrCreate("description", "p");
-        if (description.firstChild)
-            description.replaceChild(span, description.firstChild);
-        else
-            description.appendChild(span);
-    };
+    parent.insertBefore(element, refNode);
+    return element;
+  }
 
-    debug = function debug(msg)
-    {
-        var span = document.createElement("span");
-        getOrCreate("console", "div").appendChild(span); // insert it first so XHTML knows the namespace
-        span.innerHTML = msg + '<br />';
-    };
+  description = function description(msg, quiet)
+      {
+    // For MSIE 6 compatibility
+    var span = document.createElement('span');
+    if (quiet)
+      span.innerHTML = '<p>' + msg +
+          '</p><p>' +
+          'On success, you will see no "<span class="fail">FAIL</span>" messages, ' +
+          'followed by "<span class="pass">TEST COMPLETE</span>".' +
+          '</p>';
+    else
+      span.innerHTML = '<p>' + msg +
+          '</p><p>' +
+          'On success, you will see a series of "<span class="pass">PASS</span>" messages, ' +
+          'followed by "<span class="pass">TEST COMPLETE</span>".' +
+          '</p>';
+
+    var description = getOrCreate('description', 'p');
+    if (description.firstChild)
+      description.replaceChild(span, description.firstChild);
+    else
+      description.appendChild(span);
+  };
 
-    var css =
-        ".pass {" +
-            "font-weight: bold;" +
-            "color: green;" +
-        "}" +
-        ".fail {" +
-            "font-weight: bold;" +
-            "color: red;" +
-        "}" +
-        "#console {" +
-            "white-space: pre-wrap;" +
-            "font-family: monospace;" +
-        "}";
-
-    function insertStyleSheet()
-    {
-        var styleElement = document.createElement("style");
-        styleElement.textContent = css;
-        (document.head || document.documentElement).appendChild(styleElement);
-    }
+  debug = function debug(msg)
+      {
+    var span = document.createElement('span');
+    getOrCreate('console', 'div').appendChild(span); // insert it first so XHTML knows the namespace
+    span.innerHTML = msg + '<br />';
+  };
+
+  var css =
+      '.pass {' +
+            'font-weight: bold;' +
+            'color: green;' +
+      '}' +
+      '.fail {' +
+            'font-weight: bold;' +
+            'color: red;' +
+      '}' +
+      '#console {' +
+            'white-space: pre-wrap;' +
+            'font-family: monospace;' +
+      '}';
+
+  function insertStyleSheet()
+  {
+    var styleElement = document.createElement('style');
+    styleElement.textContent = css;
+    (document.head || document.documentElement).appendChild(styleElement);
+  }
 
-    insertStyleSheet();
+  insertStyleSheet();
 
-    if (!self.isOnErrorTest) {
-        self.onerror = function(message)
+  if (!self.isOnErrorTest) {
+    self.onerror = function(message)
         {
-            errorMessage = message;
-        };
-    }
+      errorMessage = message;
+    };
+  }
 
 })();
 
@@ -107,64 +115,65 @@ function descriptionQuiet(msg) { description(msg, true); }
 
 function escapeHTML(text)
 {
-    return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/\0/g, "\\0");
+  return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/\0/g, '\\0');
 }
 
 function testPassed(msg)
 {
-    debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
+  debug('<span><span class="pass">PASS</span> ' + escapeHTML(msg) + '</span>');
 }
 
 function testFailed(msg)
 {
-    debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
+  debug('<span><span class="fail">FAIL</span> ' + escapeHTML(msg) + '</span>');
 }
 
 function areArraysEqual(_a, _b)
 {
-    try {
-        if (_a.length !== _b.length)
-            return false;
-        for (var i = 0; i < _a.length; i++)
-            if (_a[i] !== _b[i])
-                return false;
-    } catch (ex) {
+  try {
+    if (_a.length !== _b.length)
+      return false;
+    for (var i = 0; i < _a.length; i++)
+      if (_a[i] !== _b[i])
         return false;
-    }
-    return true;
+  } catch (ex) {
+    return false;
+  }
+  return true;
 }
 
 function isMinusZero(n)
 {
-    // the only way to tell 0 from -0 in JS is the fact that 1/-0 is
-    // -Infinity instead of Infinity
-    return n === 0 && 1/n < 0;
+  // the only way to tell 0 from -0 in JS is the fact that 1/-0 is
+  // -Infinity instead of Infinity
+  return n === 0 && 1 / n < 0;
 }
 
 function isResultCorrect(_actual, _expected)
 {
-    if (_expected === 0)
-        return _actual === _expected && (1/_actual) === (1/_expected);
-    if (_actual === _expected)
-        return true;
-    if (typeof(_expected) == "number" && isNaN(_expected))
-        return typeof(_actual) == "number" && isNaN(_actual);
-    if (_expected && (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([])))
-        return areArraysEqual(_actual, _expected);
-    return false;
+  if (_expected === 0)
+    return _actual === _expected && (1 / _actual) === (1 / _expected);
+  if (_actual === _expected)
+    return true;
+  if (typeof(_expected) == 'number' && isNaN(_expected))
+    return typeof(_actual) == 'number' && isNaN(_actual);
+  if (_expected &&
+      (Object.prototype.toString.call(_expected) == Object.prototype.toString.call([])))
+    return areArraysEqual(_actual, _expected);
+  return false;
 }
 
 function stringify(v)
 {
-    if (v === 0 && 1/v < 0)
-        return "-0";
-    else return "" + v;
+  if (v === 0 && 1 / v < 0)
+    return '-0';
+  else return '' + v;
 }
 
 function evalAndLog(_a, _quiet)
 {
-  if (typeof _a != "string")
-    debug("WARN: tryAndLog() expects a string argument");
+  if (typeof _a != 'string')
+    debug('WARN: tryAndLog() expects a string argument');
 
   // Log first in case things go horribly wrong or this causes a sync event.
   if (!_quiet)
@@ -172,36 +181,37 @@ function evalAndLog(_a, _quiet)
 
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-    testFailed(_a + " threw exception " + e);
+    testFailed(_a + ' threw exception ' + e);
   }
   return _av;
 }
 
 function shouldBe(_a, _b, quiet)
 {
-  if (typeof _a != "string" || typeof _b != "string")
-    debug("WARN: shouldBe() expects string arguments");
+  if (typeof _a != 'string' || typeof _b != 'string')
+    debug('WARN: shouldBe() expects string arguments');
   var exception;
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-     exception = e;
+    exception = e;
   }
   var _bv = eval(_b);
 
   if (exception)
-    testFailed(_a + " should be " + _bv + ". Threw exception " + exception);
+    testFailed(_a + ' should be ' + _bv + '. Threw exception ' + exception);
   else if (isResultCorrect(_av, _bv)) {
     if (!quiet) {
-        testPassed(_a + " is " + _b);
+      testPassed(_a + ' is ' + _b);
     }
   } else if (typeof(_av) == typeof(_bv))
-    testFailed(_a + " should be " + _bv + ". Was " + stringify(_av) + ".");
+    testFailed(_a + ' should be ' + _bv + '. Was ' + stringify(_av) + '.');
   else
-    testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ").");
+    testFailed(_a + ' should be ' + _bv + ' (of type ' + typeof _bv + '). Was ' +
+               _av + ' (of type ' + typeof _av + ').');
 }
 
 // Execute condition every 5 milliseconds until it succeed or failureTime is reached.
@@ -219,8 +229,8 @@ function _waitForCondition(condition, failureTime, completionHandler, failureHan
 
 function shouldBecomeEqual(_a, _b, completionHandler, timeout)
 {
-  if (typeof _a != "string" || typeof _b != "string")
-    debug("WARN: shouldBecomeEqual() expects string arguments");
+  if (typeof _a != 'string' || typeof _b != 'string')
+    debug('WARN: shouldBecomeEqual() expects string arguments');
 
   if (timeout === undefined)
     timeout = 500;
@@ -235,16 +245,16 @@ function shouldBecomeEqual(_a, _b, completionHandler, timeout)
     }
     var _bv = eval(_b);
     if (exception)
-      testFailed(_a + " should become " + _bv + ". Threw exception " + exception);
+      testFailed(_a + ' should become ' + _bv + '. Threw exception ' + exception);
     if (isResultCorrect(_av, _bv)) {
-      testPassed(_a + " became " + _b);
+      testPassed(_a + ' became ' + _b);
       return true;
     }
     return false;
   };
   var failureTime = Date.now() + timeout;
-  var failureHandler = function () {
-    testFailed(_a + " failed to change to " + _b + " in " + (timeout / 1000) + " seconds.");
+  var failureHandler = function() {
+    testFailed(_a + ' failed to change to ' + _b + ' in ' + (timeout / 1000) + ' seconds.');
     completionHandler();
   };
   _waitForCondition(condition, failureTime, completionHandler, failureHandler);
@@ -252,8 +262,8 @@ function shouldBecomeEqual(_a, _b, completionHandler, timeout)
 
 function shouldBecomeEqualToString(value, reference, completionHandler, timeout)
 {
-  if (typeof value !== "string" || typeof reference !== "string")
-    debug("WARN: shouldBecomeEqualToString() expects string arguments");
+  if (typeof value !== 'string' || typeof reference !== 'string')
+    debug('WARN: shouldBecomeEqualToString() expects string arguments');
   var unevaledString = JSON.stringify(reference);
   shouldBecomeEqual(value, unevaledString, completionHandler, timeout);
 }
@@ -269,9 +279,9 @@ function shouldBeType(_a, _type) {
 
   var _typev = eval(_type);
   if (_av instanceof _typev) {
-    testPassed(_a + " is an instance of " + _type);
+    testPassed(_a + ' is an instance of ' + _type);
   } else {
-    testFailed(_a + " is not an instance of " + _type);
+    testFailed(_a + ' is not an instance of ' + _type);
   }
 }
 
@@ -279,68 +289,69 @@ function shouldBeType(_a, _type) {
 // numeric _tolerance of numeric _target.
 function shouldBeCloseTo(_to_eval, _target, _tolerance, quiet)
 {
-  if (typeof _to_eval != "string") {
-    testFailed("shouldBeCloseTo() requires string argument _to_eval. was type " + typeof _to_eval);
+  if (typeof _to_eval != 'string') {
+    testFailed('shouldBeCloseTo() requires string argument _to_eval. was type ' + typeof _to_eval);
     return;
   }
-  if (typeof _target != "number") {
-    testFailed("shouldBeCloseTo() requires numeric argument _target. was type " + typeof _target);
+  if (typeof _target != 'number') {
+    testFailed('shouldBeCloseTo() requires numeric argument _target. was type ' + typeof _target);
     return;
   }
-  if (typeof _tolerance != "number") {
-    testFailed("shouldBeCloseTo() requires numeric argument _tolerance. was type " + typeof _tolerance);
+  if (typeof _tolerance != 'number') {
+    testFailed('shouldBeCloseTo() requires numeric argument _tolerance. was type ' +
+               typeof _tolerance);
     return;
   }
 
   var _result;
   try {
-     _result = eval(_to_eval);
+    _result = eval(_to_eval);
   } catch (e) {
-    testFailed(_to_eval + " should be within " + _tolerance + " of "
-               + _target + ". Threw exception " + e);
+    testFailed(_to_eval + ' should be within ' + _tolerance + ' of ' +
+               _target + '. Threw exception ' + e);
     return;
   }
 
   if (typeof(_result) != typeof(_target)) {
-    testFailed(_to_eval + " should be of type " + typeof _target
-               + " but was of type " + typeof _result);
+    testFailed(_to_eval + ' should be of type ' + typeof _target +
+               ' but was of type ' + typeof _result);
   } else if (Math.abs(_result - _target) <= _tolerance) {
     if (!quiet) {
-        testPassed(_to_eval + " is within " + _tolerance + " of " + _target);
+      testPassed(_to_eval + ' is within ' + _tolerance + ' of ' + _target);
     }
   } else {
-    testFailed(_to_eval + " should be within " + _tolerance + " of " + _target
-               + ". Was " + _result + ".");
+    testFailed(_to_eval + ' should be within ' + _tolerance + ' of ' + _target +
+               '. Was ' + _result + '.');
   }
 }
 
 function shouldNotBe(_a, _b, quiet)
 {
-  if (typeof _a != "string" || typeof _b != "string")
-    debug("WARN: shouldNotBe() expects string arguments");
+  if (typeof _a != 'string' || typeof _b != 'string')
+    debug('WARN: shouldNotBe() expects string arguments');
   var exception;
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-     exception = e;
+    exception = e;
   }
   var _bv = eval(_b);
 
   if (exception)
-    testFailed(_a + " should not be " + _bv + ". Threw exception " + exception);
+    testFailed(_a + ' should not be ' + _bv + '. Threw exception ' + exception);
   else if (!isResultCorrect(_av, _bv)) {
     if (!quiet) {
-        testPassed(_a + " is not " + _b);
+      testPassed(_a + ' is not ' + _b);
     }
   } else
-    testFailed(_a + " should not be " + _bv + ".");
+    testFailed(_a + ' should not be ' + _bv + '.');
 }
 
 function shouldBecomeDifferent(_a, _b, completionHandler, timeout)
 {
-  if (typeof _a != "string" || typeof _b != "string")
-    debug("WARN: shouldBecomeDifferent() expects string arguments");
+  if (typeof _a != 'string' || typeof _b != 'string')
+    debug('WARN: shouldBecomeDifferent() expects string arguments');
   if (timeout === undefined)
     timeout = 500;
 
@@ -354,37 +365,38 @@ function shouldBecomeDifferent(_a, _b, completionHandler, timeout)
     }
     var _bv = eval(_b);
     if (exception)
-      testFailed(_a + " should became not equal to " + _bv + ". Threw exception " + exception);
+      testFailed(_a + ' should became not equal to ' + _bv + '. Threw exception ' + exception);
     if (!isResultCorrect(_av, _bv)) {
-      testPassed(_a + " became different from " + _b);
+      testPassed(_a + ' became different from ' + _b);
       return true;
     }
     return false;
   };
   var failureTime = Date.now() + timeout;
-  var failureHandler = function () {
-    testFailed(_a + " did not become different from " + _b + " in " + (timeout / 1000) + " seconds.");
+  var failureHandler = function() {
+    testFailed(_a + ' did not become different from ' +
+               _b + ' in ' + (timeout / 1000) + ' seconds.');
     completionHandler();
   };
   _waitForCondition(condition, failureTime, completionHandler, failureHandler);
 }
 
-function shouldBeTrue(_a) { shouldBe(_a, "true"); }
-function shouldBeTrueQuiet(_a) { shouldBe(_a, "true", true); }
-function shouldBeFalse(_a) { shouldBe(_a, "false"); }
-function shouldBeNaN(_a) { shouldBe(_a, "NaN"); }
-function shouldBeNull(_a) { shouldBe(_a, "null"); }
-function shouldBeZero(_a) { shouldBe(_a, "0"); }
+function shouldBeTrue(_a) { shouldBe(_a, 'true'); }
+function shouldBeTrueQuiet(_a) { shouldBe(_a, 'true', true); }
+function shouldBeFalse(_a) { shouldBe(_a, 'false'); }
+function shouldBeNaN(_a) { shouldBe(_a, 'NaN'); }
+function shouldBeNull(_a) { shouldBe(_a, 'null'); }
+function shouldBeZero(_a) { shouldBe(_a, '0'); }
 
 function shouldBeEqualToString(a, b)
 {
-  if (typeof a !== "string" || typeof b !== "string")
-    debug("WARN: shouldBeEqualToString() expects string arguments");
+  if (typeof a !== 'string' || typeof b !== 'string')
+    debug('WARN: shouldBeEqualToString() expects string arguments');
   var unevaledString = JSON.stringify(b);
   shouldBe(a, unevaledString);
 }
 
-function shouldBeEmptyString(_a) { shouldBeEqualToString(_a, ""); }
+function shouldBeEmptyString(_a) { shouldBeEqualToString(_a, ''); }
 
 function shouldEvaluateTo(actual, expected) {
   // A general-purpose comparator.  'actual' should be a string to be
@@ -393,33 +405,33 @@ function shouldEvaluateTo(actual, expected) {
   if (expected == null) {
     // Do this before the object test, since null is of type 'object'.
     shouldBeNull(actual);
-  } else if (typeof expected == "undefined") {
+  } else if (typeof expected == 'undefined') {
     shouldBeUndefined(actual);
-  } else if (typeof expected == "function") {
+  } else if (typeof expected == 'function') {
     // All this fuss is to avoid the string-arg warning from shouldBe().
     try {
       actualValue = eval(actual);
     } catch (e) {
-      testFailed("Evaluating " + actual + ": Threw exception " + e);
+      testFailed('Evaluating ' + actual + ': Threw exception ' + e);
       return;
     }
-    shouldBe("'" + actualValue.toString().replace(/\n/g, "") + "'",
-             "'" + expected.toString().replace(/\n/g, "") + "'");
-  } else if (typeof expected == "object") {
+    shouldBe("'" + actualValue.toString().replace(/\n/g, '') + "'",
+             "'" + expected.toString().replace(/\n/g, '') + "'");
+  } else if (typeof expected == 'object') {
     shouldBeTrue(actual + " == '" + expected + "'");
-  } else if (typeof expected == "string") {
+  } else if (typeof expected == 'string') {
     shouldBe(actual, expected);
-  } else if (typeof expected == "boolean") {
-    shouldBe("typeof " + actual, "'boolean'");
+  } else if (typeof expected == 'boolean') {
+    shouldBe('typeof ' + actual, "'boolean'");
     if (expected)
       shouldBeTrue(actual);
     else
       shouldBeFalse(actual);
-  } else if (typeof expected == "number") {
+  } else if (typeof expected == 'number') {
     shouldBe(actual, stringify(expected));
   } else {
-    debug(expected + " is unknown type " + typeof expected);
-    shouldBeTrue(actual, "'"  +expected.toString() + "'");
+    debug(expected + ' is unknown type ' + typeof expected);
+    shouldBeTrue(actual, "'" expected.toString() + "'");
   }
 }
 
@@ -428,17 +440,17 @@ function shouldBeNonZero(_a)
   var exception;
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-     exception = e;
+    exception = e;
   }
 
   if (exception)
-    testFailed(_a + " should be non-zero. Threw exception " + exception);
+    testFailed(_a + ' should be non-zero. Threw exception ' + exception);
   else if (_av != 0)
-    testPassed(_a + " is non-zero.");
+    testPassed(_a + ' is non-zero.');
   else
-    testFailed(_a + " should be non-zero. Was " + _av);
+    testFailed(_a + ' should be non-zero. Was ' + _av);
 }
 
 function shouldBeNonNull(_a)
@@ -446,17 +458,17 @@ function shouldBeNonNull(_a)
   var exception;
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-     exception = e;
+    exception = e;
   }
 
   if (exception)
-    testFailed(_a + " should be non-null. Threw exception " + exception);
+    testFailed(_a + ' should be non-null. Threw exception ' + exception);
   else if (_av != null)
-    testPassed(_a + " is non-null.");
+    testPassed(_a + ' is non-null.');
   else
-    testFailed(_a + " should be non-null. Was " + _av);
+    testFailed(_a + ' should be non-null. Was ' + _av);
 }
 
 function shouldBeUndefined(_a)
@@ -464,17 +476,17 @@ function shouldBeUndefined(_a)
   var exception;
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-     exception = e;
+    exception = e;
   }
 
   if (exception)
-    testFailed(_a + " should be undefined. Threw exception " + exception);
-  else if (typeof _av == "undefined")
-    testPassed(_a + " is undefined.");
+    testFailed(_a + ' should be undefined. Threw exception ' + exception);
+  else if (typeof _av == 'undefined')
+    testPassed(_a + ' is undefined.');
   else
-    testFailed(_a + " should be undefined. Was " + _av);
+    testFailed(_a + ' should be undefined. Was ' + _av);
 }
 
 function shouldBeDefined(_a)
@@ -482,47 +494,47 @@ function shouldBeDefined(_a)
   var exception;
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-     exception = e;
+    exception = e;
   }
 
   if (exception)
-    testFailed(_a + " should be defined. Threw exception " + exception);
+    testFailed(_a + ' should be defined. Threw exception ' + exception);
   else if (_av !== undefined)
-    testPassed(_a + " is defined.");
+    testPassed(_a + ' is defined.');
   else
-    testFailed(_a + " should be defined. Was " + _av);
+    testFailed(_a + ' should be defined. Was ' + _av);
 }
 
 function shouldBeGreaterThanOrEqual(_a, _b) {
-    if (typeof _a != "string" || typeof _b != "string")
-        debug("WARN: shouldBeGreaterThanOrEqual expects string arguments");
+  if (typeof _a != 'string' || typeof _b != 'string')
+    debug('WARN: shouldBeGreaterThanOrEqual expects string arguments');
 
-    var exception;
-    var _av;
-    try {
-        _av = eval(_a);
-    } catch (e) {
-        exception = e;
-    }
-    var _bv = eval(_b);
+  var exception;
+  var _av;
+  try {
+    _av = eval(_a);
+  } catch (e) {
+    exception = e;
+  }
+  var _bv = eval(_b);
 
-    if (exception)
-        testFailed(_a + " should be >= " + _b + ". Threw exception " + exception);
-    else if (typeof _av == "undefined" || _av < _bv)
-        testFailed(_a + " should be >= " + _b + ". Was " + _av + " (of type " + typeof _av + ").");
-    else
-        testPassed(_a + " is >= " + _b);
+  if (exception)
+    testFailed(_a + ' should be >= ' + _b + '. Threw exception ' + exception);
+  else if (typeof _av == 'undefined' || _av < _bv)
+    testFailed(_a + ' should be >= ' + _b + '. Was ' + _av + ' (of type ' + typeof _av + ').');
+  else
+    testPassed(_a + ' is >= ' + _b);
 }
 
 function shouldNotThrow(_a) {
-    try {
-        eval(_a);
-        testPassed(_a + " did not throw exception.");
-    } catch (e) {
-        testFailed(_a + " should not throw exception. Threw exception " + e + ".");
-    }
+  try {
+    eval(_a);
+    testPassed(_a + ' did not throw exception.');
+  } catch (e) {
+    testFailed(_a + ' should not throw exception. Threw exception ' + e + '.');
+  }
 }
 
 function shouldThrow(_a, _e)
@@ -530,14 +542,14 @@ function shouldThrow(_a, _e)
   var exception;
   var _av;
   try {
-     _av = eval(_a);
+    _av = eval(_a);
   } catch (e) {
-     exception = e;
+    exception = e;
   }
 
   var _ev;
   if (_e)
-      _ev =  eval(_e);
+    _ev = eval(_e);
 
   if (exception) {
     // Handle WebAPIException and WebAPIError.
@@ -546,43 +558,47 @@ function shouldThrow(_a, _e)
       _ev = _ev.name;
     }
 
-    if (typeof _e == "undefined" || exception == _ev)
-      testPassed(_a + " threw exception " + exception + ".");
+    if (typeof _e == 'undefined' || exception == _ev)
+      testPassed(_a + ' threw exception ' + exception + '.');
     else
-      testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Threw exception " + exception + ".");
-  } else if (typeof _av == "undefined")
-    testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was undefined.");
-  else
-    testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
+      testFailed(_a + ' should throw ' + (typeof _e == 'undefined' ? 'an exception' : _ev) +
+                 '. Threw exception ' + exception + '.');
+  } else if (typeof _av == 'undefined') {
+    testFailed(_a + ' should throw ' + (typeof _e == 'undefined' ? 'an exception' : _ev) +
+               '. Was undefined.');
+  } else {
+    testFailed(_a + ' should throw ' + (typeof _e == 'undefined' ? 'an exception' : _ev) +
+               '. Was ' + _av + '.');
+  }
 }
 
 function shouldHaveHadError(message)
 {
-    if (errorMessage) {
-        if (!message)
-            testPassed("Got expected error");
-        else if (errorMessage.indexOf(message) !== -1)
-            testPassed("Got expected error: '" + message + "'");
-        else
-            testFailed("Unexpexted error '" + message + "'");
-    } else
-        testFailed("Missing expexted error");
-    errorMessage = undefined;
+  if (errorMessage) {
+    if (!message)
+      testPassed('Got expected error');
+    else if (errorMessage.indexOf(message) !== -1)
+      testPassed("Got expected error: '" + message + "'");
+    else
+      testFailed("Unexpexted error '" + message + "'");
+  } else
+    testFailed('Missing expexted error');
+  errorMessage = undefined;
 }
 
 function isSuccessfullyParsed()
 {
-    // FIXME: Remove this and only report unexpected syntax errors.
-    if (!errorMessage)
-        successfullyParsed = true;
-    shouldBeTrue("successfullyParsed");
-    debug('<br /><span class="pass">TEST COMPLETE</span>');
+  // FIXME: Remove this and only report unexpected syntax errors.
+  if (!errorMessage)
+    successfullyParsed = true;
+  shouldBeTrue('successfullyParsed');
+  debug('<br /><span class="pass">TEST COMPLETE</span>');
 }
 
 function finishJSTest()
 {
-    wasFinishJSTestCalled = true;
-    if (!self.wasPostTestScriptParsed)
-        return;
-    isSuccessfullyParsed();
+  wasFinishJSTestCalled = true;
+  if (!self.wasPostTestScriptParsed)
+    return;
+  isSuccessfullyParsed();
 }
index 693227c..c8a7c60 100644 (file)
@@ -140,14 +140,14 @@ FileSystemManager.prototype.listStorages = function(onsuccess, onerror) {
     cmd: 'FileSystemManagerListStorages'
   }, function(result) {
     if (result.isError)
-        onerror(new tizen.WebAPIError(result.errorCode));
+      onerror(new tizen.WebAPIError(result.errorCode));
     else {
-        var storages = [];
-        for (var i = 0; i < result.value.length; i++) {
-          var storage = result.value[i];
-          storages.push(new FileSystemStorage(storage.label, storage.type, storage.state));
-        }
-        onsuccess(storages);
+      var storages = [];
+      for (var i = 0; i < result.value.length; i++) {
+        var storage = result.value[i];
+        storages.push(new FileSystemStorage(storage.label, storage.type, storage.state));
+      }
+      onsuccess(storages);
     }
   });
 };
@@ -155,7 +155,7 @@ FileSystemManager.prototype.listStorages = function(onsuccess, onerror) {
 function handleStorageChanged(msg) {
   var storage = msg.storage;
   _listeners.forEach(function(id) {
-    _listeners[id](new FileSystemStorage(storage.label, storage.type, storage.state))
+    _listeners[id](new FileSystemStorage(storage.label, storage.type, storage.state));
   });
 }
 
@@ -434,7 +434,7 @@ function File(fullPath, parent) {
     if (status.isDirectory)
       return status.length;
     return undefined;
-   };
+  };
 
   Object.defineProperties(this, {
     'parent': { get: getParent, enumerable: true },
index b2bab2f..79dfffd 100644 (file)
@@ -141,7 +141,7 @@ exports.getScreenBrightness = function() {
   var r = JSON.parse(sendSyncMessage({
     'cmd': 'PowerGetScreenBrightness'
   }));
-  if (r['error']){
+  if (r['error']) {
     throw new tizen.WebAPIException(tizen.WebAPIException.NOT_SUPPORTED_ERR);
     return;
   }
index 29a914a..c27de41 100755 (executable)
@@ -8,6 +8,13 @@ if [ ! `which cpplint.py` ]; then
    exit 1
 fi
 
+if [ ! `which gjslint` ]; then
+   echo -e "\nPlease make sure gjslint (Google Closure Lint) is in your PATH."
+   echo -e "You can install it directly by \"sudo easy_install-2.7 http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz\"."
+   echo -e "Or visit https://developers.google.com/closure/utilities/docs/linter_howto for more information.\n"
+   exit 1
+fi
+
 # Store current dir and change to repository root dir.
 OLD_PWD=$PWD
 SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -26,8 +33,21 @@ cpplint.py --filter="$FILTERS" $(find . \
                                ! -name 'XW_Extension*.h' \
                                ! -name 'picojson.*' \
                                \( -name '*.h' -o -name '*.cc' \) )
+CPP_RET_VAL=$?
+
+gjslint --strict --nojsdoc --max_line_length 100 --unix_mode $(find . \
+                               ! -path './out*' ! -path './.git*' \
+                               ! -path './packaging' \
+                               ! -name 'jquery.*' \
+                               ! -name 'flotr2.*' \
+                               -name '*.js' )
 
 # Return to previous dir and return the code returned by cpplint.py
-RET_VAL=$?
+JS_RET_VAL=$?
 cd $OLD_PWD
-exit $RET_VAL
+
+if [ "x$CPP_RET_VAL" = "x0" -a "x$JS_RET_VAL" = "x0" ]; then
+  exit 0
+else
+  exit 1
+fi
diff --git a/tools/js_lint.sh b/tools/js_lint.sh
deleted file mode 100755 (executable)
index bc601f5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2013 Intel Corporation. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-if [ ! `which gjslint` ]; then
-   echo -e "\nPlease make sure gjslint (Google Closure Lint) is in your PATH."
-   echo -e "You can install it directly by \"sudo easy_install-2.7 http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz\"."
-   echo -e "Or visit https://developers.google.com/closure/utilities/docs/linter_howto for more information.\n"
-   exit 1
-fi
-
-if [ $# -eq 0 ]; then
-   echo -e "\nUsage: $0 path_to_js_files_to_check\n"
-   exit 1
-fi
-
-gjslint --strict --nojsdoc --max_line_length 100 --unix_mode $1
index b97c8b5..baac521 100644 (file)
@@ -45,6 +45,6 @@ Utils.prototype.validateObject = function(object, signature, attributes) {
   }
 
   return true;
-}
+};
 
 exports = new Utils();