-
Notifications
You must be signed in to change notification settings - Fork 38
/
default.index.html
47 lines (31 loc) · 1.07 KB
/
default.index.html
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
<!DOCTYPE html>
<html>
<head>
<title>jDrupal</title>
<!-- Load jDrupal and configure its settings-->
<script src="jdrupal.min.js"></script>
<script type="text/javascript">
jDrupal.settings = {
sitePath: '', // The path to your Drupal site, for example: http://www.example.com
basePath: '/'
};
</script>
</head>
<body onload="hello_world()">
<p id="message">Loading...</p>
<script type="text/javascript">
function hello_world() {
// Connect to Drupal.
jDrupal.connect().then(function() {
// Grab the current user account.
var user = jDrupal.currentUser();
// Prepare a message form the user.
var msg = 'Hello World';
if (user.isAuthenticated()) { msg = 'Hello ' + user.getAccountName(); }
// Show the message in the paragraph.
document.getElementById("message").innerHTML = msg;
});
}
</script>
</body>
</html>