Mayx's Home Page https://mabbs.github.io
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.

59 lines
2.2 KiB

  1. var message_Path = '/Live2dHistoire/live2d/';
  2. var talkAPI = BlogAPI + "/ai_chat";
  3. $(function () {
  4. (function () {
  5. var $backToTopTxt = "返回顶部", $backToTopEle = $('<div class="backToTop"></div>').appendTo($("body"))
  6. .text($backToTopTxt).attr("title", $backToTopTxt).click(function () {
  7. $("html, body").animate({ scrollTop: 0 }, 120);
  8. }), $backToTopFun = function () {
  9. var st = $(document).scrollTop(), winh = $(window).height();
  10. (st > 0) ? $backToTopEle.show() : $backToTopEle.hide();
  11. };
  12. $(window).bind("scroll", $backToTopFun);
  13. $(function () { $backToTopFun(); });
  14. })();
  15. function showHitCount() {
  16. $(".visitors-index").each(function () {
  17. var $elem = $(this);
  18. $.get(BlogAPI + "/count_click?id=" + $elem.attr('id'), function (data) {
  19. $elem.text(Number(data));
  20. });
  21. });
  22. }
  23. function addCount() {
  24. var $visitor = $(".visitors:first");
  25. $.get(BlogAPI + "/count_click_add?id=" + $visitor.attr('id'), function (data) {
  26. $visitor.text(Number(data));
  27. });
  28. }
  29. if ($('.visitors').length == 1) {
  30. addCount();
  31. } else if ($('.visitors-index').length > 0) {
  32. showHitCount();
  33. }
  34. if (Math.floor((new Date().getTime() - lastUpdated.getTime()) / (24 * 60 * 60 * 1000)) > 90) {
  35. $("html")[0].style = "-webkit-filter: grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(graysale=1);";
  36. $("html")[0].innerHTML = $("html")[0].innerHTML.replace(/Mayx/g, "Ghost");
  37. console.warn("Mayx may already be Dead");
  38. }
  39. });
  40. function getSearchJSON(callback) {
  41. var searchData = JSON.parse(localStorage.getItem("blog_" + lastUpdated.valueOf()));
  42. if (!searchData) {
  43. for (var i = 0; i < localStorage.length; i++) {
  44. var key = localStorage.key(i);
  45. if (key.startsWith('blog_')) {
  46. localStorage.removeItem(key);
  47. }
  48. }
  49. $.getJSON("/search.json", function (data) {
  50. localStorage.setItem("blog_" + lastUpdated.valueOf(), JSON.stringify(data));
  51. callback(data);
  52. });
  53. } else {
  54. callback(searchData);
  55. }
  56. }

Powered by TurnKey Linux.