forked from vju42/ucaas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmyexample.js
55 lines (52 loc) · 2.17 KB
/
myexample.js
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
// ==UserScript==
// @copyright Copyright IBM Corp. 2017
//
// @name helloWorld
// @version 0.1
// @description *** PROTOTYPE CODE *** demonstrates simple hello world script to customize the Home Page
//
// @namespace http://ibm.com
//
// @author Hello World (aka You!)
//
// @include *://apps.collabservintegration.com/homepage/*
//
// @exclude
//
// @run-at document-end
//
// ==/UserScript==
if(typeof(dojo) != "undefined") {
require(["dojo/domReady!"], function(){
try {
// utility function to let us wait for a specific element of the page to load...
var waitFor = function(callback, elXpath, elXpathRoot, maxInter, waitTime) {
if(!elXpathRoot) var elXpathRoot = dojo.body();
if(!maxInter) var maxInter = 10000; // number of intervals before expiring
if(!waitTime) var waitTime = 1; // 1000=1 second
if(!elXpath) return;
var waitInter = 0; // current interval
var intId = setInterval( function(){
if( ++waitInter<maxInter && !dojo.query(elXpath,elXpathRoot).length) return;
clearInterval(intId);
if( waitInter >= maxInter) {
console.log("**** WAITFOR ["+elXpath+"] WATCH EXPIRED!!! interval "+waitInter+" (max:"+maxInter+")");
} else {
console.log("**** WAITFOR ["+elXpath+"] WATCH TRIPPED AT interval "+waitInter+" (max:"+maxInter+")");
callback();
}
}, waitTime);
};
// here we use waitFor to wait on the .lotusStreamTopLoading div.loaderMain.lotusHidden element
// before we proceed to customize the page...
waitFor( function(){
// wait until the "loading..." node has been hidden
// indicating that we have loaded content.
dojo.query("span.shareSome-title")[0].textContent="Willkommen beim UCaaS PoC für Sievert AG! ";
},
".lotusStreamTopLoading div.loaderMain.lotusHidden");
} catch(e) {
alert("Exception occurred in helloWorld: " + e);
}
});
}