/**
* サブミット
**/
// ネームスペースを設定
window.CmnLib = {};
// HTMLエスケープ
CmnLib.escapeHtml = function (str) {
if (typeof str !== 'string') {
return str;
}
// エスケープ文字
var escChars = {
'&': '&',
'"': '"',
"'": ''',
'<': '<',
'>': '>'
};
return str.replace(/[&"'<>]/g, function (match) {
return escChars[match];
});
};
CmnLib.isSubmit = false;
// 2重クリック防止用サブミット(id属性指定)
CmnLib.doubleClickSubmit = function (formId) {
if(!CmnLib.isSubmit) {
CmnLib.isSubmit = true;
$('#' + formId).submit();
}
}
// 画面表示が完了したタイミングで必ず2重クリック防止フラグを戻す。
window.onpageshow = function() {
CmnLib.isSubmit = false;
}
// サブミット(id属性指定)
CmnLib.submit = function (formId) {
$('#' + formId).submit();
}
//サブミット(授業画面外から授業画面へ遷移する際に使用)
CmnLib.attendUrlLinkSubmit = function (formId) {
$('#' + formId).append('');
CmnLib.doubleClickSubmit(formId);
}
// CSVダウンロード(id属性指定)
CmnLib.csvDownload = function (formId) {
$('#' + formId).submit();
}
//ファイルダウンロード(ウイルスチェックなし)
CmnLib.fileDownload = function (downloadUrl, bucket, filepath, filename) {
var _params = $.param({bucket:bucket, filepath:filepath, filename:filename});
$.ajax({
type: 'POST',
url: downloadUrl,
data: _params,
beforeSend: function(request) {
request.setRequestHeader($('meta[name="_csrf_token_header"]').attr('content'), $('meta[name="_csrf_token"]').attr('content'));
}
}).done(function (res, status, xhr) {
// ダウンロード用URLにアクセス
window.location.href = res.url;
}).fail(function (xhr, status, error) {
});
}
// ファイルダウンロード(ウイルスチェックあり)
CmnLib.fileDownloadVirusCheck = function (downloadUrl, bucket, filepath, filename, table) {
// バケット/ファイルパス/ファイル名をURLパラメータ化
var _params = $.param({bucket:bucket, filepath:filepath, filename:filename, table:table});
// ダウンロード中表示On処理
$('[data-remodal-id=virusCheckModal]').remodal().open();
$.ajax({
type: 'POST',
url: downloadUrl,
data: _params,
beforeSend: function(request) {
request.setRequestHeader($('meta[name="_csrf_token_header"]').attr('content'), $('meta[name="_csrf_token"]').attr('content'));
}
}).done(function (res, status, xhr) {
CmnLib._virusCheckModalClose();
// ダウンロード用URLにアクセス
window.location.href = res.url;
}).fail(function (xhr, status, error) {
CmnLib._virusCheckModalClose();
});
}
CmnLib._virusCheckModalClose = function () {
var timerid = setInterval(function(){
clearInterval(timerid);
// ダウンロード中表示Off処理
$('[data-remodal-id=virusCheckModal]').remodal().close();
}, 300);
}
// 帳票ダウンロード
CmnLib.reportDownload = function (downloadUrl, id) {
var _form = $('#' + id).serialize();
$.ajax({
type: 'POST',
url: downloadUrl,
data: _form,
beforeSend: function(request) {
request.setRequestHeader($('meta[name="_csrf_token_header"]').attr('content'), $('meta[name="_csrf_token"]').attr('content'));
}
}).done(function (res, status, xhr) {
window.location.href = res.url;
}).fail(function (xhr, status, error) {
});
}
// ファイルアップロード
CmnLib.fileUpload = function (uploadUrl) {
$.ajax({
type: 'POST',
url: uploadUrl,
beforeSend: function(request) {
request.setRequestHeader($('meta[name="_csrf_token_header"]').attr('content'), $('meta[name="_csrf_token"]').attr('content'));
}
}).done(function (res, status, xhr) {
// 遷移先
window.location.href = res.url;
}).fail(function (xhr, status, error) {
});
}
/**
* モーダル
**/
// モーダル生成
CmnLib.modalCreate = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
'
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ ' ' + content
+ '
'
+ '
'
+ '
'
+ '
'
);
}
/**
* モーダル
**/
// モーダル生成
CmnLib.modalCreateWhiteSpace = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
' + content + '
'
+ '
'
+ '
'
+ '
'
);
}
// モーダル生成(SP)
CmnLib.modalCreateSP = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ ' ' + content
+ '
'
+ '
'
+ '
'
+ '
'
);
}
// モーダル表示
CmnLib.modalOpen = function(id) {
$('[data-remodal-id=' + id + ']').remodal().open();
}
// モーダル非表示
CmnLib.modalClose = function(id) {
$('[data-remodal-id=' + id + ']').remodal().close();
}
// メンバー閲覧機能利用時
CmnLib.modalMemberImpersonation = function(id) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "#");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
メンバー閲覧機能では情報の登録・変更はできません。
'
+ '
'
+ '
'
+ '
'
);
}
//Booklooperモーダル生成(PC)
CmnLib.modalBooklooperCreatePC = function(id, url) {
jQuery(function($) {
$("." + id).attr("href", "#");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
電子書籍ビューアアプリケーション「BookLooper」を利用し、テキストが閲覧できます。
ログインの際、IDとパスワードを要求されますので、airUにご登録いただいているIDとパスワードを入力してください。
'
+ '
※airU側でのIDやパスワードの変更後、BookLooper側への連携に最大20分程度の時間が必要な場合があります。予めご了承ください。
'
+ '
ID:airUと同じID
パスワード:airUと同じパスワード
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
);
}
//Booklooperモーダル生成(SP)
CmnLib.modalBooklooperCreateSP = function(id, url, title) {
jQuery(function($) {
$("." + id).attr("href", "#");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ ' 電子テキストの閲覧について'
+ '
'
+ '
'
+ ' 電子書籍ビューアアプリケーション「BookLooper」を利用し、テキストが閲覧できます。
'
+ ' ログインの際、IDとパスワードを要求されますので、airUにご登録いただいているIDとパスワードを入力してください。'
+ '
'
+ '
'
+ ' ※airU側でのIDやパスワードの変更後、BookLooper側への連携に最大20分程度の時間が必要な場合があります。予めご了承ください。'
+ '
'
+ '
'
+ ' ID:airUと同じID
'
+ ' パスワード:airUと同じパスワード'
+ '
'
+ '
'
+ '
'
+ '
'+ title +'
'
+ '
'
+ '
');
}
//メンバー閲覧機能利用時(藝術学舎向け)
CmnLib.modalMemberImpersonationGakusha = function(id) {
jQuery(function($) {
$("." + id).attr("href", "#");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
メンバー閲覧機能では藝術学舎サイトは使用できません。
'
+ '
'
+ '
'
+ '
'
);
}
// 課題提出取消用モーダル生成
CmnLib.modalSubmissionCancelCreate = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ ' ' + content
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
);
}
//課題提出取消用モーダル生成(SP)
CmnLib.modalSubmissionCancellCreateSP = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ ' ' + content
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
);
}
// 授業アンケート用モーダル生成(PC)
CmnLib.modalAttendEnqueteCreate = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
' + content + '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
);
}
// 授業アンケート用モーダル生成(PC スクーリング用)
CmnLib.modalAttendEnqueteSchoolingCreate = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
' + content + '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
);
}
// 授業アンケート用モーダル生成(SP)
CmnLib.modalAttendEnqueteCreateSP = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
''
+ '
'
+ '
'
+ '
'
+ '
'
+ '
' + content + '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
);
}
// 授業アンケート用モーダル生成(SP スクーリング用)
CmnLib.modalAttendEnqueteSchoolingCreateSP = function(id, title, content) {
jQuery(function($) {
$("." + id).off("click");
$("." + id).attr("href", "javascript:void(0);");
$("." + id).attr("id", "");
$("." + id).attr("onclick", "CmnLib.modalOpen('"+id+"')");
});
document.write(
'
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
' + content + '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
+ '
'
);
}
//画像リサイズ(正方形の場合のみ使用)
CmnLib.imageReSizeForSquare = function(id) {
if(id === undefined || id === null) {
return;
}
var _image = new Image();
_image.onload = function(event) {
var orgWidth = _image.width;
var orgHeight = _image.height;
newWidth = $("#" + id).attr('width');
newHeight = $("#" + id).attr('height');
// 元画像から比率を算出
var scale = 0.0;
scale = newWidth / orgWidth;
if(scale * orgHeight > newHeight) {
scale = newHeight / orgHeight;
}
// 比率からリサイズ後のサイズ算出
var dstWidth = orgWidth * scale;
var dstHeight = orgHeight * scale;
$("#" + id).attr('width', dstWidth);
$("#" + id).attr('height', dstHeight);
};
_image.src = $("#" + id).attr('src');
}
// ローディング表示
CmnLib.showLoading = function () {
var html = (function () {/*
*/}).toString().match(/(?:\/\*(?:[\s\S]*?)\*\/)/).pop().replace(/^\/\*/, "").replace(/\*\/$/, "");
if($("#loading").length == 0){
$('body').append(html);
}
}
//ローディング非表示
CmnLib.removeLoading = function () {
$('#loading').remove();
}
//ネームスペース
AiruSchoolingCmnLib = {};
/**
*キーワード検索 押下
*/
//キーワード : テキスト項目
AiruSchoolingCmnLib.keywordClick = function() {
var keyword = $('#header-keyword').val();
var sitekind = $('#selectsite option:selected').val();
// 検索条件
var criteria = [];
if(keyword){
criteria.push({ 'name' : 'keyword', 'value' : keyword }, {'name2' : 'sitekind', 'value2' : sitekind})
} else {
criteria.push({ 'name' : 'keyword', 'value' : '' }, {'name2' : 'sitekind', 'value2' : sitekind})
}
// 検索実行
AiruSchoolingCmnLib.search(criteria);
};
/**
* 検索を実行
*/
AiruSchoolingCmnLib.search = function(criteria) {
// 検索条件をキーワード検索Formにhiddenとして追加
criteria.forEach(function (criterion) {
//キーワードをフォームに設定
$("
", {type: 'hidden', name: criterion['name'], value: criterion['value']}).appendTo('#siteSearchForm');
//ターゲットサイトをフォームに指定
$("
", {type: 'hidden', name: criterion['name2'], value: criterion['value2']}).appendTo('#siteSearchForm');
});
// キーワード検索Formをサブミット
CmnLib.doubleClickSubmit('siteSearchForm');
}
//クリップボードに学生公開用の授業画面URLを保存
CmnLib.clipboardWriteSchoolingClassUrl = function (schoolingClassPath) {
if (schoolingClassPath) {
const url = window.location.protocol + '//' + window.location.hostname + schoolingClassPath
navigator.clipboard.writeText(url)
.then(() => {
alert('共有可能なURLをクリップボードに保存しました。');
})
.catch(err => {
alert('共有可能なURLのクリップボードへの保存に失敗しました。');
});
}
}
$(function () {
// Enterキーでのsubmit を抑止
$('form:not([id*=menu])').each(function () {
this.addEventListener('submit', function (e) {
e.preventDefault();
})
});
});