1//Autocomment for Approve Button
2function approval_checkbox(text) {
3  if(text == "") { return true; }
4  var cb=document.getElementById('approved');
5  if(cb == null) { return true; } //huh?
6  if(!cb.checked) { return true; } //this only fires on set
7  var sum=document.getElementById('edit__summary');
8  if(sum == null) { return true; } //huh?
9  if(sum.value != '') { return true; } // already set
10  sum.value = text;
11
12  // in case enforced Comments are installed
13  var btn = document.getElementById('edbtn__save');
14  if(btn == null) { return true; } //huh?
15  btn.className = 'button';
16  btn.disabled = false;
17
18  return true;
19}
20
21
22jQuery( document ).ready(function () {
23    jQuery('button.publish__approveNS').click(function(evt){
24        var $_this = jQuery(this);
25        var namespace = $_this.attr('ns');
26        jQuery.post(
27            DOKU_BASE + 'lib/exe/ajax.php',
28            {
29                call: 'plugin_publish_approveNS',
30                namespace: namespace
31            },
32            function(data) {
33                $_this.parent().parent().siblings('tr.apr_table').each(function(index) {
34                    var id = jQuery(this).find('a').first().text();
35                    var pageNamespace = id.substr(0,id.lastIndexOf(':'));
36                    if (pageNamespace === namespace) {
37                        jQuery(this).hide('slow');
38                    }
39                });
40                $_this.parent().parent().hide('slow');
41            },
42            null
43        );
44    });
45});
46