aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/resources/html
diff options
context:
space:
mode:
authoralexbiehl <alex.biehl@gmail.com>2017-08-21 20:05:42 +0200
committeralexbiehl <alex.biehl@gmail.com>2017-08-21 20:05:42 +0200
commit7a71af839bd71992a36d97650004c73bf11fa436 (patch)
treee64afbc9df5c97fde6ac6433e42f28df8a4acf49 /haddock-api/resources/html
parentc8a01b83be52e45d3890db173ffe7b09ccd4f351 (diff)
parent740458ac4d2acf197f2ef8dc94a66f9b160b9c3c (diff)
Merge remote-tracking branch 'origin/master' into ghc-head
Diffstat (limited to 'haddock-api/resources/html')
-rw-r--r--haddock-api/resources/html/Classic.theme/xhaddock.css1
-rw-r--r--haddock-api/resources/html/Ocean.std-theme/ocean.css9
-rw-r--r--haddock-api/resources/html/haddock-util.js140
3 files changed, 11 insertions, 139 deletions
diff --git a/haddock-api/resources/html/Classic.theme/xhaddock.css b/haddock-api/resources/html/Classic.theme/xhaddock.css
index 19dc28ec..1bf668e9 100644
--- a/haddock-api/resources/html/Classic.theme/xhaddock.css
+++ b/haddock-api/resources/html/Classic.theme/xhaddock.css
@@ -285,6 +285,7 @@ div.top h5 {
padding: 0 8px 2px 5px;
margin-right: -3px;
background-color: #f0f0f0;
+ -moz-user-select: none;
}
div.subs {
diff --git a/haddock-api/resources/html/Ocean.std-theme/ocean.css b/haddock-api/resources/html/Ocean.std-theme/ocean.css
index 29af691b..8d3f91a9 100644
--- a/haddock-api/resources/html/Ocean.std-theme/ocean.css
+++ b/haddock-api/resources/html/Ocean.std-theme/ocean.css
@@ -327,10 +327,6 @@ div#style-menu-holder {
}
#synopsis {
- display: none;
-}
-
-.no-frame #synopsis {
display: block;
position: fixed;
right: 0;
@@ -398,6 +394,7 @@ div#style-menu-holder {
background: #f0f0f0;
padding: 0 0.5em 0.2em;
margin: 0 -0.5em 0 0;
+ -moz-user-select: none;
}
#interface .src .selflink {
border-left: 1px solid #919191;
@@ -614,4 +611,8 @@ div#style-menu-holder {
float: right;
}
+:target {
+ background-color: #ffff00;
+}
+
/* @end */
diff --git a/haddock-api/resources/html/haddock-util.js b/haddock-api/resources/html/haddock-util.js
index 92d07d2a..967e2026 100644
--- a/haddock-api/resources/html/haddock-util.js
+++ b/haddock-api/resources/html/haddock-util.js
@@ -1,7 +1,7 @@
// Haddock JavaScript utilities
var rspace = /\s\s+/g,
- rtrim = /^\s+|\s+$/g;
+ rtrim = /^\s+|\s+$/g;
function spaced(s) { return (" " + s + " ").replace(rspace, " "); }
function trim(s) { return s.replace(rtrim, ""); }
@@ -52,17 +52,17 @@ function toggleSection(id)
{
var b = toggleShow(document.getElementById("section." + id));
toggleCollapser(document.getElementById("control." + id), b);
- rememberCollapsed(id, b);
+ rememberCollapsed(id);
return b;
}
var collapsed = {};
-function rememberCollapsed(id, b)
+function rememberCollapsed(id)
{
- if(b)
+ if(collapsed[id])
delete collapsed[id]
else
- collapsed[id] = null;
+ collapsed[id] = true;
var sections = [];
for(var i in collapsed)
@@ -109,136 +109,6 @@ function getCookie(name) {
return null;
}
-
-
-var max_results = 75; // 50 is not enough to search for map in the base libraries
-var shown_range = null;
-var last_search = null;
-
-function quick_search()
-{
- perform_search(false);
-}
-
-function full_search()
-{
- perform_search(true);
-}
-
-
-function perform_search(full)
-{
- var text = document.getElementById("searchbox").value.toLowerCase();
- if (text == last_search && !full) return;
- last_search = text;
-
- var table = document.getElementById("indexlist");
- var status = document.getElementById("searchmsg");
- var children = table.firstChild.childNodes;
-
- // first figure out the first node with the prefix
- var first = bisect(-1);
- var last = (first == -1 ? -1 : bisect(1));
-
- if (first == -1)
- {
- table.className = "";
- status.innerHTML = "No results found, displaying all";
- }
- else if (first == 0 && last == children.length - 1)
- {
- table.className = "";
- status.innerHTML = "";
- }
- else if (last - first >= max_results && !full)
- {
- table.className = "";
- status.innerHTML = "More than " + max_results + ", press Search to display";
- }
- else
- {
- // decide what you need to clear/show
- if (shown_range)
- setclass(shown_range[0], shown_range[1], "indexrow");
- setclass(first, last, "indexshow");
- shown_range = [first, last];
- table.className = "indexsearch";
- status.innerHTML = "";
- }
-
-
- function setclass(first, last, status)
- {
- for (var i = first; i <= last; i++)
- {
- children[i].className = status;
- }
- }
-
-
- // do a binary search, treating 0 as ...
- // return either -1 (no 0's found) or location of most far match
- function bisect(dir)
- {
- var first = 0, finish = children.length - 1;
- var mid, success = false;
-
- while (finish - first > 3)
- {
- mid = Math.floor((finish + first) / 2);
-
- var i = checkitem(mid);
- if (i == 0) i = dir;
- if (i == -1)
- finish = mid;
- else
- first = mid;
- }
- var a = (dir == 1 ? first : finish);
- var b = (dir == 1 ? finish : first);
- for (var i = b; i != a - dir; i -= dir)
- {
- if (checkitem(i) == 0) return i;
- }
- return -1;
- }
-
-
- // from an index, decide what the result is
- // 0 = match, -1 is lower, 1 is higher
- function checkitem(i)
- {
- var s = getitem(i).toLowerCase().substr(0, text.length);
- if (s == text) return 0;
- else return (s > text ? -1 : 1);
- }
-
-
- // from an index, get its string
- // this abstracts over alternates
- function getitem(i)
- {
- for ( ; i >= 0; i--)
- {
- var s = children[i].firstChild.firstChild.data;
- if (s.indexOf(' ') == -1)
- return s;
- }
- return ""; // should never be reached
- }
-}
-
-function setSynopsis(filename) {
- if (parent.window.synopsis && parent.window.synopsis.location) {
- if (parent.window.synopsis.location.replace) {
- // In Firefox this avoids adding the change to the history.
- parent.window.synopsis.location.replace(filename);
- } else {
- parent.window.synopsis.location = filename;
- }
- }
-}
-
function addMenuItem(html) {
var menu = document.getElementById("page-menu");
if (menu) {