diff --git a/PrivacyPolicy.md b/PrivacyPolicy.md new file mode 100644 index 0000000..b545790 --- /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) 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 +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 + + 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). 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/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. diff --git a/js/background.js b/js/background.js index 8b20cd2..60d2935 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) * @@ -256,9 +238,8 @@ 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()) + dateToday = (new Date()), cExtVersion = chrome.runtime.getManifest().version; // replace period '.' chars with dashes '-' for firebase to accept it 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 2dcbc5d..57f187c 100644 --- a/manifest.json +++ b/manifest.json @@ -7,14 +7,13 @@ "permissions": [ "storage", - "tabs", - "history" + "tabs" ], "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", @@ -54,16 +53,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