diff --git a/LICENSE b/LICENSE index fdcfe87..65238c6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,18 +1,21 @@ MIT License -Copyright (c) 2026 Xiaoxiaobai5724 +Copyright (c) 2021 Golden -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -associated documentation files (the "Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the -following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO -EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index c34a315..3b8945d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,31 @@ -# clipboardjs +# XXB Clipboardjs -Add a modern approach to copy code to clipboard with code language display. \ No newline at end of file +![License](https://img.shields.io/badge/license-MIT-blue.svg) [![Latest Stable Version](https://img.shields.io/packagist/v/xxb5724/clipboardjs.svg)](https://packagist.org/packages/xxb5724/clipboardjs) + +A [Flarum](https://flarum.org) 2.0 extension. Use [Clipboardjs](https://clipboardjs.com/) to add copy code approach with code language display to your Flarum. You can choose 7 different button styles, like GitHub, SegmentFault, etc. + +Supports 47 common languages by default: +.properties, apacheconf, bash, bbcode, c, csharp, css, cpp, coffeescript, diff, django, docker, dockerfile, git, go, html, ini, java, javadoc, js, json, less, lua, makefile, markdown, nginx, objectivec, perl, php, powershell, properties, python, python-repl, regex, ruby, rust, sass, scss, sql, stylus, swift, typescript, vim, visual-basic, vue, xml, yaml. + +### Installation + +Install manually with composer: + +```sh +composer require xxb5724/clipboardjs +``` + +> **Migrating from ffans/clipboardjs** +> This extension was transferred to XXB and was previously published as `ffans/clipboardjs`. The XXB line begins at **2.0.0**, continuing the version history (the previous package reached 1.0.0). +> For forum admins, migration is a one-line change — swap the package, keep your settings and stored SEO data: +> ```sh +composer remove ffans/clipboardjs +composer require xxb5724/clipboardjs +php flarum cache:clear +> ``` + +### Updating + +```sh +composer update xxb5724/clipboardjs +``` \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..6cfc25c --- /dev/null +++ b/composer.json @@ -0,0 +1,47 @@ +{ + "name": "xxb5724/clipboardjs", + "description": "Add a modern approach to copy code to clipboard with code language display.", + "keywords": [ + "flarum", + "clipboardjs", + "code language" + ], + "type": "flarum-extension", + "license": "MIT", + "require": { + "flarum/core": "^2.0.0" + }, + "authors": [ + { + "name": "Golden", + "email": "littlegoldenjin@gmail.com", + "role": "Developer" + }, + { + "name": "Xiaoxiaobai5724", + "email": "odoorbell@163.com", + "role": "Developer" + } + ], + "support": { + "issues": "https://git.parlz.com/Xiaoxiaobai5724/clipboardjs/issues", + "source": "https://git.parlz.com/Xiaoxiaobai5724/clipboardjs" + }, + "homepage": "https://git.parlz.com/Xiaoxiaobai5724", + "autoload": { + "psr-4": { + "FFans\\ClipboardJS\\": "src/" + } + }, + "extra": { + "flarum-extension": { + "title": "XXB Clipboardjs", + "category": "feature", + "icon": { + "name": "far fa-clipboard", + "backgroundColor": "#00BFFF", + "color": "#ffffff" + } + } + } +} \ No newline at end of file diff --git a/extend.php b/extend.php new file mode 100644 index 0000000..cde65df --- /dev/null +++ b/extend.php @@ -0,0 +1,27 @@ +js(__DIR__.'/js/dist/forum.js') + ->css(__DIR__.'/resources/less/forum.less'), + (new Extend\Frontend('admin')) + ->js(__DIR__.'/js/dist/admin.js'), + new Extend\Locales(__DIR__ . '/resources/locale'), + (new Extend\Settings()) + ->serializeToForum('themeName', 'ffans-clipboardjs.theme_name') + ->serializeToForum('isCopyEnable', 'ffans-clipboardjs.is_copy_enable', 'boolVal') + ->serializeToForum('isShowCodeLang', 'ffans-clipboardjs.is_show_codeLang', 'boolVal'), +];