2016-02-03 20:02:37 +08:00
|
|
|
/*
|
2016-03-19 10:28:18 +08:00
|
|
|
* @Author: printempw
|
2016-02-03 20:02:37 +08:00
|
|
|
* @Date: 2016-02-03 18:23:21
|
2016-03-05 21:49:33 +08:00
|
|
|
* @Last Modified by: printempw
|
2016-03-19 10:28:18 +08:00
|
|
|
* @Last Modified time: 2016-03-19 10:08:58
|
2016-02-03 20:02:37 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
function showMsg(type, msg) {
|
|
|
|
$("[id=msg]").removeClass().addClass("alert").addClass(type).html(msg);
|
|
|
|
}
|
|
|
|
|
2016-03-19 10:28:18 +08:00
|
|
|
function showCallout(type, msg) {
|
|
|
|
$("[id=msg]").removeClass().addClass("callout").addClass(type).html(msg);
|
|
|
|
}
|
|
|
|
|
2016-03-05 21:49:33 +08:00
|
|
|
function showAlert(msg, callback, callback2) {
|
2016-02-03 20:02:37 +08:00
|
|
|
callback = callback ? callback : new Function;
|
2016-03-05 21:49:33 +08:00
|
|
|
Ply.dialog("alert", msg).done(callback).fail(callback2);
|
|
|
|
}
|
|
|
|
|
|
|
|
function isMobile() {
|
|
|
|
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2016-02-03 20:02:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function logout(callback) {
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: "../ajax.php?action=logout",
|
|
|
|
dataType: "json",
|
|
|
|
data: {"uname": docCookies.getItem('uname')},
|
|
|
|
success: function(json) {
|
|
|
|
docCookies.removeItem("uname", "/");
|
|
|
|
docCookies.removeItem("token", "/");
|
|
|
|
callback(json);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-02-04 23:49:31 +08:00
|
|
|
|
|
|
|
$("#logout").click(function(){
|
|
|
|
logout(function(json){
|
2016-02-05 22:08:06 +08:00
|
|
|
showAlert(json.msg, function(){
|
2016-02-04 23:49:31 +08:00
|
|
|
window.location = "../index.php";
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|