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 | //************************************************************************
//*
//* BBL_Highlight_Admin_Links_DEMO
//* Highlight specified links on System Admin Page
//* JSH_HiLiAdminLinks
//* https://myclass.kckcc.edu/*
//*
//************************************************************************
//************************************************************************
//*
//* May need to call mainline function with a slight delay by using:
//*
//* setTimeout
//*
//* This may be necessary to give the page time to completely render.
//*
//************************************************************************
setTimeout(BBL_Highlight_Admin_Links_20180517, 3000);
//BBL_Highlight_Admin_Links_20180517();
//************************************************************************
//*
//* This is the mainline function. The mainline function should
//* use try/catch/finally blocks so any unexpected errors will
//* be caught and will not affect rendering of the page.
//*
//************************************************************************
function BBL_Highlight_Admin_Links_20180517()
{
//alert("BEGIN - BBL_Highlight_Admin_Links_20180517 3000");
var error1000;
error1000 = "0"; //***** 0 indicates no errors occurred *****
try
{ // begin try
if (Is_Admin_Page_Via_Title_20180517() == true)
//if (Is_Admin_Page_Via_Url_20180517() == true)
{
//alert("***** Is System Admin Page *****");
Highlight_Specified_Admin_Links_20180517();
}
else
{
//alert("***** Not System Admin Page *****");
}
} // end try
catch(e)
{
//alert("***** CATCH *****");
error1000 = "1"; //***** indicate an error occurred *****
}
finally
{
//alert(error1000);
}
//alert("END - BBL_Highlight_Admin_Links_20180517");
}
//************************************************************************
//*
//* Test for the "System Admin" page by using the title of the page.
//*
//* The innerHTML of the title of the "System Admin" page is:
//*
//* System Admin - Blackboard Learn
//*
//* If the token "System Admin" is found in the page title then this
//* function returns true.
//*
//************************************************************************
function Is_Admin_Page_Via_Title_20180517()
{
//alert("BEGIN - Is_Admin_Page_Via_Title_20180517");
var s1;
var token1000;
var rc1;
rc1 = false;
token1000 = "SYSTEM ADMIN";
s1 = document.getElementsByTagName("title")[0].innerHTML;
//alert(s1);
s1 = s1.toUpperCase();
if (s1.indexOf(token1000) >= 0)
{
rc1 = true;
}
//alert(rc1);
//alert("END - Is_Admin_Page_Via_Title_20180517");
return rc1;
}
//************************************************************************
//*
//* This is an alternate method of testing for the "System Admin" page.
//*
//* This function tests the URL to determine if this is the
//* "System Admin" page. For KCKCC the URL for this page is:
//*
//* https://myclass.kckcc.edu/webapps/portal/execute/tabs/tabAction?tab_tab_group_id=_65_1
//*
//* A portion of this URL is tested to determine if it is the
//* "System Admin" page. The URL for the "System Admin" page
//* will most likely be different for your school, if so adjust
//* this function accordingly by modifying the token to search for.
//*
//************************************************************************
function Is_Admin_Page_Via_Url_20180517()
{
//alert("BEGIN - Is_Admin_Page_Via_Url_20180517");
var token2000;
var url1;
var rc1;
rc1 = false;
token2000 = "WEBAPPS/PORTAL/EXECUTE/TABS/TABACTION?TAB_TAB_GROUP_ID=_65_1";
url1 = location.href;
url1 = url1.toUpperCase();
if (url1.indexOf(token2000) >= 0)
{
rc1 = true;
}
//alert("END - Is_Admin_Page_Via_Url_20180517");
return rc1;
}
//************************************************************************
//*
//* This function highlights specified links on the "System Admin" page.
//*
//************************************************************************
function Highlight_Specified_Admin_Links_20180517()
{
//alert("BEGIN - Highlight_Specified_Admin_Links_20180517");
var obj1, obj2;
var token1000;
var token2000;
var s1;
var j;
var k;
var links_to_highlight;
links_to_highlight =
["Users",
"Courses"
//"Building Blocks",
//"Data Integration"
];
//alert(links_to_highlight.length);
obj1 = document.getElementById("content");
obj2 = obj1.getElementsByTagName("a");
//alert(obj2.length);
for(j = 0; j < obj2.length; j++)
{
s1 = obj2[j].innerHTML;
token1000 = s1.toUpperCase();
for (k = 0; k < links_to_highlight.length; k++)
{
token2000 = links_to_highlight[k].toUpperCase();
if (token1000.indexOf(token2000) >= 0)
{
//obj2[j].style.backgroundColor = "LightGreen";
//obj2[j].style.backgroundColor = "Aqua";
obj2[j].style.backgroundColor = "DeepPink";
}
}
}
//alert("END - Highlight_Specified_Admin_Links_20180517");
}
//************************************************************************
|