mirror of
https://github.com/wassname/mad.git
synced 2026-06-27 16:10:31 +08:00
v3.0.0
This commit is contained in:
+7
-7
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "Mindful-Anti-Distraction",
|
"name": "Mindful-Anti-Distraction",
|
||||||
"version": "0.3.0",
|
"version": "0.3.0",
|
||||||
"description": "Chrome extension to help curtail poor internet habits",
|
"description": "Chrome extension to help curtail poor internet habits",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/qt31415926/mad"
|
"url": "https://github.com/qt31415926/mad"
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"grunt": "^0.4.5",
|
"grunt": "^0.4.5",
|
||||||
"grunt-contrib-compress": "^0.13.0",
|
"grunt-contrib-compress": "^0.13.0",
|
||||||
"grunt-crx": "^0.3.4",
|
"grunt-crx": "^1.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Binary file not shown.
+13
-14
@@ -4,6 +4,7 @@
|
|||||||
<title>MAD</title>
|
<title>MAD</title>
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="js/shared/jquery.min.js"></script>
|
<script src="js/shared/jquery.min.js"></script>
|
||||||
|
<script src="js/shared/jquery-ui.min.js"></script>
|
||||||
<script src="js/fuzzyset.js"></script>
|
<script src="js/fuzzyset.js"></script>
|
||||||
<script src="js/shared/bootstrap.min.js"></script>
|
<script src="js/shared/bootstrap.min.js"></script>
|
||||||
<script src="js/shared/angular.min.js"></script>
|
<script src="js/shared/angular.min.js"></script>
|
||||||
@@ -29,8 +30,9 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="text-center content" ng-controller="HeaderController">
|
<div class="text-center content" ng-controller="HeaderController">
|
||||||
<h1>MAD: <small>Mindful Anti Distraction</small></h1>
|
<h1>MAD: <small>Mindful Anti Distraction</small></h1>
|
||||||
<button class='btn btn-danger' ng-click='openOptions("lg")'>Block List</button>
|
<button class='btn btn-danger' ng-click='openOptions("lg")'>Block List <span class="glyphicon glyphicon-th-list"></span></button>
|
||||||
<button class='btn btn-success' ng-click='openReasons("lg")'>Reason Tracker</button>
|
<button ng-if="useReasons" class='btn btn-success' ng-click='openReasons("lg")'>Reason Tracker <span class="glyphicon glyphicon-eye-open"></span></button>
|
||||||
|
<button class='btn btn-primary' ng-click='openSettings()'>Options<span class="glyphicon glyphicon-cog"></span></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row content">
|
<div class="row content">
|
||||||
@@ -46,8 +48,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div ng-hide="!editMode[$index]">
|
<div ng-hide="!editMode[$index]">
|
||||||
<a href=""><span class='glyphicon glyphicon-chevron-left' aria-hidden="true" ng-click='switchPic("left", $index)'></span></a>
|
<a href=""><span class='glyphicon glyphicon-chevron-left' aria-hidden="true" ng-click='switchPic("left", $index)'></span></a>
|
||||||
<img ng-src="{{ alt.imgsrc }}" class="restrict-img-circle img-circle">
|
<img ng-src="{{ alt.imgsrc }}" class="restrict-img-circle img-circle">
|
||||||
<a href=""><span class='glyphicon glyphicon-chevron-right' aria-hidden="true" ng-click='switchPic("right", $index)'></span></a>
|
<a href=""><span class='glyphicon glyphicon-chevron-right' aria-hidden="true" ng-click='switchPic("right", $index)'></span></a>
|
||||||
<input class='form-control text-center nice-form-control' ng-model="alt.text" ></h3>
|
<input class='form-control text-center nice-form-control' ng-model="alt.text" ></h3>
|
||||||
</div>
|
</div>
|
||||||
<button class='btn btn-xs btn-danger' ng-click='deleteAlt($index)'><span class='glyphicon glyphicon-trash' aria-hidden="true"></span></button>
|
<button class='btn btn-xs btn-danger' ng-click='deleteAlt($index)'><span class='glyphicon glyphicon-trash' aria-hidden="true"></span></button>
|
||||||
@@ -130,30 +132,27 @@
|
|||||||
<form class="form-horizontal">
|
<form class="form-horizontal">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="input-a">Retype</label>
|
<label class="col-sm-2 control-label" for="input-a">Retype</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-9">
|
||||||
<input type="text" id="input-a" class="custwidth form-control"></input>
|
<input type="text" id="input-a" class="form-control"></input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div ng-show="useReasons" class="form-group">
|
||||||
<label class="col-sm-2 control-label" for="input-b">Reason Tracking (Optional)</label>
|
<label class="col-sm-2 control-label" for="input-b">Reason Tracking (Optional)</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-9">
|
||||||
<input type="text" id="input-b" class="custwidth form-control" ng-model="reason"></input>
|
<input type="text" id="input-b" class="form-control" ng-model="reason"></input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<input id="submit1" class="btn btn-primary" type="submit" value="Verify">
|
<a id="submit1" class="btn btn-primary" type="submit" href="#target">Verify</a>
|
||||||
<a id="submit2" class="btn btn-success" href="#" disabled="enabled" ng-click='enterSite()'>Enter Site</a>
|
<a id="submit2" class="btn btn-success" href="#" disabled="enabled" ng-click="enterSite($event)">Enter Site</a>
|
||||||
<br><strong id="message"></strong>
|
<br><strong id="message"></strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
|
||||||
<h2 class="btn btn-danger text-center">HELP IM DISTRACTED</h2>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
+32
-2
@@ -1,8 +1,38 @@
|
|||||||
|
|
||||||
var currTabs = []; //TODO add additional information to these objects, e.g. time
|
var currTabs = [];
|
||||||
var updateInterval = 5;
|
var updateInterval = 5;
|
||||||
var cumulativeTime = 0;
|
var cumulativeTime = 0;
|
||||||
var totalTime = 0;
|
var totalTime = 0;
|
||||||
|
var settings = {};
|
||||||
|
|
||||||
|
var defaultSettings = {
|
||||||
|
"numOfPasses": 1,
|
||||||
|
"useReasonList": true
|
||||||
|
};
|
||||||
|
|
||||||
|
var updateSettings = function(){
|
||||||
|
chrome.storage.sync.get('settings', function(items){
|
||||||
|
if (items.settings == undefined){
|
||||||
|
settings = defaultSettings;
|
||||||
|
} else {
|
||||||
|
settings = items.settings;
|
||||||
|
}
|
||||||
|
console.log(settings);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
updateSettings();
|
||||||
|
|
||||||
|
var saveSettings = function(){
|
||||||
|
chrome.storage.sync.set({'settings': settings}, function(){
|
||||||
|
console.log('settings saved');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var deleteSettings = function(){
|
||||||
|
chrome.storage.sync.remove('settings', function(){
|
||||||
|
console.log('settings deleted');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function updateTimes(){
|
function updateTimes(){
|
||||||
chrome.idle.queryState(60, function (state){
|
chrome.idle.queryState(60, function (state){
|
||||||
@@ -38,4 +68,4 @@ chrome.webRequest.onBeforeRequest.addListener(
|
|||||||
["blocking"]
|
["blocking"]
|
||||||
);
|
);
|
||||||
|
|
||||||
setInterval(updateTimes, updateInterval * 1000);
|
//setInterval(updateTimes, updateInterval * 1000);
|
||||||
|
|||||||
+12
-16
@@ -2,15 +2,7 @@
|
|||||||
<html ng-app="app" ng-csp>
|
<html ng-app="app" ng-csp>
|
||||||
<head>
|
<head>
|
||||||
<title>MAD Options</title>
|
<title>MAD Options</title>
|
||||||
<script src="js/shared/bootstrap.min.js"></script>
|
</head>
|
||||||
<!-- <script src="js/shared/angular.min.js"></script>
|
|
||||||
<script src="js/shared/ui-bootstrap-ng.min.js"></script>-->
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
|
|
||||||
<link rel="stylesheet" href="css/main.css">
|
|
||||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
|
||||||
</head>
|
|
||||||
<body>
|
<body>
|
||||||
<div class='modal-header text-center'>
|
<div class='modal-header text-center'>
|
||||||
<h1> BlockList </h1>
|
<h1> BlockList </h1>
|
||||||
@@ -35,21 +27,25 @@
|
|||||||
<h3>ASSIST FUTURE SELF</h3>
|
<h3>ASSIST FUTURE SELF</h3>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<h4>Simple Block</h4>
|
<h4>Simple Block</h4>
|
||||||
<div class='col-md-10'>
|
<form ng-submit="addSimple()">
|
||||||
<input id="simpleDomain" ng-model="simple" type='text' class='form-control' placeholder='e.g. reddit or twitter'/>
|
<div class='col-md-10'>
|
||||||
</div>
|
<input id="simpleDomain" ng-model="simple" type='text' class='form-control' placeholder='e.g. reddit or twitter'/>
|
||||||
<div class='col-md-2 modal-right-button'>
|
</div>
|
||||||
<button class='btn btn-success btn-sm' ng-click='addSimple()'>Add</button>
|
<div class='col-md-2 modal-right-button'>
|
||||||
</div>
|
<button class='btn btn-success btn-sm'>Add</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<h4>Exactsies Block</h4>
|
<h4>Exactsies Block</h4>
|
||||||
|
<form ng-submit="addExact()">
|
||||||
<div class='col-md-10'>
|
<div class='col-md-10'>
|
||||||
<input id="exactUrl" ng-model="exact" type='text' class='form-control' placeholder='e.g. http://www.reddit.com/r/all'/>
|
<input id="exactUrl" ng-model="exact" type='text' class='form-control' placeholder='e.g. http://www.reddit.com/r/all'/>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-2 modal-right-button'>
|
<div class='col-md-2 modal-right-button'>
|
||||||
<button class='btn btn-success btn-sm' ng-click='addExact()'>Add</button>
|
<button class='btn btn-success btn-sm'>Add</button>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class='row'>
|
<!-- <div class='row'>
|
||||||
<h4>Custom Regex</h4>
|
<h4>Custom Regex</h4>
|
||||||
|
|||||||
@@ -66,3 +66,17 @@ blockquote{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.max-height{
|
||||||
|
min-height: 300px;
|
||||||
|
height: 100% !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#settings-container{
|
||||||
|
max-width: 950px;
|
||||||
|
margin: auto;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clicky{
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
var app = angular.module("app",['ui.bootstrap']);
|
var app = angular.module("app",['ui.bootstrap' ]);
|
||||||
|
|
||||||
var bkg = chrome.extension.getBackgroundPage();
|
var bkg = chrome.extension.getBackgroundPage();
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,33 @@
|
|||||||
app.controller('FooterController', ['$scope', '$modal',
|
app.controller('FooterController', ['$scope', '$modal',
|
||||||
function($scope){
|
function($scope){
|
||||||
|
$scope.useReasons = bkg.settings['useReasonList'];
|
||||||
|
|
||||||
chrome.storage.sync.get('reasons', function(items){
|
chrome.storage.sync.get('reasons', function(items){
|
||||||
if (items.reasons == undefined){
|
if (items.reasons == undefined){
|
||||||
$scope.listOfReasons = [];
|
$scope.listOfReasons = {
|
||||||
|
unsorted: [],
|
||||||
|
good: [],
|
||||||
|
bad: []
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
$scope.listOfReasons = items.reasons;
|
$scope.listOfReasons = items.reasons;
|
||||||
}
|
}
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.enterSite = function(){
|
$scope.enterSite = function(href){
|
||||||
if ($scope.reason == "") return;
|
var reason = $scope.reason;
|
||||||
console.log($scope.listOfReasons);
|
if (reason == "" || reason.length == 0 || reason == undefined) return;
|
||||||
$scope.listOfReasons.push($scope.reason);
|
var currTabs = chrome.extension.getBackgroundPage().currTabs;
|
||||||
chrome.storage.sync.set( {'reasons': $scope.listOfReasons}, function(){
|
var result = "";
|
||||||
});
|
var reasonObj = {
|
||||||
|
reason: reason,
|
||||||
|
link: href.target.href,
|
||||||
|
time: Date.now()
|
||||||
|
};
|
||||||
|
console.log(reasonObj);
|
||||||
console.log($scope.listOfReasons);
|
console.log($scope.listOfReasons);
|
||||||
|
$scope.listOfReasons['unsorted'].push(reasonObj);
|
||||||
|
chrome.storage.sync.set( {'reasons': $scope.listOfReasons}, function(){ console.log("reasons saved"); });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
@@ -2,17 +2,67 @@ var ReasonTrackerModalInstanceCtrl = function($scope, $modalInstance){
|
|||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$modalInstance.dismiss('cancel');
|
$modalInstance.dismiss('cancel');
|
||||||
};
|
};
|
||||||
|
|
||||||
chrome.storage.sync.get('reasons', function(item){
|
chrome.storage.sync.get('reasons', function(item){
|
||||||
if (item.reasons == undefined){
|
if (item.reasons == undefined){
|
||||||
$scope.reasons = [];
|
$scope.reasons = {
|
||||||
|
unsorted: [],
|
||||||
|
good: [],
|
||||||
|
bad: []
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
console.log(item.reasons);
|
$scope.unsortedReasons = item.reasons['unsorted'];
|
||||||
$scope.reasons = item.reasons;
|
$scope.goodReasons = item.reasons['good'];
|
||||||
|
$scope.badReasons= item.reasons['bad'];
|
||||||
}
|
}
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.move = function(dir, current, index){
|
||||||
|
if (current == 'unsorted'){
|
||||||
|
var temp = $scope.unsortedReasons.splice(index, 1)[0];
|
||||||
|
if (dir== 'left'){
|
||||||
|
$scope.goodReasons.push(temp);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$scope.badReasons.push(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (current == 'good'){
|
||||||
|
var temp = $scope.goodReasons.splice(index, 1)[0];
|
||||||
|
$scope.unsortedReasons.push(temp);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var temp = $scope.badReasons.splice(index, 1)[0];
|
||||||
|
$scope.unsortedReasons.push(temp);
|
||||||
|
};
|
||||||
|
var tempArr = {
|
||||||
|
unsorted: $scope.unsortedReasons,
|
||||||
|
good: $scope.goodReasons,
|
||||||
|
bad: $scope.badReasons
|
||||||
|
};
|
||||||
|
chrome.storage.sync.set({'reasons': tempArr}, function(){
|
||||||
|
console.log('saved reasons');
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.clearAll = function(){
|
||||||
|
var tempArr = {
|
||||||
|
unsorted: [],
|
||||||
|
good: [],
|
||||||
|
bad: []
|
||||||
|
};
|
||||||
|
$scope.unsortedReasons = tempArr['unsorted'];
|
||||||
|
$scope.goodReasons = tempArr['good'];
|
||||||
|
$scope.badReasons= tempArr['bad'];
|
||||||
|
chrome.storage.sync.set({'reasons': tempArr}, function(){
|
||||||
|
console.log('saved reasons');
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var BlockListModalInstanceCtrl = function($scope, $modalInstance) {
|
var BlockListModalInstanceCtrl = function($scope, $modalInstance) {
|
||||||
|
|
||||||
$scope.blocklist = bkg.blockList;
|
$scope.blocklist = bkg.blockList;
|
||||||
@@ -109,6 +159,7 @@ var BlockListModalInstanceCtrl = function($scope, $modalInstance) {
|
|||||||
|
|
||||||
app.controller('HeaderController', ['$scope', '$modal',
|
app.controller('HeaderController', ['$scope', '$modal',
|
||||||
function($scope, $modal){
|
function($scope, $modal){
|
||||||
|
$scope.useReasons = bkg.settings['useReasonList'];
|
||||||
$scope.openOptions = function(size) {
|
$scope.openOptions = function(size) {
|
||||||
var modalInstance = $modal.open({
|
var modalInstance = $modal.open({
|
||||||
templateUrl:'../../blocklist.html',
|
templateUrl:'../../blocklist.html',
|
||||||
@@ -125,7 +176,9 @@ app.controller('HeaderController', ['$scope', '$modal',
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$scope.openSettings = function(){
|
||||||
|
chrome.runtime.openOptionsPage();
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,5 +19,8 @@ popup.controller('PopupController', ['$scope',
|
|||||||
$scope.testfunc = function(){
|
$scope.testfunc = function(){
|
||||||
alert("DOES WORK>?");
|
alert("DOES WORK>?");
|
||||||
}
|
}
|
||||||
|
$scope.openSettings = function(){
|
||||||
|
chrome.runtime.openOptionsPage();
|
||||||
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
settings.controller('SettingsController', ['$scope',
|
||||||
|
function($scope){
|
||||||
|
$scope.currentSettings = bkg.settings;
|
||||||
|
$scope.numberList = [1,2,3,4,5,6,7,8,9,10];
|
||||||
|
$scope.yesNo = [true,false];
|
||||||
|
|
||||||
|
|
||||||
|
$scope.changeItem = function(item){
|
||||||
|
console.log("selected" + item);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.settingChanged = function(){
|
||||||
|
chrome.storage.sync.set({'settings': $scope.currentSettings}, function(){
|
||||||
|
console.log('settings saved');
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
}]);
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
var settings= angular.module('settings', []);
|
||||||
|
|
||||||
|
var bkg = chrome.extension.getBackgroundPage();
|
||||||
-2
File diff suppressed because one or more lines are too long
Vendored
+13
File diff suppressed because one or more lines are too long
+58
-25
@@ -11,26 +11,34 @@ var defSayings = [
|
|||||||
"Sites are only tools. They don't control me",
|
"Sites are only tools. They don't control me",
|
||||||
"Resisting this site is easy",
|
"Resisting this site is easy",
|
||||||
"Not all those who wander are lost",
|
"Not all those who wander are lost",
|
||||||
|
"My future self can benefit from this",
|
||||||
"I will fight my automatic actions",
|
"I will fight my automatic actions",
|
||||||
"Conserve willpower through smart choices",
|
"Conserve willpower through smart choices",
|
||||||
"Mindless rote behaviour is changeable",
|
"Mindless rote behaviour is changeable",
|
||||||
"Refocus on what needs to be done",
|
"Refocus on what needs to be done",
|
||||||
|
"I should strive to help out my future self",
|
||||||
"What was the cue that led me here?"
|
"What was the cue that led me here?"
|
||||||
]
|
]
|
||||||
|
|
||||||
/* setupUpdater will be called once, on page load.
|
/* setupUpdater will be called once, on page load.
|
||||||
*/
|
*/
|
||||||
var passed = false;
|
var passed = false;
|
||||||
|
var count = 0;
|
||||||
|
var targetPasses= chrome.extension.getBackgroundPage().settings['numOfPasses'];
|
||||||
|
var currentText = "";
|
||||||
|
|
||||||
window.onload = function setupUpdater(){
|
window.onload = function setupUpdater(){
|
||||||
var input=document.getElementById('input-a')
|
var input=document.getElementById('input-a')
|
||||||
, count=document.getElementById('message')
|
, timeout=null
|
||||||
, targetText = defSayings[Math.floor(Math.random()*defSayings.length)]
|
, ifOne = "Verify"
|
||||||
, a = FuzzySet([targetText])
|
, numLeft = "Verify (" + (targetPasses-count) +")";
|
||||||
, timeout=null;
|
changeText(target);
|
||||||
|
if ((targetPasses-count)==1) set(submit1, ifOne);
|
||||||
set(target, targetText);
|
else set(submit1, numLeft);
|
||||||
|
|
||||||
|
|
||||||
function handleChange(){
|
function handleChange(){
|
||||||
|
var a = FuzzySet([currentText])
|
||||||
var newText=input.value;
|
var newText=input.value;
|
||||||
var score = a.get(newText)[0][0];
|
var score = a.get(newText)[0][0];
|
||||||
if (score>0.88) {
|
if (score>0.88) {
|
||||||
@@ -49,27 +57,52 @@ window.onload = function setupUpdater(){
|
|||||||
input.onkeydown=input.onkeyup=onClick=eventHandler;
|
input.onkeydown=input.onkeyup=onClick=eventHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var changeText = function(element){
|
||||||
|
$("#input-a").val('');
|
||||||
|
var targetText = defSayings[Math.floor(Math.random()*defSayings.length)];
|
||||||
|
while (targetText == currentText){
|
||||||
|
targetText = defSayings[Math.floor(Math.random()*defSayings.length)];
|
||||||
|
}
|
||||||
|
currentText = targetText;
|
||||||
|
set(element, targetText);
|
||||||
|
}
|
||||||
|
|
||||||
var activate = function(){
|
var activate = function(){
|
||||||
var currTabs = chrome.extension.getBackgroundPage().currTabs;
|
count += 1;
|
||||||
chrome.tabs.query({
|
if (count >= targetPasses) {
|
||||||
active: true,
|
var currTabs = chrome.extension.getBackgroundPage().currTabs;
|
||||||
windowId: chrome.windows.WINDOW_ID_CURRENT
|
chrome.tabs.query({
|
||||||
}, function (tabs){
|
active: true,
|
||||||
result = $.grep(currTabs, function(e){
|
windowId: chrome.windows.WINDOW_ID_CURRENT
|
||||||
e.currStatus = false;
|
}, function (tabs){
|
||||||
return e.tabId == tabs[0].id;
|
result = $.grep(currTabs, function(e){
|
||||||
|
e.currStatus = false;
|
||||||
|
return e.tabId == tabs[0].id;
|
||||||
|
});
|
||||||
|
if (result.length==0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
var numLeft = "Verifed";
|
||||||
|
set(submit1, numLeft);
|
||||||
|
$("#message").text("Button Unlocked");
|
||||||
|
$("#submit1").attr("disabled", "enabled");
|
||||||
|
console.log(result[0]);
|
||||||
|
$(".btn-success").removeAttr("disabled");
|
||||||
|
$(".btn-success").attr("href", result[0].origUrl);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (result.length==0){
|
} else if ((targetPasses - count)==1){
|
||||||
return false;
|
var numLeft = "Verify";
|
||||||
}
|
set(submit1, numLeft);
|
||||||
else{
|
changeText(target);
|
||||||
$("#message").text("Button Unlocked");
|
}
|
||||||
console.log(result[0]);
|
else{
|
||||||
$(".btn-success").removeAttr("disabled");
|
var numLeft = "Verify (" + (targetPasses-count) +")";
|
||||||
$(".btn-success").attr("href", result[0].origUrl);
|
set(submit1, numLeft);
|
||||||
return true;
|
changeText(target);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
"background.html"
|
"background.html"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"options_page": "options.html",
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
"default_icon": "img/128.png",
|
"default_icon": "img/128.png",
|
||||||
"default_title": "MAD",
|
"default_title": "MAD",
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html ng-app='settings' ng-csp>
|
||||||
|
<head>
|
||||||
|
<title>MAD Options</title>
|
||||||
|
<!-- CSS -->
|
||||||
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
|
||||||
|
<link rel="stylesheet" href="css/main.css">
|
||||||
|
<link rel="stylesheet" href="css/angular-csp.css">
|
||||||
|
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
||||||
|
|
||||||
|
<!-- Scripts -->
|
||||||
|
<script src="js/shared/jquery.min.js"></script>
|
||||||
|
<script src="js/shared/bootstrap.min.js"></script>
|
||||||
|
<script src="js/shared/angular.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Module -->
|
||||||
|
<script src="js/settings.js"></script>
|
||||||
|
<script src="js/controllers/settingsController.js"></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body ng-controller="SettingsController">
|
||||||
|
<div class="text-center content">
|
||||||
|
<h1>Options<h1>
|
||||||
|
</div>
|
||||||
|
<div id="settings-container">
|
||||||
|
<h3>General</h3>
|
||||||
|
<div class="row container panel-body">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<div class="btn-group">
|
||||||
|
<select id="numVerif" class="form-control" ng-model="currentSettings['numOfPasses']" ng-options="number for number in numberList" ng-change="settingChanged()">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-10"> <label for="numVerif"> <h4>Number of phrases to type in order to unlock page</h4><label></div>
|
||||||
|
</div>
|
||||||
|
<div class="row container panel-body">
|
||||||
|
<div class="col-md-2">
|
||||||
|
<div class="btn-group">
|
||||||
|
<select class="form-control" ng-model="currentSettings['useReasonList']" ng-options="option for option in yesNo" ng-change="settingChanged()">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-7"> <h4> Show Reasons Feature</h4></div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -19,10 +19,7 @@
|
|||||||
|
|
||||||
<body ng-controller="PopupController">
|
<body ng-controller="PopupController">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<nav class="navbar navbar-static-top ">
|
|
||||||
<button href="" class="btn btn-primary"><span class="glyphicon glyphicon-cog"></span></button>
|
|
||||||
<button ng-click="addToBlock()" ng-disabled="isBlocked" id="blacklist_button" class="btn btn-primary" type="submit">Block this site</button>
|
<button ng-click="addToBlock()" ng-disabled="isBlocked" id="blacklist_button" class="btn btn-primary" type="submit">Block this site</button>
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+36
-19
@@ -3,41 +3,58 @@
|
|||||||
<html ng-app="app" ng-csp>
|
<html ng-app="app" ng-csp>
|
||||||
<head>
|
<head>
|
||||||
<title>MAD Reasons</title>
|
<title>MAD Reasons</title>
|
||||||
<script src="js/shared/bootstrap.min.js"></script>
|
|
||||||
<!-- <script src="js/shared/angular.min.js"></script>
|
|
||||||
<script src="js/shared/ui-bootstrap-ng.min.js"></script>-->
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/bootstrap.min.css">
|
|
||||||
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
|
|
||||||
<link rel="stylesheet" href="css/main.css">
|
|
||||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class='modal-header text-center'>
|
<div class='modal-header text-center'>
|
||||||
<h1> Reason Tracker</h1>
|
<h1> Reason Tracker: <small>Increase Self Awareness </small></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-4 text-left">
|
|
||||||
<h2> Good Reasons </h2>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4 text-center">
|
<div class="col-md-4 text-center">
|
||||||
<h2> Unsorted Reasons </h2>
|
<h2> Good </h2>
|
||||||
<div ng-repeat="reason in reasons track by $index">
|
<ul class="max-height thumbnail img-responsive">
|
||||||
<p> {{ reason }} </p>
|
<div ng-repeat="reason in goodReasons track by $index">
|
||||||
</div>
|
<p class="btn btn-success" tooltip="Wanted to go to: {{reason.link}}">{{reason.reason}}</p>
|
||||||
|
<span class="glyphicon clicky glyphicon-chevron-right" aria-hidden="true" ng-click="move('right', 'good', $index)"></span>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 text-right">
|
|
||||||
<h2> Poor Reasons </h2>
|
<div class="col-md-4 text-center">
|
||||||
|
<h2> Unsorted </h2>
|
||||||
|
<ul class="max-height thumbnail img-responsive">
|
||||||
|
<div ng-repeat="reason in unsortedReasons track by $index">
|
||||||
|
<span class="glyphicon clicky glyphicon-chevron-left" aria-hidden="true" ng-click="move('left', 'unsorted', $index)"></span>
|
||||||
|
<p class="btn btn-primary" tooltip="Wanted to go to: {{reason.link}}">{{reason.reason}}</p>
|
||||||
|
<span class="glyphicon clicky glyphicon-chevron-right" aria-hidden="true" ng-click="move('right', 'unsorted', $index)"></span>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-4 text-center">
|
||||||
|
<h2> Poor </h2>
|
||||||
|
<div class="max-height thumbnail img-responsive">
|
||||||
|
<div ng-repeat="reason in badReasons track by $index">
|
||||||
|
<span class="glyphicon clicky glyphicon-chevron-left" aria-hidden="true" ng-click="move('left', 'poor', $index)"></span>
|
||||||
|
<p class="btn btn-danger" tooltip="Wanted to go to: {{reason.link}}">{{reason.reason}}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class='modal-footer text-center'>
|
<div class='modal-footer text-center'>
|
||||||
<div class='row col-md-12 text-center'>
|
<div class='row col-md-12 text-center'>
|
||||||
<button class='btn btn-primary' ng-disabled='undoBool' ng-click='undo()'>Clear All</button>
|
<button class='btn btn-primary' ng-click='clearAll()'>Clear All</button>
|
||||||
<button class='btn btn-danger' ng-click='cancel()'>Close</button>
|
<button class='btn btn-danger' ng-click='cancel()'>Close</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user