options_page_chooser.js 921 B

123456789101112131415161718192021222324252627282930313233
  1. jQuery(document).ready(function () {
  2. setPageCooserEvents();
  3. });
  4. //Set Events
  5. function setPageCooserEvents() {
  6. $(".chooser").click(function () {
  7. var panel = $(this).attr("id");
  8. if ($(this).hasClass("selected"))
  9. return;
  10. var id = $(this).attr("id");
  11. if (id == "getting_started") {
  12. openExtPage("http://www.editthiscookie.com/start/");
  13. return;
  14. } else if (id == "help") {
  15. openExtPage("http://www.editthiscookie.com/faq/");
  16. return;
  17. }
  18. ls.set("option_panel", panel);
  19. location.href = "/options_pages/" + id + ".html";
  20. });
  21. }
  22. function openExtPage(url) {
  23. chrome.tabs.getCurrent(function (tab) {
  24. chrome.tabs.create({
  25. index: tab.index + 1,
  26. url: url,
  27. active: true,
  28. openerTabId: tab.id
  29. });
  30. })
  31. }