1$(document).ready(function() { 2 $.validator.addMethod('filesize', function(value, element, param) { 3 // param = size (en bytes) 4 // element = element to validate (<input>) 5 // value = value of the element (file name) 6 return this.optional(element) || (element.files[0].size <= param) 7 }); 8 9 $(".add-more-file").live('click', function(){ 10 var counter = $("#counter").val(); 11 $(".file-upload-content").append("<p><input type='file' name='upload_file" + parseInt(counter, 10) + "' class='file-input'></p>"); 12 counter = parseInt(counter, 10) + 1; 13 if(counter >= 5){ 14 $(this).remove(); 15 } 16 $("#counter").val(counter); 17 }); 18 19 20 $("#per_page").live('change', function(){ 21 $(".filter-form").submit(); 22 }); 23 24 $(".page-message").live('click', function(){ 25 var url = $(this).attr('href'); 26 if(url!= ""){ 27 $.get(url, function(data) { 28 $('.messages-content').html(data); 29 }); 30 } 31 return false; 32 }); 33 34 $(".reply-btn").live('click', function(){ 35 if($(".reply-content").css('display') == 'none'){ 36 $(".reply-content").show(); 37 }else{ 38 $(".error-message").html(""); 39 $(".message-content").val(""); 40 $(".message-content").removeClass("error"); 41 $(".reply-content").hide(); 42 } 43 }); 44 45 46 $(".ticket-form").validate({ 47 errorLabelContainer: ".error-message", 48 errorElement: "li", 49 errorPlacement: function(error, element) { 50 if (element.hasClass('group')){ 51 element = element.parent(); 52 } 53 offset = element.offset(); 54 error.prepend("<div class='label'><img src=\"/images/alert.png\" border=\"0\"></div>"); 55 error.insertAfter(element.closest("li")); 56 }, 57 rules: { 58 "ticket[name]" : { 59 required: true, 60 minlength: 3 61 }, 62 "ticket[email]" : { 63 required: true, 64 email: true 65 }, 66 "ticket[subject]" : { 67 required: true, 68 maxlength: 150 69 }, 70 "message[content]": { 71 required: true, 72 maxlength: 5000 73 }, 74 "upload_file0":{ 75 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 76 filesize: 2092152 77 }, 78 "upload_file1":{ 79 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 80 filesize: 2092152 81 }, 82 "upload_file2":{ 83 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 84 filesize: 2092152 85 }, 86 "upload_file3":{ 87 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 88 filesize: 2092152 89 }, 90 "upload_file4":{ 91 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 92 filesize: 2092152 93 }, 94 "recaptcha_response_field": { 95 required: true 96 } 97 }, 98 messages: { 99 "ticket[name]" : { 100 required: "Please enter a support name.", 101 minlength: "You have exceed the minium character of 3 for your name." 102 }, 103 "ticket[email]" : { 104 required: "Please enter a support email.", 105 email: "Please enter a support valid email." 106 }, 107 "ticket[subject]" : { 108 required: "Please enter a support ticket subject.", 109 maxlength: "You have exceed the maximum character limit of 150 for your subject." 110 }, 111 "message[content]" : { 112 required: "Please enter a support ticket message.", 113 maxlength: "You have exceed the maximum character limit of 5000 for your message body." 114 }, 115 "upload_file0" : "You are trying to upload a file type that is not permitted.", 116 "upload_file1" : "You are trying to upload a file type that is not permitted.", 117 "upload_file2" : "You are trying to upload a file type that is not permitted.", 118 "upload_file3" : "You are trying to upload a file type that is not permitted.", 119 "upload_file4" : "You are trying to upload a file type that is not permitted.", 120 "recaptcha_response_field" : "Please enter a support ticket captcha." 121 } 122 123 });
124 125 $(".message-form").validate({ 126 errorLabelContainer: ".error-message", 127 errorElement: "li", 128 errorPlacement: function(error, element) { 129 if (element.hasClass('group')){ 130 element = element.parent(); 131 } 132 offset = element.offset(); 133 error.prepend("<div class='label'><img src=\"/images/alert.png\" border=\"0\"></div>"); 134 error.insertAfter(element.closest("li")); 135 }, 136 rules: { 137 "message[content]": { 138 required: true, 139 maxlength: 5000 140 }, 141 "upload_file0":{ 142 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 143 filesize: 2092152 144 }, 145 "upload_file1":{ 146 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 147 filesize: 2092152 148 }, 149 "upload_file2":{ 150 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 151 filesize: 2092152 152 }, 153 "upload_file3":{ 154 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 155 filesize: 2092152 156 }, 157 "upload_file4":{ 158 extension: "jpg|gif|jpeg|png|doc|zip|tar|gz|7z|tar.gz|tgz|rar|xls|txt|pdf", 159 filesize: 2092152 160 }, 161 "recaptcha_response_field": { 162 required: true 163 } 164 }, 165 messages: { 166 "message[content]" : { 167 required: "Please enter a support ticket message.", 168 maxlength: "You have exceed the maximum character limit of 5000 for your message body." 169 }, 170 "upload_file0" : "You are trying to upload a file type that is not permitted.", 171 "upload_file1" : "You are trying to upload a file type that is not permitted.", 172 "upload_file2" : "You are trying to upload a file type that is not permitted.", 173 "upload_file3" : "You are trying to upload a file type that is not permitted.", 174 "upload_file4" : "You are trying to upload a file type that is not permitted.", 175 "recaptcha_response_field" : "Please enter a support ticket captcha." 176 } 177 178 }); 179 180 // $(".time-ago").timeago(); 181 $(".tickets-user .sorting, .tickets-user .sorting_desc").live('click', function(){ 182 var url = $(".filter-form").attr('action'); 183 $(".tickets-user .sorting_asc").attr("class", "sorting"); 184 $(".tickets-user .sorting_desc").attr("class", "sorting"); 185 $(this).attr('class', 'sorting_asc'); 186 $("#sort-filter").val('asc'); 187 $("#sort-name").val($(this).attr("data")); 188 $(".filter-form").submit(); 189 }); 190 191 $(".tickets-user .sorting_asc").live('click', function(){ 192 var url = $(".filter-form").attr('action'); 193 $(".tickets-user .sorting_asc").attr("class", "sorting"); 194 $(".tickets-user .sorting_desc").attr("class", "sorting"); 195 $(this).attr('class', 'sorting_desc'); 196 $("#sort-filter").val('desc'); 197 $("#sort-name").val($(this).attr("data")); 198 $(".filter-form").submit(); 199 }); 200 201 $('.QapTcha').QapTcha({ 202 txtLock: "Lock: Slide to right then click Submit.", 203 txtUnlock: "Unlocked: Now click the Submit button.", 204 PHPfile: "/tickets/qaptcha", 205 autoRevert: true 206 }); 207 208 $('.tickets-user').dataTable( { 209 "sPaginationType": "full_numbers", 210 "aaSorting": [[ 2, "desc" ]], 211 "iDisplayLength": 10, 212 "iDisplayStart" :0, 213 "sSearch": "Search all columns:", 214 "bProcessing": true, 215 "bServerSide": true, 216 "sServerMethod": "POST", 217 "sAjaxSource": '/tickets/list', 218 "oLanguage": { 219 "sEmptyTable": "<img src=\"/images/alert.png\" border=\"0\"> No tickets to display." 220 } 221 });
222 223 $(".tickets-user-content .dataTables_filter input").attr("placeholder", "Enter Ticket # or Subject"); 224 $(".message-quote").live('click', function(){ 225 var id = $(this).attr("id"); 226 var content = $("#message-content-" + id + " pre").html(); 227 content = "> " + content; 228 content = content.replace(/\n/g, "\n> "); 229 var value = $(".message-content").val(); 230 content = strip_tags(content); 231 content = content.replace(/</g,"<"); 232 content = content.replace(/>/g,">"); 233 $(".message-content").val(content + "\n" + value); 234 $(".message-content").focus(); 235 var size = $(".message-content").val().length; 236 setCursorPos($(".message-content")[0], size, size); 237 }); 238})
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.