-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathpaginatedOnload.js
More file actions
872 lines (815 loc) · 34.7 KB
/
paginatedOnload.js
File metadata and controls
872 lines (815 loc) · 34.7 KB
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
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
// IE doesn't support "startsWith", adding definition
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(searchString, position){
position = position || 0;
return this.substr(position, searchString.length) === searchString;
};
}
function PaginatedNext()
{
// NOTE: You can add any custom navigation logic you want here.
// Check that a username was entered correctly
var u = new InputUtil();
var e = new LoginErrors();
var usernameInput = document.getElementById('userNameInput');
if (!usernameInput.value || !usernameInput.value.match('[@\\\\]')) {
u.setError(usernameInput, e.userNameFormatError);
return false;
}
ShowPasswordPage();
}
function PaginatedBack()
{
// NOTE: You can add any custom navigation logic you want here.
ShowUsernamePage();
}
function AdjustElementDisplay(elementList, display)
{
for ( var i = 0; i < elementList.length; i++ )
{
if ( elementList[i] && elementList[i].style )
{
elementList[i].style.display = display;
}
}
}
function GetLocalizedStringForElement(element)
{
// LOCALIZATION NOTE: The following table allows for the translation of the text items created
// within this JavaScript. Elements created client-side are not localized by ADFS, so we must
// localize the text ourselves. Admins can add additional translations to this table
var translationTable = {
"ms": {
"backButton": "Ke belakang",
"nextButton": "Seterusnya",
"loginMessage": "Masukkan kata laluan"
},
"gl": {
"backButton": "Atrás",
"nextButton": "Seguinte",
"loginMessage": "Introducir contrasinal"
},
"gu": {
"backButton": "પાછળ",
"nextButton": "આગલું",
"loginMessage": "પાસવર્ડ દાખલ કરો"
},
"km": {
"backButton": "ថយក្រោយ",
"nextButton": "បន្ទាប់",
"loginMessage": "បញ្ចូលពាក្យសម្ងាត់"
},
"ig": {
"backButton": "Àzụ",
"nextButton": "Osote",
"loginMessage": "Tinye okwuntụghe"
},
"uz": {
"backButton": "Orqaga",
"nextButton": "Keyingisi",
"loginMessage": "Parolni kiriting"
},
"sv": {
"backButton": "Bakåt",
"nextButton": "Nästa",
"loginMessage": "Ange lösenord"
},
"mi": {
"backButton": "Hoki",
"nextButton": "Panuku",
"loginMessage": "Tāuru kupuhipa"
},
"rw": {
"backButton": "Gusubira inyuma",
"nextButton": "Komeza",
"loginMessage": "Andika ijambobanga"
},
"lb": {
"backButton": "Zréck",
"nextButton": "Nächst",
"loginMessage": "Passwuert aginn"
},
"ku-Arab": {
"backButton": "دواوە",
"nextButton": "داهاتوو",
"loginMessage": "لێدانی تێپەرەوشە"
},
"yo": {
"backButton": "Padàsẹ́yìn",
"nextButton": "Tókàn",
"loginMessage": "Ṣàtẹ̀wọlé ọ̀rọ̀ aṣínà"
},
"am": {
"backButton": "ወደኋላ",
"nextButton": "ቀጣይ",
"loginMessage": "የይለፍ ቃል ያስገቡ"
},
"es-MX": {
"backButton": "Atrás",
"nextButton": "Siguiente",
"loginMessage": "Escriba la contraseña"
},
"ur": {
"backButton": "واپس",
"nextButton": "اگلا",
"loginMessage": "پاس ورڈ درج کریں"
},
"quc": {
"backButton": "Tzalijsab\u0027al",
"nextButton": "Teren chi uloq",
"loginMessage": "Utz\u0027ib\u0027axik retokib\u0027al"
},
"sl": {
"backButton": "Nazaj",
"nextButton": "Naprej",
"loginMessage": "Vnesite geslo"
},
"pa-Arab-PK": {
"backButton": "پچھے جاؤ",
"nextButton": "آگے",
"loginMessage": "پاس ورڈ داخل کرو"
},
"tk": {
"backButton": "Yza",
"nextButton": "Indiki",
"loginMessage": "Parol giriz"
},
"te": {
"backButton": "వెనుకకు",
"nextButton": "తదుపరి",
"loginMessage": "పాస్వర్డ్ను నమోదు చేయండి"
},
"ro": {
"backButton": "Înapoi",
"nextButton": "Următorul",
"loginMessage": "Introduceți parola"
},
"en": {
"backButton": "Back",
"nextButton": "Next",
"loginMessage": "Enter password"
},
"zh-hans": {
"backButton": "后退",
"nextButton": "下一步",
"loginMessage": "输入密码"
},
"ha": {
"backButton": "Baya",
"nextButton": "Na gaba",
"loginMessage": "Shigar da kalmar sirri"
},
"mt": {
"backButton": "Lura",
"nextButton": "Li Jmiss",
"loginMessage": "Daħħal il-password"
},
"tn": {
"backButton": "Morago",
"nextButton": "Latelang",
"loginMessage": "Tsenya khunololamoraba"
},
"mn": {
"backButton": "Буцах",
"nextButton": "Дараах",
"loginMessage": "Нууц үг оруулах"
},
"pa-IN": {
"backButton": "ਪਿੱਛੇ ਜਾਓ",
"nextButton": "ਅਗਲਾ",
"loginMessage": "ਪਾਸਵਰਡ ਦਾਖ਼ਲ ਕਰੋ"
},
"bn-IN": {
"backButton": "ফিরে যান",
"nextButton": "পরবর্তী",
"loginMessage": "পাসওয়ার্ড লিখুন"
},
"kok": {
"backButton": "फाटीं व्हरचें",
"nextButton": "फुडलें",
"loginMessage": "पासवर्ड नोंद करचो"
},
"id": {
"backButton": "Kembali",
"nextButton": "Selanjutnya",
"loginMessage": "Masukkan sandi"
},
"bg": {
"backButton": "Назад",
"nextButton": "Напред",
"loginMessage": "Въведете парола"
},
"da": {
"backButton": "Tilbage",
"nextButton": "Næste",
"loginMessage": "Indtast adgangskode"
},
"az": {
"backButton": "Geri",
"nextButton": "Növbəti",
"loginMessage": "Parol daxil edin"
},
"mk": {
"backButton": "Назад",
"nextButton": "Следно",
"loginMessage": "Внесете ја лозинката"
},
"mr": {
"backButton": "मागे",
"nextButton": "पुढे",
"loginMessage": "पासवर्ड प्रविष्ठ करा"
},
"kk": {
"backButton": "Артқа",
"nextButton": "Келесі",
"loginMessage": "Құпия сөзді енгізіңіз"
},
"ml": {
"backButton": "മടങ്ങുക",
"nextButton": "അടുത്തത്",
"loginMessage": "പാസ്വേഡ് നൽകുക"
},
"xh": {
"backButton": "Emva",
"nextButton": "Okulandelayo",
"loginMessage": "Ngenisa iphaswedi"
},
"gd": {
"backButton": "Air ais",
"nextButton": "Air adhart",
"loginMessage": "Cuir a-steach am facal-faire"
},
"as": {
"backButton": "পিছলৈ যাওক",
"nextButton": "পৰৱৰ্তী",
"loginMessage": "পাছৱৰ্ড প্ৰৱিষ্ট কৰক"
},
"tr": {
"backButton": "Geri",
"nextButton": "İleri",
"loginMessage": "Parola girin"
},
"is": {
"backButton": "Til baka",
"nextButton": "Áfram",
"loginMessage": "Færa inn aðgangsorð"
},
"fa": {
"backButton": "برگشت",
"nextButton": "بعدی",
"loginMessage": "رمز عبور را وارد کنید"
},
"ga": {
"backButton": "Siar",
"nextButton": "Ar aghaidh",
"loginMessage": "Iontráil an pasfhocal"
},
"sr-Cyrl-BA": {
"backButton": "Назад",
"nextButton": "Даље",
"loginMessage": "Унесите лозинку"
},
"tg": {
"backButton": "Бозгашт",
"nextButton": "Навбатӣ",
"loginMessage": "Паролро дохил кунед"
},
"or": {
"backButton": "ପଶ୍ଚ୍ୟାତ୍",
"nextButton": "ପରବର୍ତ୍ତୀ",
"loginMessage": "ପାସ୍ୱାର୍ଡ୍ ଏଣ୍ଟର୍ କରନ୍ତୁ"
},
"ru": {
"backButton": "Назад",
"nextButton": "Далее",
"loginMessage": "Введите пароль"
},
"sq": {
"backButton": "Prapa",
"nextButton": "Tjetër",
"loginMessage": "Fut fjalëkalimin"
},
"he": {
"backButton": "הקודם",
"nextButton": "הבא",
"loginMessage": "הזן סיסמה"
},
"ug": {
"backButton": "قايتىش",
"nextButton": "كېيىنكى",
"loginMessage": "پارول كىرگۈزۈڭ"
},
"eu": {
"backButton": "Atzera",
"nextButton": "Hurrengoa",
"loginMessage": "Idatzi pasahitza"
},
"wo": {
"backButton": "Dellu",
"nextButton": "Li ci topp",
"loginMessage": "Dugalal baatu-jàll bi"
},
"no": {
"backButton": "Tilbake",
"nextButton": "Neste",
"loginMessage": "Skriv inn passord"
},
"es": {
"backButton": "Atrás",
"nextButton": "Siguiente",
"loginMessage": "Escribir contraseña "
},
"pt-BR": {
"backButton": "Voltar",
"nextButton": "Avançar",
"loginMessage": "Insira a senha"
},
"bn-BD": {
"backButton": "ফিরুন",
"nextButton": "পরবর্তী",
"loginMessage": "পাসওয়ার্ড লিখুন"
},
"hy": {
"backButton": "Հետ",
"nextButton": "Հաջորդը",
"loginMessage": "Մուտքագրեք գաղտնաբառը"
},
"zh-hant": {
"backButton": "返回",
"nextButton": "下一步",
"loginMessage": "輸入密碼"
},
"vi": {
"backButton": "Quay lại",
"nextButton": "Tiếp theo",
"loginMessage": "Nhập mật khẩu"
},
"sr-cyrl-RS": {
"backButton": "Назад",
"nextButton": "Даље",
"loginMessage": "Унесите лозинку"
},
"sr-Latn-RS": {
"backButton": "Nazad",
"nextButton": "Dalje",
"loginMessage": "Unesite lozinku"
},
"nl": {
"backButton": "Vorige",
"nextButton": "Volgende",
"loginMessage": "Wachtwoord invoeren"
},
"th": {
"backButton": "ย้อนกลับ",
"nextButton": "ถัดไป",
"loginMessage": "ใส่รหัสผ่าน"
},
"lt": {
"backButton": "Atgal",
"nextButton": "Tolyn",
"loginMessage": "Įveskite slaptažodį"
},
"ja": {
"backButton": "戻る",
"nextButton": "次へ",
"loginMessage": "パスワードの入力"
},
"ko": {
"backButton": "뒤로",
"nextButton": "다음",
"loginMessage": "암호 입력"
},
"it": {
"backButton": "Indietro",
"nextButton": "Avanti",
"loginMessage": "Immettere la password"
},
"el": {
"backButton": "Πίσω",
"nextButton": "Επόμενο",
"loginMessage": "Εισαγάγετε κωδικό πρόσβασης"
},
"pt-PT": {
"backButton": "Anterior",
"nextButton": "Seguinte",
"loginMessage": "Introduzir palavra-passe"
},
"kn": {
"backButton": "ಹಿಂದಕ್ಕೆ",
"nextButton": "ಮುಂದೆ",
"loginMessage": "ಪಾಸ್ವರ್ಡ್ ನಮೂದಿಸಿ"
},
"de": {
"backButton": "Zurück",
"nextButton": "Weiter",
"loginMessage": "Kennwort eingeben"
},
"ne": {
"backButton": "पछाडि जानुहोस्",
"nextButton": "अर्को",
"loginMessage": "पासवर्ड प्रविष्ट गर्नुहोस्"
},
"sd": {
"backButton": "واپس",
"nextButton": "اڳيون",
"loginMessage": "پاسورڊ داخل ڪريو"
},
"ky": {
"backButton": "Артка",
"nextButton": "Кийинки",
"loginMessage": "Сырсөз киргизүү"
},
"ar": {
"backButton": "الخلف",
"nextButton": "التالي",
"loginMessage": "أدخل كلمة المرور"
},
"hi": {
"backButton": "वापस जाएँ",
"nextButton": "अगला",
"loginMessage": "पासवर्ड दर्ज करें"
},
"quz": {
"backButton": "Qhipa",
"nextButton": "Qatiq",
"loginMessage": "Kichanata qillqay"
},
"ka": {
"backButton": "უკან",
"nextButton": "შემდეგი",
"loginMessage": "შეიყვანეთ პაროლი"
},
"af": {
"backButton": "Terug",
"nextButton": "Volgende",
"loginMessage": "Voer wagwoord in"
},
"et": {
"backButton": "Tagasi",
"nextButton": "Edasi",
"loginMessage": "Sisestage parool"
},
"pl": {
"backButton": "Wstecz",
"nextButton": "Dalej",
"loginMessage": "Wprowadź hasło"
},
"ta": {
"backButton": "பின் செல்",
"nextButton": "அடுத்து",
"loginMessage": "கடவுச்சொல்லை உள்ளிடவும்"
},
"prs": {
"backButton": "بازگشت",
"nextButton": "بعدی",
"loginMessage": "رمزعبور را وارد کنید"
},
"tt": {
"backButton": "Артка",
"nextButton": "Алга",
"loginMessage": "Серсүзне кертү"
},
"fr": {
"backButton": "Précédent",
"nextButton": "Suivant",
"loginMessage": "Entrez le mot de passe"
},
"be": {
"backButton": "Назад",
"nextButton": "Наступны",
"loginMessage": "Увядзіце пароль"
},
"hr": {
"backButton": "Natrag",
"nextButton": "Dalje",
"loginMessage": "Unesite lozinku"
},
"zu": {
"backButton": "Emuva",
"nextButton": "Okulandelayo",
"loginMessage": "Faka iphasiwedi"
},
"sk": {
"backButton": "Späť",
"nextButton": "Ďalej",
"loginMessage": "Zadajte heslo"
},
"bs": {
"backButton": "Nazad",
"nextButton": "Dalje",
"loginMessage": "Unesite lozinku"
},
"fi": {
"backButton": "Edellinen",
"nextButton": "Seuraava",
"loginMessage": "Anna salasana"
},
"lo": {
"backButton": "ກັບຄືນ",
"nextButton": "ຖັດໄປ",
"loginMessage": "ໃສ່ລະຫັດຜ່ານ"
},
"lv": {
"backButton": "Atpakaļ",
"nextButton": "Tālāk",
"loginMessage": "Ievadīt paroli"
},
"fil": {
"backButton": "Itim",
"nextButton": "Susunod",
"loginMessage": "Ipasok ang password"
},
"ti": {
"backButton": "ድሕሪት",
"nextButton": "ቀጻሊ",
"loginMessage": "መሕለፊ ቃል የእትው"
},
"cy": {
"backButton": "Yn ôl",
"nextButton": "Nesaf",
"loginMessage": "Rhowch gyfrinair"
},
"si": {
"backButton": "ආපසු",
"nextButton": "ඊළඟ",
"loginMessage": "මුරපදය ඇතුළු කරන්න"
},
"sw": {
"backButton": "Nyuma",
"nextButton": "Ifuatayo",
"loginMessage": "Ingiza nywila"
},
"fr-CA": {
"backButton": "Précédent",
"nextButton": "Suivant",
"loginMessage": "Entrer le mot de passe"
},
"cs": {
"backButton": "Zpět",
"nextButton": "Další",
"loginMessage": "Zadat heslo"
},
"uk": {
"backButton": "Назад",
"nextButton": "Далі",
"loginMessage": "Введіть пароль"
},
"nn-NO": {
"backButton": "Tilbake",
"nextButton": "Neste",
"loginMessage": "Skriv inn passord"
},
"nso": {
"backButton": "Morago",
"nextButton": "Latelago",
"loginMessage": "Tsenya phasewete"
},
"hu": {
"backButton": "Vissza",
"nextButton": "Tovább",
"loginMessage": "Jelszó megadása"
},
"ca": {
"backButton": "Endarrere",
"nextButton": "Següent",
"loginMessage": "Introduïu la contrasenya"
}
};
var languageAndCountry = navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage;
var language = "en";
if ( languageAndCountry && languageAndCountry.length >= 2 )
{
var languageOptions = Object.keys(translationTable);
// Sort the codes by length, so that we match longest first
languageOptions.sort(function(a, b){
return b.length - a.length;
});
for ( i = 0; i < languageOptions.length; i++ )
{
// Prefix match the longest (most specific) langauge code we can
if ( languageAndCountry.startsWith( languageOptions[i] ) )
{
language = languageOptions[i];
break;
}
}
}
if ( !element || !element.id )
{
return;
}
var returnText = "";
returnText = translationTable["en"][element.id];
if ( translationTable[language] )
{
returnText = translationTable[language][element.id];
}
return returnText;
}
function ShowUsernamePage(badUsernamePassword)
{
var nextButton = document.getElementById('nextButton');
var backButton = document.getElementById('backButton');
var idBanner = document.getElementById('identityBanner');
var idBannerImage = document.getElementById('identityBannerImage');
var thingsToHide = [ passArea, submitButton, backButton, idBannerImage, idBanner ];
var thingsToShow = [ nextButton, username ];
// Show/Hide elements
AdjustElementDisplay(thingsToHide, 'none');
AdjustElementDisplay(thingsToShow, 'block');
// Set the login message to what it was originally
if ( loginMessage )
{
loginMessage.innerHTML = originalLoginMessage;
}
if ( errorText && errorText.innerHTML && !badUsernamePassword )
{
errorDisplay.style.display = 'none';
}
// Create the 'next' button if we don't have it yet
if ( submissionArea && !nextButton )
{
var nextButton = document.createElement("span");
nextButton.id = "nextButton";
nextButton.className = "submit nextButton";
nextButton.setAttribute("onclick", "PaginatedNext(); return false;");
var nextButtonText = GetLocalizedStringForElement(nextButton);
nextButton.innerHTML = nextButtonText;
nextButton.setAttribute("role", "button");
submissionArea.appendChild(nextButton);
}
if ( submissionArea )
{
submissionArea.classList.remove('submitModified');
}
// Add 'enter' key listener to username textbox
if ( usernameInput && !didAddListener )
{
usernameInput.addEventListener("keydown", function(event) {
if (event.keyCode === 13) {
event.preventDefault();
PaginatedNext();
return false;
}
});
didAddListener = true;
}
}
function ShowPasswordPage()
{
var nextButton = document.getElementById('nextButton');
var idBanner = document.getElementById('identityBanner');
var idBannerImage = document.getElementById('identityBannerImage');
var backButton = document.getElementById('backButton');
var thingsToHide = [ errorDisplay, nextButton, username ];
var thingsToShow = [ submitButton, passArea, backButton, idBanner, idBannerImage ];
// Show/Hide elements
AdjustElementDisplay(thingsToHide, 'none');
AdjustElementDisplay(thingsToShow, 'block');
if ( loginMessage )
{
var loginMessageText = GetLocalizedStringForElement(loginMessage);
loginMessage.innerHTML = loginMessageText;
}
if ( idBanner )
{
idBanner.innerText = usernameInput.value;
}
// Create the ID Banner if we need to
if ( workArea && !idBanner)
{
// Create the ID banner
var idBanner = document.createElement("div");
idBanner.id = "identityBanner";
idBanner.className = "identityBanner";
idBanner.innerText = usernameInput.value;
// Add the newly-created element
workArea.insertBefore(idBanner, workArea.firstChild);
}
// Create the 'Back' button if we need to
if ( submissionArea && !backButton )
{
var backButton = document.createElement("span");
backButton.id = "backButton";
backButton.className = "submit";
backButton.classList.add('backButton');
backButton.setAttribute("onclick", "PaginatedBack(); return false;");
if ( submitButton )
{
submitButton.classList.add('modifiedSignIn');
}
var backButtonText = GetLocalizedStringForElement(backButton);
backButton.innerHTML = backButtonText;
backButton.setAttribute("role", "button");
submissionArea.appendChild(backButton);
}
if ( submissionArea )
{
submissionArea.classList.add('submitModified');
}
if ( passwordInput )
{
passwordInput.focus();
}
}
var usernameInput = document.getElementById("userNameInput");
var passwordInput = document.getElementById('passwordInput');
if ( usernameInput && passwordInput)
{
var username = document.getElementById('userNameArea');
var passArea = document.getElementById('passwordArea');
var submitButton = document.getElementById('submitButton');
var submissionArea = document.getElementById('submissionArea');
var errorText = document.getElementById('errorText');
var errorDisplay = document.getElementById('error');
var workArea = document.getElementById('workArea');
var loginMessage = document.getElementById('loginMessage');
var originalLoginMessage = "";
var didLoadPasswordPageBefore = false;
if ( loginMessage )
{
originalLoginMessage = loginMessage.innerHTML;
}
var didAddListener = false;
var errorIsShown = false;
if ( errorDisplay && errorDisplay.style && errorDisplay.style.display != "none")
{
errorIsShown = true;
}
// Show the Username page, unless a username was already entered (login hint on the request), or we have an error
if ( usernameInput && usernameInput.value && !errorIsShown )
{
ShowPasswordPage();
}
else
{
ShowUsernamePage(errorIsShown);
}
}
function getStyle(element, styleProp) {
var propStyle = null;
if (element && element.currentStyle) {
propStyle = element.currentStyle[styleProp];
}
else if (element && window.getComputedStyle) {
propStyle = document.defaultView.getComputedStyle(element, null).getPropertyValue(styleProp);
}
return propStyle;
}
var computeLoadIllustration = function () {
var branding = document.getElementById("branding");
var brandingDisplay = getStyle(branding, "display");
var brandingWrapperDisplay = getStyle(document.getElementById("brandingWrapper"), "display");
if (brandingDisplay && brandingDisplay !== "none" &&
brandingWrapperDisplay && brandingWrapperDisplay !== "none") {
var newClass = "illustrationClass";
if (branding.classList && branding.classList.add) {
branding.classList.add(newClass);
} else if (branding.className !== undefined) {
branding.className += " " + newClass;
}
if (window.removeEventListener) {
window.removeEventListener('load', computeLoadIllustration, false);
window.removeEventListener('resize', computeLoadIllustration, false);
}
else if (window.detachEvent) {
window.detachEvent('onload', computeLoadIllustration);
window.detachEvent('onresize', computeLoadIllustration);
}
}
};
if (window.addEventListener) {
window.addEventListener('resize', computeLoadIllustration, false);
window.addEventListener('load', computeLoadIllustration, false);
}
else if (window.attachEvent) {
window.attachEvent('onresize', computeLoadIllustration);
window.attachEvent('onload', computeLoadIllustration);
}
function SetIllustrationImage(imageUri) {
var illustrationImageClass = '.illustrationClass {background-image:url(' + imageUri + ');}';
var css = document.createElement('style');
css.type = 'text/css';
if (css.styleSheet) css.styleSheet.cssText = illustrationImageClass;
else css.appendChild(document.createTextNode(illustrationImageClass));
document.getElementsByTagName("head")[0].appendChild(css);
}
// IE doesn't support "startsWith", adding definition
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(searchString, position){
position = position || 0;
return this.substr(position, searchString.length) === searchString;
};
}
// Create new div to handle background tint overlay
var tintDiv = document.createElement('div');
tintDiv.id = 'brandingTint';
tintDiv.class = 'illustrationClass';
// Locate branding div and apply add tintDiv as child
var brandingDiv = document.getElementById('branding');
if (brandingDiv) {
brandingDiv.appendChild(tintDiv);
}
// NOTE: If you wish to support the ADFS illustration (background image), you must use the following:
// PSH> Set-AdfsWebTheme -TargetName <activeTheme> -AdditionalFileResource @{uri='/adfs/portal/images/illustration_mine.png';path='.\illustration_mine.png'}
// SetIllustrationImage('/adfs/portal/images/illustration_mine.png');