-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhac.js
788 lines (685 loc) · 21.6 KB
/
hac.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
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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
/** @type {number} */
var asianness,
/** @type {boolean} */
asianness_on,
/** @type {number} */
hue,
/** @type {boolean} */
shadowMax = false;
/**
* Gets the number of properties of an object
* @param {Object} obj - the object to get the size of
* @returns {number} the number of properties of the object
*/
Object.size = function (obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
/***================***
*** LOGIN HANDLERS ***
***================***/
/** Disables input to the login form and shows that a login is in progress */
function disable_login_form() {
$("#error_msg").slideUp(250, function () {
$("#error_msg").text("");
});
$("#login_form input").attr("disabled", true);
$("#do_login").val("Logging in...");
}
/** Resets the login form to its original enabled state */
function reset_login_form() {
$("body").removeClass("busy");
$("#login_form input").attr("disabled", false);
$("#do_login").val("Login");
}
/**
* Shows that an error occurred during the login process
* @param {string} text - the text to display
* @deprecated use {@link toast} instead
*/
function show_login_error(text) {
$("#error_msg").text(text).slideDown();
}
/** Hides the login form and show the grades */
function hide_login_form() {
$("#password").val("");
$(document.body).addClass("logged_in");
window.setTimeout(function () {
$("#login_wrapper").hide();
$("#restricted_access_wrapper").addClass("hide");
}, 500);
}
/**
* Handles any error thrown while logging in by displaying an error message
* to the user and showing the login form
* @param {XMLHttpRequest} jqXHR - the request that threw the error
* @param {string} textStatus - the type of error thrown
* @param {string} errorThrown - a description of the error
*/
function on_error_logging_in(jqXHR, textStatus, errorThrown) {
console.log(textStatus, errorThrown);
var error_msg;
switch (textStatus) {
case "error":
error_msg = "Unable to log in";
break;
case "timeout":
error_msg = "Login timed out";
break;
default:
error_msg = "Failed to log in";
}
toast(error_msg);
reset_login_form();
}
/**
* Displays a small message near the bottom of the window, inspired by Android
* Toast
* @param {string} txt - the message to display
* @param {number} [duration=5] - the length of time in seconds to display the
* message for
*/
function toast(txt, duration) {
var invalid_duration = typeof duration == "undefined" || duration < 0;
duration = invalid_duration ? 5 : duration;
var toast = document.createElement("div");
$(toast).addClass("toast").text(txt);
if (!$("body").hasClass("nonimations"))
$(toast).addClass("out");
window.setTimeout(function () {
$(toast).removeClass("out");
}, 10);
window.setTimeout(function () {
$(toast).addClass("out");
}, duration * 1000 + 510);
$("body").append(toast);
window.setTimeout(function () {
$(toast).detach();
}, duration * 1000 + 2510);
}
var error_id = 0;
/**
* Displays an error on the restricted access form (password protection)
* @param {jQuery} $input - the element that sent the request to show an error
* @param {string} message - the message to display
*/
function show_error($input, message) {
console.error(message);
// Hide old error messages
$input.parent().children(".error_msg").detach();
$el = $(document.createElement("div"));
$el.addClass("error_msg")
.text(message)
.appendTo($input.parent())
.addClass("animate");
window.setTimeout(function () {
$el.detach();
}, 4000);
$input.focus();
error_id++;
}
/**
* Handles any error that occurs when loading grades fails
* @param {XMLHttpRequest} jqXHR - the request that caused the error
* @param {string} textStatus - the type of error thrown
* @param {string} errorThrown - a description of the error
*/
function handle_load_error(jqXHR, textStatus, errorThrown) {
// console.log(textStatus, errorThrown);
switch (textStatus) {
case "timeout": error_msg = "Loading grades timed out"; break;
case "abort": error_msg = "Loading grades aborted"; break;
default: error_msg = "Loading grades failed";
}
$("body").removeClass("busy").addClass("offline");
toast(error_msg);
}
/**
* Handles any error that occurs when loading class grades fails
* @param {XMLHttpRequest} jqXHR - the request that caused the error
* @param {string} textStatus - the type of error thrown
* @param {string} errorThrown - a description of the error
*/
function handle_load_error_class(jqXHR, textStatus, errorThrown) {
// console.log(textStatus, errorThrown);
switch (textStatus) {
case "timeout": error_msg = "Loading class grades timed out"; break;
case "abort": error_msg = "Loading class grades aborted"; break;
default: error_msg = "Loading class grades failed";
}
$("body").removeClass("busy").addClass("offline");
toast(error_msg);
}
/**
* Logs into Round Rock ISD with the given credentials
* @param {string} uname - username
* @param {string} pass - password
* @param {string} studentid - 6-digit district-assigned student ID
*/
function login_to_rrisd(uname, pass, studentid) {
// get a session ID
RRISD_HAC.get_session(
uname,
pass,
studentid,
function (id) {
// save session id
window.session_id = id;
// load grades
RRISD_HAC.get_gradesHTML(undefined, function (doc) {
window.doc = doc;
processUpdatedGrades(doc);
hide_login_form();
reset_login_form();
chrome.extension.getBackgroundPage().create_interval(true);
$("body").removeClass("busy offline edited");
}, handle_load_error);
},
on_error_logging_in);
}
/**
* Logs into Austin ISD with the given credentials
* @param {string} uname - username
* @param {string} pass - password
* @param {string} studentid - 7-digit district-assigned student ID
*/
function login_to_aisd(uname, pass, studentid) {
// get a session ID
AISD_HAC.get_session(
uname,
pass,
studentid,
function (id) {
// save session id
window.session_id = id;
// load grades
AISD_HAC.get_gradesHTML(id, localStorage["studentid"].decrypt().decrypt(),
function(doc) {
window.doc = doc;
processUpdatedGrades(doc);
hide_login_form();
reset_login_form();
chrome.extension.getBackgroundPage().create_interval(true);
$("body").removeClass("busy offline edited");
});
},
on_error_logging_in);
}
/**
* Saves credentials to localStorage and logs in
* @param {string} uname - username
* @param {string} pass - password
* @param {string} studentid - district-assigned student ID
* @param {string} district - district name
*/
function login(uname, pass, studentid, district) {
$("body").addClass("busy");
// analytics
_gaq.push(['_trackEvent', 'Account', 'Login']);
disable_login_form();
localStorage.setItem("login", uname.encrypt().encrypt());
localStorage.setItem("studentid", studentid.encrypt().encrypt());
localStorage.setItem("district", district);
if (district == "aisd")
localStorage.setItem("aisd_password", pass.encrypt().encrypt());
else if (district == "rrisd")
localStorage.setItem("rrisd_password", pass.encrypt().encrypt());
// query the correct district's website
switch (district) {
case "rrisd":
login_to_rrisd(uname, pass, studentid);
break;
case "aisd":
login_to_aisd(uname, pass, studentid);
break;
}
}
/** Generates the bar that shows up right below the overall grades table */
function generateBottomBar() {
var $root = $(document.createElement("div"));
$root.prop("id", "bottom_bar");
var $gpa_wrapper = $(document.createElement("span"));
$gpa_wrapper.prop("id", "gpa_wrapper")
.html("GPA: ")
.prop("title", "Click for GPA options")
.tipsy({ gravity: "w", fade: true })
.click(GPA.toggle_panel)
.append($(document.createElement("span")).prop("id", "gpa"));
$("#GPA_panel_wrapper").click(GPA.toggle_panel);
$("#GPA_panel").click(function (event) {
event.stopPropagation();
});
// re-render GPA panel when changing weighted/unweighted
$("#GPA_panel_wrapper #gpa_weighted_toggle_wrapper input").change(function () {
var gpa_weighted = this.checked;
localStorage.setItem("gpa_weighted", gpa_weighted ? "true" : "false");
GPA.show();
GPA.render_panel();
});
// initialize GPA weighted value
var gpa_weighted = localStorage["gpa_weighted"] == "true";
if (gpa_weighted)
$("#gpa_weighted_toggle_wrapper input").attr("checked", true);
var ad = Ad.generate_ad();
$root.append($gpa_wrapper).append(ad).append(
$(document.createElement("span")).html(" ")
.css("clear", "both"));
$("#grades").append($root);
}
/** Retrieves the cached grades from localStorage and displays them */
function showCachedGrades() {
if (localStorage.hasOwnProperty("grades")) {
$("#grades").html("").append(HAC_HTML.json_to_html(
JSON.parse(localStorage["grades"])));
generateBottomBar();
setChangedGradeIndicators();
GPA.show();
}
}
/**
* Checks if a response from HAC contains grade data
* @param {string} the HTML document to parse and check
* @returns {boolean} true if the document is valid
*/
function isValidGradeData(doc) {
return $(".DataTable", $.parseHTML(doc)).length != 0;
}
/** Reverts user edits and tries to update the grades from the server */
function update() {
$("body").addClass("busy");
// analytics
_gaq.push(['_trackEvent', 'Grades', 'Refresh']);
// show cached grades (this undoes user edits)
showCachedGrades();
// hide class grades
$("#classgrades").html("");
// query the correct district
switch (localStorage["district"]) {
case "rrisd":
RRISD_HAC.load_session(function() {
RRISD_HAC.get_gradesHTML(
localStorage["url"], processUpdatedGrades, handle_load_error);
});
break;
case "aisd":
AISD_HAC.load_session(function() {
AISD_HAC.get_gradesHTML(
window.session_id,
localStorage["studentid"].decrypt().decrypt(),
processUpdatedGrades)
});
break;
}
}
/**
* Displays a set of grades from JSON on-screen
* @param {JSON} grades_json - the grades to display
*/
function displayGrades(grades_json) {
$("#grades").html("").append(HAC_HTML.json_to_html(grades_json));
generateBottomBar();
}
/**
* Saves a response from a HAC server for marking period grades and displays it
* to the user
* @param {string} doc - the HTML response of the server
* @returns {boolean} true if the operation was successful
*/
function processUpdatedGrades(doc) {
if (!isValidGradeData(doc)) return false;
var doc_json = HAC_HTML.html_to_jso(doc);
// output
displayGrades(doc_json);
// compare
if (localStorage.hasOwnProperty("grades")) {
HAC_HTML.compare_grades(JSON.parse(localStorage["grades"]), doc_json);
setChangedGradeIndicators();
}
// store
localStorage.setItem("grades", JSON.stringify(doc_json));
Updater.set_updated();
$("#lastupdated").html(Updater.get_update_text());
// classes
$("body").addClass("logged_in").removeClass("busy offline edited");
// gpa
GPA.show();
return true;
}
/**
* Saves a response from a HAC server for class grades and displays it to the user
* @param {string} data - the unique class and marking period identifier
* @param {string} doc - the HTML response of the server
* @returns {boolean} true if the operation was successful
*/
function processUpdatedClassGrades(data, doc) {
// process marking period-level grades first
if (!processUpdatedGrades(doc))
// if processUpdatedGrades returns false, cancel the operation; it failed
return false;
// store
var cgrades_json = HAC_HTML.cgrades_to_json(doc);
localStorage.setItem("class-" + data, JSON.stringify(cgrades_json));
// show grades
$("#classgrades").html(HAC_HTML.cjson_to_html(cgrades_json));
return true;
}
/**
* Logs out, deletes all user data, and shows the login from
*/
function logout() {
// analytics
_gaq.push(['_trackEvent', 'Account', 'Logout']);
// show login
$("#direct_access_form").hide();
$("#login_form, #login_wrapper").show();
$(document.body).removeClass("logged_in");
// hide grades
$("#grades").html("");
$("#classgrades").html("");
// clear cache
localStorage.clear();
// clear interval
chrome.extension.getBackgroundPage().clear_interval();
}
/**
* Loads class grades for a given class and marking period
* @param {string} data - the unique class and marking period identifier, which
* corresponds to the ID the HAC server assigns
*/
function loadClassGrades(data) {
$("body").addClass("busy");
// analytics
_gaq.push(['_trackEvent', 'Class Grades', 'View']);
// pass data
var cg;
(cg = $("#classgrades")).data("data", data);
// hide old class grades if visible while loading
cg.html("");
// Remove grade change indicator
if (localStorage.hasOwnProperty("changed_grades")) {
var gradeChanges = JSON.parse(localStorage["changed_grades"]);
delete gradeChanges[data];
localStorage.setItem("changed_grades", JSON.stringify(gradeChanges));
// setChangedGradeIndicators();
}
// show cached grades (this undoes user edits)
showCachedGrades();
if (localStorage.hasOwnProperty("class-" + data))
cg.html("").append(
HAC_HTML.cjson_to_html(
JSON.parse(
localStorage["class-" + data])));
// load
switch (localStorage["district"]) {
case "rrisd":
RRISD_HAC.load_session(function() {
RRISD_HAC.get_classGradeHTML(
localStorage["url"], data,
function(stuff) { processUpdatedClassGrades(data, stuff); },
handle_load_error_class);
});
break;
case "aisd":
AISD_HAC.load_session(function() {
AISD_HAC.get_classGradeHTML(
window.session_id,
localStorage["studentid"].decrypt().decrypt(),
data,
function(stuff) { processUpdatedClassGrades(data, stuff); });
});
break;
}
}
/** Restricts access to the grades by displaying a form over them */
function lock() {
// $(document.body).addClass("locked").removeClass("logged_in");
$(document.body).addClass("locked");
$("#unlocker").focus();
$("#restricted_access_wrapper").removeClass("hide");
}
var shakeTimer;
/**
* Tests the password given through the restricted access form and grants access
* if it is correct
* @param {string} password - the password that the user entered
*/
function unlock(password) {
if (typeof shakeTimer !== "undefined") window.clearTimeout(shakeTimer);
var hashedInput = CryptoJS.SHA512(password).toString();
if (hashedInput === localStorage["password"]) {
$("#unlocker")[0].setCustomValidity("");
$(document.body).removeClass("locked");
window.setTimeout(function () {
$("#restricted_access_wrapper").addClass("hide");
}, 1000);
} else {
if (!localStorage.hasOwnProperty("animations") || localStorage["animations"] != "on") {
// $("#unlocker")[0].setCustomValidity("Incorrect Password");
show_error($("#unlocker"), "Incorrect Password");
} else {
$("#restricted_access").addClass("shake");
shakeTimer = window.setTimeout(function () {
$("#restricted_access").removeClass("shake");
}, 1000);
}
$("#unlocker").select();
}
}
/**
* Throttles calls to a callback to fire at a given minimum interval. Used for
* setting the shadow blur while scrolling.
* @param {number} ms - the number of milliseconds to wait between each function call
* @param {function} callback - the function to call
*/
function throttle(ms, callback) {
var timer, lastCall = 0;
return function() {
var now = new Date().getTime(),
diff = now - lastCall;
if (diff >= ms) {
lastCall = now;
callback.apply(this, arguments);
}
};
}
/**
* Changes given grades in the grades JSON stored in localStorage to the given
* values for testing purposes
* @param {Array.<Array.<number, number, string>>}} gradesToFake - an array
* of grades to change
*/
function imposter(gradesToFake) {
// for development testing
// gradesToFake = [[
// 1, // row
// 7, // col
// "100" // grade
// ], ... ];
var fakeGrades = JSON.parse(localStorage["grades"]);
for (var n = gradesToFake.length - 1; n >=0; n--) {
fakeGrades[gradesToFake[n][0]].grades[gradesToFake[n][1]] = gradesToFake[n][2];
}
localStorage["grades"] = JSON.stringify(fakeGrades);
return fakeGrades;
}
/** Displays changed grade indicators for all grades that have recently changed */
function setChangedGradeIndicators() {
var n = 0;
if (localStorage.hasOwnProperty("changed_grades")) {
var changedGrades = JSON.parse(localStorage["changed_grades"]);
for (gradeChange in changedGrades) {
if (changedGrades.hasOwnProperty(gradeChange)) {
$("#grades tr").eq(changedGrades[gradeChange].row)
.children(".grade").eq(changedGrades[gradeChange].col)
.children("a").removeClass().addClass(changedGrades[gradeChange].dir);
}
}
n = Object.size(changedGrades);
}
// Set Badge
localStorage.setItem("badge", n.toString());
if (localStorage["badge_enabled"] == "true")
chrome.browserAction.setBadgeText({"text": n > 0 ? n.toString() : ""});
}
// init
$(function () {
// body is hidden in css on page load
// delete potential localStorage errors
for (var key in localStorage) {
if (localStorage.hasOwnProperty(key) && localStorage[key] === undefined) {
localStorage.removeItem(key);
console.log("Rogue localStorage item deleted in key " + key);
}
}
// Setup AJAX (converters not used)
$.ajaxSetup({
timeout: 15000,
contents: {
gjson: /gjson/,
cjson: /cjson/
},
converters: {
"text gjson": HAC_HTML.html_to_jso,
"text cjson": HAC_HTML.cgrades_to_json,
"gjson html": HAC_HTML.json_to_html,
"cjson html": HAC_HTML.cjson_to_html
}
});
// backwards compatibility with 1.x: update district if not set
// (in 1.x, the only valid district was RRISD)
if (!localStorage.hasOwnProperty("district"))
localStorage.setItem("district", "rrisd");
// Set animations
if (!localStorage.hasOwnProperty("animations")) {
localStorage.setItem("animations", "on");
}
if (localStorage["animations"] != "on")
$("body").addClass("noanimations");
// asianness
if (localStorage.hasOwnProperty("asianness")) {
asianness = localStorage.getItem("asianness");
if (asianness == null || isNaN(asianness)) asianness = DEFAULT_ASIANNESS;
} else asianness = DEFAULT_ASIANNESS;
asianness_on = (localStorage.hasOwnProperty("asianness_on") ? localStorage["asianness_on"] : true) === "true";
// hue
if (localStorage.hasOwnProperty("hue")) {
hue = parseInt(localStorage.getItem("hue"));
if (hue == null || isNaN(hue)) hue = DEFAULT_HUE;
} else hue = DEFAULT_HUE;
// paint the logo
$(window).focus(function (e) {
paintLogo($("#logo")[0], hue, 36);
});
// handlers
$("#login_form").submit(function(e) {
e.preventDefault();
login($("#login").val(), $("#password").val(), $("#studentid").val(), $("#district").val());
return false;
});
$("#do_direct_access").click(update);
$("#cancel_refresh").click(function () {
$("body").removeClass("busy");
XHR_Queue.abortAll();
});
$("#do_options").click(function() { chrome.tabs.create({url: "options.html"}); });
$("#do_logout").click(logout);
$("#do_close").click(function() {
close();
});
// fill in form
try {
$("#login").attr("value", localStorage["login"].decrypt().decrypt());
$("#studentid").attr("value", localStorage["studentid"].decrypt().decrypt());
} catch (e) { /* it's not filled out yet, carry on */ }
// fill in grades
if (localStorage.hasOwnProperty("grades") && localStorage["grades"] != "") {
displayGrades(JSON.parse(localStorage["grades"]));
setChangedGradeIndicators();
}
// shadow on scrolling
$(window).scroll(throttle(30, function() {
var pos = $(window).scrollTop();
if (pos <= 0) {
$("#direct_access_form").css("box-shadow", "none");
shadowMax = false;
}
else if (pos < 32) {
$("#direct_access_form").css("box-shadow",
"0px " + Math.round(pos / 4) + "px " +
Math.round(pos / 4) + "px -" +
Math.round(pos / 4) + "px rgba(0,0,0,0.5)");
shadowMax = false;
}
else if (!shadowMax) {
$("#direct_access_form").css("box-shadow", "0px 8px 8px -8px rgba(0,0,0,0.5)");
shadowMax = true;
}
return true;
}
));
// login or direct access?
if (typeof localStorage["url"] == "undefined" && typeof localStorage["aisd_password"] == "undefined" && typeof localStorage["rrisd_password"] == "undefined")
// not logged in
$("#login_form").removeClass("hide");
else {
// logged in
$("#login_form").addClass("hide");
$("#lastupdated").html(Updater.get_update_text());
GPA.show();
$(document.body).addClass("logged_in");
}
$("#logOutToReset").click(function () {
logout();
$("#resetInfo").removeClass("visible");
});
$("#cancelReset").click(function () {
$("#restricted_access").removeClass("reset");
});
$("#resetLink").click(function () {
$("#restricted_access").addClass("reset");
});
// password protection
if (!localStorage.hasOwnProperty("password")) {
localStorage["password"] = ""; // set default if not set
} else if (localStorage["password"] != "") {
// Lock if necessary
lock();
$("#unlocker").focus();
$("#restricted_access").submit(function (e) {
e.preventDefault();
unlock($("#unlocker").val());
return false;
});
} else {
$("#restricted_access_wrapper").addClass("hide");
}
// bug: http://stackoverflow.com/questions/13217353/random-whitespace-in-google-chrome-extension
// show body after done populating DOM
if ($(document.body).hasClass("logged_in"))
window.setTimeout(function() {
$(document.body).css({
width: '600px',
height: '100px',
display: 'block'})
.animate(
{height: $("#main_view").height() + 'px'},
1000); // this is the hackiest HAC hack that QuickHAC has ever HAC'd
}, 200);
else
$(document.body).css({
width: '600px',
display: 'block'
});
});
// analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-37395872-1']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = 'https://ssl.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();