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
f2056729
Commit
f2056729
authored
Nov 08, 2012
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search init
parent
bfbf8087
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
14 deletions
+42
-14
assets/javascripts/decks.coffee
assets/javascripts/decks.coffee
+7
-0
assets/javascripts/decks.js
assets/javascripts/decks.js
+16
-0
decks/index.html
decks/index.html
+19
-14
No files found.
assets/javascripts/decks.coffee
View file @
f2056729
...
...
@@ -15,6 +15,9 @@ class Card extends Spine.Model
"http://images.my-card.in/
#{
@
id
}
.jpg"
image_thumbnail_url
:
->
"http://images.my-card.in/thumbnail/
#{
@
id
}
.jpg"
@
fetch_by_name
:
(
name
,
callback
)
->
$
.
getJSON
"
#{
@
locale_url
}
&q=
#{
JSON
.
stringify
{
name
:
{
$regex
:
name
.
replace
(
/([.?*+^$[\]\\(){}|-])/g
,
'
\\
$1'
),
$options
:
'i'
}
}}"
,
(
langs
)
=>
alert
langs
@
query
:
(
q
,
callback
)
->
$
.
getJSON
"
#{
@
url
}
&q=
#{
JSON
.
stringify
(
q
)
}
"
,
(
cards
)
=>
cards_id
=
(
card
.
_id
for
card
in
cards
)
...
...
@@ -247,6 +250,10 @@ $(document).ready ->
cache
:
true
callback
:
->
Card
.
fetch
->
$
(
'#search'
).
submit
->
Card
.
fetch_by_name
$
(
'.search_input'
).
val
()
return
false
deck
.
decode
$
.
url
().
param
(
'cards'
)
window
.
addEventListener
'popstate'
,
(
ev
)
->
if
ev
.
state
...
...
assets/javascripts/decks.js
View file @
f2056729
...
...
@@ -46,6 +46,18 @@
return
"
http://images.my-card.in/thumbnail/
"
+
this
.
id
+
"
.jpg
"
;
};
Card
.
fetch_by_name
=
function
(
name
,
callback
)
{
var
_this
=
this
;
return
$
.
getJSON
(
""
+
this
.
locale_url
+
"
&q=
"
+
(
JSON
.
stringify
({
name
:
{
$regex
:
name
.
replace
(
/
([
.?*+^$[
\]\\
(){}|-
])
/g
,
'
\\
$1
'
),
$options
:
'
i
'
}
})),
function
(
langs
)
{
return
alert
(
langs
);
});
};
Card
.
query
=
function
(
q
,
callback
)
{
var
_this
=
this
;
return
$
.
getJSON
(
""
+
this
.
url
+
"
&q=
"
+
(
JSON
.
stringify
(
q
)),
function
(
cards
)
{
...
...
@@ -559,6 +571,10 @@
cache
:
true
,
callback
:
function
()
{
Card
.
fetch
(
function
()
{
$
(
'
#search
'
).
submit
(
function
()
{
Card
.
fetch_by_name
(
$
(
'
.search_input
'
).
val
());
return
false
;
});
deck
.
decode
(
$
.
url
().
param
(
'
cards
'
));
return
window
.
addEventListener
(
'
popstate
'
,
function
(
ev
)
{
if
(
ev
.
state
)
{
...
...
decks/index.html
View file @
f2056729
...
...
@@ -86,24 +86,27 @@
<
span
class
=
"
deck_category_count ${$index}
"
>
$
{
$value
}
<
/span>{{/
each
}})
<
/small>
<
/legend>
<
div
class
=
"
deck_part main
"
{{
if
$
(
'
.operate_area
'
).
hasClass
(
'
graphic
'
)}}
style
=
"
width:${main_count}px
"
{{
/if}}>
{{
tmpl
(
main
)
'
#card_usage_
'
+
(
$
(
'
.operate_area
'
).
hasClass
(
'
text
'
)
?
'
text
'
:
'
graphic
'
)
+
'
_template
'
}}
<
div
class
=
"
deck_part main
"
{{
if
$
(
'
.operate_area
'
).
hasClass
(
'
graphic
'
)}}
style
=
"
width:${main_count}px
"
{{
/if}}>
{{
tmpl
(
main
)
'
#card_usage_
'
+
(
$
(
'
.operate_area
'
).
hasClass
(
'
text
'
)
?
'
text
'
:
'
graphic
'
)
+
'
_template
'
}}
<
/div>
<
/fieldset>
<
fieldset
id
=
"
deck_side
"
>
<
legend
id
=
"
deck_side_title
"
class
=
"
deck_title main
"
>
副卡组
<
small
>
(
$
{
side_count
})
<
/small>
<
/legend>
<
div
class
=
"
deck_part side
"
{{
if
$
(
'
.operate_area
'
).
hasClass
(
'
graphic
'
)}}
style
=
"
width:${main_count}px
"
{{
/if}}>
{{
tmpl
(
side
)
'
#card_usage_
'
+
(
$
(
'
.operate_area
'
).
hasClass
(
'
text
'
)
?
'
text
'
:
'
graphic
'
)
+
'
_template
'
}}
<
div
class
=
"
deck_part side
"
{{
if
$
(
'
.operate_area
'
).
hasClass
(
'
graphic
'
)}}
style
=
"
width:${main_count}px
"
{{
/if}}>
{{
tmpl
(
side
)
'
#card_usage_
'
+
(
$
(
'
.operate_area
'
).
hasClass
(
'
text
'
)
?
'
text
'
:
'
graphic
'
)
+
'
_template
'
}}
<
/div>
<
/fieldset>
<
fieldset
id
=
"
deck_extra
"
>
<
legend
id
=
"
deck_extra_title
"
class
=
"
deck_title main
"
>
额外卡组
<
small
>
(
$
{
extra_count
})
<
/small>
<
/legend>
<
div
class
=
"
deck_part extra
"
{{
if
$
(
'
.operate_area
'
).
hasClass
(
'
graphic
'
)}}
style
=
"
width:${extra_extra}px
"
{{
/if}}>
{{
tmpl
(
extra
)
'
#card_usage_
'
+
(
$
(
'
.operate_area
'
).
hasClass
(
'
text
'
)
?
'
text
'
:
'
graphic
'
)
+
'
_template
'
}}
<
div
class
=
"
deck_part extra
"
{{
if
$
(
'
.operate_area
'
).
hasClass
(
'
graphic
'
)}}
style
=
"
width:${extra_extra}px
"
{{
/if}}>
{{
tmpl
(
extra
)
'
#card_usage_
'
+
(
$
(
'
.operate_area
'
).
hasClass
(
'
text
'
)
?
'
text
'
:
'
graphic
'
)
+
'
_template
'
}}
<
/div>
<
/fieldset>
</script>
...
...
@@ -170,13 +173,15 @@
<div
class=
"main_right floatleft line"
>
<div
class=
"floatleft search_data graphic"
>
<div
class=
"floatleft search_bar"
>
<div
class=
"floatleft search_frame"
>
<input
type=
"text"
name=
""
class=
"search_input floatleft"
value=
""
/>
<input
type=
"submit"
class=
"serach_button"
value=
""
/>
</div>
<div
class=
"floatright advanced_search_father"
>
<div
class=
"advanced_search"
onclick=
"showMe(this,'submenu');"
>
高级搜索
</div>
</div>
<form
id=
"search"
>
<div
class=
"floatleft search_frame"
>
<input
type=
"text"
name=
""
class=
"search_input floatleft"
value=
""
/>
<input
type=
"submit"
class=
"serach_button"
value=
""
/>
</div>
<div
class=
"floatright advanced_search_father"
>
<div
class=
"advanced_search"
onclick=
"showMe(this,'submenu');"
>
高级搜索
</div>
</div>
</form>
<!-- 修改 -->
<div
class=
"submenu"
>
<div
class=
"floatright submenu_mask"
></div>
...
...
@@ -426,7 +431,7 @@
</div>
<div
class=
"select_cardUnder"
>
<div
class=
"donwload_out"
title=
"上传"
>
<input
id=
"deck_load"
class=
"upload_inner"
type=
"file"
/>
<input
id=
"deck_load"
class=
"upload_inner"
type=
"file"
/>
</div>
<div
class=
"donwload_out"
title=
"分享"
id=
"deck_share"
>
<div
class=
"download_inner"
></div>
...
...
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