A corporation manager and dashboard for EVE Online
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

47 lines
1.6 KiB

  1. var overlaps = function(needle, haystack) {
  2. return haystack.is(needle) || haystack.has(needle).length > 0;
  3. };
  4. $(function() {
  5. // Install logout auto-POST form:
  6. $("#logout").click(function() {
  7. $("<form>", {
  8. "action": this.href,
  9. "method": "post"
  10. }).appendTo($("body")).submit();
  11. return false;
  12. });
  13. // Toggle character options on click:
  14. var charopts = $("#character-options");
  15. charopts.hide();
  16. $("#character-portrait").click(function() {
  17. if (charopts.is(":visible")) {
  18. charopts.hide();
  19. $(document).off("mouseup.charopts");
  20. } else {
  21. charopts.show();
  22. $(document).on("mouseup.charopts", function(e) {
  23. if (!overlaps(e.target, charopts) &&
  24. !overlaps(e.target, $("#character-portrait"))) {
  25. charopts.hide();
  26. $(document).off("mouseup.charopts");
  27. }
  28. });
  29. }
  30. }).keypress(function (e) {
  31. if (e.which === 13)
  32. $(this).click();
  33. }).css("cursor", "pointer").prop("alt", "Options").prop("tabindex", 0);
  34. // Switch style immediately without reloading the page:
  35. $("#style-options form").submit(function() {
  36. var style = $(this).find('input[type="submit"]').data("style");
  37. var stylesheet = "/static/styles/" + style + ".css";
  38. $("#user-style").prop("href", stylesheet);
  39. $("#style-options .cur").removeClass("cur").find(":submit")
  40. .prop("disabled", false);
  41. $(this).addClass("cur").find(":submit").prop("disabled", true);
  42. });
  43. });