Wiki source code of Installing Javascript libraries or frameworks in Confluence
Last modified by Normann P. Nielsen on 2014/07/16 08:56
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | There are a lot of fine Javascript files (libraries/frameworks) - both for plain Javascript and for j[[query>>http://jquery.com/]] on the market, both free and commercials, but they all need to be loaded (installed) into Your Confluence to utilize: |
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | {{error}}First, All of the stuff below is quite generic and samples only, refer to the documentation. | ||
| 6 | |||
| 7 | Second, all the files are considered "foreign" (including symbolic links) during an upgrade and must be reimplemented.{{/error}} | ||
| 8 | |||
| 9 | {{info}}Some lightboxes: | ||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | [[prettyPhoto>>http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/]] (Best, and actually free (thumbs-up) - does not support slide on iOS ) | ||
| 14 | |||
| 15 | [[FloatBox>>http://floatboxjs.com/]] (Best, not free for commercial sites) | ||
| 16 | |||
| 17 | [[Flare>>http://pixelentity.com/previews/components/flare/index.html]] (Not free) | ||
| 18 | |||
| 19 | [[Slimbox2>>http://www.digitalia.be/software/slimbox2]] (Free, not good on mobile devices) | ||
| 20 | |||
| 21 | [[OrangeBox>>http://orangebox.davidpaulhamilton.net/]] (Free) | ||
| 22 | |||
| 23 | [[FancyBox>>http://fancybox.net/]] | ||
| 24 | |||
| 25 | [[LightView>>http://projects.nickstakenburg.com/lightview]] (Free) | ||
| 26 | |||
| 27 | See more at [[http://www.tripwiremagazine.com/2013/06/jquery-lightbox-plugins.html]]{{/info}} | ||
| 28 | |||
| 29 | = Install below Confluence = | ||
| 30 | |||
| 31 | Download the Javascript files/Framework zip, upload it to the server and place the files under the install: | ||
| 32 | |||
| 33 | |||
| 34 | {{code}} | ||
| 35 | cd /opt/confluence/confluence | ||
| 36 | mkdir mylightbox | ||
| 37 | cd mylightbox | ||
| 38 | mv ~/mylightbox.zip . | ||
| 39 | unzip mylightbox.zip | ||
| 40 | {{/code}} | ||
| 41 | |||
| 42 | = Somewhere else in the filesystem with symbolic linking = | ||
| 43 | |||
| 44 | Along the way, I have given up having individual symbolic links pr. library/framework, so now I place all under "confluence-ext-libs" | ||
| 45 | |||
| 46 | Download the Javascript files/Framework zip, upload it to the server and place the files under the install: | ||
| 47 | |||
| 48 | {{info}}This requires support for Linking in Tomcat. the server.xml file has to be changed adding the allowedLinked parameter: | ||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | | ##<Context path=####""## ##docBase=####"../confluence"## ##debug=####"0"## ##reloadable=####"false"## ##useHttpOnly=####"true"## ##allowLinking=####"true"####>##{{/info}} | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | Create the filestructure: | ||
| 57 | |||
| 58 | |||
| 59 | {{code}} | ||
| 60 | cd /data | ||
| 61 | mkdir confluence-ext-libs | ||
| 62 | mkdir mylightbox | ||
| 63 | cd mylightbox | ||
| 64 | mv ~/mylightbox.zip . | ||
| 65 | |||
| 66 | unzip mylightbox.zip | ||
| 67 | {{/code}} | ||
| 68 | |||
| 69 | Link under Confluence (only needed once) | ||
| 70 | |||
| 71 | |||
| 72 | {{code}} | ||
| 73 | ln -s /data/confluence-ext-libs /opt/confluence/confluence/confluence-ext-libs | ||
| 74 | {{/code}} | ||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | = The Common Part = | ||
| 79 | |||
| 80 | Now these can be referenced as /opt/confluence/confluence in the server root, so in [[Custom HTML>>Main.atlassian.atlassian-confluence.styling-confluence.custom-html]] (header part) add: | ||
| 81 | |||
| 82 | |||
| 83 | {{code}} | ||
| 84 | <!-- MyLightbox --> | ||
| 85 | <link rel="stylesheet" href="/confluence-ext-libs/mylightbox/css/mylightbox.css" type="text/css" media="screen" charset="utf-8" /> | ||
| 86 | <script src="/confluence-ext-libs/mylightbox/js/jquery.mylightbox.js" type="text/javascript" charset="utf-8"></script> | ||
| 87 | {{/code}} | ||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | Some lighboxes requires to be initiated (the Jquery reference $ is AJS.$ for Confluence): | ||
| 92 | |||
| 93 | |||
| 94 | {{code}} | ||
| 95 | <script type="text/javascript" charset="utf-8"> | ||
| 96 | AJS.$(document).ready(function(){ | ||
| 97 | AjS.$("a[rel^='mylightbox']").mylightbox(); | ||
| 98 | }); | ||
| 99 | </script> | ||
| 100 | {{/code}} |