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.

68 lines
2.4 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").css({
  36. "-webkit-filter": "grayscale(100%)",
  37. "filter": "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)"
  38. })
  39. $('body').html(function(_, oldHTML) {
  40. return oldHTML.replace(/Mayx/g, 'Ghost');
  41. });
  42. console.warn("Mayx may already be Dead");
  43. }
  44. });
  45. function getSearchJSON(callback) {
  46. if (typeof Storage == 'undefined') {
  47. $.getJSON("/search.json", callback);
  48. return;
  49. }
  50. var searchData = JSON.parse(localStorage.getItem("blog_" + lastUpdated.valueOf()));
  51. if (!searchData) {
  52. for (var i = localStorage.length - 1; i >= 0; i--) {
  53. var key = localStorage.key(i);
  54. if (key.indexOf('blog_') === 0) {
  55. localStorage.removeItem(key);
  56. }
  57. }
  58. $.getJSON("/search.json", function (data) {
  59. localStorage.setItem("blog_" + lastUpdated.valueOf(), JSON.stringify(data));
  60. callback(data);
  61. });
  62. } else {
  63. callback(searchData);
  64. }
  65. }

Powered by TurnKey Linux.