{"id":15818434,"url":"https://github.com/wellwind/cookie-checkbox","last_synced_at":"2025-04-01T05:13:34.516Z","repository":{"id":82780362,"uuid":"37168199","full_name":"wellwind/cookie-checkbox","owner":"wellwind","description":"Save cookie data when checkbox checked, or load cookie data to checkbox when page load.","archived":false,"fork":false,"pushed_at":"2015-06-10T01:46:48.000Z","size":136,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T06:35:36.464Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wellwind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-10T01:22:02.000Z","updated_at":"2021-09-24T03:42:03.000Z","dependencies_parsed_at":"2023-02-28T15:15:59.250Z","dependency_job_id":null,"html_url":"https://github.com/wellwind/cookie-checkbox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellwind%2Fcookie-checkbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellwind%2Fcookie-checkbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellwind%2Fcookie-checkbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wellwind%2Fcookie-checkbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wellwind","download_url":"https://codeload.github.com/wellwind/cookie-checkbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246586036,"owners_count":20801028,"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-10-05T06:01:58.369Z","updated_at":"2025-04-01T05:13:34.494Z","avatar_url":"https://github.com/wellwind.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cookie-checkbox\nSave cookie data when checkbox checked, or load cookie data to checkbox when page load.\n\nSee demo here: http://wellwind.github.io/cookie-checkbox/demo.html\n\n## Installation\n\n```HTML\n\u003cscript src=\"jquery.js\" /\u003e\n\u003cscript src=\"jquery.cookie.js\" /\u003e\n\u003cscript src=\"cookie-checkbox.js\" /\u003e\n```\n\nYou can get jquery.cookie plugin here:\nhttps://github.com/carhartl/jquery-cookie\n\n## Usage\n\n### Step 1. Set data-checkbox-* data-api to checkbox\n\nAll cookie checkbox shoud add data-checkbox-* data-api.\n\nYou need to set `data-cookie-checkbox=\"true\"` to enable a cookie checkbox, then set `data-cookie-check-box-key=\"{key}\"` and `data-cookie-checkbox-value=\"{value}\"`.\n\n```HTML\n\u003cinput type=\"checkbox\" data-cookie-checkbox=\"true\" \n  data-cookie-checkbox-key=\"CookieCheckBoxSample1\" data-cookie-checkbox-value=\"01\"\u003e Option 01\n\u003cinput type=\"checkbox\" data-cookie-checkbox=\"true\" \n  data-cookie-checkbox-key=\"CookieCheckBoxSample1\" data-cookie-checkbox-value=\"02\"\u003e Option 02\n```\n\nWhen check or uncheck the checkbox the {value} will be added or removed from cookie {key} (cookie name will be cookie-checkbox-{key}).\n\nIf you want a checkbox for check all. You can set `data-cookie-checkbox-check-all=\"true\"` and `data-cookie-checkbox-key=\"{key}\"` to a checkbox.\n\n```HTML\n\u003cinput type=\"checkbox\" \n  data-cookie-checkbox-check-all=\"true\" data-cookie-checkbox-key=\"CookieCheckBoxSample1\"\u003e Select All\n```\n\nWhen this check box check or uncheck, all checkboxes with same {key} will be checked / unchecked.\n\n### Step 2. Use javascript to enable cookie checkbox\n\nWhen page load, you need to call `enableCookieCheckBox();` to enable cookie checkbox.\n\n```javascript\n$(document).ready(function() {\n  enableCookieCheckBox();\n});\n```\n\nYou can call `getCookieCheckboxValues('{key}')` to get the values checked.\n\n```javascript\nvar result = JSON.stringify(getCookieCheckboxValues('CookieCheckBoxSample1'));\nalert(result);\n```\n\nIf you want to clear the cookie checkbox values stored to cookie, juse call `clearCookieCheckBox('{key}')`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwellwind%2Fcookie-checkbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwellwind%2Fcookie-checkbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwellwind%2Fcookie-checkbox/lists"}