Skip to content

Commit

Permalink
merged version # - 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Beamanator committed Feb 21, 2018
2 parents c674771 + 91ff7b4 commit 707ee17
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 228 deletions.
26 changes: 26 additions & 0 deletions PrivacyPolicy.md
Original file line number Diff line number Diff line change
@@ -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


3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
55 changes: 0 additions & 55 deletions html/popup.html

This file was deleted.

64 changes: 0 additions & 64 deletions js/ViewManipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 1 addition & 20 deletions js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
*
Expand Down Expand Up @@ -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
Expand Down
73 changes: 0 additions & 73 deletions js/popup.js

This file was deleted.

19 changes: 3 additions & 16 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
*/
}

0 comments on commit 707ee17

Please # to comment.