Skip to content

Commit

Permalink
Merge pull request #1548 from splitbrain/fix-broken-js-in-xhtml
Browse files Browse the repository at this point in the history
Fix broken JS in xhtml
  • Loading branch information
splitbrain committed Jan 30, 2017
2 parents e01e83d + 694afa0 commit 9d2d084
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
2 changes: 1 addition & 1 deletion inc/parser/xhtml.php
Expand Up @@ -147,7 +147,7 @@ function document_end() {
}

// add footnote markup and close this footnote
$this->doc .= $footnote;
$this->doc .= '<div class="content">'.$footnote.'</div>';
$this->doc .= '</div>'.DOKU_LF;
}
}
Expand Down
34 changes: 18 additions & 16 deletions lib/scripts/behaviour.js
Expand Up @@ -168,26 +168,28 @@ var dw_behaviour = {
* disable multiple revisions checkboxes if two are checked
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Anika Henke <anika@selfthinker.org>
*/
revisionBoxHandler: function(){
var $checked = jQuery('#page__revisions input[type=checkbox]:checked');
var $all = jQuery('#page__revisions input[type=checkbox]');

if($checked.length < 2){
$all.attr('disabled',false);
jQuery('#page__revisions button').attr('disabled',true);
}else{
$all.attr('disabled',true);
jQuery('#page__revisions button').attr('disabled',false);
for(var i=0; i<$checked.length; i++){
$checked[i].disabled = false;
if(i>1){
$checked[i].checked = false;
revisionBoxHandler: function() {
var $revisions = jQuery('#page__revisions');
var $all = jQuery('input[type=checkbox]', $revisions);
var $checked = $all.filter(':checked');
var $button = jQuery('button', $revisions);

if($checked.length < 2) {
$all.removeAttr('disabled');
$button.attr('disabled', true);
} else {
$all.attr('disabled', true);
$button.removeAttr('disabled');
$checked.each(function(i) {
jQuery(this).removeAttr('disabled');
if(i>1) {
jQuery(this).attr('checked', false);
}
}
});
}
}

};

jQuery(dw_behaviour.init);
2 changes: 1 addition & 1 deletion lib/scripts/editor.js
Expand Up @@ -63,7 +63,7 @@ var dw_editor = {
['smaller', function(){dw_editor.sizeCtl(editor,-100);}],
['wrap', function(){dw_editor.toggleWrap(editor);}]
], function (_, img) {
jQuery(document.createElement('IMG'))
jQuery(document.createElement('img'))
.attr('src', DOKU_BASE+'lib/images/' + img[0] + '.gif')
.attr('alt', '')
.click(img[1])
Expand Down
19 changes: 11 additions & 8 deletions lib/scripts/page.js
Expand Up @@ -83,23 +83,26 @@ dw_page = {
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Chris Smith <chris@jalakai.co.uk>
* @author Anika Henke <anika@selfthinker.org>
*/
footnoteDisplay: function () {
var content = jQuery(jQuery(this).attr('href')) // Footnote text anchor
.closest('div.fn').html();
var $content = jQuery(jQuery(this).attr('href')) // Footnote text anchor
.parent().siblings('.content').clone();

if (content === null){
if (!$content) {
return;
}

// strip the leading content anchors and their comma separators
content = content.replace(/((^|\s*,\s*)<sup>.*?<\/sup>)+\s*/gi, '');

// prefix ids on any elements with "insitu__" to ensure they remain unique
content = content.replace(/\bid=(['"])([^"']+)\1/gi,'id="insitu__$2');
jQuery('[id]', $content).each(function(){
var id = jQuery(this).attr('id');
jQuery(this).attr('id', 'insitu__' + id);
});

var content = $content.html().trim();
// now put the content into the wrapper
dw_page.insituPopup(this, 'insitu__fn').html(content).show().attr('aria-hidden', 'false');
dw_page.insituPopup(this, 'insitu__fn').html(content)
.show().attr('aria-hidden', 'false');
},

/**
Expand Down
3 changes: 3 additions & 0 deletions lib/tpl/dokuwiki/css/_footnotes.css
Expand Up @@ -23,6 +23,9 @@ div.insitu-footnote {
}
.dokuwiki div.footnotes div.fn {
}
.dokuwiki div.footnotes div.fn div.content {
display: inline;
}
.dokuwiki div.footnotes div.fn sup a.fn_bot {
font-weight: bold;
}

0 comments on commit 9d2d084

Please sign in to comment.