Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Moecube Store
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Moecube Store
Commits
94c38fe1
Commit
94c38fe1
authored
Feb 08, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login
parent
d01d0db1
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
211 additions
and
131 deletions
+211
-131
assets/javascripts/room_show.coffee
assets/javascripts/room_show.coffee
+25
-1
assets/javascripts/room_show.js
assets/javascripts/room_show.js
+32
-2
rooms/show.html
rooms/show.html
+128
-104
vendor/javascripts/jquery.cookie.js
vendor/javascripts/jquery.cookie.js
+26
-24
No files found.
assets/javascripts/room_show.coffee
View file @
94c38fe1
login
=
(
username
,
password
)
->
$
(
'#username'
).
html
username
$
(
'#login'
).
hide
()
$
(
'#userinfo'
).
show
()
$
(
'#need_login'
).
hide
()
$
(
'#join'
).
show
()
$
(
'#logout'
).
click
->
$
.
cookie
(
'username'
,
''
)
$
.
cookie
(
'password'
,
''
)
window
.
location
.
reload
()
$
(
'#login'
).
submit
->
$
.
cookie
(
'username'
,
@
username
.
value
)
$
.
cookie
(
'password'
,
@
password
.
value
)
login
(
$
.
cookie
(
'username'
),
$
.
cookie
(
'password'
))
false
matched
=
window
.
location
.
href
.
match
/\/(?:(.*?)(?::(.*?))?@)?([\d\.]+)\:(\d+)(?:\/(.*))?/
matched
=
window
.
location
.
href
.
match
/\/(?:(.*?)(?::(.*?))?@)?([\d\.]+)\:(\d+)(?:\/(.*))?/
if
matched
==
null
if
matched
==
null
alert
"解析房间信息失败"
alert
"解析房间信息失败"
...
@@ -31,5 +48,12 @@ $('#server_ip').html room.server.ip
...
@@ -31,5 +48,12 @@ $('#server_ip').html room.server.ip
$
(
'#server_port'
).
html
room
.
server
.
port
$
(
'#server_port'
).
html
room
.
server
.
port
$
(
'#server_auth'
).
html
room
.
server
.
auth
$
(
'#server_auth'
).
html
room
.
server
.
auth
if
room
.
server
.
auth
and
!
(
$
.
cookie
(
'username'
)
&&
$
.
cookie
(
'password'
))
$
(
'#join'
).
hide
()
$
(
'#need_login'
).
show
()
if
$
.
cookie
(
'username'
)
&&
$
.
cookie
(
'password'
)
login
(
$
.
cookie
(
'username'
),
$
.
cookie
(
'password'
))
$
(
'#join'
).
click
->
$
(
'#join'
).
click
->
mycard
.
join
room
.
server
.
ip
,
room
.
server
.
port
,
mycard
.
room_name
(
room
.
name
,
room
.
password
)
mycard
.
join
room
.
server
.
ip
,
room
.
server
.
port
,
mycard
.
room_name
(
room
.
name
,
room
.
password
),
$
.
cookie
(
'username'
),
(
$
.
cookie
(
'password'
)
if
room
.
server
.
auth
)
\ No newline at end of file
\ No newline at end of file
assets/javascripts/room_show.js
View file @
94c38fe1
// Generated by CoffeeScript 1.4.0
// Generated by CoffeeScript 1.4.0
(
function
()
{
(
function
()
{
var
matched
,
room
,
url
;
var
login
,
matched
,
room
,
url
;
login
=
function
(
username
,
password
)
{
$
(
'
#username
'
).
html
(
username
);
$
(
'
#login
'
).
hide
();
$
(
'
#userinfo
'
).
show
();
$
(
'
#need_login
'
).
hide
();
return
$
(
'
#join
'
).
show
();
};
$
(
'
#logout
'
).
click
(
function
()
{
$
.
cookie
(
'
username
'
,
''
);
$
.
cookie
(
'
password
'
,
''
);
return
window
.
location
.
reload
();
});
$
(
'
#login
'
).
submit
(
function
()
{
$
.
cookie
(
'
username
'
,
this
.
username
.
value
);
$
.
cookie
(
'
password
'
,
this
.
password
.
value
);
login
(
$
.
cookie
(
'
username
'
),
$
.
cookie
(
'
password
'
));
return
false
;
});
matched
=
window
.
location
.
href
.
match
(
/
\/(?:(
.*
?)(?:
:
(
.*
?))?
@
)?([\d\.]
+
)\:(\d
+
)(?:\/(
.*
))?
/
);
matched
=
window
.
location
.
href
.
match
(
/
\/(?:(
.*
?)(?:
:
(
.*
?))?
@
)?([\d\.]
+
)\:(\d
+
)(?:\/(
.*
))?
/
);
...
@@ -42,8 +63,17 @@
...
@@ -42,8 +63,17 @@
$
(
'
#server_auth
'
).
html
(
room
.
server
.
auth
);
$
(
'
#server_auth
'
).
html
(
room
.
server
.
auth
);
if
(
room
.
server
.
auth
&&
!
(
$
.
cookie
(
'
username
'
)
&&
$
.
cookie
(
'
password
'
)))
{
$
(
'
#join
'
).
hide
();
$
(
'
#need_login
'
).
show
();
}
if
(
$
.
cookie
(
'
username
'
)
&&
$
.
cookie
(
'
password
'
))
{
login
(
$
.
cookie
(
'
username
'
),
$
.
cookie
(
'
password
'
));
}
$
(
'
#join
'
).
click
(
function
()
{
$
(
'
#join
'
).
click
(
function
()
{
return
mycard
.
join
(
room
.
server
.
ip
,
room
.
server
.
port
,
mycard
.
room_name
(
room
.
name
,
room
.
password
));
return
mycard
.
join
(
room
.
server
.
ip
,
room
.
server
.
port
,
mycard
.
room_name
(
room
.
name
,
room
.
password
)
,
$
.
cookie
(
'
username
'
),
(
room
.
server
.
auth
?
$
.
cookie
(
'
password
'
)
:
void
0
)
);
});
});
}).
call
(
this
);
}).
call
(
this
);
rooms/show.html
View file @
94c38fe1
This diff is collapsed.
Click to expand it.
vendor/javascripts/jquery.cookie.js
View file @
94c38fe1
/*!
/*!
* jQuery Cookie Plugin v1.3.
0
* jQuery Cookie Plugin v1.3.
1
* https://github.com/carhartl/jquery-cookie
* https://github.com/carhartl/jquery-cookie
*
*
* Copyright 2013 Klaus Hartl
* Copyright 2013 Klaus Hartl
* Released under the MIT license
* Released under the MIT license
*/
*/
(
function
(
$
,
document
,
undefined
)
{
(
function
(
factory
)
{
if
(
typeof
define
===
'
function
'
&&
define
.
amd
&&
define
.
amd
.
jQuery
)
{
// AMD. Register as anonymous module.
define
([
'
jquery
'
],
factory
);
}
else
{
// Browser globals.
factory
(
jQuery
);
}
}(
function
(
$
)
{
var
pluses
=
/
\+
/g
;
var
pluses
=
/
\+
/g
;
...
@@ -14,15 +22,17 @@
...
@@ -14,15 +22,17 @@
}
}
function
decoded
(
s
)
{
function
decoded
(
s
)
{
return
unRfc2068
(
decodeURIComponent
(
s
.
replace
(
pluses
,
'
'
)
));
return
decodeURIComponent
(
s
.
replace
(
pluses
,
'
'
));
}
}
function
unRfc2068
(
value
)
{
function
converted
(
s
)
{
if
(
value
.
indexOf
(
'
"
'
)
===
0
)
{
if
(
s
.
indexOf
(
'
"
'
)
===
0
)
{
// This is a quoted cookie as according to RFC2068, unescape
// This is a quoted cookie as according to RFC2068, unescape
value
=
value
.
slice
(
1
,
-
1
).
replace
(
/
\\
"/g
,
'
"
'
).
replace
(
/
\\\\
/g
,
'
\\
'
);
s
=
s
.
slice
(
1
,
-
1
).
replace
(
/
\\
"/g
,
'
"
'
).
replace
(
/
\\\\
/g
,
'
\\
'
);
}
}
return
value
;
try
{
return
config
.
json
?
JSON
.
parse
(
s
)
:
s
;
}
catch
(
er
)
{}
}
}
var
config
=
$
.
cookie
=
function
(
key
,
value
,
options
)
{
var
config
=
$
.
cookie
=
function
(
key
,
value
,
options
)
{
...
@@ -31,10 +41,6 @@
...
@@ -31,10 +41,6 @@
if
(
value
!==
undefined
)
{
if
(
value
!==
undefined
)
{
options
=
$
.
extend
({},
config
.
defaults
,
options
);
options
=
$
.
extend
({},
config
.
defaults
,
options
);
if
(
value
===
null
)
{
options
.
expires
=
-
1
;
}
if
(
typeof
options
.
expires
===
'
number
'
)
{
if
(
typeof
options
.
expires
===
'
number
'
)
{
var
days
=
options
.
expires
,
t
=
options
.
expires
=
new
Date
();
var
days
=
options
.
expires
,
t
=
options
.
expires
=
new
Date
();
t
.
setDate
(
t
.
getDate
()
+
days
);
t
.
setDate
(
t
.
getDate
()
+
days
);
...
@@ -54,23 +60,19 @@
...
@@ -54,23 +60,19 @@
// read
// read
var
decode
=
config
.
raw
?
raw
:
decoded
;
var
decode
=
config
.
raw
?
raw
:
decoded
;
var
cookies
=
document
.
cookie
.
split
(
'
;
'
);
var
cookies
=
document
.
cookie
.
split
(
'
;
'
);
var
result
=
key
?
null
:
{};
var
result
=
key
?
undefined
:
{};
for
(
var
i
=
0
,
l
=
cookies
.
length
;
i
<
l
;
i
++
)
{
for
(
var
i
=
0
,
l
=
cookies
.
length
;
i
<
l
;
i
++
)
{
var
parts
=
cookies
[
i
].
split
(
'
=
'
);
var
parts
=
cookies
[
i
].
split
(
'
=
'
);
var
name
=
decode
(
parts
.
shift
());
var
name
=
decode
(
parts
.
shift
());
var
cookie
=
decode
(
parts
.
join
(
'
=
'
));
var
cookie
=
decode
(
parts
.
join
(
'
=
'
));
if
(
config
.
json
)
{
cookie
=
JSON
.
parse
(
cookie
);
}
if
(
key
&&
key
===
name
)
{
if
(
key
&&
key
===
name
)
{
result
=
co
okie
;
result
=
co
nverted
(
cookie
)
;
break
;
break
;
}
}
if
(
!
key
)
{
if
(
!
key
)
{
result
[
name
]
=
co
okie
;
result
[
name
]
=
co
nverted
(
cookie
)
;
}
}
}
}
...
@@ -80,11 +82,11 @@
...
@@ -80,11 +82,11 @@
config
.
defaults
=
{};
config
.
defaults
=
{};
$
.
removeCookie
=
function
(
key
,
options
)
{
$
.
removeCookie
=
function
(
key
,
options
)
{
if
(
$
.
cookie
(
key
)
!==
null
)
{
if
(
$
.
cookie
(
key
)
!==
undefined
)
{
$
.
cookie
(
key
,
null
,
options
);
$
.
cookie
(
key
,
''
,
$
.
extend
(
options
,
{
expires
:
-
1
})
);
return
true
;
return
true
;
}
}
return
false
;
return
false
;
};
};
})
(
jQuery
,
document
);
}));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment