Simple image host.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. (function() {
  2. window.util = {};
  3. util.notify = function notify(title, body) {
  4. var elem = $("#notify-box");
  5. elem.children(".title").html(title);
  6. elem.children(".body").html(body || "");
  7. elem.addClass("active");
  8. notify.timeout = setTimeout(function() {
  9. elem.removeClass("active");
  10. }, 5000);
  11. }
  12. $(document).ready(function() {
  13. $("#notify-box").on("mouseenter", function() {
  14. clearTimeout(util.notify.timeout);
  15. });
  16. $("#login-form").on("submit", function(evt) {
  17. evt.stopPropagation();
  18. evt.preventDefault();
  19. util.notify("Feature Not Implemented", "This feature is not implemented.");
  20. });
  21. });
  22. util.htmlEntities = function(str) {
  23. return str.replace(/&/g, "&")
  24. .replace(/</g, "&lt;")
  25. .replace(/>/g, "&lt;")
  26. .replace(/"/g, "&quot");
  27. }
  28. util.api = function(name, data, cb, getXhr) {
  29. var fd = new FormData();
  30. for (var i in data) {
  31. console.log(i);
  32. fd.append(i, data[i]);
  33. }
  34. return $.ajax({
  35. method: "POST",
  36. url: "/api/"+name,
  37. data: fd,
  38. processData: false,
  39. contentType: false,
  40. xhr: function() {
  41. var xhr = new XMLHttpRequest();
  42. if (getXhr)
  43. getXhr(xhr);
  44. return xhr;
  45. }
  46. }).done(function(res) {
  47. var obj = JSON.parse(res);
  48. if (obj.success)
  49. cb(null, obj);
  50. else
  51. cb(obj.error);
  52. });
  53. }
  54. })();