{"id":22588768,"url":"https://github.com/farhadg/script-tag-data","last_synced_at":"2025-03-28T17:44:09.652Z","repository":{"id":57153996,"uuid":"46704707","full_name":"FarhadG/script-tag-data","owner":"FarhadG","description":":paperclip: Set and read data from a JavaScript \u003cscript\u003e tag","archived":false,"fork":false,"pushed_at":"2015-11-27T19:35:34.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T19:06:03.309Z","etag":null,"topics":["script","script-data"],"latest_commit_sha":null,"homepage":"http://farhadg.github.io/script-tag-data/","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/FarhadG.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-11-23T07:49:13.000Z","updated_at":"2017-04-04T18:54:30.000Z","dependencies_parsed_at":"2022-08-27T18:41:13.851Z","dependency_job_id":null,"html_url":"https://github.com/FarhadG/script-tag-data","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhadG%2Fscript-tag-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhadG%2Fscript-tag-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhadG%2Fscript-tag-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FarhadG%2Fscript-tag-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FarhadG","download_url":"https://codeload.github.com/FarhadG/script-tag-data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246073071,"owners_count":20719430,"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":["script","script-data"],"created_at":"2024-12-08T08:11:03.317Z","updated_at":"2025-03-28T17:44:09.625Z","avatar_url":"https://github.com/FarhadG.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://farhadg.github.io/script-tag-data\" target=\"_blank\"\u003eScript Tag Data\u003c/a\u003e\n=======================================================================================\n\nSet and read data from a `\u003cscript\u003e` tag. You can check this out being used in my \u003ca href=\"https://www.github.com/farhadg/repo-card\" target=\"_blank\"\u003eRepo Card\u003c/a\u003e project.\n\n### Installation\n\nBower\n```bash\n$ bower install script-tag-data --save\n```\n\nCDN\n```html\n\u003cscript src=\"https://rawgit.com/FarhadG/script-tag-data/master/script-tag-data.min.js\"\u003e\u003c/script\u003e\n```\n\n### Usage\n\n```html\n\u003cscript src=\"https://cdn.com/lib-name.js\" id=\"lib-name\" data-weather=\"sunny\" data... /\u003e\u003c/script\u003e\n```\n\nProvide the user / app a simple `\u003cscript\u003e` tag, a CSS `#id` and whatever data points as HTML5 `data` attributes.\n\n- Get all of the data values from a `\u003cscript\u003e` tag: `ScriptTagData.getData(scriptId)`\n- Only get the `\u003cscript\u003e` tag: `ScriptTagData.getScript(scriptId)`\n\n### Examples\n\nSome website with your `\u003cscript\u003e` tag, an ID and the desired data points.\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003ctitle\u003eTitle\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    ...\n\n    \u003cscript id=\"your-library\" src=\"./your-library.js\" data-car=\"pagani\" data-star-repo=\"yes, please :)\"\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nYour JS file where you have ScriptTagData library loaded by either referencing from here on \u003ca href=\"https://cdn.rawgit.com/FarhadG/script-tag-data/master/script-tag-data.min.js\" target=\"_blank\"\u003eGitHub\u003c/a\u003e or serving it yourself.\n```javascript\n/**\n * This returns the following:\n *\n * {\n *   car: 'pagani',\n *   starRepo: 'yes, please :)'\n * }\n */\n\nScriptTagData.getData('your-library');\n\n/**\n * This returns the just \u003cscript\u003e tag\n */\n\nScriptTagData.getData('your-library');\n```\n\n### Questions\n\nPlease use issues page for any questions or concerns.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhadg%2Fscript-tag-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarhadg%2Fscript-tag-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarhadg%2Fscript-tag-data/lists"}