Changeset 31416
- Timestamp:
- 2017-02-15T03:56:51+13:00 (7 years ago)
- Location:
- main/trunk/greenstone3/web/interfaces/default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/web/interfaces/default/js/document_scripts.js
r31050 r31416 310 310 } 311 311 } 312 312 function focusAnchor(sectionID, level, tocDisabled, anchor) 313 { 314 if(!level) 315 { 316 level = 0; 317 } 318 var parts = sectionID.split("."); 319 if(level >= parts.length) 320 { 321 var target = document.getElementById(anchor); 322 if (!target){ 323 target = document.getElementsByName(anchor)[0]; 324 } 325 var topVal = $(target).offset().top - 50; 326 $('html, body').stop().animate({scrollTop: topVal}, 1000); 327 window.location.hash = anchor; 328 return; 329 } 330 331 var idToExpand = ""; 332 for(var i = 0; i < level + 1; i++) 333 { 334 if(i > 0) 335 { 336 idToExpand += "."; 337 } 338 339 idToExpand += parts[i]; 340 } 341 342 if(!isSectionExpanded(idToExpand)) 343 { 344 toggleSection(idToExpand, function(success) 345 { 346 if(success) 347 { 348 focusAnchor(sectionID, level + 1, tocDisabled, anchor); 349 } 350 }, tocDisabled); 351 } 352 else 353 { 354 focusAnchor(sectionID, level + 1, tocDisabled, anchor); 355 } 356 } 313 357 function expandOrCollapseAll(expand) 314 358 { -
main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl
r31248 r31416 239 239 <xsl:template name="javascriptForDocumentView"> 240 240 <script type="text/javascript" src="interfaces/{$interface_name}/js/document_scripts.js"><xsl:text> </xsl:text></script> 241 <script type="text/javascript"> 242 <xsl:text disable-output-escaping="yes"> 243 function goToAnchor(sectionID,anchor) 244 { 245 var docIdentifier = '</xsl:text><xsl:value-of select="//documentNode[@nodeType = 'root']/@nodeID"/><xsl:text disable-output-escaping="yes">'; 246 focusAnchor(docIdentifier + "."+ sectionID,0,1,anchor); 247 } 248 </xsl:text> 249 </script> 241 250 </xsl:template> 242 251 <xsl:template name="javascriptForDocumentEditing">
Note:
See TracChangeset
for help on using the changeset viewer.