-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
105 lines (90 loc) · 2.37 KB
/
demo.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
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
<!doctype html>
<html>
<head>
<meta name="asq-elements" content="width=device-width, initial-scale=1, user-scalable=no">
<title>ASQ | Mashup Challenge Scoreboard</title>
<script src="..//webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="asq-mashup-challenge-scoreboard.html">
<style shim-shadowdom>
body {
font-family: 'Helvetica Neue', Helvetica, Arial;
font-size: 14px;
margin: 0;
padding: 24px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
}
section {
padding: 20px 0;
}
section > div {
padding: 14px;
font-size: 16px;
}
</style>
</head>
<body>
<template is="auto-binding" id="demo-template">
<section>
<asq-mashup-challenge-scoreboard questions="{{questions}}">
</asq-mashup-challenge-scoreboard>
</section>
<script>
var template = document.querySelector('#demo-template');
template.questions = [
{
data:{
stem: "Item #1",
total: 3.29,
rank: 2,
ratingItems: [
{html: "Criterion 1", rating: 1.23},
{html: "Criterion 2", rating: 2.57},
{html: "Criterion 3", rating: 0.58}
]
}
},
{
data:{
stem: "Item #2",
total: 4,
rank: 1,
ratingItems: [
{html: "Criterion 1", rating: 5},
{html: "Criterion 2", rating: 4},
{html: "Criterion 3", rating: 3}
]
}
},
{
data:{
stem: "Item #3",
total: 2.27,
rank:3,
ratingItems: [
{html: "Criterion 1", rating: 1},
{html: "Criterion 2", rating: 3},
{html: "Criterion 3", rating: 2.8}
]
}
}
];
window.onmessage = function(e){
if (typeof e.data.role == "string" && e.data.role.length > 0) {
var allAsqElements = document.querySelectorAll('html /deep/ *');
allAsqElements = Array.prototype.slice.call(allAsqElements).filter(function(el) {
return isASQEl(el);
});
//set role for every asq-element in this page
allAsqElements.forEach(function(elem, index) {
elem.role = e.data.role;
});
}
function isASQEl(el) {
return el.localName.indexOf('asq-') != -1;
}
};
</script>
</template>
</body>
</html>