{"id":15520967,"url":"https://github.com/sloev/cccp","last_synced_at":"2025-04-19T12:18:00.162Z","repository":{"id":62561136,"uuid":"212515276","full_name":"sloev/cccp","owner":"sloev","description":null,"archived":false,"fork":false,"pushed_at":"2020-09-02T21:41:43.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T13:48:33.653Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/sloev.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","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-10-03T06:56:25.000Z","updated_at":"2020-09-02T21:41:46.000Z","dependencies_parsed_at":"2022-11-03T15:00:36.536Z","dependency_job_id":null,"html_url":"https://github.com/sloev/cccp","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/sloev%2Fcccp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fcccp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fcccp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sloev%2Fcccp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sloev","download_url":"https://codeload.github.com/sloev/cccp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249692904,"owners_count":21311420,"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-02T10:31:03.409Z","updated_at":"2025-04-19T12:18:00.140Z","avatar_url":"https://github.com/sloev.png","language":"Python","funding_links":["https://www.buymeacoffee.com/sloev"],"categories":[],"sub_categories":[],"readme":"[![Latest Version](https://img.shields.io/pypi/v/cccp.svg)](https://pypi.python.org/pypi/cccp) [![Python Support](https://img.shields.io/pypi/pyversions/cccp.svg)](https://pypi.python.org/pypi/cccp)\n\n# CCCP - Semi Server Side Rendered ☭\n\n\u003ca href=\"https://www.buymeacoffee.com/sloev\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-pink.png\" alt=\"Buy Me A Coffee\" height=\"51px\" width=\"217px\"\u003e\u003c/a\u003e\n\nCCCP uses [dominate](https://github.com/Knio/dominate) for generation of HTML in Python but **extends it with JavaScript snippets**\n\nIncludes:\n\n* Custom elements that can be rendered:\n    * Function declarations for simple DOM manipulation\n    * Indludes of external scripts (like jquery etc.)\n* Render function that can take a single or lists of *dominate HTML elements*\n\n## HTML tag manipulation using external sourcecode from GET's\n\nCCCP currently includes the following functions:\n\n(They all work by fetching html from a remote endpoint and manipulating a HTML tag with a given **id**)\n\n* **ReplaceHtml(url, id)**: Lets you replace the contents of an HTML tag\n* **AppendHtml(url, id)**: Lets you append to the end of a HTML tag\n* **PrependHtml(url, id)**: Lets you prepend to the beginning of a HTML tag\n\n## Usage\n\nInstall from **PYPI** (also installs [dominate](https://github.com/Knio/dominate)):\n\n```\n$ pip install cccp\n```\n\nImport modules:\n```\nfrom dominate import tags as t\nimport cccp\n```\n\nInclude needed definitions in HTML Head:\n\n```\nt.head(\n        [\n            cccp.REQUIRED,\n            cccp.BOOTSTRAP,\n            cccp.CreateReplaceHtmlFunc()\n        ]\n    )\n],\nt.body(\n    [\n        div(id=\"pageContent\")\n    ]\n)\n```\n\nUse functions inside HTML to manipulate select DOM elements:\n\n```\nt.button(\n    \"go to blog\",\n    onClick=cccp.replaceHtml(\n        \"http://127.0.0.1:9999/page/1\", \"pageContent\"\n    ),\n)\n```\n\n☝️This will replace the contents of the div `\"pageContent\"` with the **HTML** it `GET`'s from `\"http://127.0.0.1:9999/page/1\"`\n\nsee [examples/flask_example.py](https://github.com/sloev/cccp/blob/master/examples/flask_example.py) for a full demo!\n\n## RoadMap\n\n- [x] Simple functions for replacing/appending/prepending of DOM elements\n- [x] Elements for popular js dependencies:\n    - [x] **axios** used for HTTP requests (performs GET requests)\n    - [x] **jquery** used for HTTP requests (does the DOM manipulation)\n- [ ] Error handling in bundled javascript functions\n- [ ] Simple **html forms** using **json-schema** for form validation etc\n- [ ] Implement tests\n- [ ] **chartjs**:\n    - [ ] Element for including library\n    - [ ] Functions for creating different kinds of interactive charts\n- [ ] More DOM manipulation javascript functions:\n    - [ ] Function for creating a [Comet](https://en.wikipedia.org/wiki/Comet_(programming)) call and replacing/prepending/appending incomming html to the DOM\n    - [ ] Functions for deleting DOM elements\n    - [ ] Functions for pulling regularily (timer interupt GET's)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloev%2Fcccp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsloev%2Fcccp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsloev%2Fcccp/lists"}