-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
110 lines (103 loc) · 3.45 KB
/
Copy pathscript.js
File metadata and controls
110 lines (103 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
$(document).ready(function(){
// input tooltip
$("input").tooltip();
// login
$("#login-submit").click(function(){
username=$("#login-username").val();
password=$("#login-password").val();
$.ajax({
type: "POST",
url: base_url+"account/login_process",
data: "username="+username+"&password="+password,
success: function(html){
if(html=='true'){
window.location = base_url;
}else if(html=='false'){
$("#login-alert").hide().html("<h4 class='alert-notif'>Ups, ada yang eror!</h4><p class=suggest>Username atau Password tidak cocok :3.</p>").fadeIn('slow');
}else{
$("#login-alert").hide().html("<h4 class='alert-notif'>Ups, ada yang eror!</h4><p class=suggest>Username dan Password harus diisi :3.</p>").fadeIn('slow');
}
},
beforeSend:function()
{
$("#login-alert").html("<h4 class='alert-notif'>Loading...</h4>").fadeIn('fast');
}
});
return false;
});
// logout
$("#logout").click(function(){
$.ajax({
type: "POST",
url: base_url+"account/logout",
success : function(){
$("#nav-right").hide().load(base_url+'template/aside').fadeIn('slow');
}
})
})
// Parsedown Preview
$('.nulis').on('keyup || keypress || focus',function(e){
var tulisan = $('.nulis').val();
if(tulisan!="") {
$.post(base_url+'admin/previewpost', {inilah: tulisan} ,function(data) {
$(".diparse").html(data).show();
});
}
});
$("#nulis-title").on("keyup || keypress",function(e){
var datanya = $("#nulis-title").val();
if(datanya !=""){
$(".title").html(datanya);
}
})
// Parsedown Preview end
// Register
$("#register-username").on('focusout',function(){
var username = $("#register-username").val();
if(username!="") {
$.post(base_url+'account/check_username', {username: username} ,function(data) {
$(".error-username").html(data).show().hide().fadeIn('slow');
});
}
})
$("#register-email").on('focusout',function(){
var email = $("#register-email").val();
if(email != "") {
$.post(base_url+'account/check_email', {email: email} ,function(data) {
$(".error-email").html(data).show().hide().fadeIn('slow');
});
}
})
$("#register-confirm-password").change(function(e){
var pass = $("#register-password").val();
var passcon = $("#register-confirm-password").val();
if(pass != passcon){
$(".error-confirm-password").hide().html("Password tidak sama").fadeIn('slow');
}else{
$(".error-confirm-password").hide();
}
})
$("#register-submit").click(function(){
username=$("#register-username").val();
email=$("#register-email").val();
password=$("#register-password").val();
passcon=$("#register-confirm-password").val();
$.ajax({
type: "POST",
url: base_url+"account/register_process",
data: "username="+username+"&email="+email+"&password="+password+"&confirm-password="+passcon,
success: function(html){
if(html == 'true'){
window.location = base_url;
}else{
$("#register-alert").hide().html(html).fadeIn('slow');
}
},
beforeSend:function()
{
$("#register-alert").html("<h4 class='alert-notif'>Logging in...</h4>").fadeIn('fast');
}
});
return false;
});
});