1+(function($) { 2 3 var pending_ajax = false; 4 5 var weDocs = { 6 initialize: function() { 7 $('.wedocs-feedback-wrap').on('click', 'a', this.feedback); 8 $('#top-search-form .dropdown-menu').on('click', 'a', this.searchForm); 9 $('a.wedocs-print-article').on('click', this.printArticle); 10 11 // modal 12 $('a#wedocs-stuck-modal').on('click', this.showModal); 13 $('a#wedocs-modal-close').on('click', this.closeModal); 14 $('#wedocs-modal-backdrop').on('click', this.closeModal); 15 $('form#wedocs-contact-modal-form').on('submit', this.contactHelp); 16 }, 17 18 feedback: function(e) { 19 e.preventDefault(); 20 21 // return if any request is in process already 22 if ( pending_ajax ) { 23 return; 24 } 25 26 pending_ajax = true; 27 28 var self = $(this), 29 wrap = self.closest('.wedocs-feedback-wrap'), 30 data = { 31 post_id: self.data('id'), 32 type: self.data('type'), 33 action: 'wedocs_ajax_feedback', 34 _wpnonce: weDocs_Vars.nonce 35 }; 36 37 wrap.append(' <i class="wedocs-icon wedocs-icon-refresh wedocs-icon-spin"></i>'); 38 $.post(weDocs_Vars.ajaxurl, data, function(resp) { 39 wrap.html(resp.data); 40 41 pending_ajax = false; 42 }); 43 }, 44 45 searchForm: function(e) { 46 e.preventDefault(); 47 48 var param = $(this).attr("href").replace("#",""); 49 var concept = $(this).text(); 50 51 $('#top-search-form span#search_concept').text(concept); 52 $('.input-group #search_param').val(param); 53 }, 54 55 printArticle: function(e) { 56 e.preventDefault(); 57 58 console.log('print article'); 59 60 var article = $(this).closest('article'); 61 62 var mywindow = window.open('', 'my div', 'height=600,width=800');
63 mywindow.document.write('<html><head><title>Print Article</title>'); 64 mywindow.document.write('<link rel="stylesheet" href="' + weDocs_Vars.style + '" type="text/css" media="all" />'); 65 mywindow.document.write('</head><body >'); 66 mywindow.document.write(article.html()); 67 mywindow.document.write('<div class="powered-by">' + weDocs_Vars.powered + '</div>'); 68 mywindow.document.write('</body></html>'); 69 70 mywindow.document.close(); // necessary for IE >= 10 71 mywindow.focus(); // necessary for IE >= 10 72 73 setTimeout(function() { 74 mywindow.print(); 75 mywindow.close(); 76 }, 500); 77 78 return true; 79 }, 80 81 showModal: function(e) { 82 e.preventDefault(); 83 84 $('#wedocs-modal-backdrop').show(); 85 $('#wedocs-contact-modal').show(); 86 }, 87 88 closeModal: function(e) { 89 e.preventDefault(); 90 91 $('#wedocs-modal-backdrop').hide(); 92 $('#wedocs-contact-modal').hide(); 93 }, 94 95 contactHelp: function(e) { 96 e.preventDefault(); 97 98 var self = $(this), 99 submit = self.find('input[type=submit]'), 100 body = self.closest('.wedocs-modal-body'), 101 data = self.serialize() + '&_wpnonce=' + weDocs_Vars.nonce; 102 103 submit.prop('disabled', true); 104 105 $.post(weDocs_Vars.ajaxurl, data, function(resp) { 106 if ( resp.success === false ) { 107 submit.prop('disabled', false); 108 $('#wedocs-modal-errors', body).empty().append('<div class="wedocs-alert wedocs-alert-danger">' + resp.data + '</div>') 109 } else { 110 body.empty().append( '<div class="wedocs-alert wedocs-alert-success">' + resp.data + '</div>' ); 111 } 112 }); 113 } 114 }; 115 116 $(function() { 117 weDocs.initialize(); 118 }); 119 120})(jQuery);
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.