-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsp-migration-banner.js
More file actions
43 lines (41 loc) · 1.54 KB
/
sp-migration-banner.js
File metadata and controls
43 lines (41 loc) · 1.54 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
// O365 - Migration Banner
function addcss(css) {
var head = document.getElementsByTagName('head')[0];
var s = document.createElement('style');
s.setAttribute('type', 'text/css');
if (s.styleSheet) { // IE
s.styleSheet.cssText = css;
} else { // the world
s.appendChild(document.createTextNode(css));
}
head.appendChild(s);
}
addcss('#status_preview_body {display:none}');
// Counter
MigrationBannerCount = 0;
function MigrationBanner() {
var sp = document.getElementById('status_preview');
if (MigrationBannerCount > 10) {
console.log('MigrationBanner - safety, max attempts, to prevent infinite loop');
// safety, max attempts, to prevent infinite loop
return
}
if (!sp) {
console.log('MigrationBanner - wait and check later');
// wait and check later
MigrationBannerCount++;
window.setTimeout(MigrationBanner, 200);
return;
} else {
console.log('MigrationBanner - found and modify');
// found and modify
var h = sp.innerHTML;
h = h.replace("This site is read only at the farm administrator's request.",'<table border=0><tr><td><img src="/_layouts/images/kpinormallarge-1.gif" height="15px" width="15px" style="padding-right:20px"/></td><td><b>MIGRATION IN PROGRESS:</b> This site is being moved to Office 365 and will be locked as Read-Only until its migration is complete.</td></tr><table>');
sp.innerHTML = h;
addcss('#status_preview_body {display:inherit}');
}
}
function MigrationBannerLoad() {
ExecuteOrDelayUntilScriptLoaded(MigrationBanner, "sp.js")
}
window.setTimeout('MigrationBannerLoad()', 1000);