1// Config 2var BASE_URL = window.location.origin; 3 4$(document).ready(function() { 5 6 $("#keyword").keyup(function() { 7 var form = $(this).closest('form'), 8 q = $(this).val(); 9 10 form.before("<img class='loader' src='images/loader.gif' />"); 11 $.get(BASE_URL + '/home/search', {'q': q}, function(data) { 12 $(".loader").remove(); 13 if (data['status'] == 'success' && data['results'] > 0) { 14 $(".wt_listing").replaceWith(data['content']); 15 } 16 else 17 { 18 $(".wt_listing").replaceWith("<div class='sorry wt_listing'>No results found</div>"); 19 } 20 }, 'json'); 21 }); 22 23 // SHARE FEEDBACK 24 $('#share_feedback').live('click', function() { 25 form_data = $(this).closest('#feedback_modal').find('form').serialize(); 26 $.post(BASE_URL + '/home/shareFeedback', form_data, function(data) { 27 28 if( data['status'] == 'success' ) { 29 $('#feedback_modal').modal('hide'); 30 alert('Thanks for Sharing your Feedback'); 31 } 32 33 if( data['status'] == 'failure' ) { 34 alert( data['error'] ); 35 } 36 37 }, 'json'); 38 return false; 39 }); 40 41 // Become an author 42 $('#send_author_request').live('click', function() { 43 form_data = $('#write_modal form').serialize(); 44 $.post(BASE_URL + '/home/author_request', form_data, function(data) { 45 46 if( data['status'] == 'success' ) { 47 $('#write_modal').modal('hide'); 48 alert('We will get back to you soon.'); 49 } 50 51 if( data['status'] == 'failure' ) { 52 alert( data['error'] ); 53 } 54 55 }, 'json'); 56 return false; 57 }); 58 59 // SAVE WT 60 /*$('#wt_submit').on('click', function() { 61 var form = $(this).closest('form'); 62 63 var data = { 64 title: $('#wt_title').val(), 65 description: $('#wt_description').val(), 66 html: $('textarea[name="html"]').val(), 67 css: $('textarea[name="css"]').val(), 68 js: $('textarea[name="js"]').val() 69 }; 70 71 $.post(BASE_URL + '/play/add', data, function(data) { 72 if (data['status'] == 'success') { 73 alert('Saved Bro ;)'); 74 } 75 else if (data['status'] == 'error') { 76 alert(data['msg']); 77 } 78 }, 'json'); 79 80 return false; 81 });*/ 82 83 // Ajax Upload for Item Screenshots 84 85 function ajaxUpload(data) { 86 if (data && data['logged_in'] === false) { 87 location.href = BASE_URL + '/login'; 88 } 89 90 if (data['status'] == 'success') { 91 location.href = data['redirect_to']; 92 } 93 else if (data['status'] == 'error') { 94 alert(data['msg']); 95 } 96 } 97 98 $('.ajax_upload').submit(function() { 99 return false; 100 101 //var descr = $('#description').val(); 102 var descr = $.trim(tinyMCE.activeEditor.getContent()); 103 104 var ajax_upload_data = { 105 title: $('#title').val(), 106 description: descr, 107 tags: $('#tags').val(), 108 html: $('textarea[name="html"]').val(), 109 css: $('textarea[name="css"]').val(), 110 js: $('textarea[name="js"]').val(), 111 uid: $('#uid').val(), 112 id: $('#id').val(), 113 }; 114 115 var options = { 116 dataType: 'json', 117 url: BASE_URL + '/play', 118 success: ajaxUpload, 119 data: ajax_upload_data, 120 type: 'POST' 121 }; 122 123 $(this).ajaxSubmit(options); 124 125 return false; 126 }); 127 128 // DELETE WALKTHROUGH 129 $('ul.wt_listing a.delete').on('click', function() { 130 var conf = confirm('Are you sure?'); 131 if (!conf) return false; 132 133 var $this = $(this); 134 var id = $(this).attr('data-id'); 135 136 $.post(BASE_URL + '/play/delete', {'id': id}, function() { 137 $this.closest('li').fadeOut(); 138 }, 'json'); 139 140 return false; 141 }); 142 143}); 144 145jQuery.fn.outerHTML = function(s) { 146 return s 147 ? this.before(s).remove() 148 : jQuery("<p>").append(this.eq(0).clone()).html(); 149};
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.