KMT / Prom Easy Description

// ==UserScript==
// @name        Prom Easy Description
// @namespace   http://tampermonkey.net/
// @version     0.1
// @description Moving description field in order editing page to right side
// @author      KMT
// @match       https://my.prom.ua/cms/*
// @copyright   2019, KMT (https://openuserjs.org/users/KMT)
// @license     MIT
// ==/UserScript==

var $ = unsafeWindow.jQuery;
if($) {console.log('UJS loaded. Used jQ v' + $().jquery)}

$(document).ready(function(){
    var config = { childList: true, subtree: true };
    var callback = function(mutationsList, observer) {
        for(var mutation of mutationsList) {
            if (mutation.type == 'childList') {
                if(document.querySelector('div[data-qaid="total_order_block"]') !== null && document.querySelector('span#missiondone') === null) {
                    var descDIV = $('span.b-order-edit__header-title:contains("Примечания")').closest('div.b-section-flex__item');
                    var summDIV = $('div[data-qaid="total_order_block"]');
                    var tagsDIV = $('span.b-order-edit__header-title:contains("Метки по заказу")').closest('div.b-section-flex__item');
                    tagsDIV.after('<span id="missiondone"></span>');
                    summDIV.after(descDIV);
                    descDIV.after(tagsDIV);
                    descDIV.css({'border-top':'1px dashed d1d7da', 'border-bottom':'1px dashed d1d7da'}).children('div').css({'padding':'10px 0', 'margin':'0 0 0 10px'});
                    return;
                }
            }
        }
    };
    var observer = new MutationObserver(callback);
    observer.observe(document, config);
});