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.
 
 
 
 
 

57 lines
2.0 KiB

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