1// This file contains javascript that is specific to the /entry controller. 2jQuery(document).ready(function($) { 3 if (gdn.definition("userSearchAvailable", true)) { 4 // Check to see if the selected email is valid 5 $("#Register input[name=Email], body.register input[name=Email]").blur(function() { 6 var email = $(this).val(); 7 if (email != "") { 8 var checkUrl = gdn.url("/user/emailavailable.json"); 9 $.ajax({ 10 type: "GET", 11 url: checkUrl, 12 data: { email: email }, 13 dataType: "json", 14 error: function(xhr) { 15 gdn.informError(xhr, true); 16 }, 17 success: function(data) { 18 if (data.Data === false) $("#EmailUnavailable").show(); 19 else $("#EmailUnavailable").hide(); 20 }, 21 }); 22 } 23 }); 24 25 // Check to see if the selected username is valid 26 $("#Register input[name=Name], body.register input[name=Name]").blur(function() { 27 var name = $(this).val(); 28 if (name != "") { 29 var checkUrl = gdn.url("/user/usernameavailable.json"); 30 $.ajax({ 31 type: "GET", 32 url: checkUrl, 33 data: { name: name }, 34 dataType: "json", 35 error: function(xhr) { 36 gdn.informError(xhr, true); 37 }, 38 success: function(data) { 39 if (data.Data === false) $("#NameUnavailable").show(); 40 else $("#NameUnavailable").hide(); 41 }, 42 }); 43 } 44 }); 45 } 46 47 var checkConnectName = function() { 48 // If config setting AllowConnect is set to false, hide the password and return. 49 if (!gdn.definition("AllowConnect", true)) { 50 $("#ConnectPassword").hide(); 51 return; 52 } 53 if (gdn.definition("NoConnectName", false)) { 54 $("#ConnectPassword").show(); 55 return; 56 } 57 var fineprint = $("#Form_ConnectName").siblings(".FinePrint"); 58 var selectedName = $("input[name=UserSelect]:checked").val(); 59 if (!selectedName || selectedName == "other") { 60 var name = $("#Form_ConnectName").val(); 61 if (typeof name == "string" && name != "") { 62 var checkUrl = gdn.url("/user/usernameavailable.json"); 63 $.ajax({ 64 type: "GET", 65 url: checkUrl, 66 data: { name: name }, 67 dataType: "json", 68 error: function (xhr) { 69 gdn.informError(xhr, true); 70 }, 71 success: function (data) { 72 if (data.Data === true) { 73 $("#ConnectPassword").hide(); 74 if (fineprint.length) { 75 fineprint.html(gdn.definition("Choose a name to identify yourself on the site.")); 76 } 77 } else { 78 $("#ConnectPassword").show(); 79 if (fineprint.length) { 80 fineprint.html(gdn.definition("Username already exists.")); 81 } 82 } 83 }, 84 }); 85 } else { 86 $("#ConnectPassword").hide(); 87 } 88 } else { 89 $("#ConnectPassword").show(); 90 } 91 }; 92 if (gdn.definition("userSearchAvailable", true)) { 93 checkConnectName(); 94 $("#Form_ConnectName").keyup(checkConnectName); 95 $("input[name=UserSelect]").click(checkConnectName); 96 } 97 // Check to see if passwords match 98 $("input[name=PasswordMatch]").blur(function() { 99 var $pwmatch = $(this); 100 var $pw = $pwmatch.closest("form").find("input[name=Password]"); 101 102 if ($pw.val() == $pwmatch.val()) $("#PasswordsDontMatch").hide(); 103 else $("#PasswordsDontMatch").show(); 104 }); 105 106 $("#Form_ConnectName").focus(function() { 107 $("input[value=other]").attr("checked", "checked"); 108 }); 109});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.