-
Notifications
You must be signed in to change notification settings - Fork 0
/
markup.min.js
7 lines (7 loc) · 3.48 KB
/
markup.min.js
1
2
3
4
5
6
7
'use strict';document.addEventListener("DOMContentLoaded",function(){function g(a,c){var e=document.createElement(c);e.innerHTML=a.innerHTML;Array.prototype.forEach.call(a.attributes,function(b){e.setAttribute(b.name,b.value)});a.parentNode.insertBefore(e,a);a.parentNode.removeChild(a);return e}(new MutationObserver(a=>{for(let e of a)for(let b of e.addedNodes)if(b instanceof HTMLElement&&(b.matches('[class*="cck_form_group_x"]')||b.matches(".ui-sortable > div"))){if(a=b.querySelector("aside")){var c=
a.innerHTML.replace(/div/g,"li");c=c.replace(/<span/g,'<a href="#" ');c=c.replace(/<\/span/g,"</a");a.outerHTML='<ul class="uk-float-right uk-iconnav uk-margin-bottom">'+c+"</ul>"}if(a=b.querySelector(".collection-group-wrap:not([uk-grid]")){a.setAttribute("uk-grid","");a.querySelector(".collection-group-form").classList.add("uk-width-expand");g(a.querySelector("span.icon-minus"),"a");g(a.querySelector("span.icon-plus"),"a");g(a.querySelector("span.icon-circle"),"a");c=a.querySelector(".collection-group-button").querySelector(".button-del").innerHTML;
let d=a.querySelector(".collection-group-button").querySelector(".button-add").innerHTML,h=a.querySelector(".collection-group-button").querySelector(".button-drag").innerHTML;a.querySelector(".collection-group-button").classList.add("uk-iconnav","uk-width-auto","uk-padding","uk-padding-remove-right");a.querySelector(".collection-group-button").innerHTML="<div>"+c+"</div><div>"+d+"</div><div>"+h+"</div>";a.querySelector('input[type="file"]')&&(c=document.createElement("input"),c.classList.add("uk-input",
"uk-with-1-1"),c.setAttribute("type","text"),c.setAttribute("placeholder","\u0412\u044b\u0431\u0440\u0430\u0442\u044c"),c.setAttribute("disabled",""),c.setAttribute("aria-label","Custom controls"),a.querySelector('input[type="file"]').after(c),c=a.querySelector('input[type="file"]').parentElement.innerHTML,a.querySelector(".collection-group-form").innerHTML='<div uk-grid><div uk-form-custom="target: true" class="uk-width-expand">'+c+"</div></div>")}b.querySelector(".icon-plus").classList.add("uk-text-success");
b.querySelector(".icon-plus").setAttribute("uk-icon","icon: plus-circle");b.querySelector(".icon-plus").setAttribute("onclick","return false;");b.querySelector(".icon-minus").classList.add("uk-text-danger");b.querySelector(".icon-minus").setAttribute("uk-icon","icon: minus-circle");b.querySelector(".icon-minus").setAttribute("onclick","return false;");b.querySelector(".icon-circle").classList.add("uk-text-primary","ui-sortable-handle","button-drag");b.querySelector(".icon-circle").setAttribute("uk-icon",
"icon: move");b.querySelector(".icon-circle").setAttribute("onclick","return false;");b.querySelector(".icon-circle").setAttribute("style","cursor:grab;");b.classList.add("uk-clearfix");b.classList.add("uk-margin");if(a=b.querySelector(".cck_cgx.cck_cgx_form:not(.uk-width-1-1)"))a.classList.add("uk-width-1-1"),a.querySelectorAll(".cck_forms.cck_site").forEach(d=>{d=d.firstElementChild;d.outerHTML=d.innerHTML});(new Map([["input[type=text]","uk-input"],["select","uk-select"],["textarea","uk-textarea"]])).forEach(function(d,
h){b.querySelectorAll(h).forEach(f=>{f.classList.add(d);f.parentNode&&"DIV"==f.parentNode.nodeName&&f.parentNode.previousElementSibling&&"LABEL"==f.parentNode.previousElementSibling.nodeName&&f.parentNode.classList.add("uk-form-controls")})});b.querySelectorAll("label:not(.uk-form-label)").forEach(d=>{d.classList.add("uk-form-label")})}})).observe(document.documentElement,{childList:!0,subtree:!0,characterDataOldValue:!1})});