瀏覽代碼

added reset color button to custom colors

CauseFX 4 年之前
父節點
當前提交
6ce53bcf1a
共有 2 個文件被更改,包括 10 次插入1 次删除
  1. 3 1
      api/classes/organizr.class.php
  2. 7 0
      js/functions.js

+ 3 - 1
api/classes/organizr.class.php

@@ -1899,7 +1899,7 @@ class Organizr
 				array(
 					'type' => 'html',
 					'override' => 12,
-					'label' => 'Custom CSS [Can replace colors from above]',
+					'label' => '',
 					'html' => '
 					<div class="row">
 						<div class="col-lg-12">
@@ -1922,6 +1922,8 @@ class Organizr
 					'type' => 'blank',
 					'label' => ''
 				),
+				$this->settingsOption('button', '', ['label' => 'Reset Colors', 'icon' => 'fa fa-ticket', 'text' => 'Reset', 'attr' => 'onclick="resetCustomColors()"']),
+				$this->settingsOption('blank'),
 				array(
 					'type' => 'input',
 					'name' => 'headerColor',

+ 7 - 0
js/functions.js

@@ -4719,6 +4719,13 @@ function loadAppearance(appearance){
         $('#custom-css').html(appearance.customCss);
     }
 }
+function resetCustomColors(){
+	let colors = ['headerColor','headerTextColor','sidebarColor','sidebarTextColor','accentColor','accentTextColor','buttonColor','buttonTextColor'];
+	$.each(colors, function(i,v) {
+		$('#customize-appearance-form [name='+v+']').val('').trigger('change');
+	});
+	messageSingle(window.lang.translate('Colors Reverted'),window.lang.translate('Please Save'),activeInfo.settings.notifications.position,'#FFF','success','10000');
+}
 function randomCSV(values){
     if(typeof values == 'string'){
         if(values.includes(',')){