javascript - Auto width widget -
I'm writing a small add-on on firefox, in which I use the widget I'm surprised that the auto-width To set which is suited for that content For example, I want my widget to display numbers, which will have a different length. I can set my widget width but how do I know how much my number of pixels takes is one way to get width, choose automatically? Here are some of my codes: My widget (my add-on uses other widgets),
// ROBOTS meta var robots_meta = widgets.Widget ({id: "robots_meta", label : "Robot displays information about meta", content: "meta-robots n / a", width: 100}); This is the function that updates the contents of my widget:
function meta_ robots_checker (tab) {var meta_robots_w = robots_meta.getView (tab.window) ); Meta_robots_w.content = 'Meta-robots N / A'; Worker = tab.attach ({contentScriptFile: data.url ("js / meta-checker.js")}); Worker.port.emit ("check_noindex"); Worker.port.on ('content', function (message) {message = message.toLowerCase (); message = message.replace ('nofollow', '& lt; span style = "color: red" & gt; nofollow & Lt; / span & gt; '); Message = message. Raley (' no index ',' noindex ;); meta_robots_w Content = message; // my frame width should be changed}); } You have to control the width dynamically, the widget is a panel. No dynamic dynamically changing width element like labels. Widget panel element to use "element selector" addon with "Dom Inspector".
Check out this topic here:
Comments
Post a Comment