On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

  • Recent Posts

    April 2010
    M T W T F S S
    « Mar   May »
  • Subscribe Options

  • Awards

  • Most Valuable Blogger @ DZone
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 175 other followers

  • Follow MyThinkPond on
  • Blog Stats

    • 366,804 hits
  • General Options

GreaseMonkey to the rescue – fixing Apache Jackrabbit Site

Posted by Venkatt Guhesan on April 21, 2010

Starting yesterday the Apache JackRabbit JCR website had an interesting problem. Someone must have made a change to the base template such that they had removed the SyntaxHighlighter code that needs to be appended to the header. I’ve opened an issue in their jira issue tracker.

>>>>>>>> Contents of JIRA Issue >>>>>>>>
It started happening today. When I visit the website, for example:

All the artifacts that contain a “SCRIPT” of type syntaxhighlighter does not get displayed.

So basically all examples on the site fails to show up.

Upon view-source, you will find artifacts like this:

<script class="toolbar: false; theme: default; brush: java; gutter: false" type="syntaxhighlighter">// <![CDATA[
 public class FirstHop { // Some Code... }
// ]]></script>

None of the artifacts that are using “syntaxhighlighter” gets displayed. Which leaves the site almost useless when it comes to documentation.

Problem must have started today (April 19, 2010) since I was able to see them last night.
>>>>>>>> Contents of JIRA Issue >>>>>>>>

But while I wait for a fix the site is pretty much unusable. Let me show you an example,

So essentially you have a website that has no examples, no configuration details, etc. While I wait for a fix (which can happen any day), I thought this is a good opportunity to whip out a Greasemonkey Script to fix the issue. So this article focuses on creating a GreaseMonkey script that addresses this issue in my browser while the site is broken.

Let’s first look at the problem:

Apache Jackrabbit site needs to include the following in their header tag:

<link href='' rel='stylesheet' type='text/css'/>
<link href='' rel='stylesheet' type='text/css'/>
<script src='' type='text/javascript'></script>
<script src='' type='text/javascript'></script>
<script src='' type='text/javascript'></script>
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = '';

Using GreaseMonkey, you can insert any script at any point in the document or site (from the browsers perspective). So here’s the script that does that:

// ==UserScript==
// @name           Apache JackRabbit Script
// @namespace
// @description    fixes the SyntaxHighlighter
// @include*
// ==/UserScript==

function addHeaderForSyntaxHighlighter(){

	var addStyle1 = document.createElement('style');
	addStyle1.type = 'text/css'; = '';

	var addStyle2 = document.createElement('style');
	addStyle2.type = 'text/css'; = '';

	var addScript1 = document.createElement('script');
	addScript1.type = 'text/javascript';
	addScript1.src = '';

	var addScript2 = document.createElement('script');
	addScript2.type = 'text/javascript';
	addScript2.src = '';

	var addScript3 = document.createElement('script');
	addScript3.type = 'text/javascript';
	addScript3.src = '';

	var addBaseScript = document.createElement('script');
	addBaseScript.type = 'text/javascript';
	addBaseScript.src = '';

	var headID = document.getElementsByTagName("head")[0];



The above greesemonkey script adds the styles and necessary javascript to the page so that all the artifacts that use the SyntaxHighlighter are displayed. I’m attaching the file here for anyone who wants to use it in their greesemonkey script in FireFox.

Greesemonkey JackRabbit Site Fix Script

If you have GreeseMonkey installed in your FireFox browser, you can then click on the above link and GreeseMonkey will prompt you to approve the installation of the script. So you don’t need to do anything fancy. And you can uninstall it at anytime.

PS: If you are someone (or if you know of someone) who manages the Apache JackRabbit website, please fix the SyntaxHighlighter issue. We need the documentation! Thank You.



UPDATE from Sébastien Launay on Thurs., April 22, 2010 – Thank you for the information. Helps to know that someone out there is aware of the issue.

Hi Venkatt,

Thanks for reporting this issue.

The bug appears to be global to Apache projects websites and related
to the confluence auto-export feature:

Sébastien Launay


Update – on Friday, April 23rd, 2010 – this bug has been resolved and verified. So no need for the patch with Grease Monkey.


4 Responses to “GreaseMonkey to the rescue – fixing Apache Jackrabbit Site”

  1. […] więcej: GreaseMonkey to the rescue – fixing Apache Jackrabbit Site … Comments RSS […]

  2. chuck said

    It looks like they broke every single Apache project — Mina and Camel are both still broken, for example. Unfortunately I can’t make the script work for either of those sites even after adding them to the included pages in GM

  3. chuck said

    My mistake — I forgot to allow the domains and the various third parties the syntax hilighter uses in noscript.

    I *certainly* hope Apache is not requiring javascript from all these third parties just to be able to display code examples at all…

  4. […] GreaseMonkey to the rescue – fixing Apache Jackrabbit Site.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: