Skip to content

Commit

Permalink
Fix a couple of UI hiccups.
Browse files Browse the repository at this point in the history
fixes #374
  • Loading branch information
jobisoft committed Aug 30, 2023
1 parent e44dbb0 commit 90655ab
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 79 deletions.
23 changes: 11 additions & 12 deletions chrome/content/modules/wzQuicktextGroup.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@ var EXPORTED_SYMBOLS = ["wzQuicktextGroup"];

const kDebug = true;

function wzQuicktextGroup() {
this.mName = "";
this.mType = "";
}
class wzQuicktextGroup {
constructor() {
this.mName = "";
this.mType = "";
}

wzQuicktextGroup.prototype = {
get name() { return this.mName; },
get name() { return this.mName; }
set name(aName) { if (typeof aName != 'undefined') return this.mName = aName; }
,
get type() { return this.mType; },

get type() { return this.mType; }
set type(aType) { if (typeof aType != 'undefined') return this.mType = aType; }
,
clone: function()
{
var newGroup = new wzQuicktextGroup();

clone() {
let newGroup = new wzQuicktextGroup();
newGroup.name = this.mName;
newGroup.type = this.mType;

Expand Down
33 changes: 6 additions & 27 deletions chrome/content/quicktext.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,27 +119,14 @@ var quicktext = {
this.mKeywords = {};

// Update the toolbar
var toolbar = document.getElementById("quicktext-toolbar");
var toolbar = document.getElementById("quicktext-templates-toolbar");
if (toolbar != null)
{

//clear toolbar and store current "variables" and "other" menus (the two rightmost ones)
var toolbarbuttonVar = null;
var toolbarbuttonOther = null;
// Clear template toolbar.
var length = toolbar.children.length;
for(var i = length-1; i >= 0; i--)
{
var element = toolbar.children[i];
switch(element.getAttribute("id"))
{
case 'quicktext-variables':
toolbarbuttonVar = element.cloneNode(true);
break;
case 'quicktext-other':
toolbarbuttonOther = element.cloneNode(true);
break;
}
toolbar.removeChild(element);
for(var i = length-1; i >= 0; i--) {
toolbar.removeChild(toolbar.children[i]);
}

//rebuild template groups (the leftmost entries)
Expand Down Expand Up @@ -211,16 +198,8 @@ var quicktext = {
}
}

//add a flex spacer to push the VAR and OTHER elements to the right
var spacer = document.createXULElement("spacer");
spacer.setAttribute("flex", "1");
toolbar.appendChild(spacer);
toolbar.appendChild(toolbarbuttonVar);
toolbar.appendChild(toolbarbuttonOther);


// Update the toolbar inside the toolbarpalette and the drop-down menu - if used
let optionalUI = ["button-quicktext", "quicktext-popup"];
// Update the template menu inside the context menu - if used.
let optionalUI = ["quicktext-popup"];
for (let a=0; a < optionalUI.length; a++) {
if (document.getElementById(optionalUI[a] + "-menupopup")) {
let rootElement = document.getElementById(optionalUI[a] + "-menupopup");
Expand Down
32 changes: 20 additions & 12 deletions chrome/content/scripts/messengercompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,28 @@ function onLoad(activatedWhileWindowOpen) {

WL.injectCSS("resource://quicktext/skin/quicktext.css");
WL.injectElements(`
<popup id="msgComposeContext">
<menuseparator id="quicktext-popupsep" hidden="true" insertafter="spellCheckSuggestionsSeparator"/>
<menu id="quicktext-popup" label="&quicktext.label;" hidden="true" insertafter="spellCheckSuggestionsSeparator" class="menu-iconic quicktext-icon menuitem-iconic" >
<menupopup id="quicktext-popup-menupopup"/>
</menu>
</popup>
<popup id="msgComposeContext">
<menuseparator id="quicktext-popupsep" hidden="true" insertafter="spellCheckSuggestionsSeparator" />
<menu id="quicktext-popup" label="&quicktext.label;" hidden="true" insertafter="spellCheckSuggestionsSeparator"
class="menu-iconic quicktext-icon menuitem-iconic">
<menupopup id="quicktext-popup-menupopup" />
</menu>
</popup>
<menupopup id="menu_View_Popup">
<menuitem id="quicktext-view" type="checkbox" label="&quicktext.label;" oncommand="quicktext.toogleToolbar();"/>
<menuitem id="quicktext-view" type="checkbox" label="&quicktext.label;" oncommand="quicktext.toogleToolbar();" />
</menupopup>
<menupopup id="taskPopup">
<menuitem id="quicktext-settings" label="&quicktext.label;" oncommand="quicktext.openSettings();" insertafter="tasksMenuAddressBook" class="menu-iconic quicktext-icon menuitem-iconic" />
<menuitem id="quicktext-settings" label="&quicktext.label;" oncommand="quicktext.openSettings();"
insertafter="tasksMenuAddressBook" class="menu-iconic quicktext-icon menuitem-iconic" />
<menuseparator insertafter="tasksMenuAddressBook" />
</menupopup>
<toolbar id="quicktext-toolbar" insertbefore="messageEditor">
<hbox id="quicktext-toolbar" insertbefore="messageEditor">
<html:div id="quicktext-templates-toolbar" />
<spacer flex="1" />
<hbox>
<button type="menu" id="quicktext-variables" label="&quicktext.variables.label;" tabindex="-1">
<menupopup>
<menu label="&quicktext.to.label;">
Expand All @@ -39,7 +44,8 @@ function onLoad(activatedWhileWindowOpen) {
<menuitem label="&quicktext.email.label;" oncommand="quicktext.insertVariable('TO=email');" />
<menuitem label="&quicktext.worknumber.label;" oncommand="quicktext.insertVariable('TO=workphone');" />
<menuitem label="&quicktext.faxnumber.label;" oncommand="quicktext.insertVariable('TO=faxnumber');" />
<menuitem label="&quicktext.cellularnumber.label;" oncommand="quicktext.insertVariable('TO=cellularnumber');" />
<menuitem label="&quicktext.cellularnumber.label;"
oncommand="quicktext.insertVariable('TO=cellularnumber');" />
<menuitem label="&quicktext.jobtitle.label;" oncommand="quicktext.insertVariable('TO=jobtitle');" />
<menuitem label="&quicktext.custom1.label;" oncommand="quicktext.insertVariable('TO=custom1');" />
<menuitem label="&quicktext.custom2.label;" oncommand="quicktext.insertVariable('TO=custom2');" />
Expand All @@ -57,7 +63,8 @@ function onLoad(activatedWhileWindowOpen) {
<menuitem label="&quicktext.email.label;" oncommand="quicktext.insertVariable('FROM=email');" />
<menuitem label="&quicktext.worknumber.label;" oncommand="quicktext.insertVariable('FROM=workphone');" />
<menuitem label="&quicktext.faxnumber.label;" oncommand="quicktext.insertVariable('FROM=faxnumber');" />
<menuitem label="&quicktext.cellularnumber.label;" oncommand="quicktext.insertVariable('FROM=cellularnumber');" />
<menuitem label="&quicktext.cellularnumber.label;"
oncommand="quicktext.insertVariable('FROM=cellularnumber');" />
<menuitem label="&quicktext.jobtitle.label;" oncommand="quicktext.insertVariable('FROM=jobtitle');" />
<menuitem label="&quicktext.custom1.label;" oncommand="quicktext.insertVariable('FROM=custom1');" />
<menuitem label="&quicktext.custom2.label;" oncommand="quicktext.insertVariable('FROM=custom2');" />
Expand Down Expand Up @@ -96,7 +103,8 @@ function onLoad(activatedWhileWindowOpen) {
<menuitem label="&quicktext.insertTextFromFileAsHTML.label;" oncommand="quicktext.insertContentFromFile(1);" />
</menupopup>
</button>
</toolbar>`,
</hbox>
</hbox>`,
["chrome://quicktext/locale/quicktext.dtd"]);

window.quicktext.load();
Expand Down
Binary file removed chrome/skin/button.large.png
Binary file not shown.
Binary file removed chrome/skin/button.small.png
Binary file not shown.
Binary file removed chrome/skin/logo.png
Binary file not shown.
29 changes: 1 addition & 28 deletions chrome/skin/quicktext.css
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
#button-quicktext {
list-style-image: url("resource://quicktext/skin/button.large.png");
-moz-image-region: rect(0px 24px 24px 0px);
}

#button-quicktext:hover {
-moz-image-region: rect(24px 24px 48px 0px);
}

#button-quicktext[disabled] {
-moz-image-region: rect(48px 24px 72px 0px);
}

toolbar[iconsize="small"] #button-quicktext {
list-style-image: url("resource://quicktext/skin/button.small.png");
-moz-image-region: rect(0px 16px 16px 0px);
}

toolbar[iconsize="small"] #button-quicktext:hover {
-moz-image-region: rect(16px 16px 32px 0px);
}

toolbar[iconsize="small"] #button-quicktext[disabled] {
-moz-image-region: rect(32px 16px 48px 0px);
}

.quicktext-icon {
list-style-image: url("resource://quicktext/skin/button.small.png");
-moz-image-region: rect(16px 16px 32px 0px);
list-style-image: url("resource://quicktext/skin/icon16.png");
}

dialog[OS=WINNT] legend.insideTab {
Expand Down

0 comments on commit 90655ab

Please sign in to comment.