PageSourceSearch

https://www.ncoa.org/ddirect/dafdirect4.js

js ncoa.org collected 2026-10-01 08:51:08 UTC 9,181 bytes, 241 lines download raw bytes

1/*
2 * Copyright 2013-2019, FMR LLC.
3 * All Rights Reserved
4 * Fidelity Confidential Information
5 */
6function toggle_visibility(id1,id2) {
7	var e1 = document.getElementById(id1);
8	var e2 = document.getElementById(id2);
9
10	if(e1.style.display == 'block') {
11		e1.style.display = 'none';
12		e2.style.display = 'block';
13	} else {
14		e1.style.display = 'block';
15		e2.style.display = 'none';
16	}
17}
18function dafdirectwhatclose() {
19	toggle_visibility("notwhatisthis","whatisthis");
20}
21function dafdirectwhatsthis() {
22	toggle_visibility("whatisthis","notwhatisthis");
23}
24function checkSubmit(e)
25{
26	if(e && e.keyCode == 13)
27	{
28		DAFDirectSubmit();
29	}
30}
31function DAFDirectSubmit()
32{
33	_dsgtxt = "";
34	_amnt="";
35	_dafurl="";
36	_npoid=_dafdirect_tin;
37	_tokenstr = "";
38	_querystring = "";
39
40	if(document.getElementById("dafprovider") != "undefined" && "FC" == document.getElementById("dafprovider").value) {
41		_dafurl="https://charitablegift.fidelity.com/cgfweb/CGFLogon.cgfdo";
42	} else if("SC" == document.getElementById("dafprovider").value) {
43		_dafurl="https://client.schwab.com/Areas/Access/Login?KC=Y&cgift=y&SANC=recommendgrant&PARMS=|";
44	} else if("BNYM" == document.getElementById("dafprovider").value) {
45		_dafurl="https://bnycharitable.org/bny/API/Grants.mvc.axd/DafDirect";
46	} else {
47		alert("Please select a donor advised fund.");
48		return;
49	}
50	if(document.getElementById("dafdirect_dsgtxt")) {
51		_dsgtxt = encodeURIComponent(document.getElementById("dafdirect_dsgtxt").value);
52		document.getElementById("dafdirect_dsgtxt").value="";
53	}
54	if(document.getElementById("dafdirect_amnt")) {
55		_amnt = document.getElementById("dafdirect_amnt").value.replace(/[^0-9\.]+/g, '');
56		document.getElementById("dafdirect_amnt").value = "";
57	}
58	if("SC" == document.getElementById("dafprovider").value) {
59		_tokenstr = "|ddtoken="+ _dafdirect_token;
60	} else {
61		_tokenstr = "&ddtoken="+ _dafdirect_token;
62	}
63
64	action = "";
65	if("SC" == document.getElementById("dafprovider").value) {
66		_querystring = "Npo_Id=" + _npoid + "|Grnt_Amnt=" + _amnt + "|Device_Type=Widget|App_Id=MDNR|source=widget"+ "|Grnt_Dsg_Txt=" + _dsgtxt ;
67		action = _dafurl + _querystring + _tokenstr;
68
69	} else {
70		_querystring="Npo_Id="+_npoid+"&Grnt_Amnt="+_amnt+"&Grnt_Dsg_Txt="+_dsgtxt+"&Device_Type=Widget&App_Id=MDNR&source=widget";
71		action=_dafurl+"?"+_querystring+_tokenstr;
72	}
73	document.getElementById("dafprovider").value = "";
74	popupWindow = window.open(action,'_blank');
75	popupWindow.focus();
76
77}
78
79
80(function() {	
81	function returnFalse() {
82		if (typeof event != "undefined" && event != null) {
83			if (event.preventDefault)
84				event.preventDefault();
85			else
86				event.returnValue = false;
87		}
88		return false;
89	}
90	
91	function addEvent(el, type, func) {
92		if (el.addEventListener) {
93			el.addEventListener(type, func);
94		} else {
95			el.attachEvent('on' + type, func)
96		}
97	}
98
99	 function registerEvents() {
100		if (document.getElementById('dafdirectsubmit') &&
101			document.getElementById('dafdirectdiv') && 
102			document.getElementById('dafdirect') &&
103			document.getElementById('showwhatisthis') &&
104			document.getElementById('closewhatisthis')) {
105
106			var el = document.getElementById('dafdirectsubmit');
107			addEvent(el, 'click', function() {
108				DAFDirectSubmit();
109				return returnFalse();
110			});
111
112			el = document.getElementById('dafdirectdiv');
113			addEvent(el, 'keypress', checkSubmit);
114
115			el = document.getElementById('dafdirect');
116			addEvent(el, 'submit', function() {
117				DAFDirectSubmit();
118				return returnFalse();
119			});
120
121			el = document.getElementById('showwhatisthis');
122			addEvent(el, 'click', function() {
123				dafdirectwhatsthis();
124				return returnFalse();
125			});
126
127			el = document.getElementById('closewhatisthis');
128			addEvent(el, 'click', function() {
129				dafdirectwhatsthis();
130				return returnFalse();
131			});
132		} else {
133			setTimeout(registerEvents);	
134		}
135	}
136
137	registerEvents();
138
139})();
140
141_dafdirect_token = "";
142_dafdirect_show_border = "true";
143_dafdirect_tin="";
144_dafdirect_dropdown = "f,s,m";
145_dafdirect_size = "2";
146_dafdirect_show_amt = "true";
147_dafdirect_show_dsg = "true";
148
149if(typeof _dafdirect_settings != "undefined") {
150	//first nine are tin
151	_dafdirect_tin = _dafdirect_settings.substring(0,9);
152	_dafdirect_size = (_dafdirect_settings.substring(10,11));
153	_dafdirect_show_dsg = (_dafdirect_settings.substring(11,12) == "0" ? "false" : "true");
154	_dafdirect_show_amt = (_dafdirect_settings.substring(12,13) == "0" ? "false" : "true");
155	_dafdirect_show_border = (_dafdirect_settings.substring(13,14) == "0" ? "false" : "true");
156	_dafdirect_token = _dafdirect_settings.substring(15);
157}
158if(_dafdirect_show_border == "false") {
159	document.write('<style type="text/css">#dafdirectdiv { border:0!important; }</style>');
160}
161if(_dafdirect_size=="2") {
162	 document.write('<link rel="stylesheet" type="text/css" href="https://www.dafdirect.org/ddirect/css/dafdirect2.1.css" />');
163} else if(_dafdirect_size=="0") {
164	 document.write('<link rel="stylesheet" type="text/css" href="https://www.dafdirect.org/ddirect/css/dafdirect0.1.css" />');
165} else {
166	 document.write('<link rel="stylesheet" type="text/css" href="https://www.dafdirect.org/ddirect/css/dafdirect1.1.css" />');
167}
168document.write('<style type="text/css">#dafdirectdiv { background:#fff; }</style>');
169
170document.write('<div id="dafdirectdiv">');
171document.write('<form name="dafdirect" id="dafdirect" method="post">');
172
173if(_dafdirect_size == "2") {
174	 document.write('<img src="https://www.dafdirect.org/ddirect/images/logo-DAF-direct2.jpg" alt="Logo DAF Direct" /><br/>');
175} else {
176	 document.write('<img src="https://www.dafdirect.org/ddirect/images/logo-DAF-direct1.jpg" alt="Logo DAF Direct" /><br/>');
177}
178document.write('<input type="hidden" name="dafdirect_token" id="dafdirect_token" value="');
179
180document.write(_dafdirect_token);
181document.write('" /><br />');
182
183document.write('<div class="whatThis"><a id="showwhatisthis" href="#">What is this?</a></div>');
184
185document.write('<div id="whatisthis" style="display:none; font-family: "Lucida Grande", "Lucida SansUnicode", Arial, sans-serif; font-size:12px; line-height:.3em;">');
186document.write('<div class="dafdirectscroll">');
187document.write('<p>A donor advised fund (DAF) is a charitable giving program that allows you to combine the most favorable tax benefits with the flexibility to support your favorite causes.</p>');
188document.write('<p>If you have a donor advised fund, DAF Direct enables you to recommend grants to this nonprofit');
189document.write(' directly from your DAF (as long as your DAF\'s sponsoring organization is participating).</p>');
190document.write('</div>');
191document.write('<div class="dafdirectClearfix"></div>');
192document.write('<div class="whatThis"><a id="closewhatisthis" href="#"><br>Close</a></div>');
193document.write('</div>');
194document.write('<div id="notwhatisthis">');
195
196document.write('<label for="dafprovider">Donate now from:</label><br />');
197document.write('<select name="dafprovider" id="dafprovider" class="dafdirectDonateFrom dafdirectDropdown dafdirectSelect">');
198if(_dafdirect_dropdown.indexOf("s")!=-1 && _dafdirect_dropdown.indexOf("f") != -1) {
199	document.write('<option value="">--Please select--</option>');
200}
201if(_dafdirect_dropdown.indexOf("f") != -1) {
202	document.write('<option value="FC">Fidelity Charitable</option>');
203}
204if(_dafdirect_dropdown.indexOf("s") != -1) {
205	document.write('<option value="SC">DAFgiving360</option>');
206}
207if(_dafdirect_dropdown.indexOf("m") != -1) {
208	document.write('<option value="BNYM">BNY Mellon</option>');
209}
210document.write('</select><br />');
211
212if(_dafdirect_show_dsg == "true") {
213	document.write('<label for="dafdirect_dsgtxt">Designation:</label><br />');
214	document.write('<input class="dafdirectInputFull dafdirectInput" type="text" name="dafdirect_dsgtxt" id="dafdirect_dsgtxt" size="8" value="" id="dafdirect_dsgtxt" class="dafdirecTextInput" />');
215	document.write('<div class="dafdirectClearfix"></div>');
216} else {
217	document.write('<div class="dafdirectClearfix"></div>');
218}
219if(_dafdirect_show_amt == "true") {
220	document.write('<div class="dafdirectClearfix"></div>');
221	document.write('<div id="amountNextContain">');
222	document.write('<div class="dafdirectInputAmount"><label for="dafdirect_amnt">Amount:</label><br /><input type="text" name="dafdirect_amnt" id="dafdirect_amnt" size="8" value="$" id="dafdirect_amnt" class="text-iput dafdirectInput" /></div>');
223} else {
224	document.write('<div class="dafdirectClearfix"></div>');
225}
226if(typeof _dafdirect_hide_button != "undefined" && _dafdirect_hide_button.toLowerCase() == "yes") {
227//do not display button
228} else {
229	if(typeof dafdirect_size != "undefined" && dafdirect_size == "2") {
230	   document.write('<div class="dafdirectButtonContain"><a id="dafdirectsubmit" href="#"><img border="0" src="https://www.dafdirect.org/ddirect/images/button-next2.jpg" alt="Next"></a></div>');
231	} else {
232	   document.write('<div class="dafdirectButtonContain"><a id="dafdirectsubmit" href="#"><img border="0" src="https://www.dafdirect.org/ddirect/images/button-next1.jpg" alt="Next"></a></div>');
233	}
234}
235document.write('<div class="dafdirectClearfix"></div>');
236document.write('</div>');
237
238document.write('</div> <!-- amountNextContain -->');
239
240document.write('</form>');
241document.write('</div>');

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.