1
0
mirror of https://github.com/pattern-lab/patternlab-php.git synced 2025-01-17 22:29:12 +01:00

adding support for open anno and move to anno via query string vars

This commit is contained in:
Dave Olsen 2014-02-22 11:02:27 -05:00
parent e8808e70f7
commit fd56ca2b8f

View File

@ -10,7 +10,8 @@ var annotationsViewer = {
// set-up default sections
commentsActive: false,
targetOrigin: (window.location.protocol === "file:") ? "*" : window.location.protocol+"//"+window.location.host,
targetOrigin: (window.location.protocol === "file:") ? "*" : window.location.protocol+"//"+window.location.host,
moveToOnInit: 0,
/**
* add the onclick handler to the annotations link in the main nav
@ -34,6 +35,15 @@ var annotationsViewer = {
// initialize the annotations viewer
annotationsViewer.commentContainerInit();
// load the query strings in case code view has to show by default
var queryStringVars = urlHandler.getRequestVars();
if ((queryStringVars.view !== undefined) && ((queryStringVars.view === "annotations") || (queryStringVars.view === "a"))) {
annotationsViewer.openComments();
if (queryStringVars.number !== undefined) {
annotationsViewer.moveToOnInit = queryStringVars.number;
}
}
},
/**
@ -187,6 +197,11 @@ var annotationsViewer = {
// slide the comment section into view
annotationsViewer.slideComment(0);
if (annotationsViewer.moveToOnInit != "0") {
annotationsViewer.moveTo(annotationsViewer.moveToOnInit);
annotationsViewer.moveToOnInit = "0";
}
},
/**