14 Commits

Author SHA1 Message Date
022558b9e3 build(deps-dev): Bump webpack from 5.90.3 to 5.92.0 in /asciiplayer
Bumps [webpack](https://github.com/webpack/webpack) from 5.90.3 to 5.92.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.90.3...v5.92.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-12 11:28:42 +00:00
40e2bf0733 build(deps): Bump asciinema-player from 3.6.3 to 3.7.0 in /asciiplayer (#23)
Bumps [asciinema-player](https://github.com/asciinema/asciinema-player) from 3.6.3 to 3.7.0.
- [Release notes](https://github.com/asciinema/asciinema-player/releases)
- [Commits](https://github.com/asciinema/asciinema-player/compare/v3.6.3...v3.7.0)

---
updated-dependencies:
- dependency-name: asciinema-player
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:13:09 +08:00
c059193e68 build(deps-dev): Bump css-loader from 6.8.1 to 6.10.0 in /asciiplayer (#18)
Bumps [css-loader](https://github.com/webpack-contrib/css-loader) from 6.8.1 to 6.10.0.
- [Release notes](https://github.com/webpack-contrib/css-loader/releases)
- [Changelog](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/css-loader/compare/v6.8.1...v6.10.0)

---
updated-dependencies:
- dependency-name: css-loader
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:12:35 +08:00
ac193bf521 build(deps-dev): Bump mini-css-extract-plugin in /asciiplayer (#25)
Bumps [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) from 2.7.6 to 2.8.1.
- [Release notes](https://github.com/webpack-contrib/mini-css-extract-plugin/releases)
- [Changelog](https://github.com/webpack-contrib/mini-css-extract-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v2.7.6...v2.8.1)

---
updated-dependencies:
- dependency-name: mini-css-extract-plugin
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:12:20 +08:00
bb93413eda build(deps-dev): Bump webpack from 5.89.0 to 5.90.3 in /asciiplayer (#24)
Bumps [webpack](https://github.com/webpack/webpack) from 5.89.0 to 5.90.3.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.89.0...v5.90.3)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-15 18:12:09 +08:00
93343e6958 bump: bump version to 1.0.1 2023-11-05 10:48:22 +08:00
03b83a3f69 Merge branch 'main' of github.com:LamGC/wp-asciiplayer 2023-11-04 21:31:23 +08:00
a2ac3e6c05 build: Update existing dependencies to the latest compatible version. 2023-11-04 21:02:32 +08:00
6bca884750 build(deps): Bump asciinema-player from 3.4.0 to 3.6.1 in /asciiplayer (#10)
Bumps [asciinema-player](https://github.com/asciinema/asciinema-player) from 3.4.0 to 3.6.1.
- [Release notes](https://github.com/asciinema/asciinema-player/releases)
- [Commits](https://github.com/asciinema/asciinema-player/compare/v3.4.0...v3.6.1)

---
updated-dependencies:
- dependency-name: asciinema-player
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-24 10:31:14 +08:00
125fbc9c7c docs: Add the GitHub repository link in readme.txt. 2023-06-06 15:52:45 +08:00
90acf62446 style: Fix code style issues. 2023-06-06 15:16:57 +08:00
79cb9dfbee feat(plugin): Support obtaining adapters through jsdelivr CDN. 2023-06-06 15:15:36 +08:00
dc20a6f305 build(deps-dev): Bump webpack from 5.85.0 to 5.85.1 in /asciiplayer (#1)
Bumps [webpack](https://github.com/webpack/webpack) from 5.85.0 to 5.85.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.85.0...v5.85.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-06 00:44:01 +08:00
8d121b9028 ci: Introduce the dependabot to help check for updates to dependencies. 2023-06-06 00:38:13 +08:00
5 changed files with 408 additions and 324 deletions

11
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/asciiplayer" # Location of package manifests
schedule:
interval: "daily"

View File

@ -10,14 +10,14 @@ Author URI: https://blog.lamgc.moe
License: GNU GENERAL PUBLIC LICENSE Version 3.0
*/
const PLUGIN_VERSION = "1.0.0";
const PLUGIN_VERSION = '1.0.1';
const ASCIIPLAYER_TAG = "asciiplayer";
const ASCIIPLAYER_TAG = 'asciiplayer';
const AP_OPTION_USE_LOCAL_RESOURCES = "ap_use_local_resources";
const AP_OPTION_USE_LOCAL_RESOURCES = 'ap_use_local_resources';
// 是否使用本地资源, 如果可以的话, 建议使用 CDN.
add_option(AP_OPTION_USE_LOCAL_RESOURCES, false);
add_option(AP_OPTION_USE_LOCAL_RESOURCES, false, $autoload = true);
function handle_asciiplayer_code($attr = [], string $content = null): string
{
@ -55,7 +55,8 @@ function is_assoc($arr): bool
}
function set_default_value(array &$array, string $key, $value) {
function set_default_value(array &$array, string $key, $value)
{
if (!isset($array[$key])) {
$array[$key] = $value;
}
@ -65,24 +66,35 @@ add_shortcode(ASCIIPLAYER_TAG, 'handle_asciiplayer_code');
function load_scripts()
{
if (!is_single())
{
if (!is_single()) {
return;
}
global $post;
if( has_shortcode( $post->post_content, ASCIIPLAYER_TAG ) ) {
if (has_shortcode($post->post_content, ASCIIPLAYER_TAG)) {
wp_enqueue_script(
'asciiplayer-adapter-js',
plugin_dir_url(__FILE__) . '/asciiplayer/dist/bundle.js',
get_adapter_url() . '/dist/bundle.js',
array(),
PLUGIN_VERSION
);
wp_enqueue_style(
'asciiplayer-adapter-css',
plugin_dir_url(__FILE__) . '/asciiplayer/dist/styles.css',
get_adapter_url() . '/dist/styles.css',
array(),
PLUGIN_VERSION
);
}
}
add_action( 'wp_enqueue_scripts', 'load_scripts' );
add_action('wp_enqueue_scripts', 'load_scripts');
function get_adapter_url(): string
{
$use_local_resources = boolval(get_option(AP_OPTION_USE_LOCAL_RESOURCES, true));
$version = PLUGIN_VERSION;
if ($use_local_resources) {
return plugin_dir_url(__FILE__) . '/asciiplayer';
} else {
return "https://cdn.jsdelivr.net/npm/wp-asciiplayer-adapter@$version";
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "wp-asciiplayer-adapter",
"version": "1.0.0",
"version": "1.0.1",
"description": "asciinema-player for wordpress.",
"main": "dist/bundle.js",
"type": "module",
@ -21,7 +21,7 @@
"devDependencies": {
"css-loader": "^6.8.1",
"mini-css-extract-plugin": "^2.7.6",
"webpack": "^5.85.0",
"webpack": "^5.85.1",
"webpack-cli": "^5.1.3"
}
}

View File

@ -3,7 +3,7 @@ Contributors: lamgc
Tags: asciicast, asciiplayer, asciinema, ascii
Requires at least: 5.2
Tested up to: 6.2
Stable tag: 1.0.0
Stable tag: 1.0.1
Requires PHP: 7.4
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -12,6 +12,8 @@ Play Asciicast files in WordPress posts.
== Description ==
You can find the source code for all versions on [Github](https://github.com/LamGC/wp-asciiplayer).
This plugin helps you insert Asciicast files into the post, better presenting terminal operations to readers.
## Quick start