How to use widget - 10 common examples

To help you get started, we’ve selected a few widget examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matagus / github-news-feed-filter / lib / main.js View on Github external
panel.port.on("save.click", function(filters) {
  ss.storage.filters = filters;
});

panel.port.on("forkme.click", function(url) {
  tabs.open(url);
  panel.hide();
});

var options = {id: "gnff-tbb", label: addon_title,
  toolbarID: "nav-bar", forceMove: true,
  image: data.url("icons/logo.png"), panel: panel};
var tbb = toolbarbutton.ToolbarButton(options);
    tbb.moveTo(options);

var widget = widgets.Widget({
  id: "github-news-feed-filter",
  label: addon_title,
  tooltip: addon_title,
  contentURL: data.url("icons/logo16.png"),
  panel: panel
});

exports.main = function(options, callbacks) {
  panel.port.emit("set-filters", ss.storage.filters);
  // If you run cfx with --static-args='{"quitWhenDone":true}' this program
  // will automatically quit Firefox when it's done.
  if (options.staticArgs.quitWhenDone)
    callbacks.quit();
};

exports.onUnload = function(reason) {
github mozilla / watchdog-visualize-passwords / lib / main.js View on Github external
tabs.open(dataDir.url("view_passwords.html"));
}

// openPasswordVisualizer();

pagemod.PageMod({
  include: dataDir.url("view_passwords.html"),
  contentScriptFile: [dataDir.url("js/util.js"),dataDir.url("js/view_passwords_content_script.js")],
  onAttach: function(worker) {
      worker.port.on('get_logins_table', function() {
          worker.port.emit('logins_table', getLoginsJSON());
      });
  }
});

var widget = widgets.Widget({
  id: "privacy-watchdog-link",
  label: "Privacy Watchdog",
  contentURL: dataDir.url("lock-blue-new.png"),
  onClick: function() {
    openPasswordVisualizer();
  }
});

function getLoginsJSON() {
    var nodes = [];
    var links = [];
    var loginsTable = passwordManager.getLoginsTable();
    var passwordsDict = {};
    for (var password in loginsTable) {
        nodes.push({
                name: password,
github GaloisInc / FiveUI / tools / addon-sdk-1.12 / examples / reddit-panel / lib / main.js View on Github external
var data = require("self").data;

var reddit_panel = require("panel").Panel({
  width: 240,
  height: 320,
  contentURL: "http://www.reddit.com/.mobile?keep_extension=True",
  contentScriptFile: [data.url("jquery-1.4.4.min.js"),
                      data.url("panel.js")]
});

reddit_panel.port.on("click", function(url) {
  require("tabs").open(url);
});

require("widget").Widget({
  id: "open-reddit-btn",
  label: "Reddit",
  contentURL: "http://www.reddit.com/static/favicon.ico",
  panel: reddit_panel
});

exports.main = function(options, callbacks) {
  // If you run cfx with --static-args='{"quitWhenDone":true}' this program
  // will automatically quit Firefox when it's done.
  if (options.staticArgs.quitWhenDone)
    callbacks.quit();
};
github mozilla / memchaser / extension / lib / main.js View on Github external
break;
      case "minimize_memory":
        memory.minimizeMemory(memory.reporter.retrieveStatistics);
        break;
      case "trigger_cc":
        garbage_collector.doCC();
        memory.reporter.retrieveStatistics();
        break;
      case "trigger_gc":
        garbage_collector.doGlobalGC();
        memory.reporter.retrieveStatistics();
        break;
    }
  });

  var widget = widgets.Widget({
    id: "memchaser-widget",
    label: "MemChaser",
    tooltip: "MemChaser",
    contentURL: [self.data.url("widget/widget.html")],
    contentScriptFile: [self.data.url("widget/widget.js")],
    contentScriptWhen: "ready",
    panel: contextPanel,
    width: 360,
    onClick: function () {
      contextPanel.port.emit("update", { logger_active: logger.active });
    }
  });

  // If user hovers over an entry the tooltip has to be updated
  widget.port.on("update_tooltip", function (data) {
    if (data === "logger" && logger.active) {
github feinstaub / webextension_local_filesystem_links / lib / widget-main.js View on Github external
}
  });

  toolbarPanel.port.on("show_options", function() {
    //// console.log("port.on: show_options");
    toolbarPanel.hide();
    openOptionsTab();
  });

  toolbarPanel.port.on("action_rescan_page", function() {
      console.log("port.on: action_rescan_page");
      toolbarPanel.hide();
      actionRescanPage();
    });

  var a = widget.Widget({
    id: "lfl-w",
    label: "Local Filesystem Links",
    // content: "Hello!",
    // width: 50
    contentURL: icon1,
    
    panel: toolbarPanel,
    
    onMouseover: function() {
      this.contentURL = icon1hover;
    },
    
    onMouseout: function() {
      this.contentURL = icon1;
    }
github bgirard / Gecko-Profiler-Addon / lib / main.js View on Github external
spsWidget = require("widget").Widget({
          id: "hello-display",
          label: "Built-in Profiler",
          content: "Profiler module not found.",
          width: 200,
          panel: panel
        });
        return;
    }
    try {
        profilerFeatures = profiler.GetFeatures([]);
        // Add-on side feature
        profilerFeatures.push("adb");
    } catch(e) { }
    
    spsWidget = require("widget").Widget({
      id: "hello-display",
      label: "Built-in Profiler",
      content: "Profiler",
      width: 200,
      panel: panel
    });
    
    sps_startup(true);
    sps_update_status();
}
github mozilla / lightbeam / lib / ui.js View on Github external
onReady: collusionTabReady,
            onActivate: collusionTabActivate,
            onDeactivate: collusionTabDeactivate
        });
    }
    // if we're on the collusion tab, close it
    if (tab === tabs.activeTab){
        tab.close();
    }else{
        // otherwise, switch to this tab
        tab.activate();
    }
}

// Set up the status bar button to open the main UI page:
var widget = require("widget").Widget({
    id: "collusion_Widget",
    label: "Collusion",
    tooltip: "Show Collusion",
    contentURL: data.url("favicon.ico"),
    onClick: function() {
        openOrSwitchToOrClose(mainPage);
    }
});
github toolness / webxray / browser-addon / firefox / lib / main.js View on Github external
var tabs = require('tabs');
var data = require('self').data;

require("widget").Widget({
  id: "goggles-icon",
  label: "Activate Goggles",
  contentURL: data.url("favicon.ico"),
  onClick: function() {
    var gogglesConfig = JSON.parse(data.load("config.json"));
    // We're removing intro/outro files with slice().
    var files = gogglesConfig.compiledFileParts.slice(1, -1);
    var urls = files.map(data.url);
    var worker = tabs.activeTab.attach({
      contentScriptFile: urls
    });
  }
});
github mozilla / lightbeam / c2 / lib / main.js View on Github external
onReady: collusionTabReady,
                onActivate: collusionTabActivate,
                onDeactivate: collusionTabDeactivate
            });
        }
        // if we're on the collusion tab, close it
        if (tab === tabs.activeTab){
            tab.close();
        }else{
            // otherwise, switch to this tab
            tab.activate();
        }
    }

    // Set up the status bar button to open the main UI page:
    var widget = require("widget").Widget({
        id: "collusion_Widget",
        label: "Show Collusion",
        contentURL: data.url("favicon.ico"),
        onClick: function() {
            openOrSwitchToOrClose(mainPage);
        }
    });

    // attachToExistingCollusionPages();

})(this);
github ianb / seeitsaveit / lib / main.js View on Github external
});

dropper.port.on("ConsumerSelected", function (consumer) {
  console.log('----------------------------------------');
  console.log('Consumer button clicked');
  currentExtraction = new Extraction(panel);
  currentExtraction.consumerChosen = consumer;
  currentExtraction.start(tabs.activeTab);
  //panel.show();
});

function addDropperConsumer(consumer) {
  dropper.port.emit("AddConsumer", consumer);
}

var widget = Widget({
  id: "seeitsaveit-link",
  label: "Save It!",
  contentURL: data.url("box-download.png"),
  panel: panel,
  onClick: function() {
    console.log('----------------------------------------');
    currentExtraction = new Extraction(panel);
    currentExtraction.start(tabs.activeTab);
  }
});

function makePage(extractor, doc) {
  var head = '';
  if (! extractor) {
    throw 'You must pass an extractor to makePage';
  }

widget

Basic DOM widget library for Ender

MIT
Latest version published 13 years ago

Package Health Score

42 / 100
Full package analysis

Popular widget functions