How to make Firefox extension auto install in nav bar? - firefox

I'm working on a Firefox extension. I'd like to make it auto-install in the far right position on the nav bar when a user installs it. As it stands, a user has to go to View > Toolbars > Customize... and drag the extension to the nav bar once it's installed. I'd like to eliminate this step.
The extension is here: http://madan.org/tickertool
The XUL for my extension looks basically like this and it overlays browser.xul:
<overlay id="my-ext-overlay" ... >
<toolbarpalette id="BrowserToolbarPalette">
<toolbaritem id="my-ext-container" ... >
<toolbarbutton id="my-ext-customize-image" ... />
<textbox id="my-ext-textbox" ... />
<hbox id="my-ext-buttons">
<image id="my-ext-button1" ... />
<image id="my-ext-button2" ... />
<image id="my-ext-button3" ... />
</hbox>
</toolbaritem>
</toolbarpalette>
</overlay>
I've seen code here ( https://developer.mozilla.org/en/Code_snippets/Toolbar ) that supposedly does what I'm looking for, but this code is if your extension is just a single button and I can't get it to work for me. The answer to my question is likely some modification of this code, but I haven't figured it out.

I think I got it. It's basically spelled out in the link I mentioned in the original post. I'm not sure why I thought there was more to it than that.

Related

Change ToolbarItem Text/Icon parameters

I am new to MAUI. And I haven't done anything complex with Xamarin as well.
The application I am testing with, has Shell navigation. And I can't find a way to change the toolbar items.
I would like to be able to change either the FontSize of the text, or the color of the SVG image. And I do not want those changes to affect the rest of my application, if possible. But if there is no other way, I can live with it.
I have managed to add styling to buttons, Labels etc... If styling is an option to this, it will be even better.
If I am on the wrong path, if you point me out why, I will be also grateful.
Thank you in advance!
If you want to just change a part of pages in your project. You can try to use a <Shell.TitleView> instead of the <Shell.ToolBarItem> in the content pages you want. Such as:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiAppTest.MainPage">
<Shell.TitleView>
<HorizontalStackLayout Margin="5" HorizontalOptions="End">
<Label Text="hello" TextColor="Red" FontSize="Medium" VerticalOptions="Center" HorizontalOptions="End" />
<Image Source="your image" Margin="10" Background="green"/>
</HorizontalStackLayout>
</Shell.TitleView>
You can change style of TabBar in Style.xaml in path \Resources\Style\. Search in file for Shell.TabBarForegroundColor. You will get TargetType="Shell" and this is style for AppShell.xaml.

Can Nativescript 4.0 new Frame use more elements than Tabview or Sidedrawer?

I see that Frame works now much better.
We can have Tabview,that is a root of current view.
<TabView androidTabsPosition="bottom">
<TabViewItem title="First">
<Frame defaultPage="home/home-page" />
</TabViewItem>
<TabViewItem title="Second">
<Frame defaultPage="second/second-page" />
</TabViewItem>
</TabView>
This looks like home-page or second-page is “included”.
Now, i’m wondering if it’s possible to have app-root.xml that holds common elements, and needed page is included. I’ve tried this, but this is not working (why? This approach is possible only for tabview and sidedrawer ?)
app-root.xml
<Page>
<Frame defaultPage="create/create"></Frame>
</Page>
create/create.xml
<StackLayout class="footer white">
<Label text="test"></Label>
</StackLayout>
Instead of Page use layout like GridLayout Look at this test application as a reference and more specifically this page
However, the above approach would work for Android but for iOS, you should either remove the action bar for each Page (inside each Frame) or create multiple action bars (not recommended!).

Nativescript tab layout approach

I am trying to create an app with NativeScript with the following layout:
On top, action bar
Content Area in the center (about 80% of screen height)
Fixed menu on bottom with 4 buttons
I know that NativeScript provides a TabView, however this view puts the menu on top for the android version of the app,and doesn't allow to use images as "ItemTitle".
So (I think) this leaves me with two options :
Create 4 different pages and load them when a user taps on the menu
buttons
Create one single page and change content according to user
selection
The first approach is great because I get to separate all xml , js and css files. However navigating between pages can take some time and doesn't give ideal user experience.
The second approach probably will have a better user experience but code will be very hard to maintain.
Which option should I use? Have any of you dealt with a similar layout?
Thank you for your time!
In my app I use the TabView with partial-views in each tab-item. So for each tab-view the content is separated in their own xml,js,css files.
So why not just take this approach and combine it with your option 2?
You could create a main-view with:
ActionBar
Centered main-content for partial-views (Stack- og GridLayout)
SegmentedBar at the bottom for navigation buttons
When the user taps a button on the SegmentedBar, you change the visibility of the corresponding partial-view.
You can use any font-icons as "images" for your title in the SegmentedBar also.
UPDATE: Added examples below.
How to create and reference partial-views
In your main-view Page-element add the references to each partial view, like here:
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded"
xmlns:t1="partial-views/tab1"
xmlns:t2="partial-views/tab2"
xmlns:t3="partial-views/tab3">
Each partial view consists of a .xml, .js and perhaps a .css file. I like to place each partial view in separate folders: tab1, tab2, tab3 as an example.
The partial-view xml file would contain only the view-modules, no page-modules. So don't add any Page or ActionBar here. Example of a partial view .xml:
<GridLayout loaded="viewLoaded">
<ListView items="{{ someItemList }}">
<ListView.itemTemplate>
...
</ListView.itemTemplate>
</ListView>
</GridLayout>
How to use partial-views
Now, it's up to you how you want to use the partial-views. Here is an example on how to use them together with a TabView component. This is placed in the same page-view where you added the references from the first example.
<TabView>
<TabView.items>
<TabViewItem title="Tab 1" iconSource="res://tab1">
<TabViewItem.view>
<t1:tab1 />
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="Tab 2" iconSource="res://tab2" >
<TabViewItem.view>
<t2:tab2 />
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="Tab 3" iconSource="res://tab3" >
<TabViewItem.view>
<t3:tab3 />
</TabViewItem.view>
</TabViewItem>
</TabView.items>
</TabView>
Or, you could do it without the TabView, and create something custom:
<StackLayout>
<t1:tab1 id="tab1" visibility="visible" />
<t2:tab2 id="tab2" visibility="collapsed" />
<t3:tab3 id="tab3" visibility="collapsed" />
</StackLayout>
<SegmentedBar selectedIndex="0" selectedIndexChanged="segBarSelected">
<SegmentedBar.items>
<SegmentedBarItem title="Tab 1" />
<SegmentedBarItem title="Tab 2" />
<SegmentedBarItem title="Tab 3" />
</SegmentedBar.items>
</SegmentedBar>
So here would selectedIndexChangedcontrol the visibility of each partial view.

Removing underline from hyperlink in Windows Store app

I'm creating a universal Windows Runtime App for Windows Phone 8.1 and Windows 8.1 using Xaml and C#.
I have inline hyperlinks setup as so -
<TextBlock Width="400" TextWrapping="Wrap">
<Span FontSize="20">
This is an example of how Hyperlink can be used in a paragraph of text. It might be helpful for you look to
<Hyperlink NavigateUri="http://www.bing.com">bing</Hyperlink>
for more answers in the future.
</Span>
</TextBlock>
This will display the text with a underline indicating the clickable hyperlink. However I want to indicate hyperlinks by color not underline as I can have multiple of them in a TextBlock.
I want to remove the underline from the inline Hyperlinks - TextDecorations property no longer exists in WP 8.1 and Windows 8.1 Store apps.
Note* I'm using Hyperlink element not HyperlinkButton as I need to have the links inline with text.
I would write a comment, but my reputation is not enough to do that.
I tried the same code on a blank both win 8.1 and win phone 8.1 project. However, the hyperlink is displayed with color by default, not with an underline as opposed to your project. My code is like below
<TextBlock Width="400" TextWrapping="Wrap">
<Span FontSize="20">
This is an example of how Hyperlink can be used in a paragraph of text. It might be helpful for you look to
<Hyperlink NavigateUri="http://www.bing.com" Foreground="#FF0007FF">bing</Hyperlink>
for more answers in the future.
</Span>
</TextBlock>
Could you try the Foreground property? Maybe it helps you.
In the final version of Windows 8.1 the Hyperlink-element doesn't have an underline. Maybe the confusion was caused by the focus border around the hyperlink? So the XAML:
<TextBlock Width="400" TextWrapping="Wrap" VerticalAlignment="Center">
<Span FontSize="20">
This is an example of how Hyperlink can be used in a paragraph of text. It might be helpful for you look to
<Hyperlink NavigateUri="http://www.bing.com">bing</Hyperlink>
for more answers in the future.
</Span>
</TextBlock>
Shows as:
One thing that can trick the viewer is that if the page doesn't have any other focusable items, the Hyperlink gets the focus and a border is drawn around it. This may look like it has underline:
If you want to get rid of that, add Button with Opacity 0 to the top of the page.
If you want to style the Hyperlink, you can overwrite it using the following keys:
<SolidColorBrush x:Key="HyperlinkDisabledThemeBrush" Color="#66000000" />
<SolidColorBrush x:Key="HyperlinkForegroundThemeBrush" Color="#FF4F1ACB" />
<SolidColorBrush x:Key="HyperlinkPointerOverForegroundThemeBrush" Color="#CC4F1ACB" />
<SolidColorBrush x:Key="HyperlinkPressedForegroundThemeBrush" Color="#994F1ACB" />
So if you have the following App.xaml.cs:
<Application.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="HyperlinkForegroundThemeBrush" Color="Green" />
</ResourceDictionary>
</Application.Resources>
You will get a green Hyperlink:
If you want the link to have underline, you can use the Underline-element. The XAML:
<TextBlock Width="400" TextWrapping="Wrap" VerticalAlignment="Center">
<Span FontSize="20">
This is an example of how Hyperlink can be used in a paragraph of text. It might be helpful for you look to
<Hyperlink NavigateUri="http://www.bing.com"><Underline>bing</Underline></Hyperlink>
for more answers in the future.
</Span>
</TextBlock>
And the result:
In my app I'm using
<Hyperlink TextDecorations="None" ...></Hyperlink>
to get rid of the underline.

How do I get a usemap working within a firefox XUL document

In my XUL I have the following code fragments:
<map name="KeypadMap">
<area href="javascript:pad('A')" coords="1,1,31,31" shape="rect"/>
</map>
...
<hbox flex="1">
<image src="./keypad.png" width="32" height="32" useMap="#KeypadMap"/>
</hbox>
The image displays just fine, however, when I mouse over, the cursor does not change to a hand, and clicking does not call the pad function.
Similar code works fine in straight HTML, so there must be some trick to get it working via a Firefox XUL file.
You'll have to use a namespace to embed HTML inside of XUL. Check this guide.

Resources