{"id":15099260,"url":"https://github.com/kurotsmile/carrot-framework-web","last_synced_at":"2026-01-07T01:32:34.280Z","repository":{"id":247499061,"uuid":"826014097","full_name":"kurotsmile/Carrot-Framework-Web","owner":"kurotsmile","description":"Template for Web","archived":false,"fork":false,"pushed_at":"2024-12-01T03:43:02.000Z","size":772,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T16:20:06.912Z","etag":null,"topics":["web-api","web-app","web-application","web-components","web-development","web-json-extract","webapp"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/kurotsmile.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-09T00:23:37.000Z","updated_at":"2024-12-01T03:43:06.000Z","dependencies_parsed_at":"2024-09-15T04:12:57.819Z","dependency_job_id":"1b050c89-c2b4-4b05-9af7-ec97719ef287","html_url":"https://github.com/kurotsmile/Carrot-Framework-Web","commit_stats":{"total_commits":204,"total_committers":1,"mean_commits":204.0,"dds":0.0,"last_synced_commit":"0f9b9bcc09ae282a3bbf8bc681aece5407f45e2f"},"previous_names":["kurotsmile/carrot-framework-web"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotsmile%2FCarrot-Framework-Web","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotsmile%2FCarrot-Framework-Web/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotsmile%2FCarrot-Framework-Web/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurotsmile%2FCarrot-Framework-Web/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kurotsmile","download_url":"https://codeload.github.com/kurotsmile/Carrot-Framework-Web/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245878930,"owners_count":20687297,"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":["web-api","web-app","web-application","web-components","web-development","web-json-extract","webapp"],"created_at":"2024-09-25T17:08:48.909Z","updated_at":"2026-01-07T01:32:34.215Z","avatar_url":"https://github.com/kurotsmile.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Carrot Framework for Web Apps\n\nCarrot Framework is a tool designed to support various functions for web applications.\n\n## Introduction\n\nCarrot-Framework-Web is a web application JavaScript support tool designed to enhance the development process by providing a variety of utility functions\n\n`Carrot.js` is the main file of this framework. It initializes the framework and provides global access to its functionalities.\n\n### Initialization\n\nClone the project into your project and pay attention to the path, you should not change the structure or name of the `Carrot-Framework-Web` folder\n\n```javascript\n\u003cscript src=\"Carrot-Framework-Web/Carrot.js\"\u003e\u003c/script\u003e\n```\n\n### Global Variable\n```javascript\n$(document).ready(function(){\n    cr.onLoad();\n});\n```\n\n## Methods\n\nHere is a list of key methods that can be quickly integrated into your web building process\n- Programming support\n\t- [loadJs](#loadJs)\n\t- [arg](#arg)\n\t- [goto](#go_to)\n\t- [top](#top)\n\t- [paste](#paste)\n\t- [copy](#copy)\n\t- [limitItem](#limitItem)\n\t- [shuffle](#shuffle)\n\t- [random](#get_random)\n\t- [download](#download)\n\t- [sortKeys](#sortKeys)\n\t- [setVer](#setVer)\n- Methods of interaction interface with user\n\t- [add_btn_top](#add_btn_top)\n\t- [share](#share)\n\t- [showSearch](#showSearch)\n\t- [show_youtube](#show_youtube)\n- The method used to process and display data\n\t- [icon](#icon)\n\t- [convertISOToLocalDatetime](#convertISOToLocalDatetime)\n\t- [convertLocalDatetimeToISO](#convertLocalDatetimeToISO)\n\n### loadJs\n`cr`.loadJs(path_js, obj_call, func_call = \"show\")\n\nDynamically loads a JavaScript file and executes a specified function. Phương thức này giúp thêm các thư viện , class, function javascript khi cần thiết để tránh quá trình tải lâu và dư thừa dữ liệu nạp lúc khởi tạo\n\n- `path_js`: Path to the JavaScript file.\n- `obj_call`: Object to call the function on.\n- `func_call`: Name of the function to call (default is \"show\").\n\n```javascript\ncr.loadJs('path/to/script.js', window, 'initialize');\n```\n\n### add_btn_top\nAdds a button at the top of the web app.\n\n```javascript\n    cr.add_btn_top();\n```\n\n### paste\nPastes the content.\n\n\u003e `cr`.**paset**(emp)\n\n- Parameters\n\t- `emp` (string): The element from which the content will be paste.\n\n```javascript\n    var emp=\"#input_val\";\n    cr.paste(emp);\n```\n\n### copy\n\nCopies the content.\n\n\u003e `cr`.**copy**(emp)\n\n- Parameters\n\t- `emp` (string): The element from which the content will be copied.\n\n```javascript\n    cr.copy(\"#input_va\");\n```\n\n### share\n\nShares the specified URL with an optional title and tip.\n\n\u003e `cr`.**share**(url='', title='', tip='Get Now')\n\n- Parameters\n\t- `url` (string): The URL to share.\n\t- `title` (string): The title of the share content.\n\t- `tip` (string): The tip for the share action.\n\n```javascript\n//Share url current \ncr.share(); \n\n//Share link customer \ncr.share('http://example.com');\n\n//Share link extended \ncr.share('http://example.com','Web Example','Visit now');\n\n```\n\n\n### limitItem\n\nLimits the number of items in an array to the specified length.\n\n\u003e `cr`.**limitItem**(array, length)\n\n- Parameters\n\t- `array` (Array):  The array to limit.\n\t- `length` (number): The maximum number of items.\n\n```javascript\n\tvar code=[\"c#\",\"javascript\",\"java\",\"c++\",\"python\",\"c\"];\n\tcr.limitItem(code,2); //return c#,javascript,java\n```\n\n### shuffle\n\nShuffles the items in an array randomly.\n\n\u003e `cr`.**shuffle**(array)\n\n- Parameters\n\t- `array` (Array):  The array to zhuffles.\n\n### get_random\n\nReturns a random item from the array.\n\n\u003e `cr`.**get_random**(array)\n\n\u003e `cr`.**random**(array)\n\n- Parameters\n\t- `array` (Array):  The list from which to get a random item.\n\n### sortKeys\n\n\u003e `cr`.**sortKeys**(obj)\n\n- Tham số\n\t- `obj` (Object) : Đối tượng hoặc một object json\n\n### arg\n\nReturns `false` if the specified URL parameter does not exist.\n\n\u003e `cr`.**arg**(sParam)\n\n- Parameters:\n\t- `sParam` (string): The URL parameter to check.\n\n### go_to\n\nNavigates to the specified element with optional start and done actions.\n\n\u003e `cr`.**go_to**(emp, act_start=null, act_done=null)\n\n\u003e `cr`.**goto**(emp, act_start=null, act_done=null)\n\n- Parameters:\n\t- `emp` (string): The element to navigate to.\n\t- `act_start` (function): The callback function when the action starts.\n\t- `act_done` (function): The callback function when the action is done.\n\n### top\n\nSimilar to `cr.go_to`, but navigates to the top.\n\n\u003e `cr`.**top**(act_start=null, act_done=null)\n\n- Parameters:\n\t- `act_start` (function): The callback function when the action starts.\n\t- `act_done` (function): The callback function when the action is done.\n\n```javascript\n\t//Basic\n\tcr.top();\n\n\t//Full\n\tcr.top(()=\u003e{\n\t\talert(\"Action Start\");\n\t},()=\u003e{\n\t\talert(\"End Scroll Done\");\n\t});\n```\n\n### get\nFetches HTML data from the specified URL with optional done and fail actions.\n\n\u003e `cr`.**get**(url, act_done=null, act_fail=null)\n\n- Parameters:\n\t- `url` (string) : Địa chỉ hoặt đường dẫn tới trang web , tệp html.\n\t- `act_done` (function): Phương thức được gọi khi thành công và trả về dữ liệu của trang theo địa chỉ url\n\t\t- Giá trị trả về (html) : Dữ liệu trả về là dạng string html\n\t- `act_fail` (function): Phương thức được gọi khi quá trình tải gặp sự cố\n\n```javascript\n\tcr.get(\"data/about.html\",(data)=\u003e{\n\t\t$(\"#container\").html(data);\n\t},()=\u003e{\n\t\talert(\"Không thể tải tệp\");\n\t});\n```\n### set_color_active\n\nSets the active color.\n\n\u003e `cr`.**set_color_active**(color)\n\n- Parameters:\n\t- `color` (string) ; Màu sắc cho các mục nỗi bật \n\n```javascript\n\tcr.set_color_active(\"#FFFFFF\");\n```\n\n### set_color_btn\n\nSets the button color.\n\n\u003e `cr`.**set_color_btn**(color)\n\n - Parameters:\n\t- `color` (string) ; Màu sắc cho các nút và các công cụ điều khiển \n\n```javascript\n\tcr.set_color_btn(\"#00FF00\");\n```\n### setColor\nSets the color.\n\n\u003e `cr`.**setColor**(color)\n\nPhương thức này tương tự `cr`.**set_color_btn**\n\n```javascript\n\tcr.setColor(\"#00FFFF\");\n```\n\n### cr.setSiteName(name)\n\nSets the site name.\n\n\u003e `cr`.**setSiteName**(name)\n\n- Tham số\n\t- `name` (string) : Tên của web app, tham số này được áp dụng trong các trang pp và tos\n\n```javascript\n\tcr.setSiteName(\"Music Store\");\n```\n\n### cr.setSiteUrl(url)\nSets the site URL. giá trị này có thể áp dụng trong chức năng show_pp và show_tos\n\n- Tham số\n\t- `url` (string) : url của website hoặt web app\n\n```javascript\n\tcr.setSiteUrl(\"https://example.com\");\n```\n### setVer\nSets the version to avoid cache memory issues.\n\n\u003e `cr`.***setVer***(ver)\n\n- Tham số \n\t- `ver` (stirng) : số phiên bản các file để tải lại các file trên trình duyện tránh sự lưu trữ tạm\n\n```javascript\n\tcr.setVer(\"0.0.1\");\n```\n\n### download\n\n\u003e `cr`.***download**(data,file_name,type_file='application/json');\n\n- Tham số\n\t- `data` (string) : Dữ liệu cho file tải xuống. dữ liệu này sẽ được tự động chuyển đổi định dạng cho phù hợp với tham số `type_file`\n\t- `file_name` (string) : Tên tệp tải xuống\n\t- `type_file` (string) : Loại định dạng của file tải xuống\n\t\t- Text Media Types:\n\t\t\t- text/plain: Văn bản thuần (plain text)\n\t\t\t- text/html: HTML\n\t\t\t- text/css: CSS\n\t\t\t- text/javascript: JavaScript (có thể dùng application/javascript)\n\t\t- Image Media Types:\n\n\t\t\t- image/jpeg: JPEG hình ảnh\n\t\t\t- image/png: PNG hình ảnh\n\t\t\t- image/gif: GIF hình ảnh\n\t\t\t- image/webp: WebP hình ảnh\n\t\t\t- image/svg+xml: SVG hình ảnh\n\t\t- Audio Media Types:\n\t\t\t- audio/mpeg: MP3 âm thanh\n\t\t\t- audio/wav: WAV âm thanh\n\t\t\t- audio/ogg: Ogg âm thanh\n\t\t\t- audio/aac: AAC âm thanh\n\t\t- Video Media Types:\n\t\t\t- video/mp4: MP4 video\n\t\t\t- video/webm: WebM video\n\t\t\t- video/ogg: Ogg video\n\t\t- Application Media Types:\n\t\t\t- application/json: JSON dữ liệu\n\t\t\t- application/xml: XML dữ liệu\n\t\t\t- application/x-www-form-urlencoded: Dữ liệu biểu mẫu URL-encoded\n\t\t\t- application/octet-stream: Dữ liệu nhị phân\n\t\t\t- application/pdf: PDF tài liệu\n\t\t\t- application/zip: ZIP tập tin\n\t\t- Font Media Types:\n\t\t\t- font/woff: Web Open Font Format (WOFF)\n\t\t\t- font/woff2: Web Open Font Format 2 (WOFF2)\n\t\t\t- font/ttf: TrueType Font (TTF)\n\t\t\t- font/otf: OpenType Font (OTF)\n\n## Data Carrot\nNhững phương thức xử lý và xây Dữ liệu cho web app bạn có thể gọi các phương thức liên quan để việc xử lý,xây dựng các biểu mẫu dữ liệu và hiển thị dữ liệu ở hai biến toàn cục này:\n\n \u003e `cr_data` or `cr.data`\n\n### icon\n\nTrả về biểu tượng tương ứng liên quan với từ tham số từ khóa\n\n\u003e `cr_data`.**icon**(key);\n\n\u003e `cr_data`.**getIconBykey**(key);\n\n- Tham số \n\t- `key` (string) : tên từ khóa hoặc tên trường dữ liệu\n\n```javascript\n\tvar icon_file_mp3=cr_data.icon('mp3');\n\t$(\"#title\").append(icon_file_mp3+\" Love You\");\n```\n### convertISOToLocalDatetime\n\nDùng để chuyển đổi thời gian ISO thành định dạng thời giang phù hợp với kiểu DateTime javascript\n\n\u003e `cr_data`.**convertISOToLocalDatetime**(isoString)\n\n```javascript\n\tvar date_loca=cr_data.convertISOToLocalDatetime('2022-12-12T13:00:09Z');\n\tconsole.loger(date_loca);\n\t//out: 12/12/2022 00:09PM\n```\n### convertLocalDatetimeToISO\n\n\u003e `cr_data`.**convertLocalDatetimeToISO**(datetimeLocalString)\n\nTrái ngược với phương thức convertISOToLocalDatetime dùng để chuyển đổi định dạng thời giang dữ liệu cục bộ thành định dạng thời gian theo chứng chỉ ISO quốc tế\n\n```javascript\nvar date_pub=cr_data.convertLocalDatetimeToISO('12/12/2022 00:09PM');\n\tconsole.loger(date_pub);\n\t//out: 2022-12-12T13:00:09Z\n```\n\n## UI Box\nNhững phương thức tích hợp giao diện để người dùng tương tác\n\n### show_setting\nPhương thức hiện hộp thoại tùy chỉnh cài đặt web với trường ngôn ngữ , kiểu dáng nút trở về đầu trang và bạn có thể thêm các trường tùy biến vào tham số **html_extension**\n\n\u003e `cr`.**show_setting**(act_done=null,html_extension='')\n\n- Parameters:\n\t- `act_done` (function): Phương thức gọi lại khi bấm nút hoàn tất (ok) trong cửa sổ cài đặt \n\t\t- Giá trị trả về (json) : data.lang\n\n\t- `html_extension` (string):Các trường html tùy biến thêm vào phần cài đặt\n\n### show_pay\nDisplays a payment prompt with the specified item name, tip, price, value, and type.\n\n\u003e `cr`.**show_pay**(name_item='Test item', tip='Please start paying to use the corresponding function', price_item='2.00', val='', type='link')\n\n- Parameters:\n\t- `name_item` (string) : Tên sản phẩm hoặc dịch vụ đơn hàng\n\t- `tip` (string) : Mô tả ngắn cho đơn hàng\n\t- `price_item` (float srting) : giá\n\t- `val` : tham số lưu lại giá trị đơn hàng thường dùng cho cách đơn hàng dịch vụ . Sau khi thanh toán thành công sẽ lưu lại dữ liệu cục bộ là `localStorage`.**setItem**(`type`,`val`)\n\t- `type` : truyền vào tham số khác với *link* nếu bạn muốn thiết lập đơn hàng cho chức năng tải file\n\n```javascript\n\t//Buy nomal download link\n\tvar name_file=\"lovestory.epub\";\n\tcr.show_pay(\"Buy Book\",\"Pay for download ebook file(\"+name_file+\")\",\"3.00\",\"path/\"+name_file);\n\n\t//Buy Service\n\tcr.show_pay(\"Buy Vip\",\"Unlock func download ebooks file\",\"all_ebook\",\"type_user\");\n```\n\n### show_youtube\n\nHiện hộp thoại xem video youtube\n\n\u003e `cr`.**show_youtube**(link_ytb,html_extension=\"\",act_done_show=null)\n\n- tham số \n\t- `link_ytb` (url) : url link youtube \n\t-  `html_extension` : html chèn mở rộng thêm các tính năng cho hộp thoại\n\t-  `act_done_show` : phương thức được gọi để xử lý khi hộp thoại được bật\n\n```javascript\n\t//Basic\n\tcr.show_youtube(\"https://youtu.be/lj9lCUGAQBY\");\n\n\t//full\n\tvar html_btn='\u003cdiv id=\"all_btn\"\u003e\u003c/div\u003e';\n\tcr.show_youtube(\"https://youtu.be/lj9lCUGAQBY\",html_btn,()=\u003e{\n\t\t$(\"#all_btn\").append('\u003cbutton\u003eInfo\u003c/button\u003e');\n\t});\n```\n### getYouTubeVideoId\n\nPhương thức lấy ID của liên kết video youtube\n\n### show_donation\n\n### showSearch\n\nDisplays the search bar and returns the search key.\n\n\u003e `cr`.**showSearch*(act_done=null)\n\n- Parameters:\n\t- `act_done` (function): The callback function when the search is done.\n\t\t- giả trị trả về (string) : là key tìm kiếm\n\n```javascript\n\tcr.showSearch((key)=\u003e{\n\t\talert(\"Xử lý từ khóa \"+key);\n\t});\n```\n\n## Register SSL For IIS\n\n- 1 Đăng ký SSL cho máy chủ IIS window\n\nChạy file `Register SSL For IIS.ps1` ở trong dự án rồi nhập host name (ví dụ `abc.store.com`)\n\n- 2 Xuất bản file chứng chỉ \n\nsau khi đã tạo chững chỉ bạn cần xuất file chứng chỉ từ Management Console và nhập vào trình chứng chỉ của IIS\n\nXuất bản chứng chỉ từ chương trình quảng lý chứng chỉ window\n\nChạy chương trình từ cửa sổ run gõ \n\n\u003e certlm.msc\n\n- 3 Nhập và khởi chạy chổng 443 cho giao thức https từ IIS manager\n\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurotsmile%2Fcarrot-framework-web","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkurotsmile%2Fcarrot-framework-web","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurotsmile%2Fcarrot-framework-web/lists"}