Commit f92daabd by Takatoshi Miura

db連携

parent 180fc1ea
// 名前空間
var ARCHIVE_UI = {};
$(function() {
// アーカイブ検索
$('#archive .search_form input[type="search"]').keyup(function(){
......@@ -8,43 +11,46 @@ $(function() {
return;
}
// 検索
var archiveList = CHAT_DB.getArchiveByName(keyword);
var archiveTemplate;
$.get({ url: "./template/template_archive_list.html", async: false }
, function(text) {
archiveTemplate = text;
});
// 検索結果を表示
CHAT_DB.callGetArchiveByName(keyword);
});
});
archiveList.forEach(function(archive) {
var typeImage = "";
switch(archive.archiveType) {
case 0: // 画像
typeImage = "icon/icon_collabo_picture.png";
break;
case 1: // 動画
typeImage = "icon/icon_collabo_videocam.png";
break;
case 2: // 音声
typeImage = "icon/icon_collabo_headset.png";
break;
case 3: // 文書
typeImage = "icon/icon_collabo_document.png";
break;
default: // その他
typeImage = "";
}
ARCHIVE_UI.refreshSearchScreen = function(keyword) {
var archiveList = CHAT_DB.getArchiveByName(keyword);
var archiveTemplate;
$.get({ url: "./template/template_archive_list.html", async: false }
, function(text) {
archiveTemplate = text;
});
let html = Mustache.render(archiveTemplate, {
archiveId: archive.archiveId,
fileName: archive.archiveName,
insertDate: archive.archiveDate,
typeImage: typeImage
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
});
archiveList.forEach(function(archive) {
var typeImage = "";
switch(archive.archiveType) {
case 0: // 画像
typeImage = "icon/icon_collabo_picture.png";
break;
case 1: // 動画
typeImage = "icon/icon_collabo_videocam.png";
break;
case 2: // 音声
typeImage = "icon/icon_collabo_headset.png";
break;
case 3: // 文書
typeImage = "icon/icon_collabo_document.png";
break;
default: // その他
typeImage = "";
}
let html = Mustache.render(archiveTemplate, {
archiveId: archive.archiveId,
fileName: archive.archiveName,
insertDate: archive.archiveDate,
typeImage: typeImage
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
});
});
};
......@@ -137,9 +137,27 @@ CHAT_DB.updateArchiveList = function() {
}
};
// アーカイブ一覧検索
var iosSearchArchiveList;
var searchWord;
getIosSearchArchiveList = function(archiveList) {
iosSearchArchiveList = archiveList;
ARCHIVE_UI.refreshSearchScreen(searchWord);
};
CHAT_DB.callGetArchiveByName = function(keyword) {
if (CHAT_UTIL.isIOS()) {
iosSearchArchiveList = "";
searchWord = keyword;
webkit.messageHandlers.getArchiveByName.postMessage({keyword});
} else if (CHAT_UTIL.isAndroid()) {
ARCHIVE_UI.refreshSearchScreen(keyword);
}
};
CHAT_DB.getArchiveByName = function(archiveName) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.getArchiveByName.postMessage({archiveName});
return JSON.parse();
} else if (CHAT_UTIL.isAndroid()) {
// TODO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment