Skip to content

Commit e1e4f53

Browse files
committed
doHighlightStyle cleanup
1 parent 2fadb98 commit e1e4f53

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

chrome/content/preferences.xul

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -613,60 +613,60 @@
613613
<tab label="&highlight.tab7.label;" value="Selected" observes="b.highlightSelected"/>
614614
</tabs>
615615
<tabpanels>
616-
<tabpanel orient="vertical">
616+
<tabpanel orient="vertical" oncommand="doHighlightStyle();"
617+
oninput="doHighlightStyle();"
618+
onchange="doHighlightStyle();">
617619
<checkbox id="c.highlightEnabled" label="&highlightEnabled.label;"/>
618620
<separator class="groove"/>
619621
<hbox>
620-
<checkbox id="c.highlightBold" label="&highlightBold.label;" style="font-weight: bold;" observes="b.highlightEnabled"
621-
oncommand="doHighlightStyle();"/>
622-
<checkbox id="c.highlightItalic" label="&highlightItalic.label;" style="font-style: italic;" observes="b.highlightEnabled"
623-
oncommand="doHighlightStyle();"/>
622+
<checkbox id="c.highlightBold" label="&highlightBold.label;" style="font-weight: bold;" observes="b.highlightEnabled"/>
623+
<checkbox id="c.highlightItalic" label="&highlightItalic.label;" style="font-style: italic;" observes="b.highlightEnabled"/>
624624
<checkbox id="c.highlightUnderline" label="&highlightUnderline.label;" style="text-decoration: underline;" observes="b.highlightEnabled"
625-
oncommand="if (this.checked) this.nextSibling.checked = false;doHighlightStyle();"/>
625+
oncommand="if (this.checked) this.nextSibling.checked = false;"/>
626626
<checkbox id="c.highlightStrikethrough" label="&highlightStrikethrough.label;" style="text-decoration: line-through;" observes="b.highlightEnabled"
627-
oncommand="if (this.checked) this.previousSibling.checked = false;doHighlightStyle();"/>
627+
oncommand="if (this.checked) this.previousSibling.checked = false;"/>
628628
</hbox>
629629
<grid>
630630
<rows>
631631
<row align="center">
632-
<checkbox id="c.highlightColor" label="&highlightColor.label;" oncommand="doHighlightStyle();">
632+
<checkbox id="c.highlightColor" label="&highlightColor.label;">
633633
<observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightColor();"/>
634634
</checkbox>
635-
<textbox id="c.highlightColorCode" observes="b.highlightColor" oninput="doHighlightStyle();"/>
635+
<textbox id="c.highlightColorCode" observes="b.highlightColor"/>
636636
<colorpicker id="c.highlightColorPicker" type="button"
637-
onchange="this.previousSibling.value = this.color;doHighlightStyle();"
637+
onchange="this.previousSibling.value = this.color;"
638638
onbroadcast="this.style.opacity = this.disabled ? 0.3 : 1;">
639639
<observes element="b.highlightColor" attribute="disabled"/>
640640
</colorpicker>
641641
</row>
642642
<row align="center">
643-
<checkbox id="c.highlightBgColor" label="&highlightBgColor.label;" oncommand="doHighlightStyle();">
643+
<checkbox id="c.highlightBgColor" label="&highlightBgColor.label;">
644644
<observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightBgColor();"/>
645645
</checkbox>
646-
<textbox id="c.highlightBgColorCode" observes="b.highlightBgColor" oninput="doHighlightStyle();"/>
646+
<textbox id="c.highlightBgColorCode" observes="b.highlightBgColor"/>
647647
<colorpicker id="c.highlightBgColorPicker" type="button"
648-
onchange="this.previousSibling.value = this.color;doHighlightStyle();"
648+
onchange="this.previousSibling.value = this.color;"
649649
onbroadcast="this.style.opacity = this.disabled ? 0.3 : 1;">
650650
<observes element="b.highlightBgColor" attribute="disabled"/>
651651
</colorpicker>
652652
</row>
653653
<row align="center">
654-
<checkbox id="c.highlightOutline" label="&highlightOutline.label;" oncommand="doHighlightStyle();">
654+
<checkbox id="c.highlightOutline" label="&highlightOutline.label;">
655655
<observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightOutline();"/>
656656
</checkbox>
657-
<textbox id="c.highlightOutlineColorCode" observes="b.highlightOutline" oninput="doHighlightStyle();"/>
657+
<textbox id="c.highlightOutlineColorCode" observes="b.highlightOutline"/>
658658
<colorpicker id="c.highlightOutlineColorPicker" type="button"
659-
onchange="this.previousSibling.value = this.color;doHighlightStyle();"
659+
onchange="this.previousSibling.value = this.color;"
660660
onbroadcast="this.style.opacity = this.disabled ? 0.3 : 1;">
661661
<observes element="b.highlightOutline" attribute="disabled"/>
662662
</colorpicker>
663663
</row>
664664
<row align="center">
665-
<checkbox id="c.highlightOpacity" label="Opacity:" oncommand="doHighlightStyle();">
665+
<checkbox id="c.highlightOpacity" label="Opacity:">
666666
<observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightOpacity();"/>
667667
</checkbox>
668668
<textbox id="c.highlightOpacityCode" type="number" min="0" max="100" increment="10" size="3" maxlength="3"
669-
observes="b.highlightOpacity" oninput="doHighlightStyle();" onchange="doHighlightStyle();"/>
669+
observes="b.highlightOpacity"/>
670670
</row>
671671
</rows>
672672
</grid>
@@ -1246,7 +1246,7 @@
12461246
$("c.highlightOutlineColorCode").value = style.outlineColorCode;
12471247
$("c.highlightOutlineColorPicker").color = style.outlineColorCode;
12481248
$("c.highlightOpacity").checked = style.opacity;
1249-
$("c.highlightOpacityCode").value = style.opacityCode * 100;
1249+
$("c.highlightOpacityCode").value = ("opacityCode" in style ? style.opacityCode : 1) * 100;
12501250
12511251
onHighlightColor();
12521252
onHighlightBgColor();
@@ -1271,6 +1271,11 @@
12711271
opacityCode: $("c.highlightOpacityCode").value / 100
12721272
};
12731273
1274+
for (let prop in style) {
1275+
if (style[prop] === false || style[prop] === "undefined" || style[prop] === 1)
1276+
delete style[prop];
1277+
}
1278+
12741279
$("style" + $("highlight").selectedItem.value).value = JSON.stringify(style);
12751280
}
12761281

0 commit comments

Comments
 (0)