|
@@ -21,7 +21,7 @@ function Hilitor(id, tag)
|
|
|
|
|
|
var targetNode = document.getElementById(id) || document.body;
|
|
var targetNode = document.getElementById(id) || document.body;
|
|
var hiliteTag = tag || "EM";
|
|
var hiliteTag = tag || "EM";
|
|
- var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM|SPAN)$");
|
|
|
|
|
|
+ var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$");
|
|
var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
|
|
var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
|
|
var wordColor = [];
|
|
var wordColor = [];
|
|
var colorIdx = 0;
|
|
var colorIdx = 0;
|
|
@@ -53,11 +53,11 @@ function Hilitor(id, tag)
|
|
if(node.nodeType == 3) { // NODE_TEXT
|
|
if(node.nodeType == 3) { // NODE_TEXT
|
|
if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
|
|
if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
|
|
//find the slide's section element and save it in our list of matching slides
|
|
//find the slide's section element and save it in our list of matching slides
|
|
- var secnode = node.parentNode;
|
|
|
|
- while (secnode.nodeName != 'SECTION') {
|
|
|
|
|
|
+ var secnode = node;
|
|
|
|
+ while (secnode != null && secnode.nodeName != 'SECTION') {
|
|
secnode = secnode.parentNode;
|
|
secnode = secnode.parentNode;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
var slideIndex = Reveal.getIndices(secnode);
|
|
var slideIndex = Reveal.getIndices(secnode);
|
|
var slidelen = matchingSlides.length;
|
|
var slidelen = matchingSlides.length;
|
|
var alreadyAdded = false;
|
|
var alreadyAdded = false;
|
|
@@ -69,7 +69,7 @@ function Hilitor(id, tag)
|
|
if (! alreadyAdded) {
|
|
if (! alreadyAdded) {
|
|
matchingSlides.push(slideIndex);
|
|
matchingSlides.push(slideIndex);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if(!wordColor[regs[0].toLowerCase()]) {
|
|
if(!wordColor[regs[0].toLowerCase()]) {
|
|
wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
|
|
wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
|
|
}
|
|
}
|
|
@@ -110,20 +110,26 @@ function Hilitor(id, tag)
|
|
|
|
|
|
function openSearch() {
|
|
function openSearch() {
|
|
//ensure the search term input dialog is visible and has focus:
|
|
//ensure the search term input dialog is visible and has focus:
|
|
|
|
+ var inputboxdiv = document.getElementById("searchinputdiv");
|
|
var inputbox = document.getElementById("searchinput");
|
|
var inputbox = document.getElementById("searchinput");
|
|
- inputbox.style.display = "inline";
|
|
|
|
|
|
+ inputboxdiv.style.display = "inline";
|
|
inputbox.focus();
|
|
inputbox.focus();
|
|
inputbox.select();
|
|
inputbox.select();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function closeSearch() {
|
|
|
|
+ var inputboxdiv = document.getElementById("searchinputdiv");
|
|
|
|
+ inputboxdiv.style.display = "none";
|
|
|
|
+ if(myHilitor) myHilitor.remove();
|
|
|
|
+ }
|
|
|
|
+
|
|
function toggleSearch() {
|
|
function toggleSearch() {
|
|
- var inputbox = document.getElementById("searchinput");
|
|
|
|
- if (inputbox.style.display !== "inline") {
|
|
|
|
|
|
+ var inputboxdiv = document.getElementById("searchinputdiv");
|
|
|
|
+ if (inputboxdiv.style.display !== "inline") {
|
|
openSearch();
|
|
openSearch();
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- inputbox.style.display = "none";
|
|
|
|
- myHilitor.remove();
|
|
|
|
|
|
+ closeSearch();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -157,7 +163,8 @@ function Hilitor(id, tag)
|
|
searchElement.classList.add( 'searchdiv' );
|
|
searchElement.classList.add( 'searchdiv' );
|
|
searchElement.style.position = 'absolute';
|
|
searchElement.style.position = 'absolute';
|
|
searchElement.style.top = '10px';
|
|
searchElement.style.top = '10px';
|
|
- searchElement.style.left = '10px';
|
|
|
|
|
|
+ searchElement.style.right = '10px';
|
|
|
|
+ searchElement.style.zIndex = 10;
|
|
//embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
|
|
//embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
|
|
searchElement.innerHTML = '<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>';
|
|
searchElement.innerHTML = '<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>';
|
|
dom.wrapper.appendChild( searchElement );
|
|
dom.wrapper.appendChild( searchElement );
|
|
@@ -179,18 +186,12 @@ function Hilitor(id, tag)
|
|
}
|
|
}
|
|
}, false );
|
|
}, false );
|
|
|
|
|
|
- // Open the search when the 's' key is hit (yes, this conflicts with the notes plugin, disabling for now)
|
|
|
|
- /*
|
|
|
|
document.addEventListener( 'keydown', function( event ) {
|
|
document.addEventListener( 'keydown', function( event ) {
|
|
- // Disregard the event if the target is editable or a
|
|
|
|
- // modifier is present
|
|
|
|
- if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
|
|
|
|
-
|
|
|
|
- if( event.keyCode === 83 ) {
|
|
|
|
|
|
+ if( event.key == "F" && (event.ctrlKey || event.metaKey) ) {//Control+Shift+f
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
- openSearch();
|
|
|
|
|
|
+ toggleSearch();
|
|
}
|
|
}
|
|
}, false );
|
|
}, false );
|
|
-*/
|
|
|
|
|
|
+ closeSearch();
|
|
return { open: openSearch };
|
|
return { open: openSearch };
|
|
})();
|
|
})();
|