From 33c84e5caf78f86c6b736f7ab751fe8dc8bccb14 Mon Sep 17 00:00:00 2001 From: Oleksandr Bardanov Date: Fri, 27 Nov 2015 12:57:28 +0200 Subject: [PATCH] v0.5.20 - remove online tracking --- main.js | 2 -- package.json | 2 +- services/onlineTracking.js | 64 -------------------------------------- 3 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 services/onlineTracking.js diff --git a/main.js b/main.js index 8b3a2f9..86e379d 100644 --- a/main.js +++ b/main.js @@ -24,7 +24,5 @@ define(function (require, exports, module) { require('./services/tabSize'); require('./services/fonts').init(); - require('./services/onlineTracking').init(); - new GeneralOptions(); }); diff --git a/package.json b/package.json index 58f8485..3de2d65 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "title": "Documents Toolbar", "description": "Adds toolbar with tabs of open documents on the top of the editor. Now with split view support!", "homepage": "https://github.com/dnbard/brackets-documents-toolbar", - "version": "0.5.19", + "version": "0.5.20", "author": "Alex Bardanov", "license": "MIT", "engines": { diff --git a/services/onlineTracking.js b/services/onlineTracking.js deleted file mode 100644 index a36a6d0..0000000 --- a/services/onlineTracking.js +++ /dev/null @@ -1,64 +0,0 @@ -// This is example of a client for extenstion online tracking service -// Part of Brackets Extension Rating extension by Alex Bardanov -// https://github.com/dnbard/brackets-extension-rating - -// use require('./onlineTrackingClient').init() to activate tracking - -define(function(require, exports){ - var trackingServiceUrl = 'http://online-dnbard.rhcloud.com/', - // http://online-dnbard.rhcloud.com/ is an address of default tracking service - // Change it if you use self-hosting instance of online tracking service - appToken = '53eca7616073b96ad100017a', - // read https://github.com/dnbard/brackets-extension-rating/wiki/Online-and-max-users-counters-in-this-extension - // to learn on how to obtain an application token for your extension - mins60 = 60 * 60 * 1000, - mins5 = 5 * 60 * 1000, - keyId = 'ext-online-id'; - - function tick(){ - var userId = getUserId(appToken, keyId), - url; - - if (userId){ - url = trackingServiceUrl + 'tick/' + appToken + '/' + userId; - } else { - url = trackingServiceUrl + 'tick/' + appToken; - } - - $.ajax({ url: url }) - .success(function(data){ - //TODO: create complex model of data in local storage to support any number of extensions - if (data && data !== 'OK' && data !== 'ERROR'){ - saveUserId(data, appToken, keyId); - } - }).error(function(){ - console.log('Can\'t track online status, retry in 5 mins'); - setTimeout(tick, mins5); - }); - } - - function init(){ - tick(); - setInterval(tick, mins60); - } - - function getUserId(appToken, keyId){ - if (typeof appToken !== 'string' || typeof keyId !== 'string'){ - throw new Error('Invalid argument'); - } - - return JSON.parse(localStorage.getItem(keyId) || '{ }')[appToken]; - } - - function saveUserId(id, appToken, keyId){ - if (typeof id !== 'string' || typeof appToken !== 'string' || typeof keyId !== 'string'){ - throw new Error('Invalid argument'); - } - - var obj = JSON.parse(localStorage.getItem(keyId) || '{ }'); - obj[appToken] = id; - localStorage.setItem(keyId, JSON.stringify(obj)); - } - - exports.init = init; -});