Commit d7b8a91b authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

prepare index entries view

parent 46707364
Pipeline #76689 passed with stage
in 23 seconds
......@@ -165,6 +165,9 @@ li.org::before {
font-family: 'FontAwesome';
padding-right: 10px;
}
li.group.org::before {
content: "";
}
ul.workList li.item:before {
color: grey;
content: "\f02d";
......
......@@ -30,7 +30,13 @@ function getCookie(cname) {
function highlight(id) {
var array = id.split(" ");
for (var i in array) {
$('#'+array[i]).toggleClass('fhighlighted');
if( array[i].indexOf(":") > 0 ) {
var target = array[i].replace(/^...:/, "");
}
else {
var target = array[i];
};
$('#' + target + ', *[data-ref="' + target + '"]' ).toggleClass('fhighlighted');
}
}
$(function () {
......
var code = {
var nb = getParameter("id").replace(/.xml|data|\//g, ""),
page = getParameter("page"),
code = {
type: 'component',
componentName: 'code',
title:'Code',
......@@ -50,7 +52,16 @@ var code = {
importclass: '.fcomm' },
isClosable: false
},
config = {
index = {
type: 'component',
componentName: 'index',
title:'Register (0)',
id: 'index',
componentState: {
importclass: '.findex' },
isClosable: false
},
config = {
settings: {showPopoutIcon: false, showCloseIcon: false},
dimensions: {headerHeight: 30},
content: [{
......@@ -59,7 +70,7 @@ var code = {
{
type: "stack",
content:
[code, toc, comm]
[code, toc, comm, index]
}
]
......@@ -152,7 +163,7 @@ container.getElement().html( '<div class="fcomm"></div>');
$( ".fcomm" ).append( data );
var currentTitle = container._config.title;
var numComments = $(".fcomm").find("li").length;
var newTitle = currentTitle.replace(/\d/g, numComments);
var newTitle = currentTitle.replace(/\d+/g, numComments);
container.setTitle(newTitle);
$("li[data-ref]").each(function(){
var target = $(this).attr("data-ref");
......@@ -167,6 +178,31 @@ container.getElement().html( '<div class="fcomm"></div>');
});
});
myLayout.registerComponent( 'index', function( container, state ){
container.getElement().html( '<div class="findex"></div>');
$.ajax({
url: "api/index/" + nb + "/"+page,
dataType: "html"
}).done( function(data){
$( ".findex" ).append( data );
var currentTitle = container._config.title;
var numEntities = $(".findex").find("*[data-ref]").length;
var newTitle = currentTitle.replace(/\d+/g, numEntities);
container.setTitle(newTitle);
$(".findex li[data-ref]").each(function(){
var target = $(this).attr("data-ref");
$(this).hover(
function(){
console.log(target);
highlight(target);
},
function(){
$(".fhighlighted").removeClass("fhighlighted");
});
});
});
});
myLayout.init();
if( localStorage.savedState ) {
......@@ -415,3 +451,18 @@ function highlightLinkedAreas() {
$(".surface *[id='"+id+"']").removeClass("fhighlighted");
});
}
// getParameter function available everywhere
// implementation for LitVZ
function getParameter(parameterName) {
var result = null,
tmp = [];
location.search
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
});
return result;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment