Bug 839634
Summary: | Add javascript to publican brand | ||
---|---|---|---|
Product: | [Other] Topic Tool | Reporter: | Joshua Wulf <jwulf> |
Component: | FUDCon Docs Hack | Assignee: | Joshua Wulf <jwulf> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Joshua Wulf <jwulf> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | unspecified | CC: | lcarlon, syeghiay, topic-tool-list |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-04-22 09:04:00 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 838277 |
Description
Joshua Wulf
2012-07-12 13:14:08 UTC
Actually, I could only get it to work through html.xsl and html-single.xsl. Additionally, I put the script inline in the xsl, rather than loading it from an external file. Here's the relevant portion of html-single.xsl: <!-- inject our javascript into the head --> <!-- http://www.sagehill.net/docbookxsl/InsertExtHtml.html --> <xsl:template name="user.head.content"> <script type="text/javascript" src="Common_Content/skynet-book.js"/> </xsl:template> <!-- set the onload of the page --> <!-- http://www.sagehill.net/docbookxsl/BodyAtts.html --> <xsl:template name="body.attributes"> <xsl:attribute name="onLoad">skynetBookLoad()</xsl:attribute> </xsl:template> ------------------------------------- It looks like arbitrary files in the Common_Content directory are not included in the brand. Looking for a way to get the javascript in. Current workaround is to use a URL. You can put the javascript file into either css or images and it will be included. It won't work in Common_Content itself, because publican will only accept .xml files there, and tries to validate them as xml. This site: http://friendlybit.com/js/lazy-loading-asyncronous-javascript/ Shows how to do lazy asynchronous loading of javascript via a small function in the <head> element. This might be the way to go. So we would inject this into the <head>: <script type="text/javascript"> (function() { function async_load(){ var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = u'css/skynetbook.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } if (window.attachEvent) window.attachEvent('onload', async_load); else window.addEventListener('load', async_load, false); })();</script> Broken in Publican 3 atm... Fixed in Publican 3.1 and rocking hard! |