praiadeseselle/wire/modules/AdminTheme/AdminThemeUikit/config-field.min.js
2022-03-08 15:55:41 +01:00

1 line
No EOL
3.3 KiB
JavaScript

function updateAdminThemeUikitExample(){var a;a=$("#wrap__adminThemeExample");if(!a.length){a=$("#_adminThemeExample")}var c=a.find("input,select,textarea");a.removeClass("InputfieldIsOffset InputfieldIsOffsetSm InputfieldIsOffsetLg InputfieldNoBorder InputfieldHideBorder uk-card uk-card-default InputfieldIsPrimary InputfieldIsSecondary InputfieldIsHighlight InputfieldIsWarning");var d=$("#wrap_Inputfield_themeInputSize");if(d.length){var b=d.find("input:checked").val();if(b=="s"){c.removeClass("uk-form-large uk-form-medium").addClass("uk-form-small")}else{if(b=="m"){c.removeClass("uk-form-large uk-form-small").addClass("uk-form-medium")}else{if(b=="l"){c.removeClass("uk-form-small uk-form-medium").addClass("uk-form-large")}else{c.removeClass("uk-form-large uk-form-medium uk-form-small")}}}}var d=$("#wrap_Inputfield_themeInputWidth");if(d.length){c.removeClass("uk-form-width-large uk-form-width-medium uk-form-width-small uk-form-width-xsmall");c.removeClass("InputfieldMaxWidth InputfieldSetWidth");var b=d.find("input:checked").val();if(b=="s"){c.addClass("uk-form-width-small")}else{if(b=="xs"){c.addClass("uk-form-width-xsmall")}else{if(b=="m"){c.addClass("uk-form-width-medium")}else{if(b=="l"){c.addClass("uk-form-width-large")}else{if(b=="f"){c.addClass("InputfieldMaxWidth")}}}}}if(b.length&&b!="f"){c.addClass("InputfieldSetWidth")}}var d=$("#Inputfield_themeBlank");if(d.length){if(d.is(":checked")){c.addClass("uk-form-blank")}else{c.removeClass("uk-form-blank")}}var d=$("#wrap_Inputfield_themeOffset");var b=d.find("input:checked").val();if(b=="s"){a.addClass("InputfieldIsOffset InputfieldIsOffsetSm")}else{if(b=="m"){a.addClass("InputfieldIsOffset")}else{if(b=="l"){a.addClass("InputfieldIsOffset InputfieldIsOffsetLg")}}}d=$("#wrap_Inputfield_themeBorder");b=d.find("input:checked").val();if(b=="card"){a.addClass("uk-card uk-card-default")}else{if(b=="none"){a.addClass("InputfieldNoBorder")}else{if(b=="hide"){a.addClass("InputfieldHideBorder")}}}d=$("#wrap_Inputfield_themeColor");b=d.find("input:checked").val();if(b=="primary"){a.addClass("InputfieldIsPrimary")}else{if(b=="secondary"){a.addClass("InputfieldIsSecondary")}else{if(b=="highlight"){a.addClass("InputfieldIsHighlight")}else{if(b=="warning"){a.addClass("InputfieldIsWarning")}}}}}function initAdminThemeUikitColumnWidth(){var c=$("#wrap__adminThemeExample");var a=$("#wrap__adminThemeExample2");if(!c.length){c=$("#_adminThemeExample")}if(!a.length){a=$("#_adminThemeExample2")}var b=$("#columnWidth");var d=$("body").hasClass("AdminThemeUikitNoGrid");b.on("change",function(h){var f=parseInt($(this).val());var i=9;var g=91;if(d){i=0}if(f>i&&f<g){c.attr("data-colwidth",f+"%");c.addClass("InputfieldColumnWidth");a.addClass("InputfieldColumnWidth");if(a.hasClass("InputfieldStateHidden")){a.removeClass("InputfieldStateHidden").show()}a.attr("data-colwidth",(100-f)+"%")}else{c.removeClass("InputfieldColumnWidth").removeAttr("data-colwidth");if(d){c.css("width","100%")}a.removeClass("InputfieldColumnWidth").addClass("InputfieldStateHidden").hide()}c.trigger("showInputfield",[c[0]])});b.change()}$(document).ready(function(){$("#_adminTheme").find("input[type=radio],input[type=checkbox]").change(function(){updateAdminThemeUikitExample()});$("#_adminTheme, #_adminTheme > *").css("background-color","#fff");updateAdminThemeUikitExample();initAdminThemeUikitColumnWidth()});