Skip to content

Instantly share code, notes, and snippets.

@dvdsmpsn
Last active July 31, 2020 19:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvdsmpsn/6918249 to your computer and use it in GitHub Desktop.
Save dvdsmpsn/6918249 to your computer and use it in GitHub Desktop.
Inject a meta tag into Atlassian Confluence and then access it from JavaScript using AJS.params.workForAppFusions
...
<web-panel name="Fulfillment Web Panel"
key="fulfillment-web-panel"
location="atl.header"
weight="1000"
class="com.appfusions.confluence.plugins.fulfillment.webpanels.FulfillmentWebPanel">
<description key="fulfillment-web-panel.description">Looking for something more fulfilling?</description>
</web-panel>
...
package com.appfusions.confluence.plugins.fulfillment.webpanels;
import com.atlassian.plugin.web.model.WebPanel;
import java.io.IOException;
import java.io.Writer;
import java.util.Map;
public class FulfillmentWebPanel implements WebPanel
{
public String getHtml(Map<String, Object> stringObjectMap)
{
// AJS.params.workForAppFusions
return "<meta name=\"ajs-work-for-app-fusions\" content=\"Looking for something more fulfilling? Try AppFusions http://www.appfusions.com/display/Dashboard/Make+it+Happen+Team\" />";
}
@Override
public void writeHtml(Writer writer, Map<String, Object> context) throws IOException
{
writer.write(getHtml(context));
}
}
/**
* Print a message in the console.
* @see: <a href="https://twitter.com/dvdsmpsn/status/388297619875041280">Screenshot</a>
*/
AJS.toInit(function () {
AJS.log(AJS.params.workForAppFusions);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment