Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chat_webview
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abookCommunication
chat_webview
Commits
582948f7
Commit
582948f7
authored
Jun 08, 2021
by
Kim Peace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed archive.js
parent
3218bb7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
46 deletions
+84
-46
public_new/js/archive.js
+84
-46
No files found.
public_new/js/archive.js
View file @
582948f7
// 名前空間
// 名前空間
var
ARCHIVE_UI
=
{};
var
ARCHIVE_UI
=
{};
$
(
function
()
{
document
.
addEventListener
(
"DOMContentLoaded"
,
function
()
{
// アーカイブ検索
// アーカイブ検索
bindArchiveSearch
();
// iOSキーボード変換検知用
bindiOSKeyBoardEvent
();
});
ARCHIVE_UI
.
refreshSearchScreen
=
function
(
keyword
)
{
const
archiveList
=
CHAT_DB
.
getArchiveByName
(
keyword
);
const
typeImage
=
getArchiveTypeIconURL
(
archive
.
archiveType
);
getArchiveTemplate
().
then
(
function
(
archiveTemplate
)
{
archiveList
.
forEach
(
function
(
archive
)
{
let
html
=
renderArchiveTemplate
(
archiveTemplate
,
archive
.
archiveId
,
archive
.
archiveName
,
archive
.
archiveDate
,
typeImage
);
let
obj
=
jQuery
.
parseHTML
(
html
);
$
(
".overlay_src_msg"
).
append
(
obj
);
});
});
};
//* UTILS *//
const
ARCHIVE_TYPE
=
{
PICTURE
:
0
,
VIDEO
:
1
,
VOICE
:
2
,
DOCUMENT
:
3
,
};
var
getArchiveTypeIconURL
=
function
(
type
)
{
switch
(
type
)
{
case
ARCHIVE_TYPE
.
PICTURE
:
return
"icon/icon_collabo_picture.png"
;
case
ARCHIVE_TYPE
.
VIDEO
:
return
"icon/icon_collabo_videocam.png"
;
case
ARCHIVE_TYPE
.
VOICE
:
return
"icon/icon_collabo_headset.png"
;
case
ARCHIVE_TYPE
.
DOCUMENT
:
return
"icon/icon_collabo_document.png"
;
default
:
return
""
;
}
};
var
getArchiveTemplate
=
function
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
$
.
get
(
{
url
:
"./template/template_archive_list.html"
,
async
:
false
},
function
(
text
)
{
resolve
(
text
);
}
);
});
};
var
bindArchiveSearch
=
function
()
{
$
(
'#archive .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
$
(
'#archive .search_form input[type="search"]'
).
keyup
(
function
(
e
)
{
var
keyword
=
$
(
'#archive .search_form input[type="search"]'
).
val
();
var
keyword
=
$
(
'#archive .search_form input[type="search"]'
).
val
();
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
const
enterKeyPressed
=
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
;
if
(
keyword
.
length
!=
0
&&
keyword
!=
""
)
{
const
keywordEmpty
=
keyword
==
""
||
keyword
.
length
<
2
;
const
keywordNotEmpty
=
keyword
.
length
!=
0
&&
keyword
!=
""
;
if
(
enterKeyPressed
)
{
if
(
keywordNotEmpty
)
{
$
(
'#archive .search_form input[type="search"]'
).
blur
();
$
(
'#archive .search_form input[type="search"]'
).
blur
();
return
;
return
;
}
}
}
else
if
(
keyword
==
""
||
keyword
.
length
<
2
)
{
}
else
if
(
keyword
Empty
)
{
$
(
".overlay_src_msg"
).
empty
();
$
(
".overlay_src_msg"
).
empty
();
return
;
return
;
}
}
...
@@ -18,13 +81,15 @@ $(function () {
...
@@ -18,13 +81,15 @@ $(function () {
ARCHIVE_UI
.
refreshSearchScreen
(
keyword
);
ARCHIVE_UI
.
refreshSearchScreen
(
keyword
);
if
(
e
.
KeyCode
==
13
||
e
.
key
==
"Enter"
)
{
if
(
e
nterKeyPressed
)
{
$
(
'#archive .search_form input[type="search"]'
).
blur
();
$
(
'#archive .search_form input[type="search"]'
).
blur
();
return
;
return
;
}
}
// 検索結果を表示
// 検索結果を表示
});
});
// iOSキーボード変換検知用
};
var
bindiOSKeyBoardEvent
=
function
()
{
$
(
'#archive .search_form input[type="search"]'
).
on
(
$
(
'#archive .search_form input[type="search"]'
).
on
(
"compositionend"
,
"compositionend"
,
function
()
{
function
()
{
...
@@ -35,46 +100,19 @@ $(function () {
...
@@ -35,46 +100,19 @@ $(function () {
}
}
}
}
);
);
});
};
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
;
}
);
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
);
var
renderArchiveTemplate
=
function
(
$
(
".overlay_src_msg"
).
append
(
obj
);
html
,
archiveId
,
archiveName
,
archiveDate
,
typeImageURL
)
{
return
Mustache
.
render
(
html
,
{
archiveId
:
archiveId
,
fileName
:
archiveName
,
insertDate
:
archiveDate
,
typeImage
:
typeImageURL
,
});
});
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment