Improving UI using JS


#1

Hi,
I am having problems with “getting used” to UI, I wish to simplify it for myself using custom javascript. On ticket view, I wish to:

  • not have visible default input text field for creating a note,
  • have a link “add note” next to “reply” link.

Here’s the code I have so far (you can just paste it and run in chrome console):

var style = document.createElement('style');
style.type = 'text/css';
 style.innerHTML = ' \
.editControls .js-selectInternalPublic,  \
a[data-type="internal"],  \
a[data-type="public"],  \
a[data-type="split"],  \
.editControls [data-value="phone"],  \
.article-new { \
	display:none; \
} \
';
document.getElementsByTagName('head')[0].appendChild(style);

var div = '<a href="" class="x-note article-action js-ArticleAction u-clickable"><svg class="icon icon-note article-action-icon"><use xlink:href="assets/images/icons.svg#icon-note"></use></svg><span class="article-action-name">add note</span></a>';

$('.js-article-actions .article-actions').prepend(div);

$('.x-note').click(function() {
	$('.article-new').toggle();
});

It more or less works. But when clicking “add note” link, I wish it to also trigger action which is being called when switching article type (the action which is in controls next to input text area to switch from email to note). Can you tell me how can I switch currently selected reply type to note via javascript?
Thanks


#2

I do not recommend changing such files, as this is not update safe.
I do also not have a soltuion that will work for you.

Maybe @thorsteneckel can find some free time some day helping you, but I doubt it to be honest.


#3

Unfortunately this is no level we (currently) give support. This is a very special edge case which will likely break in the future. We’re working hard on creating sustainable solutions that will make your life easier :rocket:


#4

@MrGeneration: Well, actually I have not modified any file. It’s a code you execute in chrome console. I am aware that it might not be update safe, but those are just UI fixes. So in case of problems it can be easily disabled and if it won’t work - usually it will just not hide unnecessary elements.

@thorsteneckel: I do not ask for very sofisticated support. Can you just point me to the repository where ticket view js files are kept, I’ll try to find answer on my own. Thanks.


#5

Sure! Here are some files that should be sufficient to get you started: