Skip to content

自動採番プラグインのプラグインのjQuery削除#230

Open
juridon wants to merge 1 commit into
kintone-samples:masterfrom
juridon:autonum-plugin-remove-jquery
Open

自動採番プラグインのプラグインのjQuery削除#230
juridon wants to merge 1 commit into
kintone-samples:masterfrom
juridon:autonum-plugin-remove-jquery

Conversation

@juridon
Copy link
Copy Markdown
Contributor

@juridon juridon commented May 25, 2026

jsRender以外のjQueryをはがしました。

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the jQuery dependency from the autonum (auto-numbering) plugin's desktop.js and config.js, replacing jQuery DOM/event/AJAX-helper calls with native DOM APIs (document.querySelector, addEventListener, classList, style, closest, etc.). jsRender ($.templates) usage is intentionally kept. The manifest version is bumped accordingly.

Changes:

  • Replace jQuery DOM/event calls in desktop.js (alert popup creation) with native DOM APIs and drop the jQuery IIFE parameter.
  • Replace jQuery in config.js (form value access, listeners, validation alerts, layout sizing, radio group handling) with native DOM APIs and drop the jQuery IIFE parameter.
  • Bump plugin version from 2.4.4 to 2.4.5.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
examples/autonum/manifest.json Version bump to 2.4.5.
examples/autonum/js/desktop.js Rewrites alertMessage popup construction with native DOM APIs; removes $ from IIFE.
examples/autonum/js/config.js Migrates form/value/event/layout/radio operations to native DOM APIs; removes $ from IIFE (jsRender $.templates retained).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 473 to +481
alert: function(element, mess) {
const elementParrent = $(element).parent();
elementParrent.parent().find('.kintoneplugin-alert').remove();
if ($('.kintoneplugin-alert').length === 0) {
$(element).focus();
const elementParrent = element.parentElement;
elementParrent.parentElement.querySelectorAll('.kintoneplugin-alert').forEach((el) => {
el.remove();
});
if (document.querySelectorAll('.kintoneplugin-alert').length === 0) {
element.focus();
}
elementParrent.after('<div class=\'kintoneplugin-alert\'><p>' + mess + '</p></div>');
elementParrent.insertAdjacentHTML('afterend', '<div class=\'kintoneplugin-alert\'><p>' + mess + '</p></div>');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これは既存の不具合ですね。
今回の修正と一緒に追加で対策していただけるとありがたいです。

Comment on lines +459 to +461
const alertMessage = document.createElement('div');
alertMessage.className = 'kintoneplugin-alert popup';
alertMessage.innerHTML = '<span>' + message + '</span>';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これも既存の不具合ですね。
今回の修正と一緒に追加で対策していただけるとありがたいです。

@SilverRusk
Copy link
Copy Markdown
Contributor

SilverRusk commented Jun 1, 2026

レビューコメント

1. config.js$.templates() が jQuery に依存しています

config.js 244行目で JsRender の API を jQuery の $ 経由で呼んでいます。

const tmpl = $.templates(configHtml);

JsRender は jQuery なしでも動作し、その場合は window.jsrender に API が公開されます。以下のように変更してください。

const tmpl = jsrender.templates(configHtml);

2. manifest.json から thirdparties/jquery.min.js が削除されていません

desktop(23行目)と config(35行目)の両方で thirdparties/jquery.min.js がまだ読み込まれています。上記 1 の修正後、jQuery はどこからも使われなくなるため、両方から削除してください。

修正の順番: 1 → 2 の順で行ってください。1 をせずに 2 だけ行うと $.templates() が動かなくなります。

3. Copyright (c) 2026 Cybozu に変更しましょう

プログラムを変更したので、西暦も変更しましょう。

  • Copyright (c) 2026 Cybozu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants