A corporation manager and dashboard for EVE Online
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

main.js 1.5 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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"]').data("style");
  34. var stylesheet = "/static/styles/" + style + ".css";
  35. $("#user-style").prop("href", stylesheet);
  36. $("#style-options .cur").removeClass("cur").find(":submit")
  37. .prop("disabled", false);
  38. $(this).addClass("cur").find(":submit").prop("disabled", true);
  39. });
  40. });