A corporation manager and dashboard for EVE Online
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

47 行
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 img").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 img"))) {
  25. charopts.hide();
  26. $(document).off("mouseup.charopts");
  27. }
  28. });
  29. }
  30. }).css("cursor", "pointer").keypress(function (e) {
  31. if (e.which === 13)
  32. $(this).click();
  33. }).prop("title", "Options").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. });