Commit 759301b2 authored by 神楽坂玲奈's avatar 神楽坂玲奈

easypignate

parent 12cc9ad8
......@@ -354,7 +354,16 @@ class CardsController extends Spine.Controller
$('#search_cards_' + (if $('.operate_area').hasClass('text') then 'text' else 'graphic') + '_template')
search: (name)->
Card.fetch_by_name name, (cards)=>
category_count = {}
for category in Card.categories
category_count[category] = 0
for card in cards
category_count[(category for category in card.card_type when category in Card.categories).pop()]++
$("#search_cards_spells_count").html category_count.Spell
$("#search_cards_traps_count").html category_count.Trap
$("#search_cards_monsters_count").html category_count.Monster
@html @template().tmpl cards
@el.easyPaginate(step: 7, delay: 30)
decks = new DecksController(el: $("#deck"))
......
This diff is collapsed.
......@@ -104,17 +104,15 @@ body{margin:0;padding:0;background:#eee;}
label{float:left;}
}
}
.page{
max-width:518px;height:60px;padding:20px 15px 0 0;text-align:right;
#pagination {
max-width:518px;height:60px;padding:20px 15px 0 0;text-align:right;float:right;
a{margin:0 4px;}
}
.page_home{background:url('/assets/images/decks/page_arrows.gif') -26px 0 no-repeat;width:23px;height:17px;display:block;float:left;}
.page_pre{background:url('/assets/images/decks/page_arrows.gif') -1px 0 no-repeat;width:13px;height:17px;display:block;float:left;}
.page_next{background:url('/assets/images/decks/page_arrows.gif') -13px 0 no-repeat;width:13px;height:17px;display:block;float:left;}
.page_last{background:url('/assets/images/decks/page_arrows.gif') -47px 0 no-repeat;width:23px;height:17px;display:block;float:left;}
.page_num{
display:block;float:left;height:17px;line-height:17px;width:16px;font-size:14px;color:#999;text-decoration:none;text-align:center;
&:hover{text-decoration:underline;}
li{
display:block;float:left;height:17px;line-height:17px;width:16px;font-size:14px;color:#999;text-decoration:none;text-align:center;
&:hover{text-decoration:underline;}
}
.next{background:url('/assets/images/decks/page_arrows.gif') -13px 0 no-repeat;width:13px;height:17px;display:block;float:left;font-size: 0px;}
.prev{background:url('/assets/images/decks/page_arrows.gif') -1px 0 no-repeat;width:13px;height:17px;display:block;float:left;font-size: 0px;}
}
.card_group{
height:565px;//width:150px;
......@@ -237,7 +235,7 @@ body{margin:0;padding:0;background:#eee;}
}
span{font-size:12px;}
}
.page{
#pagination{
padding:20px 5px 0 0;
a{margin:0 2px;}
}
......
......@@ -442,22 +442,13 @@
<!-- 修改 -->
<div class="floatleft search_results">
<span style="color:#3366CC;font-weight:bold;">结果数</span>
魔法:<span style="color:#FFAD6E;">XXX</span>
陷阱:<span style="color:#FFAD6E;">XXX</span>
怪兽:<span style="color:#FFAD6E;">XXX</span>
魔法:<span id="search_cards_spells_count" style="color:#FFAD6E;">-</span>
陷阱:<span id="search_cards_traps_count" style="color:#FFAD6E;">-</span>
怪兽:<span id="search_cards_monsters_count" style="color:#FFAD6E;">-</span>
</div>
</div>
<div class="floatleft main_area" id="search_cards"></div>
<div class="floatright page">
<a class="page_home" href=""></a>
<a class="page_pre" href=""></a>
<a class="page_num" href="">9</a>
<a class="page_num" href="">10</a>
<a class="page_num" href="">11</a>
<a class="page_next" href=""></a>
<a class="page_last" href=""></a>
</div>
<!--{"archetypes":"","card_type":"\u6548\u679c\u602a\u517d","id":2067,"lore":"\u8fd9\u5f20\u5361\u653b\u51fb\u7684\u573a\u5408\uff0c\u5bf9\u65b9\u76f4\u5230\u4f24\u5bb3\u6b65\u9aa4\u7ed3\u675f\u65f6\u4e0d\u80fd\u53d1\u52a8\u9b54\u6cd5\u00b7\u9677\u9631\u5361\u3002\u7528\u4ee5\u4e0b\u7684\u602a\u517d\u4e3a\u796d\u54c1\u4f5c\u796d\u54c1\u53ec\u5524\u7684\u573a\u5408\uff0c\u8fd9\u5f20\u5361\u5f97\u5230\u5404\u81ea\u7684\u6548\u679c\u3002\u25cf\u7eff\u9f7f\u8f6e\uff1a\u8fd9\u5f20\u5361\u653b\u51fb\u5b88\u5907\u8868\u793a\u602a\u517d\u65f6\uff0c\u82e5\u8fd9\u5f20\u5361\u7684\u653b\u51fb\u529b\u8d85\u8fc7\u5b88\u5907\u8868\u793a\u602a\u517d\u7684\u5b88\u5907\u529b\uff0c\u7ed9\u4e88\u5bf9\u65b9\u57fa\u672c\u5206\u90a3\u4e2a\u6570\u503c\u7684\u6218\u6597\u4f24\u5bb3\u3002\u25cf\u7ea2\u9f7f\u8f6e\uff1a\u7ed9\u4e88\u5bf9\u65b9\u73a9\u5bb6\u6218\u6597\u4f24\u5bb3\u65f6\uff0c\u7ed9\u4e88\u5bf9\u65b9\u57fa\u672c\u5206400\u5206\u4f24\u5bb3\u3002\u25cf\u9ec4\u9f7f\u8f6e\uff1a\u6218\u6597\u7834\u574f\u5bf9\u65b9\u602a\u517d\u7684\u573a\u5408\uff0c\u7ed9\u4e88\u5bf9\u65b9\u57fa\u672c\u5206600\u5206\u4f24\u5bb3\u3002","mediums":"OCG\tTCG","monster_atk":3000,"monster_attribute":"\u5730","monster_def":2000,"monster_level":8,"monster_type":null,"name":"\u53e4\u4ee3\u7684\u673a\u68b0\u5de8\u9f99","number":50933533,"stats":"21,26,37","status":3,"tokens":0,"type":"\u673a\u68b0"} -->
</div>
......@@ -533,6 +524,7 @@
<script src="/vendor/javascripts/jquery.i18n.properties-min-1.0.9.js"></script>
<script src="/vendor/javascripts/jquery-ui-1.9.1.custom.min.js"></script>
<script src="/vendor/javascripts/jquery.base64.min.js"></script>
<script src="/vendor/javascripts/easypaginate.js"></script>
<script src="/vendor/javascripts/hScrollPane.js"></script>
<script src="/vendor/javascripts/jscroll.js"></script>
<script src="/vendor/javascripts/json2.js"></script>
......
/*
* Easy Paginate 1.0 - jQuery plugin
* written by Alen Grakalic
* http://cssglobe.com/
*
* Copyright (c) 2011 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* Built for jQuery library
* http://jquery.com
*
*/
(function($) {
$.fn.easyPaginate = function(options){
var defaults = {
step: 4,
delay: 100,
numeric: true,
nextprev: true,
auto:false,
loop:false,
pause:4000,
clickstop:true,
controls: 'pagination',
current: 'current',
randomstart: false
};
var options = $.extend(defaults, options);
var step = options.step;
var lower, upper;
var children = $(this).children();
var count = children.length;
var obj, next, prev;
var pages = Math.floor(count/step);
var page = (options.randomstart) ? Math.floor(Math.random()*pages)+1 : 1;
var timeout;
var clicked = false;
function show(){
clearTimeout(timeout);
lower = ((page-1) * step);
upper = lower+step;
$(children).each(function(i){
var child = $(this);
child.hide();
if(i>=lower && i<upper){ setTimeout(function(){ child.fadeIn('fast') }, ( i-( Math.floor(i/step) * step) )*options.delay ); }
if(options.nextprev){
if(upper >= count) { next.fadeOut('fast'); } else { next.fadeIn('fast'); };
if(lower >= 1) { prev.fadeIn('fast'); } else { prev.fadeOut('fast'); };
};
});
$('li','#'+ options.controls).removeClass(options.current);
$('li[data-index="'+page+'"]','#'+ options.controls).addClass(options.current);
if(options.auto){
if(options.clickstop && clicked){}else{ timeout = setTimeout(auto,options.pause); };
};
};
function auto(){
if(options.loop) if(upper >= count){ page=0; show(); }
if(upper < count){ page++; show(); }
};
this.each(function(){
obj = this;
if(count>step){
if((count/step) > pages) pages++;
var ol = $('<ol id="'+ options.controls +'"></ol>').insertAfter(obj);
if(options.nextprev){
prev = $('<li class="prev">Previous</li>')
.hide()
.appendTo(ol)
.click(function(){
clicked = true;
page--;
show();
});
};
if(options.numeric){
for(var i=1;i<=pages;i++){
$('<li data-index="'+ i +'">'+ i +'</li>')
.appendTo(ol)
.click(function(){
clicked = true;
page = $(this).attr('data-index');
show();
});
};
};
if(options.nextprev){
next = $('<li class="next">Next</li>')
.hide()
.appendTo(ol)
.click(function(){
clicked = true;
page++;
show();
});
};
show();
};
});
};
})(jQuery);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment