From 5875d0e662f3a99b94bc8e2172d1601eba7bbcae Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:00:31 +0200 Subject: [PATCH 01/11] Removed old data recovery fns --- js/ViewManipulator.js | 64 ------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/js/ViewManipulator.js b/js/ViewManipulator.js index ab71178..e64a48d 100644 --- a/js/ViewManipulator.js +++ b/js/ViewManipulator.js @@ -232,70 +232,6 @@ function mCreateSaveButton(url) { SetupRipsSubmitListener(url, 'input[value="Save"].newField'); } -/** - * Function called by click of the restore-ui-action button. Gets processes CACHED_DATA, - * then displays the data on the page (if possible!) - * - * @param {any} e_click click event handler - * @param {any} CACHED_DATA cached data from previous save - */ -function mRecoverData( e_click, CACHED_DATA ) { - // var $button = $(this); - var errMessage = ''; - - Object.keys(CACHED_DATA).forEach(function(key, index) { - $elemsFound = $('[name="' + key + '"][type!="hidden"]'); - - if ( $elemsFound.length > 1 || $elemsFound.length === 0 ) { - // if jQuery finds 0 or more than 1 matching element, log error and skip processing - errMessage += 'key (' + key + ') not handled appropriately on data recovery.'; - return; - } - - var value = CACHED_DATA[key]; - - // check if data is checkbox -> handled differently - if ( $elemsFound.attr('type') === 'checkbox' ) { - - // if value is true, check checkbox - var checked = value === 'false' ? false : true; - - if ( checked ) - $elemsFound.prop('checked', true); - - } else { - // put non-checkbox cached data back onto page - $($elemsFound).val( value ); - } - }); - - if (errMessage !== '') - console.log(errMessage); - - // Finally, delete from cached data - mClearCachedData('CALLED FROM mRecoverData'); -} - -/** - * Function clears cached data from chrome local storage, then hides restore-ui panel - * - * @param {jQuery event} e_click jQuery click event from clicking clear button - */ -function mClearCachedData( e_click ) { - // time to delete cached data! - var mObj = { - action: 'clear_data_from_chrome_storage_local', - dataObj: { - 'CACHED_DATA': '' - } - }; - - // On callback, hide restore panel - chrome.runtime.sendMessage(mObj, function() { - $('#restore-ui').hide(500); - }); -} - /** * Function cleans attendance note text from "History" page by running note * text through some regex replacements, then pasting the data back into the page. From ff445ee8d2b1e30951bd605f9054ba17a5e91430 Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:13:02 +0200 Subject: [PATCH 02/11] Removed old popup files --- html/popup.html | 55 ------------------------------------- js/popup.js | 73 ------------------------------------------------- manifest.json | 4 +-- 3 files changed, 2 insertions(+), 130 deletions(-) delete mode 100644 html/popup.html delete mode 100644 js/popup.js diff --git a/html/popup.html b/html/popup.html deleted file mode 100644 index ac54688..0000000 --- a/html/popup.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - RIPS Validation Popup - - - - - - - - -
- Validation -
-
- UNHCR Case #
- Phone # - - - -
-
- - diff --git a/js/popup.js b/js/popup.js deleted file mode 100644 index 12ec827..0000000 --- a/js/popup.js +++ /dev/null @@ -1,73 +0,0 @@ -$(document).ready(function() { - initScript(); -}) -// ================================ FIELD VALIDATION ================================== - -/** - * Function aligns validation checkboxes with data from chrome local storage - * Function gets data from local storage via background.js - * - * @param {array} keys - */ -function initializeValidationCheckboxes() { - - var dataKeys = [ - "VALID_UNHCR", - "VALID_PHONE", - "VALID_DATES", - "VALID_APPT" - ]; - - // setup action for background.js - var mObj = { - action: "get_data_from_chrome_storage_local", - key: 'key' - }; - - // add all dataKeys to mObj (in serializable format) - for (let i = 0; i < dataKeys.length; i++) { - var objKey = 'key' + i; - mObj[objKey] = dataKeys[i]; - } - - // send data to background.js - chrome.runtime.sendMessage(mObj, function(response) { - var responseKey = mObj.key; - - // successes should come back in the same order, so: - var valUNHCR = response[responseKey + '0']; - var valPhone = response[responseKey + '1']; - // var valDates = response[2]; - // var valAppt = response[3]; - - if ( typeof(valUNHCR) === 'boolean') - $('input[value="validate_unhcr"]').prop('checked', valUNHCR); - - if ( typeof(valPhone) === 'boolean') - $('input[value="validate_phone"]').prop('checked', valPhone); - - // if (valDates === true) { $('input[value="validate_dates"]').prop(); } - // if (valAppt === true) { $('input[value="validate_appt_no"]').prop(); } - }); -} - -// holds all initialization stuff -function initScript() { - initializeValidationCheckboxes(); - - // adding click event binding to validation checkboxes - $('input[type="checkbox"]').click(function() { - - var val = $( this ).val(); - var state = $( this ).prop('checked'); - - chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { - var activeTab = tabs[0]; - chrome.tabs.sendMessage(activeTab.id, { - "message": "clicked_browser_action", - "value": val, - "on": state - }); - }); - }); -} \ No newline at end of file diff --git a/manifest.json b/manifest.json index ea533f7..b269fda 100644 --- a/manifest.json +++ b/manifest.json @@ -13,8 +13,8 @@ "browser_action": { "default_icon": { "32": "img/icon32.ico" // unpacked exts need .png :) - }//, - // "default_popup": "html/popup.html" + } + // "default_popup": "html or js here" }, "icons": { "48": "img/icon48.png", From 8e48833808536e6b17e0fca7a79495907e31dd1f Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:13:45 +0200 Subject: [PATCH 03/11] removed old oauth props --- manifest.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/manifest.json b/manifest.json index b269fda..1ba1a3c 100644 --- a/manifest.json +++ b/manifest.json @@ -54,16 +54,4 @@ "page": "html/background.html" }, "content_security_policy":"script-src 'self' 'unsafe-eval' https://www.gstatic.com/ https://*.firebaseio.com https://www.googleapis.com; object-src 'self'" - /* - TODO: add these properties: - - "oauth2": { - "client_id": "197993359621-6q4s20irj442v5n7kpfd4ob54u88b8ih.apps.googleusercontent.com", - "scopes": [ - "https://www.googleapis.com/auth/userinfo.email", - "https://www.googleapis.com/auth/userinfo.profile" - ] - }, - "key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA20tPoEJrU6IouTlxhEgtCB3exSbK/XJ/mgI1c2S/11llvVZcQJ2ioVVrzabjvhS1MeEwmFmvk2ioBRp22LzfgFhqVsGDqXCub0+Tc3QQZp0tIJ6YOFy02NA/NSAbCdtg5fF7iqZIRG4DvYBQbkHS4SG/YbqYC05ZjhsnquP9FLn3I1Qpb2URViXJFduJklp5Cu85r+qEmwCNFHDuEIUXDFuV3qpA0EcH1mrsACNUW2RPshfpttgpDPNaoxQ8wBsreW9Bl4Rju6o2sgA+mK1K+X3qlpUKtu8QcP70ivGhscDm9J07qfvdYtUa8JQtvW26/HP9SVs7k4x/6+UaByYvBQIDAQAB" - */ } \ No newline at end of file From a3077f8916973c8b8e2f2d98e8a53997451836cc Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:16:17 +0200 Subject: [PATCH 04/11] Removed old chrome history data gathering --- js/background.js | 18 ------------------ manifest.json | 3 +-- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/js/background.js b/js/background.js index 8b20cd2..18acc63 100644 --- a/js/background.js +++ b/js/background.js @@ -52,13 +52,6 @@ chrome.runtime.onMessage.addListener(function(mObj, MessageSender, sendResponse) async = true; break; - // gets data from chrome history - case 'get_data_from_chrome_history': - getChromeHistoryItems(mObj, sendResponse); - // async because uses promises - async = true; - break; - // save data to chrome's local storage case 'store_data_to_chrome_storage_local': storeToChromeLocalStorage(mObj, sendResponse); @@ -142,17 +135,6 @@ function getValuesFromChromeLocalStorage(mObj, responseCallback) { }); } -function getChromeHistoryItems(mObj, responseCallback) { - chrome.history.search({ - 'text': 'rips.247lib.com/stars/', - 'maxResults': 20 - }, function(results) { - console.log('history results:', results); - - responseCallback(results); - }); -} - /** * Function stores data to chrome local storage based off config object (mObj) * diff --git a/manifest.json b/manifest.json index 1ba1a3c..1d0e6b0 100644 --- a/manifest.json +++ b/manifest.json @@ -7,8 +7,7 @@ "permissions": [ "storage", - "tabs", - "history" + "tabs" ], "browser_action": { "default_icon": { From 57233a1ba8190a8ce7a67bbb0e91d9ecbecbd0d7 Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:18:39 +0200 Subject: [PATCH 05/11] removed excess debugger --- js/background.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/background.js b/js/background.js index 18acc63..c330dbf 100644 --- a/js/background.js +++ b/js/background.js @@ -238,7 +238,6 @@ function clearDataFromChromeLocalStorage(mObj, responseCallback) { * @param {object} mObj - message config object with username data */ function FB_handleUserLogin(fb, mObj) { - debugger; let username = mObj.username, dateToday = (new Date()) cExtVersion = chrome.runtime.getManifest().version; From 9f1878c3eb3660915e41402abe2c8e1a03c0404e Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:32:05 +0200 Subject: [PATCH 06/11] Added missing comma (,) --- js/background.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/background.js b/js/background.js index c330dbf..60d2935 100644 --- a/js/background.js +++ b/js/background.js @@ -239,7 +239,7 @@ function clearDataFromChromeLocalStorage(mObj, responseCallback) { */ function FB_handleUserLogin(fb, mObj) { let username = mObj.username, - dateToday = (new Date()) + dateToday = (new Date()), cExtVersion = chrome.runtime.getManifest().version; // replace period '.' chars with dashes '-' for firebase to accept it From fddec0f9e86ff9b832ea6d8d5211add5932a2965 Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:32:15 +0200 Subject: [PATCH 07/11] initial commit --- PrivacyPolicy.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 PrivacyPolicy.md diff --git a/PrivacyPolicy.md b/PrivacyPolicy.md new file mode 100644 index 0000000..1589fad --- /dev/null +++ b/PrivacyPolicy.md @@ -0,0 +1,26 @@ +# Privacy Policy +Here are the ways that the RIPS Validation Extension changes / uses your webpage: + +## Login Name Tracking +When users log in to RIPS, username is stored in Firebase Database. This is the data stored in the database: +1) username +2) last login date +3) # of times user has logged in, on current version of extension + +This is meant for a few purposes: +1) Tracking how many RIPS users have accessed RIPS on current version of extension +2) When new staff is hired, make sure they are using RIPS with the extension is installed +3) If some data is stored in RIPS with invalid format, confirm that they disabled or deleted the extension via Firebase. + +## Chrome Dev Features +1) chrome.runtime + - listens to background messages, sends commands between background.js and MainContent.js. + - Commands include: + - Getting / storing data from chrome local storage + - storing rips username count to Firebase +2) chrome.tabs + - sends command to main page +3) chrome.storage + - stores / edits / listens to local storage data changes + + From e43005f442488ab016be7e7baa385cad94a27b2c Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 18 Jan 2018 12:34:03 +0200 Subject: [PATCH 08/11] Added comment about privacy policy --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3c63382..7680524 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,6 @@ Chrome Extension that adds some special features to RIPS Thus far (as of today) we've added Phone number validation, UNHCR number validation (4 or 5 formats) and Date of birth validation. This extension has also manipulated the RIPS view a bit, and now tracks some user login occurrances just for fun. + +## Privacy Policy +To see how this extension accesses and manipulates data on the page, see the [PrivacyPolicy document](https://github.com/Beamanator/RIPS-Validation-CExt/blob/master/PrivacyPolicy.md). From c4463fa89f136e69fc0bf782f8868a259740d45c Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 18 Jan 2018 12:38:54 +0200 Subject: [PATCH 09/11] Fixed "# vs number" problem --- PrivacyPolicy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PrivacyPolicy.md b/PrivacyPolicy.md index 1589fad..a00bd53 100644 --- a/PrivacyPolicy.md +++ b/PrivacyPolicy.md @@ -5,7 +5,7 @@ Here are the ways that the RIPS Validation Extension changes / uses your webpage When users log in to RIPS, username is stored in Firebase Database. This is the data stored in the database: 1) username 2) last login date -3) # of times user has logged in, on current version of extension +3) Number of times user has logged in, on current version of extension This is meant for a few purposes: 1) Tracking how many RIPS users have accessed RIPS on current version of extension From fcd890cf02dccae018637fc9428023ac7e99d480 Mon Sep 17 00:00:00 2001 From: Beamanator Date: Thu, 18 Jan 2018 12:40:02 +0200 Subject: [PATCH 10/11] Publishing v0.1.20 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 1d0e6b0..2603e9f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "RIPS Extension - Validation", - "version": "0.1.20", + "version": "0.1.21", "description": "RIPS Extension - Adds validation on UNHCR #, Phone #, and DOB", From 91ff7b4b356d82f8ee639bfc5f8beaec03628c8d Mon Sep 17 00:00:00 2001 From: Alex Beaman Date: Thu, 18 Jan 2018 12:54:18 +0200 Subject: [PATCH 11/11] bolded specific chrome extension name --- PrivacyPolicy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PrivacyPolicy.md b/PrivacyPolicy.md index a00bd53..b545790 100644 --- a/PrivacyPolicy.md +++ b/PrivacyPolicy.md @@ -1,5 +1,5 @@ # Privacy Policy -Here are the ways that the RIPS Validation Extension changes / uses your webpage: +Here are the ways that the **RIPS Validation Extension** changes / uses your webpage: ## Login Name Tracking When users log in to RIPS, username is stored in Firebase Database. This is the data stored in the database: