CSS Plus
1.0
Why store color-information on two places within YaBB ?!
When this mod is installed, you only have to change the standard Yabb-colors in the Template.html. For non-CSS browers, the needed colors are read from the Template.html !
The colors are still shown in the 'Forum Preferences and Settings', but can not longer be changed there.
IMPORTANT:
Within the CSS-tag of the Template.html, the following classes have to be defined (these are YaBB-standard):
.windowbg
.windowbg2
.windowbg3
.titlebg
.text1
.catbg
.bordercolor
D2N
YaBB.pl
### Log this click ###
&ClickLog;
# --- Added for CSS Plus 1.0 --- #
# Get non-CSS Colors from Template
&GetColors;
# --- Added for CSS Plus 1.0 --- #
}
#END SUB YYMAIN
# --- Added for CSS Plus 1.0 --- #
sub GetColors {
# Read Template
fopen(FILE, "$boarddir/template.html");
@template = ;
fclose (FILE);
foreach $line (@template) {
chomp($line);
if (index($line, ".titlebg") != -1) { &GetColor("bgcolor", $line); $color{'titlebg'} = $Template_Color; }
if (index($line, ".text1") != -1) { &GetColor("color", $line); $color{'titletext'} = $Template_Color; }
if (index($line, ".windowbg") != -1 && index($line, ".windowbg2") == -1 && index($line, ".windowbg3") == -1) { &GetColor("bgcolor", $line); $color{'windowbg'} = $Template_Color; }
if (index($line, ".windowbg2") != -1) { &GetColor("bgcolor", $line); $color{'windowbg2'} = $Template_Color; }
if (index($line, ".windowbg3") != -1) { &GetColor("bgcolor", $line); $color{'windowbg3'} = $Template_Color; }
if (index($line, ".catbg") != -1) { &GetColor("bgcolor", $line); $color{'catbg'} = $Template_Color; }
if (index($line, ".bordercolor") != -1) { &GetColor("bgcolor", $line); $color{'bordercolor'} = $Template_Color; }
}
}
sub GetColor {
# Get parameters
local($type, $line) = @_;
$Template_Color = "";
$counter = 0;
$char = substr($line, $counter, 1);
# Search for image-source(s)
while ($counter <= length($line)) {
# Color found !!
if ($type eq "color" && substr($line, $counter-6, 7) eq "color: ") {
$Template_Color = substr($line, $counter+1, 7);
last;
}
# Color found !!
elsif ($type eq "bgcolor" && substr($line, $counter-17, 18) eq "background-color: ") {
$Template_Color = substr($line, $counter+1, 7);
last;
}
++$counter;
}
return($Template_Color);
}
# --- /Added for CSS Plus 1.0 --- #
Sources/Admin.pl
$txt{'365'}
$txt{'366'}
$txt{'367'}
$txt{'368'}
$txt{'640'}
$txt{'369'}
$txt{'370'}
$txt{'365'}
$color{'titlebg'}
$txt{'366'}
$color{'titletext'}
$txt{'367'}
$color{'windowbg'}
$txt{'368'}
$color{'windowbg2'}
$txt{'640'}
$color{'windowbg3'}
$txt{'369'}
$color{'catbg'}
$txt{'370'}
$color{'bordercolor'}
$color{'titletext'} = $FORM{'titletext'} || '#000000';
$color{'windowbg'} = $FORM{'windowbg'} || '#272A2F';
$color{'windowbg2'} = $FORM{'windowbg2'} || '#444444';
$color{'windowbg3'} = $FORM{'windowbg3'} || '#FFB903';
$color{'catbg'} = $FORM{'catbg'} || '#40454C';
$color{'bordercolor'} = $FORM{'bordercolor'} || '#000000';
# --- Deleted for CSS Plus 1.0 --- #
# $color{'titletext'} = $FORM{'titletext'} || '#000000';
# $color{'windowbg'} = $FORM{'windowbg'} || '#272A2F';
# $color{'windowbg2'} = $FORM{'windowbg2'} || '#444444';
# $color{'windowbg3'} = $FORM{'windowbg3'} || '#FFB903';
# $color{'catbg'} = $FORM{'catbg'} || '#40454C';
# $color{'bordercolor'} = $FORM{'bordercolor'} || '#000000';
# --- /Deleted for CSS Plus 1.0 --- #
\$color{'titlebg'} = "$color{'titlebg'}"; # Background color of the 'title-bar'
\$color{'titletext'} = "$color{'titletext'}"; # Color of text in the 'title-bar' (above each 'window')
\$color{'windowbg'} = "$color{'windowbg'}"; # Background color for messages/forms etc.
\$color{'windowbg2'} = "$color{'windowbg2'}"; # Background color for messages/forms etc.
\$color{'windowbg3'} = "$color{'windowbg3'}"; # Color of horizontal rules in posts
\$color{'catbg'} = "$color{'catbg'}"; # Background color for category (at Board Index)
\$color{'bordercolor'} = "$color{'bordercolor'}"; # Table Border color for some tables
# --- Deleted for CSS Plus 1.0 --- #
#\$color{'titlebg'} = "$color{'titlebg'}"; # Background color of the 'title-bar'
#\$color{'titletext'} = "$color{'titletext'}"; # Color of text in the 'title-bar' (above each 'window')
#\$color{'windowbg'} = "$color{'windowbg'}"; # Background color for messages/forms etc.
#\$color{'windowbg2'} = "$color{'windowbg2'}"; # Background color for messages/forms etc.
#\$color{'windowbg3'} = "$color{'windowbg3'}"; # Color of horizontal rules in posts
#\$color{'catbg'} = "$color{'catbg'}"; # Background color for category (at Board Index)
#\$color{'bordercolor'} = "$color{'bordercolor'}"; # Table Border color for some tables
# --- Deleted for CSS Plus 1.0 --- #