{"id":17645318,"url":"https://github.com/mazeyqian/mazey-wordpress-utils","last_synced_at":"2025-04-07T03:25:45.682Z","repository":{"id":39918669,"uuid":"118215891","full_name":"mazeyqian/mazey-wordpress-utils","owner":"mazeyqian","description":"WordPress utilities.","archived":false,"fork":false,"pushed_at":"2025-03-08T14:08:30.000Z","size":713,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-30T04:31:56.665Z","etag":null,"topics":["npm","utilities","wordpress"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mazeyqian.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-20T06:27:37.000Z","updated_at":"2025-03-08T14:08:35.000Z","dependencies_parsed_at":"2023-11-15T05:24:12.955Z","dependency_job_id":"aa095ca2-982d-45fb-b7ea-e9cf05b45180","html_url":"https://github.com/mazeyqian/mazey-wordpress-utils","commit_stats":{"total_commits":33,"total_committers":3,"mean_commits":11.0,"dds":0.4545454545454546,"last_synced_commit":"f88b5b9a6ee9a9dda8b45efaa2dd8e75dcaa5a61"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazeyqian%2Fmazey-wordpress-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazeyqian%2Fmazey-wordpress-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazeyqian%2Fmazey-wordpress-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mazeyqian%2Fmazey-wordpress-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mazeyqian","download_url":"https://codeload.github.com/mazeyqian/mazey-wordpress-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247585665,"owners_count":20962375,"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":["npm","utilities","wordpress"],"created_at":"2024-10-23T10:54:54.647Z","updated_at":"2025-04-07T03:25:45.662Z","avatar_url":"https://github.com/mazeyqian.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mazey WordPress Utils\n\n[![NPM version][npm-image]][npm-url]\n[![l][l-image]][l-url]\n\n[npm-image]: https://img.shields.io/npm/v/mazey-wordpress-utils\n[npm-url]: https://npmjs.org/package/mazey-wordpress-utils\n[l-image]: https://img.shields.io/npm/l/mazey-wordpress-utils\n[l-url]: https://github.com/mazeyqian/mazey-wordpress-utils\n\nWordPress utilities.\n\n## Install\n\nYou can get mazey-wordpress-utils via [npm](https://www.npmjs.com/package/mazey-wordpress-utils).\n\n```bash\nnpm install mazey-wordpress-utils --save\n```\n\n## Usage\n\n### hideSidebar\n\nHide the sidebar on the webpage.\n\nExample: \u003chttps://example.com/home?hide_sidebar\u003e\n\n```javascript\nhideSidebar({\n  urlContainList: ['hide_sidebar', 'no_sidebar'],\n  primarySelector: '#main-content',\n  secondarySelector: '#sidebar'\n});\n```\n\n### hideHeaderInTOC\n\nHide the header when it meets one of these two conditions:\n\n- Use WordPress Plugin [Easy Table of Contents](https://wordpress.org/plugins/easy-table-of-contents/) and open it in this page.\n- The page's URL is matched with one of the `urlContainList`.\n\nExample: \u003chttps://example.com/home?hide_header_in_toc\u003e\n\n```javascript\nhideHeaderInTOC({\n  urlContainList: ['hide_header_in_toc', 'no_header_in_toc'],\n  headerSelector: '.site-header'\n});\n```\n\n### isIncludeInUrl\n\nCheck if the current URL includes a specified string.\n\nExample: \u003chttps://example.com/home?example\u003e\n\n```javascript\nisIncludeInUrl({\n  urlContainString: 'example'\n});\n```\n\n### setImgWidthHeight\n\nSet the width and height of an image based on the parameters specified in the image's URL.\n\nUse jQuery to select all `img` elements on the page and then checks each image's `src` attribute for `width` and `height` parameters. If these parameters are found, the function sets the image's width and height accordingly.\n\nThe width and height parameters in the URL should be in the format `width=\u003cvalue\u003e\u003cunit\u003e` and `height=\u003cvalue\u003e\u003cunit\u003e`, where `\u003cvalue\u003e` is a number and `\u003cunit\u003e` is a CSS unit like `px`, `rem`, or `vw`.\n\nExample 1:\nFor an image with the URL `\u003cimg src=\"https://example.com/image.png?width=400px\u0026height=200px\" alt=\"file\" /\u003e`, the function will execute `window.jQuery('img').width('400px')` and `window.jQuery('img').height('200px')`.\n\nExample 2:\nFor an image with the URL `\u003cimg src=\"https://example.com/image.png?width=400rem\u0026height=20vw\" alt=\"file\" /\u003e`, the function will execute `window.jQuery('img').width('400rem')` and `window.jQuery('img').height('20vw')`.\n\n## Contributing\n\n```bash\n# dev\nnpm run dev\n\n# build\nnpm run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazeyqian%2Fmazey-wordpress-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmazeyqian%2Fmazey-wordpress-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazeyqian%2Fmazey-wordpress-utils/lists"}