Merge branch 'pageattributes' into 'master'

refactoring der Pageattributes (qc und do)

See merge request 
This commit is contained in:
Jana Deutschländer 2017-04-19 16:16:08 +02:00
commit 9fbd182782
14 changed files with 308 additions and 240 deletions

View file

@ -1,47 +1,49 @@
( function( $, spc ) {
var togglePageAnalysis = function(){
var $this = $('.page-attributes').find('.plugin__qc');
try{
var $link = $this.find('#plugin__qc__link'),
$container = $this.find('#plugin__qc__wrapper');
if($container.length < 1){
$this.remove();
}else{
$container.attr('aria-hidden','true');
var $icon = $container.find('#plugin__qc__icon');
$container.find('#plugin__qc__out').removeAttr('style');
$link.on( 'click', function(e){
e.preventDefault();
$icon.trigger('click');
var oldState = ($link.attr('aria-expanded')=== "true" );
$container.attr('aria-hidden',oldState);
$(this).attr('aria-expanded',!oldState);
});
if($container.length > 0){
var num = $container.attr('data-errors');
if(num){
$link.find('.num').empty().append(num);
$link.closest('li').removeClass('do_none');
}
}
}
}catch(err){
$this.remove();
}
};
$(function(){
togglePageAnalysis();
});
} )( jQuery, spc );
// FIXME figure out what this did and why
// ( function( $, spc ) {
//
// var togglePageAnalysis = function(){
// var $this = $('.page-attributes').find('.plugin__qc');
// try{
// var $link = $this.find('#plugin__qc__link'),
// $container = $this.find('#plugin__qc__wrapper');
//
// if($container.length < 1){
// $this.remove();
// }else{
// $container.attr('aria-hidden','true');
// var $icon = $container.find('#plugin__qc__icon');
// $container.find('#plugin__qc__out').removeAttr('style');
// $link.on( 'click', function(e){
// e.preventDefault();
// $icon.trigger('click');
// var oldState = ($link.attr('aria-expanded')=== "true" );
// $container.attr('aria-hidden',oldState);
// $(this).attr('aria-expanded',!oldState);
//
// });
//
// if($container.length > 0){
// var num = $container.attr('data-errors');
// if(num){
// $link.find('.num').empty().append(num);
// $link.closest('li').removeClass('do_none');
// }
// }
//
// }
//
// }catch(err){
// $this.remove();
// }
// };
//
// $(function(){
// togglePageAnalysis();
// });
//
// } )( jQuery, spc );
//
//
//
//

37
js/plugins/qc.js Normal file
View file

@ -0,0 +1,37 @@
/**
* Add custom QC functionality instead of using the plugin's mechanism
*/
jQuery(function () {
var $panel = jQuery('div.qc-output').hide();
// load summary
jQuery('.page-attributes .plugin_qc a').load(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_qc_short',
id: JSINFO['id']
},
function () {
jQuery(this).find('span span').addClass('num');
}
).click(function (e) {
e.preventDefault();
if ($panel.html() == '') {
// load output
$panel.load(
DOKU_BASE + 'lib/exe/ajax.php',
{
call: 'plugin_qc_long',
id: JSINFO['id']
},
function () {
$panel.dw_show();
}
);
} else {
$panel.dw_toggle();
}
});
});