-
Notifications
You must be signed in to change notification settings - Fork 0
/
charities.html
executable file
·336 lines (320 loc) · 16.9 KB
/
charities.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Charity Settings</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="./css/bootstrap.css" type="text/css">
<link rel="stylesheet" href="./css/masterStyles.css" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="./lib/angular-strap-master/dist/angular-strap.min.js"></script>
<script src="./lib/angular-strap-master/dist/angular-strap.tpl.min.js"></script>
<script type="text/javascript"
src="https://www.simplify.com/commerce/simplify.pay.js"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<script>
function readit(){
var file = './DB/health.csv'
var reader = new FileReader();
reader.onload = function(e) {
var rawData = reader.result;
}
}
function read(file) {
var reader = new FileReader();
var buffer = [];
reader.onload = function(progressEvent){
// Entire file
//console.log(this.result);
// By line
var lines = this.result.split('\n');
for(var line = 0; line < lines.length; line++){
var spline = lines[line].split(',');
buffer.push([spline[0],spline[1],spline[2]]);
}
};
reader.readAsText(file);
};
var myApp = angular.module("myApp", ['mgcrea.ngStrap']);
myApp.controller('ctrl', function($scope, $http) {
$scope.test=100;
$scope.result = '';
var magic; //DATA FETCHED
var magic2; //DATA PARSED
//$scope.dummy = [{name : "Amazon Conservation Association", desc: "Our mission is to protect the world's most diverse landscapes, train the next generation of Amazonian conservationists, and partner with communities to support livelihoods that sustain biodiversity.", img: "./img/imgDB/image30.jpg"},{name : "Education without Borders",desc : "Education without Borders (EwB) aims to provide improved educational opportunities and facilities in disadvantaged regions of the world.", img: "./img/imgDB/image11.jpg"},{name: 'Canadian Red Cross',desc: 'The Canadian Red Cross mission is to improve the lives of vulnerable people by mobilizing the power of humanity in Canada and around the world.',img: './img/imgDB/image1.jpg'}];
$scope.environment = [
[{name : "Amazon Conservation Association", desc: "Our mission is to protect the world's most diverse landscapes, train the next generation of Amazonian conservationists, and partner with communities to support livelihoods that sustain biodiversity.", img: "./img/imgDB/image30.jpg"},
{name : "Earth Island Institute", desc: "Earth Island Institute is home to more than 60 grassroots projects working for environmental sustainability.", img: "./img/imgDB/image28.jpg"},
{name: "The Sierra Club Foundation", desc:"Our board and staff raise charitable funds, preserve and enhance these assets and ensure they are used appropriately. As the fiscal sponsor of the charitable programs of the Sierra Club, we provide resources to it and other nonprofit organizations to support scientific, educational, literary, organizing, advocacy, and legal programs that further our charitable goals.",img:"./img/imgDB/image29.jpg"}],
[{name:"Ocean Conservancy",desc:"Ocean Conservancy seeks the best and brightest to help us achieve our goal of a healthy, thriving ocean.",img: "./img/imgDB/image27.jpg"},
{name: "Earth Justice", desc:"Earth Justice uses the power of law and the strength of partnership to protect people’s health; to preserve magnificent places and wildlife; to advance clean energy; and to combat climate change.",img:"./img/imgDB/image26.jpg"},
{name:"Rainforest Alliance", desc:"The Rainforest Alliance works to conserve biodiversity and ensure sustainable livelihoods by transforming land-use practices, business practices and consumer behavior.",img:"./img/imgDB/image25.jpg"}],
[{name:"Friends of the Earth", desc:"We are members of Friends of the Earth International,a global network representing more than two million activists in 75 different countries. In the United States, we advocate in the halls of Congress, in state capitals, and with community groups around the country. With offices in Washington, D.C., and Berkeley, CA, and members in all 50 states, we urge policymakers to defend the environment and work towards a healthy environment for all people.",img:"./img/imgDB/image24.jpg"}]
];
$scope.education = [
[{name: "Education without Borders",desc : "Education without Borders (EwB) aims to provide improved educational opportunities and facilities in disadvantaged regions of the world.", img: "./img/imgDB/image11.jpg"},
{name : "Pathways to Education", desc: "It works with high school students from low-income areas that have high dropout rates and helps them to transition into post-secondary education.", img: "./img/imgDB/image20.jpg"},
{name:"Africa Educational Trust", desc:"We are working for education for all in the face of conflict and poverty. Education is a right. It is also the most requested service, and key to helping communities move towards peace and prosperity.",img:"./img/imgDB/image14.jpg"}],
[{name:"Canadian World Education Society",desc: "The Canadian World Education Society is a registered nonprofit Canadian organization. We are committed to improving access and overcoming barriers to education in developing regions.",img:"./img/imgDB/image15.jpg"},
{name:"Rose Charities",desc:"We raise money resources and personnel to support Rose Charities projects that have strong local leadership and dedicated volunteers in communities around the world. We work with them as they find their own solutions to the problems of poverty.",img:"./img/imgDB/image12.jpg"},
{name:"Mon Sheong Foundation", desc:"The Mon Sheong Foundation is a Canadian registered charitable organization, dedicated to the promotion of Chinese culture, heritage, language and philosophy through caring for the elderly, encouraging the young and providing programs and services to meet the needs of our communities.",img:"./img/imgDB/image16.jpg"}]
];
$scope.health = [[
{name: 'Canadian Red Cross',desc: 'The Canadian Red Cross mission is to improve the lives of vulnerable people by mobilizing the power of humanity in Canada and around the world.',img: './img/imgDB/image1.jpg'},
{name: "Alzheimer Society",desc: "The Alzheimer Society is the leading not-for-profit health organization working nationwide to improve the quality of life for Canadians affected by Alzheimer's disease and other dementias and advance the search for the cause and cure.", img:"./img/imgDB/image2.jpg"},
{name: "The Foundation Fighting Blindness", desc:"The Foundation Fighting Blindness is leading the fight against blindness by advancing retinal disease research, education and public awareness.",img:'./img/imgDB/image3.jpg'}
],
[{name: "American Foundation for Suicide Prevention",desc:"By educating the public they change the way people think and talk about suicide and mental illness. By educating leaders and communities, they help to shape new laws and policies.",img:"./img/imgDB/image4.jpg"},
{name:"Breast Cancer Prevention Fund",desc:"The Breast Cancer Fund works to connect the dots between breast cancer and exposures to chemicals and radiation in our everyday environments.",img:"./img/imgDB/image5.jpg"},
{name:"HopeHIV",desc:"We support children and young people in sub-Saharan Africa who have been orphaned or affected by HIV/AIDS. Rather than dismissing them as helpless victims, we believe they have the potential to lead change in their families, communities and countries and create a better future for Africa.",img:"./img/imgDB/image6.jpg"}],
[{name:"Against Malaria Foundation",desc:"We fund anti-malaria nets specifically long-lasting insecticidal nets (LLINs), and work with distribution partners to ensure they are used. We track and report on net use and malaria case data.",img:"./img/imgDB/image7.jpg"},
{name: "The Global Alliance for Improved Nutrition",desc:"Around 3.5 billion people — half the people on the planet today — are malnourished. Each year, malnutrition kills 3.1 million children under the age of five and leaves 161 million stunted, trapping generations in lives of poverty and unfulfilled potential. The Global Alliance for Improved Nutrition (GAIN) is focused on finding solutions to end malnutrition within our lifetimes.",img: "./img/imgDB/image8.jpg"},
{name: "Deworm the World Initiative",desc:"Deworm the World, which supports government-led mass deworming in schools, and Dispensers for Safe Water, which provides chlorination services at rural water points to make water safe to drink, are excellent examples of the Evidence Action vision.",img:"./img/imgDB/image9.jpg"}]
];
//magic end
//$scope.education = <?php education() ?>;
$scope.displayed=false;
$scope.browse = [];
var browseThis = function () {
angular.forEach($scope.health, function (value){
angular.forEach(value, function (val) {
$scope.browse.push(val);
//console.log(val);
});
});
angular.forEach($scope.education, function (value){
angular.forEach(value, function (val) {
$scope.browse.push(val);
//console.log(val);
});
});
angular.forEach($scope.environment, function (value){
angular.forEach(value, function (val) {
$scope.browse.push(val);
//console.log(val);
});
});
};
browseThis();
console.log($scope.browse[0]);
$scope.first='';
$scope.category = '';
$scope.browse2 = {health: $scope.health, education: $scope.education, environment: $scope.environment};
$scope.$watch('selection.length', function() {
//console.log($scope.selection.length);
$scope.test=100/$scope.selection.length;
angular.forEach($scope.selection, function (val) {
var i = 0;
if (i == 0) {
$scope.first=val;
i++;
}
});
if ($scope.selection.length == 0) {
$scope.displayed=false;
} else {
$scope.displayed=true;
}
$scope.$apply;
//console.log('here' + $scope.first.name);
});
// $scope.environment = <?php environment() ?>;
// $scope.health = <?php health() ?>;
$scope.selection = [];
$scope.chunkedData = [['a', 'b', 'c'], ['d', 'a','qqq']];
$scope.fire = function(input) {
var xx;
var check = 1;
angular.forEach($scope.browse, function (val) {
//console.log(val.name);
//console.log($scope.result);
if (val == $scope.result) {
//console.log('entered');
xx = val;
check = -1;
}
});
if ($scope.result == '' || check > -1) {
alert('invalid input');
} else if (check == -1 && $scope.result != '') {
$scope.selection.push($scope.result);
//console.log(xx);
$scope.result = '';
} else {
alert('Already selected');
}
};
$scope.fire2 = function(input) {
var check = $scope.selection.indexOf(input);
console.log(check);
if (check == -1 && input.name != '') {
$scope.selection.push(input);
//$scope.result = '';
} else {
alert('Already selected');
}
};
$scope.off = function(input) {
var check = $scope.selection.indexOf(input);
console.log(check);
if (check != -1 && input.name != '') {
$scope.selection.splice(check, 1);
//$scope.selection.push(input);
//$scope.result = '';
} else {
alert('Already wrong input');
}
};
$scope.save = function () {
alert('Your choices of charities have been saved.');
};
$scope.cancel = function () {
$scope.selection = [];
alert('Changes discarded.');
};
//$scope.$watch('selection');
});
</script>
</head>
<body ng-app="myApp">
<div style="position:fixed;width:100%;margin-bottom:50px;z-index:10000000;">
<nav class="navbar navbar-default navbar-inverse" style="border-radius:0px;">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
<div class="proj-name"><img src="img/mc.png" height="25px"/> Spend to Save</div>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="http://localhost:8000/PageGen.py?first=bob%40hotmail.com&last=password">Home </a> </li>
<li><a href="http://localhost:8000/readDon.py">Donation Manager</a> </li>
<li class="active"><a href="#">Charity Settings <span class="sr-only">(current)</span></a> </li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
</div>
<div class="charity-title">
Edit Charities To Donate To:
</div>
<form class="form-horizontal" ng-controller="ctrl">
<div class="container-fluid">
<div class="col-md-1 ">
<label>Search:</label>
</div>
<div class="col-md-2">
<input class="form-control-sm" type="text" ng-model="result" bs-options="b.name for b in browse" bs-typeahead>
</div>
<div class="col-md-4">
<button class="btn-primary btn-sm" ng-click="fire(b)">Add</button>
</div>
</div>
<br/>
<div class=" container-fluid">
<div class="input-group input-group-sm container-fluid">
<label>Categories</label><br/>
<ul class="nav nav-tabs nav-justified centered" id="Categories">
<li class="active"><a href="#1" data-toggle="tab">Health</a>
</li>
<li><a href="#2" data-toggle="tab">Education</a>
</li>
<li><a href="#3" data-toggle="tab">Environment</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="1">
<div class="row" ng-repeat="health2 in health">
<br/>
<div class="col-xs-4 name-center" ng-repeat="h in health2"><input type="image" src="{{h.img}}" title="{{ h.desc}}" width="64" height="64" ng-click="fire2(h)"><br/>
<div class="name-center no-marg">
{{h.name}}
</div>
</div>
</div>
</div>
<div class="tab-pane" id="2">
<div class="row" ng-repeat="education2 in education">
<br/>
<div class="col-xs-4 name-center" ng-repeat="h in education2"><input type="image" src="{{h.img}}" title="{{ h.desc}}" width="64" height="64" ng-click="fire2(h)"><br/>
<div class="name-center no-marg">
{{h.name}}
</div>
</div>
</div>
</div>
<div class="tab-pane" id="3">
<div class="row" ng-repeat="environment2 in environment">
<br/>
<div class="col-xs-4 name-center" ng-repeat="h in environment2"><input type="image" src="{{h.img}}" title="{{ h.desc}}" width="64" height="64" ng-click="fire2(h)">
<br/>
<div class="name-center no-marg">
{{h.name}}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br/>
<div class="container-fluid ">
<div class="selections-title" ng-show="displayed">Selections: </div>
<br/>
<div class="col-md-4 pic-center" ng-repeat="h in selection">
<input type="image" src="{{h.img}}" title="{{h.desc}}" width="64"
height="64" ng-click="off(h)">
<br/>
<div class="name-center no-marg">
{{h.name}}
</div>
<input type="range" min="0" max="100" step="1" ng-model="test"
style="width:50%;margin-left:25%;" class="ng-pristine ng-valid"/>
<div class="name-center no-marg">
{{test | number:0}}%
</div>
</div>
</div>
<br/><br/>
<div class="container-fluid" style="text-align:center;">
<button class="btn btn-success btn-lg" ng-click="save()"> Save </button>
<button class="btn btn-danger btn-lg" ng-click="cancel()">Discard</button>
</div>
<div class="container-fluid" style="text-align:center;margin-top:25px;">
<button data-sc-key="sbpb_OWEwZDkzYTMtYzE3MS00NmFkLTkwMzMtNGY5YzYwMjZjMzI2"
data-name=""
data-description="Donate this amount?"
data-reference="99999"
data-amount="8000"
data-color="#104E8B"
data-masterpass="true"
data-receipt="true"
>
Give One-Time Payment
</button>
</div>
</form>
<hr>
<footer class="text-center">
<div class="container-fluid">
<div class="col-md-12" style="margin-bottom:10px;">
<p>Copyright © 2015 BXT SENC. All rights reserved.</p>
</div>
</div>
</footer>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery-1.11.2.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>