Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Mateusz Sz December 8, 2017

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
TAGS
AUG Leaders

Atlassian Community Events