1+(function ($) { 2 var pending_ajax = false; 3 4 var weDocs = { 5 initialize: function () { 6 $('.wedocs-feedback-wrap').on('click', 'a', this.feedback); 7 $('#top-search-form .dropdown-menu').on('click', 'a', this.searchForm); 8 $('a.wedocs-print-article').on('click', this.printArticle); 9 10 // sidebar toggle 11 $('ul.doc-nav-list .page_item_has_children').on( 12 'click', 13 '.wedocs-caret', 14 function (event) { 15 event.preventDefault(); 16 var self = $(this), 17 parent = self.closest('.page_item'); 18 19 if (parent.hasClass('wd-state-closed')) { 20 parent.removeClass('wd-state-closed').addClass('wd-state-open'); 21 } else { 22 parent.removeClass('wd-state-open').addClass('wd-state-closed'); 23 } 24 } 25 ); 26 27 // modal 28 $('a#wedocs-stuck-modal').on('click', this.showModal); 29 $('a#wedocs-modal-close').on('click', this.closeModal); 30 $('#wedocs-modal-backdrop').on('click', this.closeModal); 31 $('form#wedocs-contact-modal-form').on('submit', this.contactHelp); 32 }, 33 34 feedback: function (e) { 35 e.preventDefault(); 36 37 // return if any request is in process already 38 if (pending_ajax) { 39 return; 40 } 41 42 pending_ajax = true; 43 44 var self = $(this), 45 wrap = self.closest('.wedocs-feedback-wrap'), 46 data = { 47 post_id: self.data('id'), 48 type: self.data('type'), 49 action: 'wedocs_ajax_feedback', 50 _wpnonce: weDocs_Vars.nonce, 51 }; 52 53 wrap.append( 54 ' <i class="wedocs-icon wedocs-icon-refresh wedocs-icon-spin"></i>' 55 ); 56 $.post(weDocs_Vars.ajaxurl, data, function (resp) { 57 wrap.html(resp.data); 58 59 pending_ajax = false; 60 }); 61 }, 62 63 searchForm: function (e) { 64 e.preventDefault(); 65 66 var param = $(this).attr('href').replace('#', ''); 67 var concept = $(this).text(); 68 69 $('#top-search-form span#search_concept').text(concept); 70 $('.input-group #search_param').val(param); 71 }, 72 73 printArticle: function (e) { 74 e.preventDefault(); 75 76 var article = $(this).closest('article'); 77 78 var mywindow = window.open('', 'my div', 'height=600,width=800');
79 mywindow.document.write('<html><head><title>Print Article</title>'); 80 mywindow.document.write( 81 '<link rel="stylesheet" href="' + 82 weDocs_Vars.style + 83 '" type="text/css" media="all" />' 84 ); 85 mywindow.document.write('</head><body >'); 86 mywindow.document.write(article.html()); 87 mywindow.document.write( 88 '<div class="powered-by">' + weDocs_Vars.powered + '</div>' 89 ); 90 mywindow.document.write('</body></html>'); 91 92 mywindow.document.close(); // necessary for IE >= 10 93 mywindow.focus(); // necessary for IE >= 10 94 95 setTimeout(function () { 96 // mywindow.print(); 97 // mywindow.close(); 98 }, 2000); 99 100 return true; 101 }, 102 103 showModal: function (e) { 104 e.preventDefault(); 105 106 $('#wedocs-modal-backdrop').show(); 107 $('#wedocs-contact-modal').show(); 108 $('body').addClass('wedocs-overflow-hidden'); 109 }, 110 111 closeModal: function (e) { 112 e.preventDefault(); 113 114 $('#wedocs-modal-backdrop').hide(); 115 $('#wedocs-contact-modal').hide(); 116 $('body').removeClass('wedocs-overflow-hidden'); 117 }, 118 119 contactHelp: function (e) { 120 e.preventDefault(); 121 122 var self = $(this), 123 submit = self.find('input[type=submit]'), 124 body = self.closest('.wedocs-modal-body'), 125 data = self.serialize() + '&_wpnonce=' + weDocs_Vars.nonce; 126 127 submit.prop('disabled', true); 128 129 $.post(weDocs_Vars.ajaxurl, data, function (resp) { 130 if (resp.success === false) { 131 submit.prop('disabled', false); 132 $('#wedocs-modal-errors', body) 133 .empty() 134 .append( 135 '<div class="wedocs-alert wedocs-alert-danger">' + 136 resp.data + 137 '</div>' 138 ); 139 } else { 140 body 141 .empty() 142 .append( 143 '<div class="wedocs-alert wedocs-alert-success">' + 144 resp.data + 145 '</div>' 146 ); 147 } 148 }); 149 }, 150 }; 151 152 $(function () { 153 weDocs.initialize(); 154 }); 155 156 // initialize anchor.js 157 anchors.options = { 158 icon: '#', 159 }; 160 anchors.add( 161 '.wedocs-single-content .entry-content > h2, .wedocs-single-content .entry-content > h3' 162 ); 163})(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.