ken_nogi/Pleasanter/Extended/ExtendedScripts/ExtendedFunction.json.js
Kenichiro NOGI ce58cb4be4 初回コミット: dev配下(NodeSrv/Pleasanter等)をGitea管理下に統合
GitHub(nextgroup2706/ken_nogi)は今後使わず自社Gitea運用に切替え。
NodeSrvは旧リポジトリの履歴を破棄しファイルのみ統合(Dokploy用サービスアカウントは
別途mygit-admin/NodeSrv.gitに履歴あり)。notepmエクスポート(12GB)とPleasanter
インストーラzip(208MB)はサイズが大きいため.gitignoreで除外。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 15:37:06 +09:00

131 lines
4.3 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////// 汎用スクリプト
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function appendScript(URL) {
var el = document.createElement('script');
el.src = URL;
document.body.appendChild(el);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//CDN読込スクリプト
function loadcdn(mode, url) {
//console.log("LOAD CDN:" + url);
if (mode == 'script') {
let script = document.createElement('script');
script.setAttribute('src', url);
document.head.appendChild(script);
}
if (mode == 'css') {
let link = document.createElement('link');
link.setAttribute('href', url);
link.setAttribute('rel', 'stylesheet');
document.head.appendChild(link);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//日付から文字列生成
function getStringFromDate(date) {
//console.log(date);
if (date) {
var year_str = date.getFullYear();
var month_str = 1 + date.getMonth(); //月だけ+1すること
var day_str = date.getDate();
var hour_str = date.getHours();
var minute_str = date.getMinutes();
var second_str = date.getSeconds();
var format_str = 'YYYY/MM/DD hh:mm:ss';
month_str = ('0' + month_str).slice(-2);
day_str = ('0' + day_str).slice(-2);
hour_str = ('0' + hour_str).slice(-2);
minute_str = ('0' + minute_str).slice(-2);
second_str = ('0' + second_str).slice(-2);
format_str = format_str.replace(/YYYY/g, year_str);
format_str = format_str.replace(/MM/g, month_str);
format_str = format_str.replace(/DD/g, day_str);
format_str = format_str.replace(/hh/g, hour_str);
format_str = format_str.replace(/mm/g, minute_str);
format_str = format_str.replace(/ss/g, second_str);
return format_str;
} else {
return 0;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//汎用関数 OwnerIDからメールアドレスを取得
//複数ある場合は改行付きで返信
function getMailAddress(OwnerId) {
let tmp = '';
//OwnerIDが空欄または数値ではない場合は空欄を返信
if (OwnerId == "" || Number.isNaN(OwnerId)) return tmp;
let JSONdata = {
"ApiVersion": 1.2,
"Name": "getMailAddr",
"ApiKey": "6504c8a807677a3a576e10327f3c19876c55736ee45d4a845796b9e7f5e087bfd4bd0d8184863da8cf1733ca635111432ab334aea59102b06a96ee6d2c05190d",
"Params": {
"OwnerId": OwnerId
}
};
$.ajax({
'type': 'post',
'async': false,
'url': 'https://nextoffice.next-hd.co.jp/pleasanter/api/extended/sql',
'data': JSON.stringify(JSONdata),
'contentType': 'application/json',
'scriptCharset': 'utf-8',
'dataType': 'json',
success: function (data) {
//console.log(data);
$.each(data.Response.Data.Table, function (index, value) {
tmp += value.MailAddress + '\n';
});
},
error: function (data) {
console.log(data);
}
});
return tmp;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//12桁パスワード生成
function genPassword() {
let password_base1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+&%$#';
let password_base2 = '1234567890';
let password_base3 = '+&%$#';
let password = '';
for (let i = 0; i < 4; i++) {
password += password_base1.charAt(Math.floor(Math.random() * password_base1.length));
}
for (let i = 0; i < 3; i++) {
password += password_base2.charAt(Math.floor(Math.random() * password_base2.length));
}
for (let i = 0; i < 1; i++) {
password += password_base3.charAt(Math.floor(Math.random() * password_base3.length));
}
for (let i = 0; i < 3; i++) {
password += password_base1.charAt(Math.floor(Math.random() * password_base1.length));
}
for (let i = 0; i < 1; i++) {
password += password_base3.charAt(Math.floor(Math.random() * password_base3.length));
}
return password;
}