main.js 975 B

12345678910111213141516171819202122232425262728293031
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. var data = require("sdk/self").data;
  5. var reddit_panel = require("sdk/panel").Panel({
  6. width: 240,
  7. height: 320,
  8. contentURL: "http://www.reddit.com/.mobile?keep_extension=True",
  9. contentScriptFile: [data.url("jquery-1.4.4.min.js"),
  10. data.url("panel.js")]
  11. });
  12. reddit_panel.port.on("click", function(url) {
  13. require("sdk/tabs").open(url);
  14. });
  15. require("sdk/widget").Widget({
  16. id: "open-reddit-btn",
  17. label: "Reddit",
  18. contentURL: "http://www.reddit.com/static/favicon.ico",
  19. panel: reddit_panel
  20. });
  21. exports.main = function(options, callbacks) {
  22. // If you run cfx with --static-args='{"quitWhenDone":true}' this program
  23. // will automatically quit Firefox when it's done.
  24. if (options.staticArgs.quitWhenDone)
  25. callbacks.quit();
  26. };