-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
325 lines (287 loc) · 15.6 KB
/
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
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
<html>
<head>
<link type="text/css" rel="stylesheet" href="styles.css">
<script>
Math.log2 = Math.log2 || function(n) {
return Math.log(n) / Math.log(2);
}
Math.trueRandom = (function() {
var crypt = window.crypto || window.msCrypto;
if (crypt && crypt.getRandomValues) {
// if we have a crypto library, use it
var random = function(min, max) {
var rval = 0;
var range = max - min;
if (range < 2) {
return min;
}
var bits_needed = Math.ceil(Math.log2(range));
if (bits_needed > 53) {
throw new Exception("We cannot generate numbers larger than 53 bits.");
}
var bytes_needed = Math.ceil(bits_needed / 8);
var mask = Math.pow(2, bits_needed) - 1;
// 7776 -> (2^13 = 8192) -1 == 8191 or 0x00001111 11111111
// Create byte array and fill with N random numbers
var byteArray = new Uint8Array(bytes_needed);
crypt.getRandomValues(byteArray);
var p = (bytes_needed - 1) * 8;
for (var i = 0; i < bytes_needed; i++) {
rval += byteArray[i] * Math.pow(2, p);
p -= 8;
}
// Use & to apply the mask and reduce the number of recursive lookups
rval = rval & mask;
if (rval >= range) {
// Integer out of acceptable range
return random(min, max);
}
// Return an integer that falls within the range
return min + rval;
}
return function() {
var r = random(0, 1000000000) / 1000000000;
return r;
};
} else {
// From https://web.archive.org/web/20120502223108/http://baagoe.com/en/RandomMusings/javascript/
// Johannes Baagøe <baagoe@baagoe.com>, 2010
function Mash() {
var n = 0xefc8249d;
var mash = function(data) {
data = data.toString();
for (var i = 0; i < data.length; i++) {
n += data.charCodeAt(i);
var h = 0.02519603282416938 * n;
n = h >>> 0;
h -= n;
h *= n;
n = h >>> 0;
h -= n;
n += h * 0x100000000; // 2^32
}
return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
};
mash.version = 'Mash 0.9';
return mash;
}
// From http://baagoe.com/en/RandomMusings/javascript/
function Alea() {
return (function(args) {
// Johannes Baagøe <baagoe@baagoe.com>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (args.length == 0) {
args = [+new Date()];
}
var mash = Mash();
s0 = mash(' ');
s1 = mash(' ');
s2 = mash(' ');
for (var i = 0; i < args.length; i++) {
s0 -= mash(args[i]);
if (s0 < 0) {
s0 += 1;
}
s1 -= mash(args[i]);
if (s1 < 0) {
s1 += 1;
}
s2 -= mash(args[i]);
if (s2 < 0) {
s2 += 1;
}
}
mash = null;
var random = function() {
var t = 2091639 * s0 + c * 2.3283064365386963e-10; // 2^-32
s0 = s1;
s1 = s2;
return s2 = t - (c = t | 0);
};
random.uint32 = function() {
return random() * 0x100000000; // 2^32
};
random.fract53 = function() {
return random() +
(random() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53
};
random.version = 'Alea 0.9';
random.args = args;
return random;
}(Array.prototype.slice.call(arguments)));
};
return Alea();
}
}());
Math.guid = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.trueRandom() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
};
var myCookie = {};
function loaded() {
debugger;
var url = window.location.href;
var queryString = url.substring(url.indexOf("?"));
var queryParams = new URLSearchParams(queryString);
var cookieStr = document.cookie;
if (cookieStr != null && cookieStr != "") {
myCookie = JSON.parse(cookieStr);
}
if (myCookie.guid == null) {
myCookie.guid = Math.guid();
}
if (!hasValue(myCookie.completedRepos)) {
myCookie.completedRepos = [];
}
var redirect = getBool(queryParams.get("redirect"));
var repo = queryParams.get("SourceRepo");
var repos = document.getElementsByName('repo');
if (redirect) {
myCookie.AdditionalResponse = true;
if (hasValue(repo)) {
myCookie.completedRepos.push(repo);
}
document.getElementById("intro1").style.display = "none";
document.getElementById("intro2").style.display = "block";
} else {
if (hasValue(repo)) {
for (i = 0; i < repos.length; i++) {
if (repos[i].value == repo) {
repos[i].checked = true;
}
}
}
}
for (i = 0; i < repos.length; i++) {
if (myCookie.completedRepos.includes(repos[i].value)) {
repos[i].disabled = true;
document.querySelector("label[for=" + repos[i].id + "]").insertAdjacentText("beforeend", " (completed)");
}
}
document.cookie = JSON.stringify(myCookie);
}
function hasValue(obj) {
return (obj != undefined && obj != null && obj != "");
}
function getBool(obj) {
return (obj != undefined && obj != null) ? obj : false;
}
function nextBtn() {
debugger;
var params = {};
params.guid = myCookie.guid;
var repo = null;
var repos = document.getElementsByName('repo');
for (i = 0; i < repos.length; i++) {
if (repos[i].checked) {
repo = repos[i];
break;
}
}
debugger;
if (repo != null) {
params.SourceRepo = repo.value;
params.RepoTitle = (hasValue(repo.getAttribute("data-title"))) ? repo.getAttribute("data-title") : repo.value;
params.TechName = (hasValue(repo.getAttribute("data-tech"))) ? repo.getAttribute("data-tech") : params.repoTitle;
params.AdditionalResponse = myCookie.AdditionalResponse;
params.UserGuid = myCookie.guid;
//https://www.surveymonkey.com/r/R77X922?SourceRepo=[SourceRepo_value]&AdditionalResponse=[AdditionalResponse_value]&RepoTitle=[RepoTitle_value]&TechName=[TechName_value]
var url = "https://www.surveymonkey.com/r/R77X922?" + new URLSearchParams(params).toString();
window.open(url);
} else {
document.getElementById("selectRepo").style.display = "block";
}
}
</script>
</head>
<body onload="loaded()">
<div class="main">
<img class="logo user-generated" src="mslogo.png" alt="Microsoft Logo" style="width:300px;height:133px;" /><br>
<h1>
Repo experience survey - Fall 2020
</h1>
<article>
<div id="intro1">
<p>The purpose of this survey is to regularly assess and monitor the customer experience for repos managed by Microsoft Developer Division. This survey is about the experience of working with the OSS projects and the health of the community
around those projects. Your answers here will be used to understand where we need to improve.</p>
<p>You may receive periodic invites to this survey over time, please respond if you haven't already in the last 30 days so that we can assess whether we are actually improving.</p>
<h2> Which repo do you wish to provide feedback on?</h2>
<p>Please choose one of the repos you visit most often. If you wish to provide feedback for multiple repos, you will be redirected here at the end of the survey where you can provide additional responses.
</p>
</div>
<div id="intro2" style="display: none;">
<h2>Thankyou for your responses. We really appreciate the feedback.</h2>
<p>If you wish to provide feedback for an additional repo, please select it from the list below. We'll ask less questions as we have some answers from your previous response.</p>
</div>
<form>
<div id="selectRepo" class="warning" style="display:none;">Please select a repo to continue!</div>
<div class="repos">
<div class="group">
<h3>.NET</h3>
<input type="radio" name="repo" value="dotnet/aspnetcore" id="dotnet_aspnetcore" data-title="ASP.NET Core" data-tech="ASP.NET">
<label for="dotnet_aspnetcore">dotnet/aspnetcore</label><br>
<input type="radio" name="repo" value="dotnet/machinelearning" id="dotnet_machinelearning" data-title="Machine Learning">
<label for="dotnet_machinelearning">dotnet/machinelearning</label><br>
<input type="radio" name="repo" value="dotnet/roslyn" id="dotnet_roslyn" data-title="Roslyn project">
<label for="dotnet_roslyn">dotnet/roslyn</label><br>
<input type="radio" name="repo" value="dotnet/runtime" id="dotnet_runtime" data-title=".NET Runtime">
<label for="dotnet_runtime">dotnet/runtime</label><br>
<input type="radio" name="repo" value="dotnet/sdk" id="dotnet_sdk" data-title=".NET SDK">
<label for="dotnet_sdk">dotnet/sdk</label><br>
<input type="radio" name="repo" value="dotnet/winforms" id="dotnet_winforms" data-title="Windows Forms">
<label for="dotnet_winforms">dotnet/winforms</label><br>
<input type="radio" name="repo" value="dotnet/wpf" id="dotnet_wpf" data-title="WPF">
<label for="dotnet_wpf">dotnet/wpf</label><br>
</div>
<div class="group">
<h3>Microsoft</h3>
<input type="radio" name="repo" value="Microsoft/pylance-release" id="Microsoft_pylance-release" data-title="Pylance">
<label for="Microsoft_pylance-release">Microsoft/pylance-release</label><br>
<input type="radio" name="repo" value="Microsoft/pyright" id="Microsoft_pyright">
<label for="Microsoft_pyright">Microsoft/pyright</label><br>
<input type="radio" name="repo" value="Microsoft/vscode-python" id="Microsoft_vscode-python" data-title="VS Code Python extension">
<label for="Microsoft_vscode-python"> Microsoft/vscode-python
</label><br>
<input type="radio" name="repo" value="Microsoft/stl" id="Microsoft_stl" data-title="STL">
<label for="Microsoft_stl">Microsoft/stl</label><br>
<input type="radio" name="repo" value="Microsoft/TypeScript" id="Microsoft_TypeScript" data-title="Typescript">
<label for="Microsoft_TypeScript">Microsoft/TypeScript</label><br>
<input type="radio" name="repo" value="Microsoft/vcpkg" id="Microsoft_vcpkg">
<label for="Microsoft_vcpkg">Microsoft/vcpkg</label><br>
<input type="radio" name="repo" value="Microsoft/vscode" id="Microsoft_vscode" data-title="Visual Studio Code">
<label for="Microsoft_vscode">Microsoft/vscode</label><br>
<input type="radio" name="repo" value="Microsoft/vscode-c++" id="Microsoft_vscode-c++" data-title="VS Code C++ extension">
<label for="Microsoft_vscode-c++">Microsoft/vscode-c++</label><br>
<input type="radio" name="repo" value="Microsoft/GSL" id="Microsoft_GSL">
<label for="Microsoft_GSL">Microsoft/GSL</label><br>
<input type="radio" name="repo" value="Microsoft/CMakeTools" id="Microsoft_CMakeTools">
<label for="Microsoft_CMakeTools">Microsoft/CMakeTools</label><br>
</div>
<div>
<div class="group">
<h3>Nuget</h3>
<input type="radio" name="repo" value="NuGet/NuGet.Home" id="NuGet_NuGet.Home" data-title="Nuget">
<label for="NuGet_NuGet.Home">NuGet/NuGet.Home</label><br>
<h3>Xamarin</h3>
<input type="radio" name="repo" value="xamarin/xamarin-android" id="xamarin_xamarin-android" data-title="Xamarin for Android">
<label for="xamarin_xamarin-android">xamarin/xamarin-android</label><br>
<input type="radio" name="repo" value="xamarin/xamarin-macios" id="xamarin_xamarin-macios" data-title="Xamarin for Mac & iOS">
<label for="xamarin_xamarin-macios">xamarin/xamarin-macios</label><br>
<input type="radio" name="repo" value="xamarin/Xamarin.Forms" id="xamarin_Xamarin.Forms" data-title="Xamarin Forms">
<label for="xamarin_Xamarin.Forms">xamarin/Xamarin.Forms </label><br>
</div>
</div>
<div class="center">
<button type="button" onclick="nextBtn()">Next</button>
</div>
</form>
</article>
</div>
</body>
</html>