]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/pretty-json/node_modules/jsonminify/report/assets/scripts/codemirror.markpopovertext.js
1 /*global CodeMirror:false, $:false*/
9 var possible
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
11 for( var i
=0; i
< num
; i
++ )
12 text
+= possible
.charAt(Math
.floor(Math
.random() * possible
.length
));
17 CodeMirror
.prototype.markPopoverText = function(lineObj
, regex
, className
, gutter
, message
){
18 var re
= new RegExp('(' + regex
+ ')', 'g');
19 var cursor
= this.getSearchCursor(re
, lineObj
);
21 var match
, internalClass
= 'plato-mark-' + makeid(10);
22 while (match
= cursor
.findNext()) {
23 if (cursor
.to().line
!== lineObj
.line
) break;
25 { line : lineObj
.line
, ch : cursor
.from().ch
},
26 { line : lineObj
.line
, ch : cursor
.to().ch
},
28 className : 'plato-mark ' + internalClass
+ ' ' + (className
|| ''),
29 startStyle : 'plato-mark-start',
30 endStyle : 'plato-mark-end'
36 this.setGutterMarker(lineObj
.line
, gutter
.gutterId
, gutter
.el
);
39 // return a function to bind hover events, to be run after
40 // the codemirror operations are executed
42 var markStart
= $('.plato-mark-start.' + internalClass
);
43 var markSpans
= $('.' + internalClass
);
45 if (message
.type
=== 'popover') {
47 var triggered
= false;
48 markSpans
.add(gutter
.el
)
49 .on('mouseenter touchstart',function(e
){
52 markSpans
.addClass('active');
53 markStart
.popover('show');
55 .on('mouseleave touchend',function(e
){
57 markSpans
.removeClass('active');
59 setTimeout(function(){
60 if (!triggered
) markStart
.popover('hide');
66 content : message
.content
,
68 title : message
.title
,
71 } else if (message
.type
=== 'block') {
72 this.addLineWidget(lineObj
.line
, $(message
.content
)[0]);