{"id":13536623,"url":"https://github.com/jiangtj-lab/hexo-cake-moon-menu","last_synced_at":"2025-04-02T03:30:54.025Z","repository":{"id":52585775,"uuid":"194970785","full_name":"jiangtj-lab/hexo-cake-moon-menu","owner":"jiangtj-lab","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-24T18:08:48.000Z","size":51,"stargazers_count":14,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T23:17:25.836Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jiangtj-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-03T03:11:12.000Z","updated_at":"2024-06-03T18:11:56.000Z","dependencies_parsed_at":"2022-08-27T07:20:57.622Z","dependency_job_id":null,"html_url":"https://github.com/jiangtj-lab/hexo-cake-moon-menu","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiangtj-lab%2Fhexo-cake-moon-menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiangtj-lab%2Fhexo-cake-moon-menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiangtj-lab%2Fhexo-cake-moon-menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jiangtj-lab%2Fhexo-cake-moon-menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jiangtj-lab","download_url":"https://codeload.github.com/jiangtj-lab/hexo-cake-moon-menu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246750930,"owners_count":20827804,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T09:00:45.640Z","updated_at":"2025-04-02T03:30:53.807Z","avatar_url":"https://github.com/jiangtj-lab.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["NexT Plugins"],"readme":"# hexo-cake-moon-menu\n\nThis plugin from [hexo-theme-inside](https://github.com/ike-c/hexo-theme-inside), thank ike-c.\n\n**If you've come here from my post, check out the [1.x](https://github.com/jiangtj-lab/hexo-cake-moon-menu/tree/1.x) branch code.**\n\n![npm](https://img.shields.io/npm/v/hexo-cake-moon-menu.svg)\n[![Theme](https://img.shields.io/badge/Theme-NexT(Pisces\u0026Gemini):7.9.0-blue.svg)](https://theme-next.org)\n[![Theme](https://img.shields.io/badge/Theme-Cake:2.0.0-blue.svg)](https://github.com/jiangtj/hexo-theme-cake)\n\n# Preview\n![image](https://user-images.githubusercontent.com/15902347/61098652-41f0ee80-a492-11e9-9c75-bb8fad0aa058.png)\n![image](https://user-images.githubusercontent.com/15902347/61098668-51703780-a492-11e9-984c-a17c1509a4c6.png)\n![image](https://user-images.githubusercontent.com/15902347/61098577-1110b980-a492-11e9-930e-cd0c677f7714.png)\n![image](https://user-images.githubusercontent.com/15902347/61098595-1ff76c00-a492-11e9-8c66-0a702b390961.png)\n\n## How to use\n\n```bash\nyarn add hexo-cake-moon-menu\n```\n\nIf you are using NexT theme version 7.8 or earlier, install version 2.1.2\n\n```bash\nyarn add hexo-cake-moon-menu@2.1.2\n```\n\n## Config\n\nIn hexo `_config.yml` (here is default config, if don't change it, nothing need to append)\n\n```yml\nmoon_menu:\n  back2top:\n    enable: true\n    icon: fas fa-chevron-up\n    order: -1\n  back2bottom:\n    enable: true\n    icon: fas fa-chevron-down\n    order: -2\n```\n\n## Custom\n\nIt's easy to add new button in `moon-menu`. And here's an example about add gitter sidecar.\n\n1. Add config\n```yml\nmoon_menu:\n  chat:\n    icon: fa fa-comments\n```\n\n2.  In `${hexo-dir}/scripts/any.js`, Add custom head\n```js\nconst path = require('path');\nconst injector = require('hexo-extend-injector2')(hexo);\ninjector.register('body-end', `\u003cscript\u003e\n((window.gitter = {}).chat = {}).options = {\n  room: 'your-room-name',\n  activationElement: false\n};\n\u003c/script\u003e`);\ninjector.register('body-end', '\u003cscript src=\"https://sidecar.gitter.im/dist/sidecar.v1.js\" async defer\u003e\u003c/script\u003e');\ninjector.register('js', path.resolve(hexo.base_dir, 'any/gitter.js'));\n```\n\n3. In `${hexo-dir}/any/gitter.js`, create custom function\n```js\ndocument.addEventListener('gitter-sidecar-instance-started', e =\u003e {\n  // every button has it's id such as #moon-menu-item-\u003ckey\u003e\n  document.querySelector('#moon-menu-item-chat').addEventListener('click', () =\u003e {\n    e.detail.chat.toggleChat(true);\n  });\n});\n```\n\n## Other themes\n\nIf you're not a user of the NexT or Cake theme, don't worry, you can still use this plug-in, just add fontawesome to your blog. We provide three scheme that you can choose.\n\n### Scheme one\n\n```bash\nyarn add hexo-fontawesome\n```\n\nIn `${hexo-or-theme-dir}/scripts/any.js`\n\n```js\nconst { dom } = require('@fortawesome/fontawesome-svg-core');\nconst injector = require('hexo-extend-injector2')(hexo);\ninjector.register('style', dom.css());\n```\n\n### Scheme two\n\nIn `${hexo-or-theme-dir}/scripts/any.js`\n```js\nconst injector = require('hexo-extend-injector2')(hexo);\n// add fontawesome\ninjector.register('head-end', {\n  value: '\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.11.2/css/all.min.css\" crossorigin=\"anonymous\"\u003e'\n});\n```\n\n### Scheme three\n\nAdd fontawesome.css in your theme layout\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiangtj-lab%2Fhexo-cake-moon-menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjiangtj-lab%2Fhexo-cake-moon-menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjiangtj-lab%2Fhexo-cake-moon-menu/lists"}