Last active
June 29, 2018 01:08
-
-
Save ngocdon0127/e15e5bde3f40cc83896562d6553479bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(window).off('blur') | |
| $(window).blur(function () { | |
| var count = $.cookie("lost_focus_count_" + UserTest); | |
| if (!count || isNaN(count)) count = 0; | |
| count++; | |
| TestCertificate.Common.showMessenger(TestCertificate.Common.getResource("LOST_FOCUS", count)); | |
| $.ajax({ | |
| type: "POST", | |
| url: "/service/exam.asmx/pushViolationLog", | |
| dataType: "json", | |
| data: { | |
| UserTestId: UserTest | |
| }, | |
| timeout: 10000 | |
| }); | |
| $.cookie("lost_focus_count_" + UserTest, count); | |
| }); | |
| function setCookie(cname, cvalue, exdays) { | |
| var d = new Date(); | |
| d.setTime(d.getTime() + (exdays*24*60*60*1000)); | |
| var expires = "expires="+ d.toUTCString(); | |
| document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; | |
| } | |
| function getCookie(cname) { | |
| var name = cname + "="; | |
| var decodedCookie = decodeURIComponent(document.cookie); | |
| var ca = decodedCookie.split(';'); | |
| for(var i = 0; i <ca.length; i++) { | |
| var c = ca[i]; | |
| while (c.charAt(0) == ' ') { | |
| c = c.substring(1); | |
| } | |
| if (c.indexOf(name) == 0) { | |
| return c.substring(name.length, c.length); | |
| } | |
| } | |
| return ""; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment