This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // *********【虫食い:その7】メッセージデータの取得 ********** | |
| chat.order("createDate", true) | |
| .limit(5) | |
| .include("user") | |
| .fetchAll() | |
| .then(function(records){ | |
| // 取得成功時の処理 | |
| console.log("取得成功:" + JSON.stringify(records)); | |
| setData(records); | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ****【虫食い:その6】参照権限とポインタを設定してデータを保存 ***** | |
| // [NCMB] 参照権限とポインタを設定してデータを保存 | |
| chat.set("message", message) | |
| .set("user", currentUser) | |
| .set("acl", acl) | |
| .save() | |
| .then(function() { | |
| // 保存成功時の処理 | |
| console.log("保存成功"); | |
| // 画面更新 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // *************【虫食い:その5】参照権限の設定 ************* | |
| // [NCMB] 参照権限の設定 | |
| var acl = new ncmb.Acl(); | |
| // 全員読み込み可・メッセージ作成ユーザーのみ書き込み可 | |
| acl.setPublicReadAccess(true) | |
| .setUserReadAccess(currentUser, true) | |
| .setUserWriteAccess(currentUser, true); | |
| // ******************************************************** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // *********【虫食い:その4】カレントユーザーの取得 ********* | |
| // [NCMB] カレントユーザーの取得 | |
| currentUser = ncmb.User.getCurrentUser(); | |
| // ******************************************************** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ***********【虫食い:その3】ログアウトの実装 ************* | |
| // ログアウト | |
| ncmb.User.logout() | |
| .then(function(user) { | |
| // ログアウト成功時の処理 | |
| console.log("ログアウト成功:" + JSON.stringify(user)); | |
| currentUser = null; | |
| window.location.href = "./index.html"; | |
| }) | |
| .catch(function(error) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ************【虫食い:その2】ログインの実装 ************** | |
| // ユーザー名・パスワードでログイン | |
| ncmb.User.login(userName, password) | |
| .then(function(user) { | |
| // ログイン成功時の処理 | |
| console.log("ログイン成功:" + JSON.stringify(user)); | |
| window.location.href = "./chatPage.html"; | |
| }) | |
| .catch(function(error) { | |
| // ログイン失敗時の処理 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // **********【⾍⾷い:その1】新規ユーザー登録の実装 ************* | |
| // ユーザークラスのインスタンスを⽣成 | |
| var user = new ncmb.User(); | |
| // ユーザー名/パスワードで新規ユーザー登録 | |
| user.set("userName", userName) | |
| .set("password", password) | |
| .signUpByAccount() | |
| .then(function (user) { | |
| // 新規ユーザー登録成功時の処理 | |
| console.log("新規ユーザー登録成功:" + JSON.stringify(user)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function passwordCheck(checked) { | |
| var pwd = document.getElementById("password"); | |
| if(checked) { | |
| pwd.setAttribute("type", "text"); | |
| } else { | |
| pwd.setAttribute("type", "password"); | |
| } | |
| } | |
| var applicationKey = "******"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
| <meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"> | |
| <link rel="stylesheet" href="components/loader.css"> | |
| <script src="components/loader.js"></script> | |
| <script src="js/app.js"></script> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
| <meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"> | |
| <link rel="stylesheet" href="components/loader.css"> | |
| <script src="components/loader.js"></script> | |
| <script src="js/app.js"></script> | |
| </head> |
NewerOlder