remove DOM after deleting texture at user manage page

This commit is contained in:
printempw 2016-04-03 08:27:33 +08:00
parent 68762bdc64
commit 791195c44d
2 changed files with 7 additions and 3 deletions

View File

@ -3,7 +3,7 @@
* @Author: printempw * @Author: printempw
* @Date: 2016-02-04 13:53:55 * @Date: 2016-02-04 13:53:55
* @Last Modified by: printempw * @Last Modified by: printempw
* @Last Modified time: 2016-04-03 07:55:53 * @Last Modified time: 2016-04-03 08:26:15
*/ */
require "../libraries/session.inc.php"; require "../libraries/session.inc.php";
@ -51,7 +51,7 @@ if (isset($_GET['action'])) {
} }
if ($_POST[$type] == "true" && $user->getTexture($type) != "") { if ($_POST[$type] == "true" && $user->getTexture($type) != "") {
Utils::remove("./textures/".$user->getTexture($type)); Utils::remove("./textures/".$user->getTexture($type));
$user->db->update($user->uname, 'hash_'.$type, ''); $user->db->update('hash_'.$type, '', ['where' => "username='$user->uname'"]);
} }
} }
$json['errno'] = 0; $json['errno'] = 0;

View File

@ -2,7 +2,7 @@
* @Author: printempw * @Author: printempw
* @Date: 2016-02-04 16:48:42 * @Date: 2016-02-04 16:48:42
* @Last Modified by: printempw * @Last Modified by: printempw
* @Last Modified time: 2016-03-19 10:08:43 * @Last Modified time: 2016-04-03 08:23:49
*/ */
'use strict'; 'use strict';
@ -82,6 +82,10 @@ function deleteTexture(uname) {
success: function(json) { success: function(json) {
if (json.errno == 0) { if (json.errno == 0) {
showAlert(json.msg); showAlert(json.msg);
// remove DOM
if (steve) $('[src="../skin/' + uname + '-steve.png"]').remove();
if (alex) $('[src="../skin/' + uname + '-alex.png"]').remove();
if (cape) $('[src="../cape/' + uname + '.png"]').remove();
} else { } else {
showAlert(json.msg); showAlert(json.msg);
} }