Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Panel tranparency firefox addon

I'm programming a firefox addon and using a panel to display info on a video, everything works fine althought I can't make the panel transparent. I define the panel styling in the html file as follow:

<html>
<head>
    <meta charset="utf-8" />
    <style type="text/css" media="all">
        html
        {
            opacity:0.1;
            border-style:none;
            resize:none;
        }
        textarea
        {
            background-color:transparent;
            resize: none;
            border-style:none;
        }
    </style>
 </head>
<body>
    <textarea id="text" readonly=true rows="3" cols="60"></textarea>
</panel>
</body>
</html>

Except the panel is not transparent only the text area is. I tried with:

opacity:1 for textarea

It doesn't work either way. What am I doing wrong? Is this even possible?

From what I understand :

html
{
    opacity:0.1;
    border-style:none;
    resize:none;
}

only applies to the panel content not to the panel itself. I found a post on this subject but it is outdated since the sdk/panel.js mentionned in the post is not the same anymore.

Anyway I tried downloading the panel.js and replacing the current one, but it doesn't seem to affect the panel I display at all. The panel is still white and the border-radius option does not work either. (I should say that I replaced all the "./" with "sdk/" as mentionned in that post).

like image 315
2A-66-42 Avatar asked Jun 27 '15 22:06

2A-66-42


2 Answers

Ok here is a pure addon sdk solution:

let myPanel = Panel({
   width: 180,
   height: 180,
   contentURL: 'data:text/html,<textarea style="width:120px; height:80px;">this is my textarea</textarea>'
})

let { getActiveView }=require("sdk/view/core");
getActiveView(myPanel).setAttribute("noautohide", true);
getActiveView(myPanel).setAttribute("level", 'top');
getActiveView(myPanel).setAttribute("style", 'background-color:rgba(0, 0, 0, 0.2);');
like image 141
Noitidart Avatar answered Oct 13 '22 21:10

Noitidart


You can't style the panel provided in the SDK, only the content but you can definitely follow the procedure you mention and provide your modified panel.

like image 42
edoput Avatar answered Oct 13 '22 23:10

edoput