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.
 
 
 
 
 

41 lines
1.3 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. }).css("cursor", "pointer");
  31. // Switch style immediately without reloading the page:
  32. $("#style-options form").submit(function() {
  33. var style = $(this).find('input[type="submit"]').prop("value");
  34. var stylesheet = "/static/styles/" + style + ".css";
  35. $("#user-style").prop("href", stylesheet);
  36. });
  37. });