U
U
uskaritel2017-09-19 12:51:07
JavaScript
uskaritel, 2017-09-19 12:51:07

How to create a JS applet that would include one of the classes depending on the source code of the page?

The essence of the problem.
There is one button in Jira (for Atlassian this is not a bug, but a feature) that is visible to everyone, both admins and ordinary users, if you do not properly handle its functionality, you can do what you don’t need.
I would like to add a small JS applet that would:
check the page code for the presence of a certain string with a unique admin ID and, depending on whether or not there is an ID on the page, the applet would activate the .ghx-config-addcolumn class in CSS. In all other cases the class would be in the state .ghx-config-addcolumn{display:none;}

Thanks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-09-19
@Stalker_RED

It's not entirely clear what exactly you're having trouble with.
Pseudocode:

<input type="hidden" id="admins" value="123,99,42">

if (admins.value.indexOf(42) !== -1) {
   $('some shit').addClass('.ghx-config-addcolumn')
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question