Browse Source

0.0.0.29.6

master
racha.non 9 years ago
parent
commit
fe439b7d15
  1. 7
      index.html
  2. 80
      js/stdb.js
  3. 99
      modal.html
  4. 115
      stat.html
  5. 47
      stdb.html
  6. 141
      testItem.html
  7. 152
      testJWT.html
  8. 87
      testUpload.html
  9. 104
      uploadFile.html

7
index.html

@ -42,6 +42,7 @@
<div> <div>
<i class="medium material-icons " style="">thumb_up</i> <i class="medium material-icons " style="">thumb_up</i>
<div class="flexCenter" style="font-size:18px;" id='like'></div> <div class="flexCenter" style="font-size:18px;" id='like'></div>
<div style="font-size:14px;color:#868686" id='like'>(Last 7 day)</div>
</div> </div>
</li> </li>
@ -50,6 +51,7 @@
<div> <div>
<i class="medium material-icons " style="color:#4CAF50">trending_up</i> <i class="medium material-icons " style="color:#4CAF50">trending_up</i>
<div class="flexCenter" style="font-size:18px;" id='status'></div> <div class="flexCenter" style="font-size:18px;" id='status'></div>
<div style="font-size:14px;color:#868686" id='like'>(Last 7 day)</div>
</div> </div>
</li> </li>
@ -58,6 +60,7 @@
<div> <div>
<i class="medium material-icons " style="">people</i> <i class="medium material-icons " style="">people</i>
<div class="flexCenter" style="font-size:18px;" id='accountActive'></div> <div class="flexCenter" style="font-size:18px;" id='accountActive'></div>
<div style="font-size:14px;color:#868686" id='like'>(Last 7 day)</div>
</div> </div>
</li> </li>
@ -73,8 +76,8 @@
<i style='margin-right:10px'></i> <i style='margin-right:10px'></i>
</div> </div>
<div class="flexCenterSpace" style="margin-top:-5px;"> <div class="flexCenterSpace" style="margin-top:-5px;">
<i id="numAll" style='margin-right:15px'>0</i> <i id="numAll" style='margin-right:15px'></i>
<i id="numPhoto" style='margin-right:10px'>0</i> <i id="numPhoto" style='margin-right:10px'></i>
</div> </div>
</li> </li>

80
js/stdb.js

@ -8,6 +8,8 @@ var nextUrl = ''
htmlText = '' htmlText = ''
var dataUri = [] var dataUri = []
console.log('Welcome to Web STDB')
function getStartPage(){ function getStartPage(){
sesToken = sessionStorage.getItem('token'); sesToken = sessionStorage.getItem('token');
if( sesToken === null){ if( sesToken === null){
@ -85,7 +87,7 @@ function getUser(status){
token = sessionStorage.getItem("token") token = sessionStorage.getItem("token")
var searchText = '' var searchText = ''
if (status === 'search'){ if (status === 'search'){
console.log("search") // console.log("search")
dataInstrument = [] dataInstrument = []
searchText = '&search='+document.getElementById("searchId").value searchText = '&search='+document.getElementById("searchId").value
start = 0 start = 0
@ -94,12 +96,12 @@ function getUser(status){
htmlText = ''; htmlText = '';
modalText = ''; modalText = '';
dataInstrument = []; dataInstrument = [];
console.log(' >> end of search button'); // console.log(' >> end of search button');
console.log(dataInstrument) // console.log(dataInstrument)
console.log($('#card').html()); // console.log($('#card').html());
} }
var url = 'http://www.serv.stdb.most.go.th/api/v2/instrument/?organization='+respone.organizations[0].id+searchText; var url = 'http://www.serv.stdb.most.go.th/api/v2/instrument/?organization='+respone.organizations[0].id+searchText;
console.log('url = ' + url) // console.log('url = ' + url)
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: url, url: url,
@ -120,7 +122,7 @@ function getUser(status){
function getDataStat(respone){ function getDataStat(respone){
getUser('first'); getUser('first');
// console.log(respone) // console.log(respone)
document.getElementById("like").innerHTML = '0' document.getElementById("like").innerHTML = respone.items.completed
document.getElementById("status").innerHTML = '+'+respone.items.recent_update document.getElementById("status").innerHTML = '+'+respone.items.recent_update
document.getElementById("accountActive").innerHTML = respone.users.active document.getElementById("accountActive").innerHTML = respone.users.active
document.getElementById("numAll").innerHTML = respone.items.all document.getElementById("numAll").innerHTML = respone.items.all
@ -129,28 +131,28 @@ function getDataStat(respone){
function getData(respone) { function getData(respone) {
// console.log(dataInstrument) // console.log(dataInstrument)
console.log(respone) // console.log(respone)
console.log("---------------- Next") // console.log("---------------- Next")
console.log(respone.next) // console.log(respone.next)
// console.log(respone.results) // console.log(respone.results)
console.log(dataInstrument) // console.log(dataInstrument)
dataInstrument = dataInstrument.concat(respone.results) dataInstrument = dataInstrument.concat(respone.results)
console.log('*******ฬฬฬฬฬฬฬฬฬ*********') // console.log('*******ฬฬฬฬฬฬฬฬฬ*********')
console.log(respone.results) // console.log(respone.results)
var htmlText = '' var htmlText = ''
var modalText = '' var modalText = ''
for (i=start;i<dataInstrument.length;i++ ){ for (i=start;i<dataInstrument.length;i++ ){
console.log('========='+i+'==========') // console.log('========='+i+'==========')
// console.log(dataInstrument[i].name) // console.log(dataInstrument[i].name)
htmlText = htmlText+"<div id='"+i.toString()+"'' class='cardStyle' onclick='modalItem("+i.toString()+")'>" htmlText = htmlText+"<div id='"+i.toString()+"'' class='cardStyle' onclick='modalItem("+i.toString()+")'>"
+'<h3 style="font-size:26px;margin-left:20px " >'+dataInstrument[i].name+'</h3>' +'<h3 style="font-size:26px;margin-left:20px " >'+dataInstrument[i].name+'</h3>'
+'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >#'+dataInstrument[i].custom_id+'</h3>' +'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >#'+dataInstrument[i].custom_id+'</h3>'
+'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >@'+dataInstrument[i].caretaker+'</h3>' +'<h3 style="color:#9E9E9E;font-size:22px;margin-left:20px " >@'+dataInstrument[i].caretaker+'</h3>'
+'</div>'; +'</div>';
console.log(dataInstrument[i].clips.length) // console.log(dataInstrument[i].clips.length)
if(dataInstrument[i].clips.length === 0){ if(dataInstrument[i].clips.length === 0){
console.log('========= = 0 =========') // console.log('========= = 0 =========')
imageTag = '<div class="flexCenter">' imageTag = '<div class="flexCenter">'
+'<div class="flexCenter bgImage">' +'<div class="flexCenter bgImage">'
+'<div class="flexCenter">' +'<div class="flexCenter">'
@ -176,7 +178,7 @@ function getData(respone) {
else{ else{
var style4 = '' var style4 = ''
if(dataInstrument[i].clips.length >= 2){ if(dataInstrument[i].clips.length >= 2){
console.log('*********** >= 2 ***********') // console.log('*********** >= 2 ***********')
var tagMiniImage = '' var tagMiniImage = ''
var loopImage = dataInstrument[i].clips.length var loopImage = dataInstrument[i].clips.length
if (loopImage > 4){ if (loopImage > 4){
@ -200,7 +202,7 @@ function getData(respone) {
} }
} }
else{ else{
console.log('*********** < 2 ***********') // console.log('*********** < 2 ***********')
var tagMiniImage = '' var tagMiniImage = ''
for(j=1;j<4;j++){ for(j=1;j<4;j++){
if (j==3){ if (j==3){
@ -316,11 +318,11 @@ function uploadImage(idImage) {
$(":file").change(function () { $(":file").change(function () {
if (this.files && this.files[0] && check===0) { if (this.files && this.files[0] && check===0) {
var reader = new FileReader(); var reader = new FileReader();
console.log(reader) // console.log(reader)
reader.onload = function(e) { reader.onload = function(e) {
instrument = dataInstrument[parseInt(idImage)] instrument = dataInstrument[parseInt(idImage)]
console.log(instrument) // console.log(instrument)
console.log('-------------xxxx-------------') // console.log('-------------xxxx-------------')
var uriAdd = [{'uri':e.target.result}]; var uriAdd = [{'uri':e.target.result}];
dataUri = dataUri.concat(uriAdd); dataUri = dataUri.concat(uriAdd);
if(idImage == 'add'){ if(idImage == 'add'){
@ -332,22 +334,22 @@ function uploadImage(idImage) {
$('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idImage].clips[idImg].photo); $('#myImg'+idImg+''+idImage).attr('src', dataInstrument[idImage].clips[idImg].photo);
} }
} }
console.log(idImage) // console.log(idImage)
var dataUriSort = dataUri var dataUriSort = dataUri
idloopImage = loopImage idloopImage = loopImage
if(loopImage==0){ if(loopImage==0){
idloopImage = 0 idloopImage = 0
} }
var idUri = 0 var idUri = 0
console.log(dataUri) // console.log(dataUri)
console.log(loopImage-1) // console.log(loopImage-1)
console.log(idloopImage+dataUri.length) // console.log(idloopImage+dataUri.length)
for(idImg=loopImage;idImg<idloopImage+dataUri.length;idImg++){ for(idImg=loopImage;idImg<idloopImage+dataUri.length;idImg++){
$('#myImg'+idImg+''+idImage).attr('src', dataUri[idUri].uri); $('#myImg'+idImg+''+idImage).attr('src', dataUri[idUri].uri);
idUri += 1 idUri += 1
} }
console.log('---------------------------') // console.log('---------------------------')
console.log(dataUri) // console.log(dataUri)
check += 1 check += 1
}; };
reader.readAsDataURL(this.files[0]); reader.readAsDataURL(this.files[0]);
@ -373,9 +375,9 @@ function addData(){
if(dataUri.length != 0){ if(dataUri.length != 0){
data.clips = dataUri data.clips = dataUri
} }
console.log(data) // console.log(data)
data = JSON.stringify(data) data = JSON.stringify(data)
console.log(data) // console.log(data)
token = sessionStorage.getItem('token') token = sessionStorage.getItem('token')
$.ajax({ $.ajax({
type: "POST", type: "POST",
@ -387,7 +389,7 @@ function addData(){
'Authorization': 'Bearer ' + token, 'Authorization': 'Bearer ' + token,
}, },
success: function(respone){ success: function(respone){
console.log(respone) // console.log(respone)
window.location.reload(true); window.location.reload(true);
}, },
dataType: 'json' dataType: 'json'
@ -395,10 +397,10 @@ function addData(){
} }
function updateData(idData){ function updateData(idData){
console.log(document.getElementById("name"+idData)) // console.log(document.getElementById("name"+idData))
console.log(document.getElementById("note"+idData)) // console.log(document.getElementById("note"+idData))
console.log(document.getElementById("id"+idData)) // console.log(document.getElementById("id"+idData))
console.log(document.getElementById("cr"+idData)) // console.log(document.getElementById("cr"+idData))
dataUpdate = { dataUpdate = {
'name':document.getElementById("name"+idData).value, 'name':document.getElementById("name"+idData).value,
'note':document.getElementById("note"+idData).value, 'note':document.getElementById("note"+idData).value,
@ -419,7 +421,7 @@ function updateData(idData){
'Authorization': 'Bearer ' + token, 'Authorization': 'Bearer ' + token,
}, },
success: function(respone){ success: function(respone){
console.log(respone) // console.log(respone)
window.location.reload(true); window.location.reload(true);
}, },
dataType: 'json' dataType: 'json'
@ -440,7 +442,7 @@ function deleteData(idData){
'Authorization': 'Bearer ' + token, 'Authorization': 'Bearer ' + token,
}, },
success: function(respone){ success: function(respone){
console.log(respone) // console.log(respone)
window.location.reload(true); window.location.reload(true);
}, },
dataType: 'json' dataType: 'json'
@ -463,12 +465,12 @@ function removeImage(idData){
else{ else{
var time = new Date() var time = new Date()
var loopImage = dataInstrument[idData].clips.length var loopImage = dataInstrument[idData].clips.length
console.log(dataInstrument[idData]) // console.log(dataInstrument[idData])
for(j=0;j<loopImage;j++){ for(j=0;j<loopImage;j++){
console.log('#myImg'+j+''+idData) // console.log('#myImg'+j+''+idData)
document.getElementById("myImg"+j+''+idData).src = dataInstrument[idData].clips[j].photo+'?'+time; document.getElementById("myImg"+j+''+idData).src = dataInstrument[idData].clips[j].photo+'?'+time;
console.log(document.getElementById("myImg"+j+''+idData).src) // console.log(document.getElementById("myImg"+j+''+idData).src)
console.log(document.getElementById("myImg"+j+''+idData)) // console.log(document.getElementById("myImg"+j+''+idData))
} }
} }

99
modal.html

@ -1,99 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<style>
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<h2>Modal Example</h2>
<!-- Trigger/Open The Modal -->
<button id="1">Open Modal</button>
<button id="2">Open Modal</button>
<button id="3">Open Modal</button>
<button id="4">Open Modal</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
<p>Some text in the Modal..</p>
</div>
</div>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the button that opens the modal
var btn = document.getElementById("2");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
console.log(event)
if (event.target == modal) {
console.log(modal)
console.log(modal.style.display)
modal.style.display = "none";
}
}
</script>
</body>
</html>

115
stat.html

@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login Form</title>
<link rel="shortcut icon" type="image/png" href="https://avatars1.githubusercontent.com/u/17867603?v=3&s=200"/>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="js/jquery-3.0.0.min.js"></script>
<script type="text/javascript" src="js/materialize.min.js"></script>
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="css/stdb.css" media="screen,projection"/>
<style>
html {
height: 100%;
}
body {
min-height: 100%;
}
a:active {
-webkit-text-fill-color: #000000;
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: #000000;
}
.column {
-webkit-flex-direction: column;
flex-direction: column;
float: left;
}
.column li {
background: deepskyblue;
}
.flex-container {
padding: 0;
margin: 0;
list-style: none;
-ms-box-orient: horizontal;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -moz-flex;
display: -webkit-flex;
display: flex;
}
</style>
</head>
<body class="flexCenter" style="background-color:#0ca3d2;">
<div>
<div style="max-width:800px;color:#F0F0F0;">
<div class="flexCenter">
<h1>หนวยงานทงหมด</h1>
</div>
</div>
<div id="organiz" style="max-width:800px"></div>
</div>
</body>
<script language="javascript">
function getStatAll(){
urlStat = 'http://expert.traffy.xyz/api/v2/organization/stats/'
console.log(urlStat)
$.ajax({
type: "GET",
url: urlStat,
success: getData,
dataType: 'json',
});
}
function getData(respone){
console.log(respone)
var htmlText = ''
for (i=0;i<respone.length;i++ ){
htmlText = htmlText+"<div class='cardStyle' style='width:800px;height:200px'>"
+"<h3 style='font-size:26px;margin-left:20px '>"+respone[i].organization.name+' ('+respone[i].organization.abbv_en+') '+"</h3>"
+"<div class='flexCenterSpace'>"
+"<div class='flex-container column flexCenter'>"
+"<i class='medium material-icons ' style=''>thumb_up</i>"
+"<i class='' style=''>อมลครบ</i>"
+"<i class='' style=''>"+respone[i].items.completed+"</i>"
+"</div>"
+"<div class='flex-container column flexCenter'>"
+"<i class='medium material-icons ' style=''>trending_up</i>"
+"<i class='' style=''>อมลอพเดท</i>"
+"<i class='' style=''>"+respone[i].items.recent_update+"</i>"
+"</div>"
+"<div class='flex-container column flexCenter'>"
+"<i class='medium material-icons ' style=''>featured_play_list</i>"
+"<i class='' style=''>งหมด</i>"
+"<i class='' style=''>"+respone[i].items.all+"</i>"
+"</div>"
+"<div class='flex-container column flexCenter'>"
+"<i class='medium material-icons ' style=''>photo</i>"
+"<i class='' style=''></i>"
+"<i class='' style=''>"+respone[i].items.photos+"</i>"
+"</div>"
+"</div>"
+"</div>"
}
document.getElementById("organiz").innerHTML = htmlText
}
getStatAll()
</script>
</html>

47
stdb.html

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login Form</title>
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="css/stdb.css" media="screen,projection"/>
<link rel="shortcut icon" type="image/png" href="https://avatars1.githubusercontent.com/u/17867603?v=3&s=200"/>
<script src="js/jquery-3.0.0.min.js"></script>
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<style>
html {
height: 100%;
}
body {
min-height: 100%;
}
a:active {
-webkit-text-fill-color: #000000;
-webkit-text-stroke-width: 2px;
-webkit-text-stroke-color: #000000;
}
</style>
</head>
<body class="flexCenter" style="background-color:#0ca3d2;">
<div >
<div>
<a href="login.html" style="font-size:100px;color:#F0F0F0;" >LOGIN</a>
<h style="font-size:200px;color:#F0F0F0;" >|</h>
<a href="stat.html" style="font-size:100px;color:#F0F0F0;" >STAT</a>
</div>
</div>
</body>
<script language="javascript">
</script>
</html>

141
testItem.html

@ -1,141 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login Form</title>
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" type="image/png" href="https://avatars1.githubusercontent.com/u/17867603?v=3&s=200"/>
<script src="js/jquery-3.0.0.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script type="text/javascript" src="js/materialize.min.js"></script>
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover:not(.active) {
background-color: #111;
}
img {
border-radius: 8px;
width: 600px;
height: 600px;
}
.active {
background-color: #4CAF50;
}
.titleIn{
position: fixed;
/*margin-top: -20px;*/
width: 100%;
display:flex;
justify-content: center;
align-items:center;
color:#FFF;
font-size:30px;
}
.container{
margin-right: auto;
margin-left: auto;
}
.boxShow{
display:flex;
justify-content: center;
align-items:center;
/*margin-top: 10px;*/
}
.cardData{
display:flex;
justify-content: center;
align-items:center;
margin-top: 10px;
margin: 10px;
background-color: #FFF;
width: 150px;
height: 150px;
border: 1px solid navy;
}
.flexCenter {
display:flex;
justify-content: center;
align-items:center;
}
.flexCenterSpace {
display:flex;
justify-content: space-around;
-webkit-justify-content: space-around;
align-items:center;
}
.cardStyle{
width: 800px;
/*height: 150px;*/
margin-top: 5px;
background-color: #FFF;
border: 1px solid navy;
}
.modalStyle{
width: 800px;
/*height: 150px;*/
margin-top: 5px;
background-color: #FFF;
border: 1px solid navy;
}
</style>
</head>
<body>
<div>
<ul style="height:80px;font-size:18px;" class="titleIn">
<li><h1 style="align-items: flex-end;font-size:36px;">Instrument</h1></li>
<li style="align-items: flex-end;"><a class="active" onClick="LogoutPage()">Logout</a></li>
</ul>
</div>
</div>
<div id="more" class="container flexCenter" style="max-width:800px">
<div>
<img >
<div>
<h style="font-size:20px">อครณฑทยาศาสตร</h>
</div>
<div>
<h style="font-size:20px">ดประสงคการใชงาน</h>
</div>
<div>
<h style="font-size:20px">เลขครณฑ</h>
</div>
<div>
<h style="font-size:20px">แล</h>
</div>
</div>
</div>
</body>
</script>
</html>

152
testJWT.html

@ -1,152 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login Form</title>
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" type="image/png" href="https://avatars1.githubusercontent.com/u/17867603?v=3&s=200"/>
<script src="js/jquery-3.0.0.min.js"></script>
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<style>
.flexCenter {
display:flex;
height: 550px;
justify-content: center;
align-items:center;
}
</style>
</head>
<body>
<section class="container">
<div class="login">
<h1>Login to STDB</h1>
<form method="post" >
<p><input type="text" name="login" value="" placeholder="token"></p>
<p class="submit"><input type="button" value="decode" onClick="pasuser()"></p>
</form>
</div>
</section>
</body>
<script language="javascript">
function pasuser(form) {
var string = 'eyJ1c2VybmFtZSI6InJhY2hhbm9uIiwib3JpZ19pYXQiOjE0NjYxNTM5NDcsInVzZXJfaWQiOjEsImVtYWlsIjoiIiwiZXhwIjoxNDY2NTg1OTQ3fQ'
var jwpStdb={
_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
encode:function(e){var t="";
var n,r,i,s,o,u,a;
var f=0;e=jwpStdb._utf8_encode(e);
while(f<e.length){
n=e.charCodeAt(f++);
r=e.charCodeAt(f++);
i=e.charCodeAt(f++);s=n>>2;
o=(n&3)<<4|r>>4;
u=(r&15)<<2|i>>6;
a=i&63;
if(isNaN(r)){
u=a=64
}
else if(isNaN(i)){
a=64
}
t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)
}
return t
},
decode:function(e){
var t="";
var n,r,i;
var s,o,u,a;
var f=0;e=e.replace(/[^A-Za-z0-9+/=]/g,"");
while(f<e.length){
s=this._keyStr.indexOf(e.charAt(f++));
o=this._keyStr.indexOf(e.charAt(f++));
u=this._keyStr.indexOf(e.charAt(f++));
a=this._keyStr.indexOf(e.charAt(f++));
n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;
t=t+String.fromCharCode(n);
if(u!=64){
t=t+String.fromCharCode(r)
}
if(a!=64){
t=t+String.fromCharCode(i)
}
}
t=jwpStdb._utf8_decode(t);
return t
},
_utf8_encode:function(e){
e=e.replace(/rn/g,"n");
var t="";
for(var n=0;n<e.length;n++){
var r=e.charCodeAt(n);
if(r<128){
t+=String.fromCharCode(r)
}
else if(r>127&&r<2048){
t+=String.fromCharCode(r>>6|192);
t+=String.fromCharCode(r&63|128)
}
else{
t+=String.fromCharCode(r>>12|224);
t+=String.fromCharCode(r>>6&63|128);
t+=String.fromCharCode(r&63|128)
}
}
return t
},
_utf8_decode:function(e){
var t="";
var n=0;
var r=c1=c2=0;
while(n<e.length){
r=e.charCodeAt(n);
if(r<128){
t+=String.fromCharCode(r);
n++
}
else if(r>191&&r<224){
c2=e.charCodeAt(n+1);
t+=String.fromCharCode((r&31)<<6|c2&63);
n+=2
}
else{
c2=e.charCodeAt(n+1);
c3=e.charCodeAt(n+2);
t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);
n+=3
}
}
return t
}
}
// Define the string
// Encode the String
// var encodedString = jwpStdb.encode(string);
console.log(string); // Outputs: "SGVsbG8gV29ybGQh"
console.log('=====================');
// Decode the String
var decodedString = jwpStdb.decode(string);
console.log(decodedString);
var res = decodedString.replace(' ', '');
console.log(res);
console.log(decodedString.length);
console.log(res.length);
console.log(typeof decodedString);
JSON.parse(res, function(k, v) {
if (k==='user_id'){
console.log(v) // return the unchanged property value.
}
});
}
</script>
</html>

87
testUpload.html

@ -1,87 +0,0 @@
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login Form</title>
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" type="image/png" href="https://avatars1.githubusercontent.com/u/17867603?v=3&s=200"/>
<script src="js/jquery-3.0.0.min.js"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script type="text/javascript" src="js/materialize.min.js"></script>
<script type="text/javascript" src="js/jwtDecode.min.js"></script>
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="css/stdb.css" media="screen,projection"/>
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<style>
</style>
</head>
<body>
<div class="flexCenter">
<div>
<i class="Large material-icons" onclick="modalItem('add')" style="position: fixed;color:#D50000;-webkit-text-stroke: 2px;-webkit-text-stroke-color:#EF9A9A;">add_circle</i>
</div>
</div>
<div id="modaladd" class="modal" style="max-height: 100%;display: none;padding-top:10px;">
<div class="modal-content cardStyle" >
<div class="flexCenter">
<div class="flexCenter bgImage">
<div class="flexCenter">
<img id="myImg0add" src="" alt=""/>
<div class="bgImage flexCenter"><h2>ไมปภาพ</h2></div>
</div>
<div class="column bgMiniImage" style="margin-left:10px">
<img id="myImg1add" class="miniImage" src="" alt=""/>
<h6 class="miniImage flexCenter" >ไมปภาพ</h6>
<img id="myImg2add" class="miniImage" src="" alt=""/>
<h6 class="miniImage flexCenter" >ไมปภาพ</h6>
<img id="myImg3add" class="miniImage" style="margin-top:5px" src="" alt=""/>
<h6 class="miniImage flexCenter" style="margin-top:5px">ไมปภาพ</h6>
</div>
</div>
</div>
<div class="flexCenter" style="margin-top:5px;">
<div class="upload flexCenter">
<a style="font-size:18px">Upload</a></div>
<input type="file" name="upload" onclick="uploadImage('add')"/>'
</div>'
<div>
<div style="font-size:20px;margin-top:10px">อครณฑทยาศาสตร</div>
<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" name="nameI" value="" placeholder="ชอครณฑทยาศาสตร"></div>
</div>
<div>
<div style="font-size:20px;margin-top:10px">ดประสงคการใชงาน</div>
<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" name="noteI" value="" placeholder="จดประสงคการใชงาน"></div>
</div>
<div>
<div style="font-size:20px;margin-top:10px">เลขครณฑ</div>
<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" name="idI" value="" placeholder="เลขครณฑ"></div>
</div>
<div>
<div style="font-size:20px;margin-top:10px">แล</div>
<div style="font-size:16px;margin-top:5px;margin-left:5px"><input type="text" name="CrI" value="" placeholder="ชอ นามสกล"></div>
</div>
<div class="flexCenterSpace" style="margin-top:20px">
<input type="button" onclick="addData()" class="buttonUpdate" value="Update">
<input type="button" onclick="backData()" class="buttonBack" value="Back">
</div>
</div>
</div>
</body>
<script>
function modalItem(idCard){
var modal = document.getElementById('modal'+idCard);
// console.log(modal)
var btn = document.getElementById(idCard);
// console.log(btn)
modal.style.display = "block";
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
removeImage(idCard)
}
}
}
</script>
</html>

104
uploadFile.html

@ -1,104 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Login Form</title>
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" type="image/png" href="https://avatars1.githubusercontent.com/u/17867603?v=3&s=200"/>
<script src="js/jquery-3.0.0.min.js"></script>
<script src="js/dropzone.js"></script>
<style>
.image {
position: relative;
width: 400px; /* for IE 6 */
}
h2 {
position: absolute;
top: 200px;
left: 0;
width: 100%;
}
img{
width: 400px;
height: 400px;
}
.flexCenter {
display:flex;
justify-content: center;
align-items:center;
}
.cardData{
display:flex;
justify-content: center;
align-items:center;
margin-top: 10px;
margin: 10px;
background-color: #FFF;
width: 150px;
height: 150px;
border: 1px solid navy;
}
div.upload {
position: absolute;
border-radius: 5px;
width: 100px;
height: 50px;
background-color: #FFF;
color: #000;
overflow: hidden;
}
div input {
position: absolute;
border-radius: 5px;
display: block !important;
width: 100px !important;
height: 50px !important;
opacity: 0 !important;
overflow: hidden !important;
}
</style>
</head>
<body>
<div class="flexCenter">
<div class="image flexCenter">
<img id="myImg" src="" alt="" />
<center><h2>ไมปภาพ</h2> </center>
</div>
</div>
<div class="flexCenter">
<div class="upload flexCenter">
<a style="font-size:18px">Upload</a>
</div>
<input type="file" name="upload"/>
</div>
</body>
<script>
$(function () {
$(":file").change(function () {
if (this.files && this.files[0]) {
var reader = new FileReader();
reader.onload = imageIsLoaded;
reader.readAsDataURL(this.files[0]);
}
});
});
function imageIsLoaded(e) {
$('#myImg').attr('src', e.target.result);
};
</script>
</html>
Loading…
Cancel
Save