Merge branch 'pageattributes' into 'master'
refactoring der Pageattributes (qc und do) See merge request !29
This commit is contained in:
commit
9fbd182782
14 changed files with 308 additions and 240 deletions
js/plugins
|
@ -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
37
js/plugins/qc.js
Normal 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();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue