diff --git a/js/components/addressBook/addressBook_controller.js b/js/components/addressBook/addressBook_controller.js index 636f09e92..69aa63f90 100644 --- a/js/components/addressBook/addressBook_controller.js +++ b/js/components/addressBook/addressBook_controller.js @@ -4,8 +4,22 @@ angular.module('contactsApp') ctrl.showUrl = false; /* globals oc_config */ + + function compareVersion(version1, version2) { + for(var i = 0; i < Math.max(version1.length, version2.length); i++) { + a = version1[i] || 0; + b = version2[i] || 0; + if(Number(a) < Number(b)) { + return true + } + if(version1[i] !== version2[i]) { + return false + } + } + return false; + } /* eslint-disable camelcase */ - ctrl.canExport = oc_config.version.split('.') >= [9, 0, 2, 0]; + ctrl.canExport = compareVersion([9, 0, 2, 0], oc_config.version.split('.')); /* eslint-enable camelcase */ ctrl.toggleShowUrl = function() {