PageSourceSearch

https://biblewebapp.com/study-v2/js/docs/plugins.notes.js

js biblewebapp.com collected 2026-09-24 19:09:38 UTC 3,282 bytes, 133 lines download raw bytes

1	
2/**
3 * Original language options
4 *
5 * @author John Dyer (http://j.hn/)
6 */
7 
8docs.plugins.push({
9
10	init: function(docManager) {
11		
12		var notesPopup = docs.createModal('notes', 'Notes & Cross References'),
13			timer = null,
14			selectedNote = null,
15			startTimer = function() {				
16				stopTimer();
17				console.log('starting notes timer');
18				timer = setTimeout(function() {
19					notesPopup.hide();
20					selectedNote = null;
21				}, 1000);
22			},
23			stopTimer = function() {
24				if (timer != null) {
25					clearTimeout(timer);
26					timer = null;
27				}
28			};
29			
30		notesPopup.content.css({'max-height': '200px', 'overflow': 'auto'});
31		
32		notesPopup.window
33			.on('mouseleave', function() {
34				startTimer();
35			})
36			.on('mouseover', function() {
37				stopTimer();	
38			})		
39		
40		
41	
42		// SHOW specific note in the footer
43		docManager.content.on('mouseover', 'span.note, span.cf', function() {
44			
45			var note = $(this);
46						
47			note
48				.closest('.document-container')
49				.find('.document-footer')
50				.empty()
51				.append(note.clone());
52			
53						
54		}).on('mouseout', 'span.note, span.cf', function() {
55			
56			$(this)
57				.closest('.document-container')
58				.find('.document-footer')
59				.empty();
60		}).on('click', 'span.note, span.cf', function(e) {
61		
62			var note = $(this);
63			
64			if (selectedNote!= null && selectedNote.html() == note.html() && notesPopup.window.is(':visible')) {
65				notesPopup.hide();
66				return;
67			}
68			
69			selectedNote = note;
70		
71			if (note.hasClass('cf')) {
72				notesPopup.title.html(docs.Localizer.get('plugin_notesandcf_cf'));
73			} else if (note.hasClass('note')) {
74				notesPopup.title.html(docs.Localizer.get('plugin_notesandcf_note'));
75			}
76		
77			notesPopup.content.empty().append(note.clone());
78
79			
80			// measure position
81			var 
82				notePos = note.offset(),
83				noteWidth = note.width(),
84				noteHeight = note.height(),
85				popupWidth = notesPopup.window.outerWidth(true),
86				popupHeight = notesPopup.window.outerHeight(true),
87				windowWidth = $(window).width(),
88				windowHeight = $(window).height(),
89				// default to below and to the right
90				top = (notePos.top + noteHeight + noteHeight > windowHeight) ? notePos.top - popupHeight - 5 : notePos.top + noteHeight + 4,
91				left = (notePos.left + popupWidth > windowWidth) ? windowWidth - popupWidth : notePos.left;			
92			
93			notesPopup.show();
94			notesPopup.window.css({top: top, left: left});
95			
96			bibly.scanForReferences(notesPopup.content.find('.text')[0]);
97			
98			stopTimer();
99			
100			$(document).one('mousemove', function() {
101				startTimer();
102			});			
103			
104		});
105		
106		// SHOW all notes from a verse in the footer
107		var hadNote = false;
108		docManager.content.on('mouseover', 'span.verse', function() {
109			
110			var verse = $(this),
111				notes = verse.find('span.note, span.cf');
112			
113			// shown in footer
114			if (notes.length > 0) {	
115				verse
116					.closest('.document-container')
117					.find('.document-footer')
118					.empty()
119					.append(notes.clone());
120					
121				//hadNote = true;
122			}			
123			
124		}).on('mouseout', 'span.verse', function() {
125			
126			$(this)
127				.closest('.document-container')
128				.find('.document-footer')
129				.empty();
130		});		
131		
132	}
133});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.