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
e3ba9477
Commit
e3ba9477
authored
Apr 02, 2013
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
72e2aa46
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
161 additions
and
153 deletions
+161
-153
assets/javascripts/decks.coffee
assets/javascripts/decks.coffee
+74
-75
assets/javascripts/decks.js
assets/javascripts/decks.js
+87
-78
No files found.
assets/javascripts/decks.coffee
View file @
e3ba9477
...
...
@@ -160,7 +160,7 @@ class Deck extends Spine.Model
if
!
line
or
line
.
charAt
(
0
)
==
'#'
continue
else
if
line
.
substr
(
0
,
5
)
==
'!side'
card_usages
.
push
{
card_id
:
last_id
,
side
:
side
,
count
:
count
}
if
last_id
card_usages
.
push
{
id
:
"
#{
result
.
cid
}
_
#{
side
}
_
#{
last_id
}
"
,
card_id
:
last_id
,
side
:
side
,
count
:
count
}
if
last_id
side
=
true
last_id
=
null
else
...
...
@@ -290,7 +290,12 @@ class DecksController extends Spine.Controller
load_from_url
:
(
url
)
->
try
decks
.
deck
Deck
.
decode
$
.
url
(
url
).
param
(
'cards'
),
$
.
url
().
param
(
'name'
)
#there is a bug in old version deck editor.
cards_param
=
$
.
url
(
url
).
param
(
'cards'
)
if
cards_param
.
indexOf
(
'*'
)
>=
0
cards_param
=
cards_param
.
replace
/[\*\-]/g
,
(
char
)
->
{
'*'
:
'-'
,
'-'
:
'_'
}[
char
]
decks
.
deck
Deck
.
decode
cards_param
,
$
.
url
().
param
(
'name'
)
catch
error
alert
error
...
...
@@ -368,20 +373,14 @@ class CardsController extends Spine.Controller
decks
=
new
DecksController
(
el
:
$
(
"#deck"
))
cards
=
new
CardsController
(
el
:
$
(
"#search_cards"
))
#there is a bug in old version deck editor.
competition_convert
=
{
'*'
:
'-'
,
'-'
:
'_'
}
if
document
.
location
.
href
.
indexOf
(
'*'
)
>=
0
location
.
href
=
document
.
location
.
href
.
replace
/[\*\-]/g
,
(
char
)
->
competition_convert
[
char
]
$
(
document
).
ready
->
decks
.
load_from_url
()
decks
.
load_from_url
()
$
(
'#search'
).
submit
->
$
(
'#search'
).
submit
->
cards
.
search
$
(
'.search_input'
).
val
()
return
false
#dialog
$
(
"#deck_share_dialog"
).
dialog
#dialog
$
(
"#deck_share_dialog"
).
dialog
modal
:
true
autoOpen
:
$
.
url
().
attr
(
'fragment'
)
==
'share'
width
:
600
...
...
@@ -390,18 +389,18 @@ $(document).ready ->
$
(
"#deck_url"
)[
0
].
select
()
$
(
"#deck_url_qrcode"
).
attr
'src'
,
'https://chart.googleapis.com/chart?chs=171x171&cht=qr&chld=|0&chl='
+
encodeURIComponent
(
decks
.
deck
().
url
())
$
(
"#drop_upload_dialog"
).
dialog
$
(
"#drop_upload_dialog"
).
dialog
dialogClass
:
'drop_upload'
draggable
:
false
resizable
:
false
modal
:
true
autoOpen
:
false
#share
$
(
'#deck_share'
).
click
->
#share
$
(
'#deck_share'
).
click
->
$
(
"#deck_share_dialog"
).
dialog
(
'open'
)
$
(
'#deck_url_shorten'
).
click
->
$
(
'#deck_url_shorten'
).
click
->
$
(
'#deck_url_shorten'
).
attr
"disabled"
,
true
$
.
ajax
url
:
'https://www.googleapis.com/urlshortener/v1/url'
...
...
@@ -413,32 +412,32 @@ $(document).ready ->
$
(
"#deck_url"
)[
0
].
select
()
$
(
'#deck_url_shorten'
).
attr
"disabled"
,
false
#upload
$
(
'#deck_load'
).
change
->
#upload
$
(
'#deck_load'
).
change
->
decks
.
upload
(
@
files
)
$
(
window
).
bind
'popstate'
,
(
ev
)
->
$
(
window
).
bind
'popstate'
,
(
ev
)
->
if
ev
.
state
deck
.
refresh
ev
.
state
,
false
$
(
'.main_div'
).
bind
'dragover'
,
(
ev
)
->
$
(
'.main_div'
).
bind
'dragover'
,
(
ev
)
->
ev
.
preventDefault
();
#$("#drop_upload_dialog").dialog('open')
#$("#drop_upload_dialog").dialog('open')
$
(
'.main_div'
).
bind
'drop'
,
(
ev
)
->
$
(
'.main_div'
).
bind
'drop'
,
(
ev
)
->
ev
.
preventDefault
();
$
(
"#drop_upload_dialog"
).
dialog
(
'close'
)
decks
.
upload
event
.
dataTransfer
.
files
$
(
".switch"
).
click
->
$
(
".switch"
).
click
->
$
(
".text,.graphic"
).
toggleClass
(
"graphic text"
)
decks
.
render
()
$
.
i18n
.
properties
$
.
i18n
.
properties
name
:
'card'
path
:
'/locales/'
mode
:
'map'
cache
:
true
addthis
.
init
()
\ No newline at end of file
addthis
.
init
()
\ No newline at end of file
assets/javascripts/decks.js
View file @
e3ba9477
// Generated by CoffeeScript 1.6.2
(
function
()
{
var
Card
,
CardUsage
,
CardsController
,
Deck
,
DecksController
,
cards
,
competition_convert
,
decks
,
locale
,
_ref
,
_ref1
,
_ref2
,
_ref3
,
_ref4
,
var
Card
,
CardUsage
,
CardsController
,
Deck
,
DecksController
,
cards
,
decks
,
locale
,
_ref
,
_ref1
,
_ref2
,
_ref3
,
_ref4
,
__hasProp
=
{}.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
();
child
.
__super__
=
parent
.
prototype
;
return
child
;
},
__indexOf
=
[].
indexOf
||
function
(
item
)
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
)
{
if
(
i
in
this
&&
this
[
i
]
===
item
)
return
i
;
}
return
-
1
;
},
...
...
@@ -392,6 +392,7 @@
}
else
if
(
line
.
substr
(
0
,
5
)
===
'
!side
'
)
{
if
(
last_id
)
{
card_usages
.
push
({
id
:
""
+
result
.
cid
+
"
_
"
+
side
+
"
_
"
+
last_id
,
card_id
:
last_id
,
side
:
side
,
count
:
count
...
...
@@ -641,10 +642,19 @@
};
DecksController
.
prototype
.
load_from_url
=
function
(
url
)
{
var
error
;
var
cards_param
,
error
;
try
{
return
decks
.
deck
(
Deck
.
decode
(
$
.
url
(
url
).
param
(
'
cards
'
),
$
.
url
().
param
(
'
name
'
)));
cards_param
=
$
.
url
(
url
).
param
(
'
cards
'
);
if
(
cards_param
.
indexOf
(
'
*
'
)
>=
0
)
{
cards_param
=
cards_param
.
replace
(
/
[\*\-]
/g
,
function
(
char
)
{
return
{
'
*
'
:
'
-
'
,
'
-
'
:
'
_
'
}[
char
];
});
}
return
decks
.
deck
(
Deck
.
decode
(
cards_param
,
$
.
url
().
param
(
'
name
'
)));
}
catch
(
_error
)
{
error
=
_error
;
return
alert
(
error
);
...
...
@@ -852,23 +862,13 @@
el
:
$
(
"
#search_cards
"
)
});
competition_convert
=
{
'
*
'
:
'
-
'
,
'
-
'
:
'
_
'
};
if
(
document
.
location
.
href
.
indexOf
(
'
*
'
)
>=
0
)
{
location
.
href
=
document
.
location
.
href
.
replace
(
/
[\*\-]
/g
,
function
(
char
)
{
return
competition_convert
[
char
];
});
}
$
(
document
).
ready
(
function
()
{
decks
.
load_from_url
();
$
(
'
#search
'
).
submit
(
function
()
{
cards
.
search
(
$
(
'
.search_input
'
).
val
());
return
false
;
});
$
(
"
#deck_share_dialog
"
).
dialog
({
modal
:
true
,
autoOpen
:
$
.
url
().
attr
(
'
fragment
'
)
===
'
share
'
,
...
...
@@ -879,6 +879,7 @@
return
$
(
"
#deck_url_qrcode
"
).
attr
(
'
src
'
,
'
https://chart.googleapis.com/chart?chs=171x171&cht=qr&chld=|0&chl=
'
+
encodeURIComponent
(
decks
.
deck
().
url
()));
}
});
$
(
"
#drop_upload_dialog
"
).
dialog
({
dialogClass
:
'
drop_upload
'
,
draggable
:
false
,
...
...
@@ -886,9 +887,11 @@
modal
:
true
,
autoOpen
:
false
});
$
(
'
#deck_share
'
).
click
(
function
()
{
return
$
(
"
#deck_share_dialog
"
).
dialog
(
'
open
'
);
});
$
(
'
#deck_url_shorten
'
).
click
(
function
()
{
$
(
'
#deck_url_shorten
'
).
attr
(
"
disabled
"
,
true
);
return
$
.
ajax
({
...
...
@@ -905,33 +908,39 @@
}
});
});
$
(
'
#deck_load
'
).
change
(
function
()
{
return
decks
.
upload
(
this
.
files
);
});
$
(
window
).
bind
(
'
popstate
'
,
function
(
ev
)
{
if
(
ev
.
state
)
{
return
deck
.
refresh
(
ev
.
state
,
false
);
}
});
$
(
'
.main_div
'
).
bind
(
'
dragover
'
,
function
(
ev
)
{
return
ev
.
preventDefault
();
});
$
(
'
.main_div
'
).
bind
(
'
drop
'
,
function
(
ev
)
{
ev
.
preventDefault
();
$
(
"
#drop_upload_dialog
"
).
dialog
(
'
close
'
);
return
decks
.
upload
(
event
.
dataTransfer
.
files
);
});
$
(
"
.switch
"
).
click
(
function
()
{
$
(
"
.text,.graphic
"
).
toggleClass
(
"
graphic text
"
);
return
decks
.
render
();
});
$
.
i18n
.
properties
({
name
:
'
card
'
,
path
:
'
/locales/
'
,
mode
:
'
map
'
,
cache
:
true
});
return
addthis
.
init
();
}
);
addthis
.
init
(
);
}).
call
(
this
);
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