Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Camil Staps
clean-doc
Commits
2aac5f28
Verified
Commit
2aac5f28
authored
Oct 06, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove fetch API (in Chrome this is not allowed on file:// urls)
parent
606012d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
data/cleandoc-default/js/cleandoc.js
data/cleandoc-default/js/cleandoc.js
+11
-9
src/Clean/Doc/ModuleCollection/HTML.icl
src/Clean/Doc/ModuleCollection/HTML.icl
+2
-1
No files found.
data/cleandoc-default/js/cleandoc.js
View file @
2aac5f28
var
lunr_items
;
var
lunr_items
;
var
lunr_index
;
var
lunr_index
;
var
restoreSessionSettings
;
function
build_lunr
(
items
)
{
function
build_lunr
(
items
)
{
lunr_items
=
items
;
lunr_items
=
items
;
lunr_index
=
lunr
(
function
(){
lunr_index
=
lunr
(
function
(){
...
@@ -11,6 +12,8 @@ function build_lunr(items) {
...
@@ -11,6 +12,8 @@ function build_lunr(items) {
this
.
add
(
items
[
i
]);
this
.
add
(
items
[
i
]);
}
}
});
});
restoreSessionSettings
();
}
}
function
make_relative_url
(
url
)
{
function
make_relative_url
(
url
)
{
...
@@ -147,7 +150,7 @@ function highlightCallback(span, cls, str) {
...
@@ -147,7 +150,7 @@ function highlightCallback(span, cls, str) {
};
};
}
}
let
restoreSessionSettings
=
function
()
{
restoreSessionSettings
=
function
()
{
if
(
typeof
sessionStorage
.
searchValue
!=
'
undefined
'
)
{
if
(
typeof
sessionStorage
.
searchValue
!=
'
undefined
'
)
{
searchfield
.
value
=
sessionStorage
.
searchValue
;
searchfield
.
value
=
sessionStorage
.
searchValue
;
searchfield
.
oninput
();
searchfield
.
oninput
();
...
@@ -160,13 +163,12 @@ function highlightCallback(span, cls, str) {
...
@@ -160,13 +163,12 @@ function highlightCallback(span, cls, str) {
if
(
typeof
sessionStorage
[
'
scrollLeft-
'
+
savedScrollDivs
[
i
]]
!=
'
undefined
'
)
if
(
typeof
sessionStorage
[
'
scrollLeft-
'
+
savedScrollDivs
[
i
]]
!=
'
undefined
'
)
elem
.
scrollLeft
=
sessionStorage
[
'
scrollLeft-
'
+
savedScrollDivs
[
i
]];
elem
.
scrollLeft
=
sessionStorage
[
'
scrollLeft-
'
+
savedScrollDivs
[
i
]];
}
}
};
/* Lunr index; afterwards restore session */
if
(
typeof
sessionStorage
[
'
scrollTop-toc
'
]
==
'
undefined
'
)
{
fetch
(
make_relative_url
(
'
data/lunr-index.json
'
)
)
var
toc
=
document
.
getElementById
(
'
toc
'
)
;
.
then
(
function
(
response
)
{
return
response
.
json
();
})
var
active
=
toc
.
querySelector
(
'
.active
'
);
.
then
(
function
(
json
)
{
if
(
active
!=
null
)
build_lunr
(
json
)
;
toc
.
scrollTop
=
active
.
offsetTop
-
50
;
restoreSessionSettings
();
}
}
)
;
};
})();
})();
src/Clean/Doc/ModuleCollection/HTML.icl
View file @
2aac5f28
...
@@ -29,7 +29,7 @@ import Clean.Doc.ModuleCollection.Index => qualified :: IndexItem{name}
...
@@ -29,7 +29,7 @@ import Clean.Doc.ModuleCollection.Index => qualified :: IndexItem{name}
generateHTML
::
!
ModuleCollection
->
WebSite
generateHTML
::
!
ModuleCollection
->
WebSite
generateHTML
mcoll
=
generateHTML
mcoll
=
[(
"
data
/lunr-index.js
on
"
,
toString
$
toJSON
$
indexModuleCollection
mcoll
)]
++
[(
"
js
/lunr-index.js"
,
"build_lunr("
+++
(
toString
$
toJSON
$
indexModuleCollection
mcoll
)
+++
");"
)
]
++
map
(\(
fp
,
html
)
->
(
fp
,
finalizeHTML
fp
html
))
map
(\(
fp
,
html
)
->
(
fp
,
finalizeHTML
fp
html
))
[
(
"index.html"
,
Text
""
)
[
(
"index.html"
,
Text
""
)
:
map
moduleFile
mcoll
:
map
moduleFile
mcoll
...
@@ -47,6 +47,7 @@ where
...
@@ -47,6 +47,7 @@ where
,
ScriptTag
[
DeferAttr
"defer"
,
SrcAttr
(
relativePath
"modules/clean-doc-markup/clean-doc-markup.js"
)]
[]
,
ScriptTag
[
DeferAttr
"defer"
,
SrcAttr
(
relativePath
"modules/clean-doc-markup/clean-doc-markup.js"
)]
[]
,
ScriptTag
[
DeferAttr
"defer"
,
SrcAttr
(
relativePath
"js/cleandoc.js"
)]
[]
,
ScriptTag
[
DeferAttr
"defer"
,
SrcAttr
(
relativePath
"js/cleandoc.js"
)]
[]
,
ScriptTag
[
DeferAttr
"defer"
,
SrcAttr
(
relativePath
"modules/lunr.js/lunr.js"
)]
[]
,
ScriptTag
[
DeferAttr
"defer"
,
SrcAttr
(
relativePath
"modules/lunr.js/lunr.js"
)]
[]
,
ScriptTag
[
DeferAttr
"defer"
,
SrcAttr
(
relativePath
"js/lunr-index.js"
)]
[]
]
]
,
BodyTag
[]
,
BodyTag
[]
[
DivTag
[
IdAttr
"container"
]
[
DivTag
[
IdAttr
"container"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment