Blank plugin for Confluence Mobile breaks js (deferred.promise is not a function)

Hello,

I'm trying to style Confluence Mobile, and only thing I've found was this: https://community.atlassian.com/t5/Confluence-questions/How-to-modify-the-mobile-css-for-Confluence/qaq-p/190187

with suggestion to create my own plugin.
So I did this using SDK and I have very basic plugin, generated using atlas-create-confluence-plugin

Only thing I've changed is atlassian-plugin.xml and I've changed
context from TreflMobile to what is seen below, so it works on mobile (atl.general don't work with mobile)

<web-resource key="TreflMobile-resources" name="TreflMobile Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="TreflMobile.js" location="/js/TreflMobile.js"/>
<resource type="download" name="TreflMobile.css" location="/css/TreflMobile.css"/>
<resource type="download" name="images/" location="/images"/>

<context>atl.mobile.confluence.app.frame</context>
</web-resource>

 

And then magics happen... I get following error in console when viewing in mobile:

Uncaught TypeError: deferred.promise is not a function
at Function.ajax
at Function.jQuery.(anonymous function) [as get]
at Function.getJSON
at updateAnchors
at Object.setupAnchors
at HTMLDocument.<anonymous>
at fire
at Object.fireWith
at Function.ready
at HTMLDocument.DOMContentLoaded

 This error doesn't happen when my plugin is turned off. 

So I've started troubleshooting:

My .js file is merged into batch.js, I can see my code there. Tried few contents of .js:

1. I've left it blank - error, page doesn't load (stuck on loading)
2. I've inserted there just simple alert('works'); - alert works, page doesn't load (stuck on loading)
3. I've inserted there my desired code - just a shot:

AJS.toInit(function() {
var mytrefl = AJS.$(      [proper,working code there for some lines]
});

- Code doesn't work, page doesn't load
4. I've stripped it from atlassian-plugin.xml, so .js doesn't load - page loads, but error is still there.

It seems that my plugin causes this error. Any hint why?

0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Published yesterday in Confluence

Think you know shares vs. @mentions in Confluence? Take this collab quiz.

To anyone who doubts that Atlassians are a little too obsessed with collaboration, and tools related thereto, let me describe a recent discussion we had (which took place on our internal Confluence, ...

108 views 2 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you