Firefox Extension Development: Adding Tabs to the Preference Pane? - firefox-addon

I'm adding this:
<prefwindow id="BrowserPreferences">
<!-- Create a new pane (tab) -->
<prefpane id="whateverPrefs" label="yes!"
onpaneload="alert('hey')"
image="chrome://helloworld/content/images/man.png">
<!-- Intermediary between GUI and preferences system -->
<preferences>
<!-- see the next section for more information -->
</preferences>
<!-- GUI Elements... -->
</prefpane>
</prefwindow>
to my overlay.xul. It doesn't work whatsoever, though it is suggested here. I do have wonderful success with this code, though:
<menupopup id="menu_ToolsPopup">
<menuitem id="helloworld-hello2" label="frigger!"
oncommand="HelloWorld.onMenuItemCommand(event);"/>
</menupopup>
Is this a version problem (e.g., Firefox 3.x will not do it)? I am unable to find the string BrowserPreferences in browser.xul, which seems to be part of the problem. How can I add tabs to the preference pane in Firefox?
[Sorry if this question is really simple, but searching for help on Firefox Extensions is like searching for help on the word "is."]

I don't think your code is wrong, but it should be overlaying preferences.xul not browser.xul - I'm guessing your overlay is registering with browser.xul and that's why your menu item works fine.
Check the section 'Register an Overlay' about half way down the MDC article Building an Extension

Related

ViewportSize in .runsettings?

I'm using NUnit and would like to start the browser in a custom size ViewportSize, I know that it is possible through overriding the ContextOptions() method, however I was wondering if this were to be possible by .runsettings also.
I've tried to add it below by going with the browser options documentation, but to be frank i can't really find a clear list on what is and isn't allowed within the .runsettings in regards to playwright or environment variables for playwright. Could anyone shed more light on this?
Code below is from the playwright documentation page.
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- NUnit adapter -->
<NUnit>
<NumberOfTestWorkers>24</NumberOfTestWorkers>
</NUnit>
<!-- General run configuration -->
<RunConfiguration>
<EnvironmentVariables>
<!-- For debugging selectors, it's recommend
to set the following environment variable -->
<DEBUG>pw:api</DEBUG>
</EnvironmentVariables>
</RunConfiguration>
<!-- Playwright -->
<Playwright>
<BrowserName>chromium</BrowserName>
<ExpectTimeout>5000</ExpectTimeout>
<LaunchOptions>
<Headless>false</Headless>
<Channel>chrome</Channel>
<!-- I tried it here -->
<ViewportSize>
<Width>2048</Width>
<Height>1080</Height>
</ViewportSize>
</LaunchOptions>
</Playwright>
</RunSettings>

FontAwesome icons in Xamarin.IOS not showing up

I have looked at and tried the first Ten examples of how to accomplish this on google and none of them work. I was able to only get one FontAwesome icon to work and that was the glyph five icon and it still wont work. Has anyone here been able to get this to work recently and if not, are there any alternatives to FontAwesome? I dont realy want to use images because the scale doesnt look right when going from an iPhone 5 to an ipad pro.
I was struggling with this issue. Fortunately, I got the right result at last. Please follow the checklist below:
Make sure your icon exists in the font files. Some icons are only available in Solid font. Check it on the FontAwesome web site. Also, you can try to set the FontAttribute of the Label as "Bold".
Place the font files in the Resources folder, such as Resources\Font Awesome 5 Free-Solid-900.otf. Then add the section below into the info.plist:
<key>UIAppFonts</key>
<array>
<string>Font Awesome 5 Brands-Regular-400.otf</string>
<string>Font Awesome 5 Free-Regular-400.otf</string>
<string>Font Awesome 5 Free-Solid-900.otf</string>
</array>
Make sure you select the right font name, not the file name. You can define a style as shown below:
<OnPlatform x:Key="FontAwesomeString" x:TypeArguments="x:String">
<On Platform="iOS" Value="Font Awesome 5 Free" />
<On Platform="Android" Value="Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free Solid" />
<On Platform="UWP" Value="Assets/fonts/Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free" />
So you can use the style like this:
<Label Text="{Binding Icon}" FontAttributes="Bold"
Style="{StaticResource FontAwesome}" />
If you use it in XAML, use it like: Text="" Use &#x before the font code.
If you use it in C# code, use it like: Text="\uf015"; Use \uf before the font code.
No need to "Copy to Output Directory". Just set the BuildAction as BundleResource.
Hope it would be helpful.

Adding configuration options to a basic JIRA gadget

This line in the Atlassian documentation leads me to believe that simply including a UserPref element should be sufficient to automatically generate the UI for updating the configuration of a gadget:
The container handles generation of the configuration UI, saves the settings and provides an API to access the settings in JavaScript.
But it doesn't seem to actually work when I create a test gadget with the following - I don't see any options when I click the "Edit" link on the gadget:
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs
title="Test"
author="Test Test"
author_email="test#example.com"
directory_title="JIRA Tests"
>
<Require feature="setprefs" />
</ModulePrefs>
<UserPref name="show_summ" display_name="Show Summaries?" datatype="bool" default_value="true"/>
<Content type="html">
<![CDATA[
<div id="main">Test Stuff</div>
]]>
</Content>
</Module>
Is there more to do to make that happen? I've seen a few examples that hard-code configuration options, but the above documentation suggest that you don't have to.
Is that something that's only available if you're packaging it as a plugin, or if you include some other js resource? So far I've been doing a bare plugin so I don't have access to stuff like #requireResource, but I'm fine with hard-coding some script elements if that's what's necessary (for now).
Sincerely stumped.
Unfortunatly that neer worked for me eighter. I think it broke in JIRA 6..
Solution: take the javascript approach and you will be just fine. it is also way more powerful.
it works for me, just add this script
<![CDATA[
<script type="text/javascript">
window.onload = function(){
var edit = window.parent.document.getElementById(window.frameElement.id + '-edit');
edit.classList.remove('hidden');
edit.style.display = 'none';
}
</script>
]]>

KryzhanovskyCssMinifier doesn't work with MsieJsEngine but does with V8JsEngine

I am using the latest BundleTransformer for ASP.NET.
I have an extremely simple bundle file with one LESS file:
var cssBundle = new CustomStyleBundle("~/Content/css/bundle").Include(
"~/Content/css/test.less");
bundles.Add(cssBundle);
The LESS file I've made as simple as possible to prove it is actually correctly interpreting as LESS.
.something
{
ol, ul
{
list-style: none;
}
}
When I try to use V8JsEngine it works as expected (relevant web.config shown):
<css defaultMinifier="KryzhanovskyCssMinifier" usePreMinifiedFiles="false">
<minifiers>
<add name="KryzhanovskyCssMinifier" type="BundleTransformer.Csso.Minifiers.KryzhanovskyCssMinifier, BundleTransformer.Csso" />
</minifiers>
</css>
<csso>
<css disableRestructuring="false" />
<jsEngine name="V8JsEngine" />
</csso>
This gives me the correct CSS:
.something ol,.something ul{list-style:none}
However when I switch to MsieJSEngine
<csso>
<css disableRestructuring="false" />
<jsEngine name="MsieJsEngine" />
</csso>
I get the following bizarrely incorrect CSS - with UL completely stripped out.
.something ol{list-style:none}
I just can't quite fathom how this is even possible. It has been interpreted correctly as LESS, but completely stripped out the UL from the list. Incidentally if I make it just a pure css file without the .something class I get the same incorrect result.
Fortunately it seems to work fine with V8JsEngine so I can keep on, but I'm posting this here hopefully to help others and because I'm very curious if there's something I did wrong.
File versions:
BundleTransformer.Core - 1.9.3.0
BundleTransformer.Csso - 1.9.1.0
BundleTransformer.Less - 1.9.1.0
BundleTransformer.MicrosoftAjax - 1.9.1.0
For BundleTransformer.Csso need the full support of ECMAScript 5, that is implemented only in ChakraJsRt mode of the MSIE JavaScript Engine for .NET. Quote from the documentation:
JsRT version of Chakra JavaScript engine (supports ECMAScript 5). Requires Internet Explorer 11 or higher on the machine.
Incidentally, in description of the BundleTransformer.Csso NuGet-package has the following requirement:
For correct working of this module is recommended to install the following NuGet packages: JavaScriptEngineSwitcher.V8 or JavaScriptEngineSwitcher.Msie (only in the ChakraJsRt mode).

Umbraco 4 Document Type not showing on page

I am a newbie with Umbraco so please excuse if I am missing something obvious. I have trawled the internet, but I can't find a solution to my problem.
I am mainly using the Umbraco.TV videos to guide me through this, and in particularly, this one: http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/datatypes/using-content-and-media-pickers/TVPlayer.
The others videos and tutorials successfully got me through setting up a responsive nav and sub-nav, but on this issue, I'm stuck.
I am building a site which requires multiple CTAs. The text for these need to be entered by persons who have no coding experience so I've set up Document Types containing RichText Editor fields for them to enter the required text and images.
Tab: Generic Properties
H2 (h2), Type: Richtext editor
Article Description (articleDescription), Type: Richtext editor
Article Feature Image (articleFeatureImage), Type: Media Picker
Label (label), Type: Label
In the Template I have then inserted an Umbraco page field which references the relevant Document Type:
<div class="rel-art">
<umbraco:Item field="relatedContent1" runat="server" />
</div>
However, when I view the page in a browser, all I'm getting on the page is the Document Type ID:
<div class="rel-art"> 1202 </div>
I have tried setting it up and inserting it as a xslt:
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:value-of select="umbraco.library:GetXmlNodeById($currentPage/data [#alias = 'relatedContent1'])/#nodeName"/>
</xsl:template>
</xsl:stylesheet>
My "Visualise XSLT" button isn't working though so I don't know what is would say at this point. I don't get a modal window. (I'm working remotely onto my client's system so that may have an impact.)
Now, if I insert the accompanying Macro into my template:
<div class="rel-art">
<umbraco:Macro Alias="RelatedContent1" runat="server"></umbraco:Macro>
</div>
that results in not even the ID showing when I view the page:
<div class="rel-art"> </div>
I have tried with and without #nodeName, but no difference.
What is happening? What am I doing wrong? The only thing I can think of is that I had some trouble getting another Document Type to show up on the page until I changed its only Property Type from RichText Editor to Textstring. But I tried that with this one as well, and that didn't make any difference.
I am using Umbraco v4.9, if that helps.
Any help is gratefully received!
Thanks! :-)
Trine,
It is not very clear, but I noticed that the returned value is ' 1202 ' (having spaces). Could you please check your code with a static value i.e.
<xsl:value-of select="umbraco.library:GetXmlNodeById(1202)/#nodeName"/>
if this works fine, then the problem is your 'relatedContent1'. You can Trim its value and use it in GetXmlNodeById function.
It appears as if you are trying to display an image chosen with a media picker. If this is the case then you should use the GetMedia method:
<xsl:value-of select="umbraco.library:GetMedia($currentPage/data[#alias='relatedContent1'], 'false')/data[#alias='umbracoFile']" />
Check out How to use umbraco.library GetMedia in XSLT by Lee Kelleher for more details and for a more fool proof approach for getting media.

Resources