Skip to content

Commit

Permalink
create unique ids for anno_close
Browse files Browse the repository at this point in the history
  • Loading branch information
turnermm committed Mar 26, 2019
1 parent 2957ef1 commit 410dd06
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
17 changes: 15 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @author Myron Turner <turnermm02@shaw.ca>
*/
jQuery( document ).ready(function() {
var last_anno_open;
jQuery("span.anno") .mouseover(function() {
Expand All @@ -20,13 +23,23 @@
}, tm);
}

jQuery("span[id^='anno_close'") .each(function() {
var clss = jQuery(this).parent().attr('class');
if(typeof clss != 'undefined') {
if(clss.match(/_r/) ) {
if (!jQuery(this).parent().css('border-radius')) {
jQuery(this).parent().css('border-radius','15px');
}
jQuery(this).css('border-radius','10px');
}
}
});

jQuery("span.annotation").mouseover(function() {
show( jQuery(this));
// jQuery(this).css('display','inline-block');
});
jQuery("span.annotation").mouseout(function() {
hide(jQuery(this));
// jQuery(this).css('display','none');
});

jQuery("span.annotation").dblclick(function() {
Expand Down
17 changes: 11 additions & 6 deletions syntax/anno.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*
* class plugin_ckgedit_specials
* class syntax_plugin_annotate_anno
* @author Myron Turner <turnermm02@shaw.ca>
*/

Expand Down Expand Up @@ -89,8 +88,6 @@ function handle($match, $state, $pos, Doku_Handler $handler){
$match = preg_replace("/<bottom>.*?<\/bottom>/ms", "\\\\\\ $text",$match);
}
}

// msg(htmlentities($match));
return array($state, $match);
case DOKU_LEXER_EXIT : return array($state, '');
case DOKU_LEXER_SPECIAL:
Expand All @@ -105,16 +102,24 @@ function handle($match, $state, $pos, Doku_Handler $handler){
* Create output
*/
function render($mode, Doku_Renderer $renderer, $data) {

static $last;
if($mode == 'xhtml'){
list($state, $xhtml) = $data;
switch ($state) {
case DOKU_LEXER_ENTER :
$classes = preg_split("/\s+/", $xhtml);
$xhtml = rtrim(implode(' ',$classes));
$last = $classes[0];
if (count($classes) > 1) {
$tip = '<span class="' . $xhtml . ' anno-dclk-over ui-widget-content">';
}
else {
$tip = '<span class="annotation ui-widget-content '. $xhtml . '">';
}
$renderer->doc .= $tip;
break;
case DOKU_LEXER_UNMATCHED :
$renderer->doc .= '<span id="anno_close"><span class="anno_exit">close</span> </span>';
$renderer->doc .= '<span id="anno_close_' . $last . '"><span class="anno_exit">close</span> </span>';
$xhtml = trim($xhtml);
if(preg_match('/^\{\{([\w\:]+)\}\}$/',$xhtml,$matches)) {
$html = p_wiki_xhtml($matches[1]);
Expand Down

0 comments on commit 410dd06

Please sign in to comment.