+(function ($) { var pending_ajax = false; var wedocs = { initialize: function () { $('.wedocs-feedback-wrap').on('click', 'a', this.feedback); $('#top-search-form .dropdown-menu').on('click', 'a', this.searchform); $('a.wedocs-print-article').on('click', this.printarticle); // sidebar toggle $('ul.doc-nav-list .page_item_has_children').on( 'click', '.wedocs-caret', function (event) { event.preventdefault(); var self = $(this), parent = self.closest('.page_item'); if (parent.hasclass('wd-state-closed')) { parent.removeclass('wd-state-closed').addclass('wd-state-open'); } else { parent.removeclass('wd-state-open').addclass('wd-state-closed'); } } ); // modal $('a#wedocs-stuck-modal').on('click', this.showmodal); $('a#wedocs-modal-close').on('click', this.closemodal); $('#wedocs-modal-backdrop').on('click', this.closemodal); $('form#wedocs-contact-modal-form').on('submit', this.contacthelp); }, feedback: function (e) { e.preventdefault(); // return if any request is in process already if (pending_ajax) { return; } pending_ajax = true; var self = $(this), wrap = self.closest('.wedocs-feedback-wrap'), data = { post_id: self.data('id'), type: self.data('type'), action: 'wedocs_ajax_feedback', _wpnonce: wedocs_vars.nonce, }; wrap.append( ' ' ); $.post(wedocs_vars.ajaxurl, data, function (resp) { wrap.html(resp.data); pending_ajax = false; }); }, searchform: function (e) { e.preventdefault(); var param = $(this).attr('href').replace('#', ''); var concept = $(this).text(); $('#top-search-form span#search_concept').text(concept); $('.input-group #search_param').val(param); }, printarticle: function (e) { e.preventdefault(); var article = $(this).closest('article'); var mywindow = window.open('', 'my div', 'height=600,width=800'); mywindow.document.write('