I have been trying to run a jquery function on Dashboard page when it loads,
i have tried to add context to web resource but can't get it to work.
Here is the Web Resource code:
<web-resource key="1-resources" name="1 Web Resources"> <dependency>com.atlassian.auiplugin:ajs</dependency> <dependency>jira.webresources:global-static</dependency> <dependency>jira.webresources:jira-global</dependency> <dependency>jira.web.resources:ajs</dependency> <dependency>jira.web.resources:jquery</dependency> <description>JavaScript</description> <resource type="download" name="1.css" location="/css/1.css"/> <resource type="download" name="1.js" location="/js/1.js"/> <resource type="download" name="images/" location="/images"/> <context>jira.dashboard</context> <context>atl.dashboard</context> <context>atl.general</context> <context>atl.admin</context> <context>atl.userprofile</context> <context>atl.popup</context> </web-resource>
And here is the JS file
AJS.$(document).ready(function(){ AJS.$(".dashboard-item-title").each(function() { var $this = $(this); $this.replaceWith($("<h5 style='padding-left:8px;color:white'>" + $this.html() + "</h5>")); }); });
What could be the problem here. Please help.
Community moderators have prevented the ability to post new answers.
Fairly sure your JS and webresource declaration is correct. The markup on the dashboard is generated after DOM ready - so your JS is probably not finding anything. What are you trying to achieve? Smaller text with more left padding and white text?
Why not just ignore JS and override it purely with CSS?
.dashboard-item-title { font-size: 14px !important; color: white !important; padding-left: 8px !important; }
I'm not one to advocate using !important but if you are just playing around then this will work.
worked like a charm! thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
anybody, all i want is to run a simple JS on dashboard.
Or have JIRA 6 changed the way JS is loaded on page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.