Merge pull request #153 from ZmagoD/zd_SCI_448

Wrong name of experiment and task - gets undefined as prefix
This commit is contained in:
Zmago Devetak 2016-09-15 15:00:34 +02:00 committed by GitHub
commit 01656c1018
2 changed files with 26 additions and 14 deletions

View file

@ -1107,6 +1107,25 @@ function constructElementContentsJson(el) {
return jsonEl;
}
/**
* Binds listeners to sidebar
* that truncate long strings
*/
function initializeReportSidebartruncation() {
var target = document.getElementById("report-sidebar-tree");
var observer = new MutationObserver(
function() {
$.each($("a.report-nav-link"),
function(){
truncateLongString($(this), 30);
});
}
);
var config = { childList: true };
observer.observe(target, config);
}
/* Initialize the first-time demo tutorial if needed. */
function initializeTutorial() {
if (showTutorial()) {
@ -1177,6 +1196,7 @@ function showTutorial() {
*/
initializeReportElements($(REPORT_CONTENT));
initializeReportSidebartruncation();
initializeGlobalReportSort();
initializePrintPopup();
initializeSaveToPdf();
@ -1185,16 +1205,3 @@ initializeAddContentsModal();
initializeSidebarNavigation();
initializeUnsavedWorkDialog();
initializeTutorial();
$(document).change(function(){
setTimeout(function(){
$(".report-nav-link").each( function(){
truncateLongString( $(this), 30);
});
}, 1000);
});
$(document).ready(function(){
$(".report-nav-link").each( function(){
truncateLongString( $(this), 30);
});
});

View file

@ -17,7 +17,12 @@ function truncateLongString( el, chars ) {
break;
}
}
el.html(html.outerHTML + newText + '...' );
if ( html ) {
el.html(html.outerHTML + newText + '...' );
} else {
el.html(newText + '...' );
}
}
}