A corporation manager and dashboard for EVE Online
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

main.js 1.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. // Allow user to dismiss flashes:
  14. $("#flashes > div").each(function() {
  15. $(this).prepend($("<a>", {
  16. addClass: "dismiss",
  17. href: "#"
  18. }).html("[&times;]").click(function() {
  19. $(this).parent().remove();
  20. return false;
  21. }));
  22. });
  23. // Toggle character options on click:
  24. var charopts = $("#character-options");
  25. charopts.hide();
  26. $("#character-portrait img").click(function() {
  27. if (charopts.is(":visible")) {
  28. charopts.hide();
  29. $(document).off("mouseup.charopts");
  30. } else {
  31. charopts.show();
  32. $(document).on("mouseup.charopts", function(e) {
  33. if (!overlaps(e.target, charopts) &&
  34. !overlaps(e.target, $("#character-portrait img"))) {
  35. charopts.hide();
  36. $(document).off("mouseup.charopts");
  37. }
  38. });
  39. }
  40. }).css("cursor", "pointer").keypress(function (e) {
  41. if (e.which === 13)
  42. $(this).click();
  43. }).prop("title", "Options").prop("alt", "Options").prop("tabindex", 0);
  44. // Switch style immediately without reloading the page:
  45. $("#style-options form").submit(function() {
  46. var style = $(this).find('input[type="submit"]').data("style");
  47. var stylesheet = "/static/styles/" + style + ".css";
  48. $("#user-style").prop("href", stylesheet);
  49. $("#style-options .cur").removeClass("cur").find(":submit")
  50. .prop("disabled", false);
  51. $(this).addClass("cur").find(":submit").prop("disabled", true);
  52. });
  53. });