Skip to content

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

Merged
sogabeharuka merged 5 commits into
kintone-samples:masterfrom
juridon:autonum-plugin-remove-jquery
Jun 4, 2026
Merged

自動採番プラグインのプラグインのjQuery削除#230
sogabeharuka merged 5 commits 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 thread examples/autonum/js/config.js Outdated
Comment thread examples/autonum/js/desktop.js Outdated
@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

@SilverRusk
Copy link
Copy Markdown
Contributor

下部の保存・キャンセルボタンが動作しません

config.js 315-320行目で document.querySelector を使っていますが、HTMLには button.plugin_submitbutton.plugin_cancel が上部と下部に2つずつあります。querySelector は最初の1つしか返さないため、下部のボタンにイベントが登録されていません。

// 現在のコード(上部のボタンにだけイベントが登録される)
document.querySelector('button.plugin_submit').addEventListener('click', () => {
  self.settingSave();
});
document.querySelector('button.plugin_cancel').addEventListener('click', () => {
  history.back();
});

querySelectorAll + forEach に変更してください。

document.querySelectorAll('button.plugin_submit').forEach((btn) => {
  btn.addEventListener('click', () => {
    self.settingSave();
  });
});
document.querySelectorAll('button.plugin_cancel').forEach((btn) => {
  btn.addEventListener('click', () => {
    history.back();
  });
});

@SilverRusk
Copy link
Copy Markdown
Contributor

前回の指摘事項はすべて対応されていることを確認しました。

1点だけ残っています。

thirdparties/moment-with-locales.min.js が削除されていません

Moment.js → Luxon に移行済みですが、thirdparties/moment-with-locales.min.js がファイルとして残っています。manifest からは参照されていないため動作には影響しませんが、不要なファイルなので削除してください。

@SilverRusk
Copy link
Copy Markdown
Contributor

指摘事項の対応を確認しました。動作確認もOKです。
マージOKです。

@sogabeharuka sogabeharuka merged commit 2ec9de0 into kintone-samples:master Jun 4, 2026
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.

4 participants