When I put inline javascript file and css file it doesn't work but when I put inline script with same contents as file it works........Why can u please explain.....It is throwing warning when I put file instead of inline script.....Attaching all relevant screenshots please check
Thanks & Regards,
Pratiksha
Hi ,
Can u please add EREZMA@Amdocs.com to this ticket.
Thanks & Regards,
Pratiksha.
Hi Pratiksha!
I'm not familiar with the dialog shown in your screenshots, but it appears you might be trying to make a custom macro using Adaptavist Scriptrunner. To confirm, could you please provide more information about what you're trying to do and the steps you took to get to this dialog?
Knowing more about your end goals and the tools your using can help others in the community to troubleshoot.
Thanks!
– Zak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, We are trying to make a custom macro. The macro will create a floating TOC at right margin of the page. I am attaching scripts if u want to check them. But according to me the issue is with configuration may be. because what I want to achieve is just to put files instead of inline script and it should work.But When I put files it shows me the error attached in above screenshot.
Thanks & Regards,
Pratiksha.
//Groovy file
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.xhtml.api.MacroDefinition
import com.atlassian.confluence.xhtml.api.XhtmlContent
import com.atlassian.renderer.v2.RenderUtils
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.api.impl.sal.ConfluenceApplicationProperties
def confluenceApplicationProperties = ComponentLocator.getComponent(ConfluenceApplicationProperties)
def baseurl= confluenceApplicationProperties.getBaseUrl()
def xhtmlContent = ComponentLocator.getComponent(XhtmlContent)
def writer
def entity = context.getEntity()
if (entity instanceof Page) {
def concat=xhtmlContent.convertMacroDefinitionToStorage(new MacroDefinition("toc", null, null, null), context)
writer=xhtmlContent.convertStorageToView(concat, context)
}
def str='<div id="myCloseSidenav" class="closesidenav"><span style="font-size:30px;cursor:pointer" onclick="openNav()">☰ </span></div> <div id="mySidenav" class="sidenav"> <a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a> '
def pageUrl=baseurl+'/'+context.spaceKey+'/'+entity.title
str=str+'<a href="'+pageUrl+'">'+entity.title+'</a>'
str=str+writer+'</div><div id="main"></div>'
return str
Javascript :
document.getElementById("myCloseSidenav").style.width = "50px";
function openNav() {
document.getElementById("mySidenav").style.width = "350px";
document.getElementById("main").style.marginRight = "350px";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0px";
document.getElementById("main").style.marginRight= "0px";
}
var expandAnchor = function() {
var hash = decodeURIComponent(window.location.hash);
if (hash) {
var hashPageTitle = AJS.params.pageTitle.split(" ").join("");
if (hash.indexOf(hashPageTitle) === -1) {
if (jQuery.isNumeric(hashPageTitle.substring(0,1))) {
hash = "#id-" + hashPageTitle + "-" + hash.slice(1);
} else {
hash = "#" + hashPageTitle + "-" + hash.slice(1);
}
}
var escapedId = hash.replace(/[!"$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&");
jQuery(escapedId).parents('.expand-container').children('.expand-hidden').prev().click();
window.location.href=hash;
}
}
AJS.toInit(function() {
expandAnchor();
jQuery(window).bind('hashchange', function() {
expandAnchor();
});
});
css file::
body {
font-family: "Lato", sans-serif;
}
.sidenav {
height: 100%;
width: 0;
position:fixed;
z-index: 10;
/*height: 847px;*/
top: 0%;
right: 0;
background-color: #ffffff;
overflow-x:auto;
overflow-y: auto;
transition: 0.5s;
padding-top: 0px;
border-image-outset:0px;
border-image-repeat:stretch;
border-image-slice:100%;
border-image-source:none;
border-image-width:1;
border-left-color:rgb(204, 204, 204);
border-left-style:solid;
border-left-width:1px;
border-top-color:rgb(204, 204, 204);
border-top-left-radius:3px;
border-top-style:solid;
border-top-width:1px;
border-bottom-color:rgb(204, 204, 204);
border-bottom-left-radius:3px;
border-bottom-style:solid;
border-bottom-width:1px;
}
.sidenav a {
padding: 0px 0px 0px 0px;
text-decoration: none;
font-size: 15px;
color:#990066 ;
display: block;
transition: 0.3s;
}
.sidenav a:hover, .offcanvas a:focus{
color: #000;
}
.sidenav .closebtn {
position: absolute;
top: 0;
right: 5px;
font-size: 25px;
margin-left: 50px;
}
.closesidenav {
height: 50px;
width: 40px;
position:fixed;
z-index: 10;
/*height: 847px;*/
top: 20%;
right: 0;
background-color: #ffffff;
overflow-x:auto;
overflow-y: auto;
transition: 0.5s;
padding-top: 0px;
text-decoration: center;
border-image-outset:0px;
border-image-repeat:stretch;
border-image-slice:100%;
border-image-source:none;
border-image-width:1;
border-left-color:rgb(204, 204, 204);
border-left-style:solid;
border-left-width:1px;
border-top-color:rgb(204, 204, 204);
border-top-left-radius:3px;
border-top-style:solid;
border-top-width:1px;
border-bottom-color:rgb(204, 204, 204);
border-bottom-left-radius:3px;
border-bottom-style:solid;
border-bottom-width:1px;
}
#main {
transition: margin-left .5s;
padding: 16px;
min-height:0px;
}
@media screen and (max-height: 450px) {
.sidenav {padding-top: 15px;}
.sidenav a {font-size: 18px;}
}
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.