From 24c5f20d3dde3822f8588c6628cdc0daec2fb21e Mon Sep 17 00:00:00 2001 From: lifesinger Date: Sat, 18 Jan 2014 10:33:55 +0800 Subject: [PATCH] for year cheering --- sea-modules/examples/lucky/1.0.0/main-debug.js | 10 +++++----- sea-modules/examples/lucky/1.0.0/main.js | 2 +- sea-modules/examples/lucky/1.0.0/style-debug.css | 16 ++++++++-------- sea-modules/examples/lucky/1.0.0/style.css | 2 +- static/lucky/dist/main-debug.js | 10 +++++----- static/lucky/dist/main.js | 2 +- static/lucky/dist/style-debug.css | 16 ++++++++-------- static/lucky/dist/style.css | 2 +- static/lucky/src/data.js | 12 +++++++----- static/lucky/src/lucky.js | 1 - static/lucky/src/style.css | 16 ++++++++-------- static/lucky/src/user.js | 8 ++++---- 12 files changed, 49 insertions(+), 48 deletions(-) diff --git a/sea-modules/examples/lucky/1.0.0/main-debug.js b/sea-modules/examples/lucky/1.0.0/main-debug.js index 0027c16..06ac9c0 100644 --- a/sea-modules/examples/lucky/1.0.0/main-debug.js +++ b/sea-modules/examples/lucky/1.0.0/main-debug.js @@ -8,7 +8,7 @@ define("examples/lucky/1.0.0/main-debug", [ "./data-debug", "./lucky-debug", "jq lucky.init(data); }); -define("examples/lucky/1.0.0/data-debug", [], [ "马云", "马化腾", "李彦宏", "周鸿祎", "玉伯", "沉鱼", "丹侠", "贯高", "邵帅", "陆辉", "南伯", "崔护", "偏右", "远尘", "臻儿", "左宜", "张初尘", "初成", "琼羽", "异草", "闭月", "周爱民", "陈皓", "winter", "army", "hax", "老赵", "sofish", "罗龙浩" ]); +define("examples/lucky/1.0.0/data-debug", [], [ "梓胥", "李磊", "俊义", "兰玉", "泥巴", "对剑", "希普", "牧木", "夏雩", "衡芜", "钝刀", "苍新", "琳心", "玉鼎", "冯衡", "伍举", "长松", "卫海", "伯川", "道潜", "丁勉", "竹棒", "妙才", "许由", "祢衡", "赵盾", "斗子文", "寇恂", "极天", "秦天", "裴秀", "花朝", "静俭", "墨颜", "王维", "马武", "公孙龙", "甘德", "流珠", "路悠", "樽空", "沐峰", "清筠", "绝伦", "星辰", "羽单", "伯兮", "郝思文", "聂壹", "南岸", "明恽", "君乾", "飞天", "文赢", "义均", "文和", "曹彬", "晁错", "兔葵", "苏星河", "太常", "北湖", "弘殷", "吕蒙", "颜良", "庄辛", "崇幻", "贝儿", "柏平", "小毛", "战尘", "子盛", "问柏", "湛然", "独慕", "浴尘", "公与", "桑美", "晏婴", "严成方", "连挚", "汪信之", "楚天", "良臣", "暮城", "塔石", "薇达", "行洋", "明何", "昔空", "蓝玉", "韩当", "丛英", "吞佛", "真岚", "仲文", "吕方", "郑天寿", "一恒", "誉少", "无竞", "九弦", "玉伯", "冒顿", "啸生", "尹曰", "臻儿", "籽沐", "余化", "玉郎", "右丞", "默哈", "血诺", "桐杰", "镜曦", "沉鱼", "贯高", "陆辉", "浩初", "天材", "偏右", "云谦", "乔花", "展新", "张初尘", "宫煌", "宗玄", "一正", "若夷", "普渡", "晴汐", "徒离", "仲景", "大禹", "徐盛", "木合", "郭淮", "方嘉", "李渔", "长皓", "渔樵", "惜年", "沧溟", "东隅", "海涛", "磻溪" ]); define("examples/lucky/1.0.0/lucky-debug", [ "jquery-debug", "jquery-easing-debug", "examples/lucky/1.0.0/user-debug" ], function(require, exports, module) { var $ = require("jquery-debug"); @@ -183,10 +183,10 @@ define("examples/lucky/1.0.0/user-debug", [ "jquery-debug" ], function(require, var $ = require("jquery-debug"); var CANVAS_HEIGHT = 500; var CANVAS_WIDTH = 900; - var BALL_WIDTH = 60; - var BALL_HEIGHT = 60; - var LUCKY_BALL_WIDTH = 200; - var LUCKY_BALL_HEIGHT = 200; + var BALL_WIDTH = 40; + var BALL_HEIGHT = 40; + var LUCKY_BALL_WIDTH = 120; + var LUCKY_BALL_HEIGHT = 120; var MAX_ZINDEX = 100; var DURATION_MIN = 100; var DURATION_MAX = 500; diff --git a/sea-modules/examples/lucky/1.0.0/main.js b/sea-modules/examples/lucky/1.0.0/main.js index aa2c61e..18943e5 100644 --- a/sea-modules/examples/lucky/1.0.0/main.js +++ b/sea-modules/examples/lucky/1.0.0/main.js @@ -1 +1 @@ -document.attachEvent&&alert("这个例子不支持 Old IE 哦"),define("examples/lucky/1.0.0/main",["./data","./lucky","jquery","jquery-easing","./user"],function(a){var b=a("./data"),c=a("./lucky");c.init(b)}),define("examples/lucky/1.0.0/data",[],["马云","马化腾","李彦宏","周鸿祎","玉伯","沉鱼","丹侠","贯高","邵帅","陆辉","南伯","崔护","偏右","远尘","臻儿","左宜","张初尘","初成","琼羽","异草","闭月","周爱民","陈皓","winter","army","hax","老赵","sofish","罗龙浩"]),define("examples/lucky/1.0.0/lucky",["jquery","jquery-easing","examples/lucky/1.0.0/user"],function(a,b,c){function d(a,b){return Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))}function e(a,b){return d(a,b)<=(a.width+b.width)/2}function f(a,b){var c=b.y-a.y,e=b.x-a.x,f=d(a,b),g=Math.ceil(((a.width+b.width)/2-f)/j),h=c>0?Math.ceil(g*c/f):Math.floor(g*c/f),i=e>0?Math.ceil(g*e/f):Math.floor(g*e/f);a.lucky?(b._xMove+=2*i,b._yMove+=2*h):b.lucky?(a._xMove+=-2*i,a._yMove+=-2*h):(a._yMove+=-1*h,b._yMove+=h,a._xMove+=-1*i,b._xMove+=i)}var g=a("jquery");a("jquery-easing");var h=a("examples/lucky/1.0.0/user"),i=100,j=4;c.exports={users:[],init:function(a){g("#container").css("background","none"),this.data=a,this.users=a.map(function(b){return new h(b,a[b])}),this._bindUI()},_bindUI:function(){function a(){"start"===c.getAttribute("data-action")?(c.setAttribute("data-action","stop"),c.innerHTML=c.getAttribute("data-text-stop"),b.start()):(c.setAttribute("data-action","start"),c.innerHTML=c.getAttribute("data-text-start"),b.stop())}var b=this,c=document.querySelector("#go");c.innerHTML=c.getAttribute("data-text-start"),c.addEventListener("click",a,!1),g("#lucky-balls").on("click","li",function(a){var c=g(a.target),d=c.text();b.addItem(d),b.hit(),c.remove()}),g("#balls").on("click","li",function(a){for(var c=g(a.target),d=c.text(),e=0;e0&&(this.timer=setTimeout(function(){a.hit()},i))}}}),define("examples/lucky/1.0.0/user",["jquery"],function(a,b,c){function d(a,b){this.name=a,this.options=b||{},this.el=null,this.width=0,this.height=0,this.left=0,this.top=0,this.x=0,this.y=0,this.moving=!1,this.lucky=!1,this.createEl(),this.move()}function e(a,b){return a=a||0,b=b||1,Math.floor(Math.random()*(b-a+1)+a)}var f=a("jquery"),g=500,h=900,i=60,j=60,k=200,l=200,m=100,n=100,o=500,p=500;c.exports=d,d.prototype.createEl=function(){this.el=f("
  • "+this.name+"
  • ").appendTo("#balls"),this.width=this.el.width(),this.height=this.el.height()},d.prototype.move=function(a){this.left=e(0,h-this.width),this.top=e(0,g-this.height),this.zIndex=e(0,m),this.reflow(a)},d.prototype.reflow=function(a,b){this.x=this.left+this.width/2,this.y=this.top+this.height/2,this.el[0].style.zIndex=this.zIndex,b?(this.el[0].style.left=this.left,this.el[0].style.top=this.top):this.el.animate({left:this.left,top:this.top},e(n,o),"easeOutBack",a)},d.prototype.start=function(){this.reset(),this.moving=!0,this.autoMove()},d.prototype.reset=function(){this.el.stop(!0,!0),this.lucky=!1,this.el[0].className="",this.el[0].style.width=i+"px",this.el[0].style.height=j+"px",this.width=this.el.width(),this.height=this.el.height(),this._maxTop=g-this.height,this._maxLeft=h-this.width},d.prototype.autoMove=function(){var a=this;this.moving&&this.move(function(){a.autoMove()})},d.prototype.stop=function(){this.el.stop(!0,!0),this.moving=!1},d.prototype.bang=function(){this.lucky=!0,this.el[0].className="selected",this.width=k,this.height=l,this.left=(h-this.width)/2,this.top=(g-this.height)/2,this.el.animate({left:this.left,top:this.top,width:this.width,height:this.height},p)},d.prototype.beginHit=function(){this._xMove=0,this._yMove=0},d.prototype.hitMove=function(){this.left+=this._xMove,this.top+=this._yMove,this.top=this.top<0?0:this.top>this._maxTop?this._maxTop:this.top,this.left=this.left<0?0:this.left>this._maxLeft?this._maxLeft:this.left,this.reflow(null,!1)}}); +document.attachEvent&&alert("这个例子不支持 Old IE 哦"),define("examples/lucky/1.0.0/main",["./data","./lucky","jquery","jquery-easing","./user"],function(a){var b=a("./data"),c=a("./lucky");c.init(b)}),define("examples/lucky/1.0.0/data",[],["梓胥","李磊","俊义","兰玉","泥巴","对剑","希普","牧木","夏雩","衡芜","钝刀","苍新","琳心","玉鼎","冯衡","伍举","长松","卫海","伯川","道潜","丁勉","竹棒","妙才","许由","祢衡","赵盾","斗子文","寇恂","极天","秦天","裴秀","花朝","静俭","墨颜","王维","马武","公孙龙","甘德","流珠","路悠","樽空","沐峰","清筠","绝伦","星辰","羽单","伯兮","郝思文","聂壹","南岸","明恽","君乾","飞天","文赢","义均","文和","曹彬","晁错","兔葵","苏星河","太常","北湖","弘殷","吕蒙","颜良","庄辛","崇幻","贝儿","柏平","小毛","战尘","子盛","问柏","湛然","独慕","浴尘","公与","桑美","晏婴","严成方","连挚","汪信之","楚天","良臣","暮城","塔石","薇达","行洋","明何","昔空","蓝玉","韩当","丛英","吞佛","真岚","仲文","吕方","郑天寿","一恒","誉少","无竞","九弦","玉伯","冒顿","啸生","尹曰","臻儿","籽沐","余化","玉郎","右丞","默哈","血诺","桐杰","镜曦","沉鱼","贯高","陆辉","浩初","天材","偏右","云谦","乔花","展新","张初尘","宫煌","宗玄","一正","若夷","普渡","晴汐","徒离","仲景","大禹","徐盛","木合","郭淮","方嘉","李渔","长皓","渔樵","惜年","沧溟","东隅","海涛","磻溪"]),define("examples/lucky/1.0.0/lucky",["jquery","jquery-easing","examples/lucky/1.0.0/user"],function(a,b,c){function d(a,b){return Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))}function e(a,b){return d(a,b)<=(a.width+b.width)/2}function f(a,b){var c=b.y-a.y,e=b.x-a.x,f=d(a,b),g=Math.ceil(((a.width+b.width)/2-f)/j),h=c>0?Math.ceil(g*c/f):Math.floor(g*c/f),i=e>0?Math.ceil(g*e/f):Math.floor(g*e/f);a.lucky?(b._xMove+=2*i,b._yMove+=2*h):b.lucky?(a._xMove+=-2*i,a._yMove+=-2*h):(a._yMove+=-1*h,b._yMove+=h,a._xMove+=-1*i,b._xMove+=i)}var g=a("jquery");a("jquery-easing");var h=a("examples/lucky/1.0.0/user"),i=100,j=4;c.exports={users:[],init:function(a){g("#container").css("background","none"),this.data=a,this.users=a.map(function(b){return new h(b,a[b])}),this._bindUI()},_bindUI:function(){function a(){"start"===c.getAttribute("data-action")?(c.setAttribute("data-action","stop"),c.innerHTML=c.getAttribute("data-text-stop"),b.start()):(c.setAttribute("data-action","start"),c.innerHTML=c.getAttribute("data-text-start"),b.stop())}var b=this,c=document.querySelector("#go");c.innerHTML=c.getAttribute("data-text-start"),c.addEventListener("click",a,!1),g("#lucky-balls").on("click","li",function(a){var c=g(a.target),d=c.text();b.addItem(d),b.hit(),c.remove()}),g("#balls").on("click","li",function(a){for(var c=g(a.target),d=c.text(),e=0;e0&&(this.timer=setTimeout(function(){a.hit()},i))}}}),define("examples/lucky/1.0.0/user",["jquery"],function(a,b,c){function d(a,b){this.name=a,this.options=b||{},this.el=null,this.width=0,this.height=0,this.left=0,this.top=0,this.x=0,this.y=0,this.moving=!1,this.lucky=!1,this.createEl(),this.move()}function e(a,b){return a=a||0,b=b||1,Math.floor(Math.random()*(b-a+1)+a)}var f=a("jquery"),g=500,h=900,i=40,j=40,k=120,l=120,m=100,n=100,o=500,p=500;c.exports=d,d.prototype.createEl=function(){this.el=f("
  • "+this.name+"
  • ").appendTo("#balls"),this.width=this.el.width(),this.height=this.el.height()},d.prototype.move=function(a){this.left=e(0,h-this.width),this.top=e(0,g-this.height),this.zIndex=e(0,m),this.reflow(a)},d.prototype.reflow=function(a,b){this.x=this.left+this.width/2,this.y=this.top+this.height/2,this.el[0].style.zIndex=this.zIndex,b?(this.el[0].style.left=this.left,this.el[0].style.top=this.top):this.el.animate({left:this.left,top:this.top},e(n,o),"easeOutBack",a)},d.prototype.start=function(){this.reset(),this.moving=!0,this.autoMove()},d.prototype.reset=function(){this.el.stop(!0,!0),this.lucky=!1,this.el[0].className="",this.el[0].style.width=i+"px",this.el[0].style.height=j+"px",this.width=this.el.width(),this.height=this.el.height(),this._maxTop=g-this.height,this._maxLeft=h-this.width},d.prototype.autoMove=function(){var a=this;this.moving&&this.move(function(){a.autoMove()})},d.prototype.stop=function(){this.el.stop(!0,!0),this.moving=!1},d.prototype.bang=function(){this.lucky=!0,this.el[0].className="selected",this.width=k,this.height=l,this.left=(h-this.width)/2,this.top=(g-this.height)/2,this.el.animate({left:this.left,top:this.top,width:this.width,height:this.height},p)},d.prototype.beginHit=function(){this._xMove=0,this._yMove=0},d.prototype.hitMove=function(){this.left+=this._xMove,this.top+=this._yMove,this.top=this.top<0?0:this.top>this._maxTop?this._maxTop:this.top,this.left=this.left<0?0:this.left>this._maxLeft?this._maxLeft:this.left,this.reflow(null,!1)}}); diff --git a/sea-modules/examples/lucky/1.0.0/style-debug.css b/sea-modules/examples/lucky/1.0.0/style-debug.css index d234a26..13a2728 100644 --- a/sea-modules/examples/lucky/1.0.0/style-debug.css +++ b/sea-modules/examples/lucky/1.0.0/style-debug.css @@ -28,15 +28,15 @@ ul li { left: 420px; top: 470px; padding: 0; - width: 60px; - height: 60px; + width: 40px; + height: 40px; overflow: hidden; - font-size: 16px; + font-size: 12px; background: #333; color: #ddd; opacity: .5; text-align: center; - line-height: 60px; + line-height: 43px; border-radius: 30px; word-break: keep-all; cursor: pointer; @@ -56,10 +56,10 @@ ul li { #balls li.selected { color: #fff; background: #f60; - font-size: 50px; + font-size: 40px; height: 200px; width: 200px; - line-height: 200px; + line-height: 128px; border-radius: 100px; -webkit-transition: 0.3s ease-in; -webkit-transition-property: width, height, font; @@ -76,8 +76,8 @@ ul li { position: relative; left: auto !important; top: auto !important; - width: 60px !important; - height: 60px !important; + width: 40px !important; + height: 40px !important; float: left; margin: 5px 10px; font-weight: bold; diff --git a/sea-modules/examples/lucky/1.0.0/style.css b/sea-modules/examples/lucky/1.0.0/style.css index 81b3f05..4307bf7 100644 --- a/sea-modules/examples/lucky/1.0.0/style.css +++ b/sea-modules/examples/lucky/1.0.0/style.css @@ -1 +1 @@ -body{font:20px "Hiragino Sans GB",sans-serif;background:#eee}ul li{list-style:none}#container{width:900px;margin:10px auto;position:relative;background:url(https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif) no-repeat 45% 25%}#balls{padding:0;margin:0;list-style:none;height:500px}#balls li,#lucky-balls li{position:absolute;left:420px;top:470px;padding:0;width:60px;height:60px;overflow:hidden;font-size:16px;background:#333;color:#ddd;opacity:.5;text-align:center;line-height:60px;border-radius:30px;word-break:keep-all;cursor:pointer}#go{width:200px;height:50px;display:block;margin:0 auto;font-size:22px;border:0;background:0;color:#999}#balls li.selected{color:#fff;background:#f60;font-size:50px;height:200px;width:200px;line-height:200px;border-radius:100px;-webkit-transition:.3s ease-in;-webkit-transition-property:width,height,font;z-index:100}#lucky-balls{padding:20px;margin:10px 0;list-style:none}#lucky-balls li{position:relative;left:auto!important;top:auto!important;width:60px!important;height:60px!important;float:left;margin:5px 10px;font-weight:700;color:#fff;background:#f60} +body{font:20px "Hiragino Sans GB",sans-serif;background:#eee}ul li{list-style:none}#container{width:900px;margin:10px auto;position:relative;background:url(https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif) no-repeat 45% 25%}#balls{padding:0;margin:0;list-style:none;height:500px}#balls li,#lucky-balls li{position:absolute;left:420px;top:470px;padding:0;width:40px;height:40px;overflow:hidden;font-size:12px;background:#333;color:#ddd;opacity:.5;text-align:center;line-height:43px;border-radius:30px;word-break:keep-all;cursor:pointer}#go{width:200px;height:50px;display:block;margin:0 auto;font-size:22px;border:0;background:0;color:#999}#balls li.selected{color:#fff;background:#f60;font-size:40px;height:200px;width:200px;line-height:128px;border-radius:100px;-webkit-transition:.3s ease-in;-webkit-transition-property:width,height,font;z-index:100}#lucky-balls{padding:20px;margin:10px 0;list-style:none}#lucky-balls li{position:relative;left:auto!important;top:auto!important;width:40px!important;height:40px!important;float:left;margin:5px 10px;font-weight:700;color:#fff;background:#f60} diff --git a/static/lucky/dist/main-debug.js b/static/lucky/dist/main-debug.js index 0027c16..06ac9c0 100644 --- a/static/lucky/dist/main-debug.js +++ b/static/lucky/dist/main-debug.js @@ -8,7 +8,7 @@ define("examples/lucky/1.0.0/main-debug", [ "./data-debug", "./lucky-debug", "jq lucky.init(data); }); -define("examples/lucky/1.0.0/data-debug", [], [ "马云", "马化腾", "李彦宏", "周鸿祎", "玉伯", "沉鱼", "丹侠", "贯高", "邵帅", "陆辉", "南伯", "崔护", "偏右", "远尘", "臻儿", "左宜", "张初尘", "初成", "琼羽", "异草", "闭月", "周爱民", "陈皓", "winter", "army", "hax", "老赵", "sofish", "罗龙浩" ]); +define("examples/lucky/1.0.0/data-debug", [], [ "梓胥", "李磊", "俊义", "兰玉", "泥巴", "对剑", "希普", "牧木", "夏雩", "衡芜", "钝刀", "苍新", "琳心", "玉鼎", "冯衡", "伍举", "长松", "卫海", "伯川", "道潜", "丁勉", "竹棒", "妙才", "许由", "祢衡", "赵盾", "斗子文", "寇恂", "极天", "秦天", "裴秀", "花朝", "静俭", "墨颜", "王维", "马武", "公孙龙", "甘德", "流珠", "路悠", "樽空", "沐峰", "清筠", "绝伦", "星辰", "羽单", "伯兮", "郝思文", "聂壹", "南岸", "明恽", "君乾", "飞天", "文赢", "义均", "文和", "曹彬", "晁错", "兔葵", "苏星河", "太常", "北湖", "弘殷", "吕蒙", "颜良", "庄辛", "崇幻", "贝儿", "柏平", "小毛", "战尘", "子盛", "问柏", "湛然", "独慕", "浴尘", "公与", "桑美", "晏婴", "严成方", "连挚", "汪信之", "楚天", "良臣", "暮城", "塔石", "薇达", "行洋", "明何", "昔空", "蓝玉", "韩当", "丛英", "吞佛", "真岚", "仲文", "吕方", "郑天寿", "一恒", "誉少", "无竞", "九弦", "玉伯", "冒顿", "啸生", "尹曰", "臻儿", "籽沐", "余化", "玉郎", "右丞", "默哈", "血诺", "桐杰", "镜曦", "沉鱼", "贯高", "陆辉", "浩初", "天材", "偏右", "云谦", "乔花", "展新", "张初尘", "宫煌", "宗玄", "一正", "若夷", "普渡", "晴汐", "徒离", "仲景", "大禹", "徐盛", "木合", "郭淮", "方嘉", "李渔", "长皓", "渔樵", "惜年", "沧溟", "东隅", "海涛", "磻溪" ]); define("examples/lucky/1.0.0/lucky-debug", [ "jquery-debug", "jquery-easing-debug", "examples/lucky/1.0.0/user-debug" ], function(require, exports, module) { var $ = require("jquery-debug"); @@ -183,10 +183,10 @@ define("examples/lucky/1.0.0/user-debug", [ "jquery-debug" ], function(require, var $ = require("jquery-debug"); var CANVAS_HEIGHT = 500; var CANVAS_WIDTH = 900; - var BALL_WIDTH = 60; - var BALL_HEIGHT = 60; - var LUCKY_BALL_WIDTH = 200; - var LUCKY_BALL_HEIGHT = 200; + var BALL_WIDTH = 40; + var BALL_HEIGHT = 40; + var LUCKY_BALL_WIDTH = 120; + var LUCKY_BALL_HEIGHT = 120; var MAX_ZINDEX = 100; var DURATION_MIN = 100; var DURATION_MAX = 500; diff --git a/static/lucky/dist/main.js b/static/lucky/dist/main.js index aa2c61e..18943e5 100644 --- a/static/lucky/dist/main.js +++ b/static/lucky/dist/main.js @@ -1 +1 @@ -document.attachEvent&&alert("这个例子不支持 Old IE 哦"),define("examples/lucky/1.0.0/main",["./data","./lucky","jquery","jquery-easing","./user"],function(a){var b=a("./data"),c=a("./lucky");c.init(b)}),define("examples/lucky/1.0.0/data",[],["马云","马化腾","李彦宏","周鸿祎","玉伯","沉鱼","丹侠","贯高","邵帅","陆辉","南伯","崔护","偏右","远尘","臻儿","左宜","张初尘","初成","琼羽","异草","闭月","周爱民","陈皓","winter","army","hax","老赵","sofish","罗龙浩"]),define("examples/lucky/1.0.0/lucky",["jquery","jquery-easing","examples/lucky/1.0.0/user"],function(a,b,c){function d(a,b){return Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))}function e(a,b){return d(a,b)<=(a.width+b.width)/2}function f(a,b){var c=b.y-a.y,e=b.x-a.x,f=d(a,b),g=Math.ceil(((a.width+b.width)/2-f)/j),h=c>0?Math.ceil(g*c/f):Math.floor(g*c/f),i=e>0?Math.ceil(g*e/f):Math.floor(g*e/f);a.lucky?(b._xMove+=2*i,b._yMove+=2*h):b.lucky?(a._xMove+=-2*i,a._yMove+=-2*h):(a._yMove+=-1*h,b._yMove+=h,a._xMove+=-1*i,b._xMove+=i)}var g=a("jquery");a("jquery-easing");var h=a("examples/lucky/1.0.0/user"),i=100,j=4;c.exports={users:[],init:function(a){g("#container").css("background","none"),this.data=a,this.users=a.map(function(b){return new h(b,a[b])}),this._bindUI()},_bindUI:function(){function a(){"start"===c.getAttribute("data-action")?(c.setAttribute("data-action","stop"),c.innerHTML=c.getAttribute("data-text-stop"),b.start()):(c.setAttribute("data-action","start"),c.innerHTML=c.getAttribute("data-text-start"),b.stop())}var b=this,c=document.querySelector("#go");c.innerHTML=c.getAttribute("data-text-start"),c.addEventListener("click",a,!1),g("#lucky-balls").on("click","li",function(a){var c=g(a.target),d=c.text();b.addItem(d),b.hit(),c.remove()}),g("#balls").on("click","li",function(a){for(var c=g(a.target),d=c.text(),e=0;e0&&(this.timer=setTimeout(function(){a.hit()},i))}}}),define("examples/lucky/1.0.0/user",["jquery"],function(a,b,c){function d(a,b){this.name=a,this.options=b||{},this.el=null,this.width=0,this.height=0,this.left=0,this.top=0,this.x=0,this.y=0,this.moving=!1,this.lucky=!1,this.createEl(),this.move()}function e(a,b){return a=a||0,b=b||1,Math.floor(Math.random()*(b-a+1)+a)}var f=a("jquery"),g=500,h=900,i=60,j=60,k=200,l=200,m=100,n=100,o=500,p=500;c.exports=d,d.prototype.createEl=function(){this.el=f("
  • "+this.name+"
  • ").appendTo("#balls"),this.width=this.el.width(),this.height=this.el.height()},d.prototype.move=function(a){this.left=e(0,h-this.width),this.top=e(0,g-this.height),this.zIndex=e(0,m),this.reflow(a)},d.prototype.reflow=function(a,b){this.x=this.left+this.width/2,this.y=this.top+this.height/2,this.el[0].style.zIndex=this.zIndex,b?(this.el[0].style.left=this.left,this.el[0].style.top=this.top):this.el.animate({left:this.left,top:this.top},e(n,o),"easeOutBack",a)},d.prototype.start=function(){this.reset(),this.moving=!0,this.autoMove()},d.prototype.reset=function(){this.el.stop(!0,!0),this.lucky=!1,this.el[0].className="",this.el[0].style.width=i+"px",this.el[0].style.height=j+"px",this.width=this.el.width(),this.height=this.el.height(),this._maxTop=g-this.height,this._maxLeft=h-this.width},d.prototype.autoMove=function(){var a=this;this.moving&&this.move(function(){a.autoMove()})},d.prototype.stop=function(){this.el.stop(!0,!0),this.moving=!1},d.prototype.bang=function(){this.lucky=!0,this.el[0].className="selected",this.width=k,this.height=l,this.left=(h-this.width)/2,this.top=(g-this.height)/2,this.el.animate({left:this.left,top:this.top,width:this.width,height:this.height},p)},d.prototype.beginHit=function(){this._xMove=0,this._yMove=0},d.prototype.hitMove=function(){this.left+=this._xMove,this.top+=this._yMove,this.top=this.top<0?0:this.top>this._maxTop?this._maxTop:this.top,this.left=this.left<0?0:this.left>this._maxLeft?this._maxLeft:this.left,this.reflow(null,!1)}}); +document.attachEvent&&alert("这个例子不支持 Old IE 哦"),define("examples/lucky/1.0.0/main",["./data","./lucky","jquery","jquery-easing","./user"],function(a){var b=a("./data"),c=a("./lucky");c.init(b)}),define("examples/lucky/1.0.0/data",[],["梓胥","李磊","俊义","兰玉","泥巴","对剑","希普","牧木","夏雩","衡芜","钝刀","苍新","琳心","玉鼎","冯衡","伍举","长松","卫海","伯川","道潜","丁勉","竹棒","妙才","许由","祢衡","赵盾","斗子文","寇恂","极天","秦天","裴秀","花朝","静俭","墨颜","王维","马武","公孙龙","甘德","流珠","路悠","樽空","沐峰","清筠","绝伦","星辰","羽单","伯兮","郝思文","聂壹","南岸","明恽","君乾","飞天","文赢","义均","文和","曹彬","晁错","兔葵","苏星河","太常","北湖","弘殷","吕蒙","颜良","庄辛","崇幻","贝儿","柏平","小毛","战尘","子盛","问柏","湛然","独慕","浴尘","公与","桑美","晏婴","严成方","连挚","汪信之","楚天","良臣","暮城","塔石","薇达","行洋","明何","昔空","蓝玉","韩当","丛英","吞佛","真岚","仲文","吕方","郑天寿","一恒","誉少","无竞","九弦","玉伯","冒顿","啸生","尹曰","臻儿","籽沐","余化","玉郎","右丞","默哈","血诺","桐杰","镜曦","沉鱼","贯高","陆辉","浩初","天材","偏右","云谦","乔花","展新","张初尘","宫煌","宗玄","一正","若夷","普渡","晴汐","徒离","仲景","大禹","徐盛","木合","郭淮","方嘉","李渔","长皓","渔樵","惜年","沧溟","东隅","海涛","磻溪"]),define("examples/lucky/1.0.0/lucky",["jquery","jquery-easing","examples/lucky/1.0.0/user"],function(a,b,c){function d(a,b){return Math.sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))}function e(a,b){return d(a,b)<=(a.width+b.width)/2}function f(a,b){var c=b.y-a.y,e=b.x-a.x,f=d(a,b),g=Math.ceil(((a.width+b.width)/2-f)/j),h=c>0?Math.ceil(g*c/f):Math.floor(g*c/f),i=e>0?Math.ceil(g*e/f):Math.floor(g*e/f);a.lucky?(b._xMove+=2*i,b._yMove+=2*h):b.lucky?(a._xMove+=-2*i,a._yMove+=-2*h):(a._yMove+=-1*h,b._yMove+=h,a._xMove+=-1*i,b._xMove+=i)}var g=a("jquery");a("jquery-easing");var h=a("examples/lucky/1.0.0/user"),i=100,j=4;c.exports={users:[],init:function(a){g("#container").css("background","none"),this.data=a,this.users=a.map(function(b){return new h(b,a[b])}),this._bindUI()},_bindUI:function(){function a(){"start"===c.getAttribute("data-action")?(c.setAttribute("data-action","stop"),c.innerHTML=c.getAttribute("data-text-stop"),b.start()):(c.setAttribute("data-action","start"),c.innerHTML=c.getAttribute("data-text-start"),b.stop())}var b=this,c=document.querySelector("#go");c.innerHTML=c.getAttribute("data-text-start"),c.addEventListener("click",a,!1),g("#lucky-balls").on("click","li",function(a){var c=g(a.target),d=c.text();b.addItem(d),b.hit(),c.remove()}),g("#balls").on("click","li",function(a){for(var c=g(a.target),d=c.text(),e=0;e0&&(this.timer=setTimeout(function(){a.hit()},i))}}}),define("examples/lucky/1.0.0/user",["jquery"],function(a,b,c){function d(a,b){this.name=a,this.options=b||{},this.el=null,this.width=0,this.height=0,this.left=0,this.top=0,this.x=0,this.y=0,this.moving=!1,this.lucky=!1,this.createEl(),this.move()}function e(a,b){return a=a||0,b=b||1,Math.floor(Math.random()*(b-a+1)+a)}var f=a("jquery"),g=500,h=900,i=40,j=40,k=120,l=120,m=100,n=100,o=500,p=500;c.exports=d,d.prototype.createEl=function(){this.el=f("
  • "+this.name+"
  • ").appendTo("#balls"),this.width=this.el.width(),this.height=this.el.height()},d.prototype.move=function(a){this.left=e(0,h-this.width),this.top=e(0,g-this.height),this.zIndex=e(0,m),this.reflow(a)},d.prototype.reflow=function(a,b){this.x=this.left+this.width/2,this.y=this.top+this.height/2,this.el[0].style.zIndex=this.zIndex,b?(this.el[0].style.left=this.left,this.el[0].style.top=this.top):this.el.animate({left:this.left,top:this.top},e(n,o),"easeOutBack",a)},d.prototype.start=function(){this.reset(),this.moving=!0,this.autoMove()},d.prototype.reset=function(){this.el.stop(!0,!0),this.lucky=!1,this.el[0].className="",this.el[0].style.width=i+"px",this.el[0].style.height=j+"px",this.width=this.el.width(),this.height=this.el.height(),this._maxTop=g-this.height,this._maxLeft=h-this.width},d.prototype.autoMove=function(){var a=this;this.moving&&this.move(function(){a.autoMove()})},d.prototype.stop=function(){this.el.stop(!0,!0),this.moving=!1},d.prototype.bang=function(){this.lucky=!0,this.el[0].className="selected",this.width=k,this.height=l,this.left=(h-this.width)/2,this.top=(g-this.height)/2,this.el.animate({left:this.left,top:this.top,width:this.width,height:this.height},p)},d.prototype.beginHit=function(){this._xMove=0,this._yMove=0},d.prototype.hitMove=function(){this.left+=this._xMove,this.top+=this._yMove,this.top=this.top<0?0:this.top>this._maxTop?this._maxTop:this.top,this.left=this.left<0?0:this.left>this._maxLeft?this._maxLeft:this.left,this.reflow(null,!1)}}); diff --git a/static/lucky/dist/style-debug.css b/static/lucky/dist/style-debug.css index d234a26..13a2728 100644 --- a/static/lucky/dist/style-debug.css +++ b/static/lucky/dist/style-debug.css @@ -28,15 +28,15 @@ ul li { left: 420px; top: 470px; padding: 0; - width: 60px; - height: 60px; + width: 40px; + height: 40px; overflow: hidden; - font-size: 16px; + font-size: 12px; background: #333; color: #ddd; opacity: .5; text-align: center; - line-height: 60px; + line-height: 43px; border-radius: 30px; word-break: keep-all; cursor: pointer; @@ -56,10 +56,10 @@ ul li { #balls li.selected { color: #fff; background: #f60; - font-size: 50px; + font-size: 40px; height: 200px; width: 200px; - line-height: 200px; + line-height: 128px; border-radius: 100px; -webkit-transition: 0.3s ease-in; -webkit-transition-property: width, height, font; @@ -76,8 +76,8 @@ ul li { position: relative; left: auto !important; top: auto !important; - width: 60px !important; - height: 60px !important; + width: 40px !important; + height: 40px !important; float: left; margin: 5px 10px; font-weight: bold; diff --git a/static/lucky/dist/style.css b/static/lucky/dist/style.css index 81b3f05..4307bf7 100644 --- a/static/lucky/dist/style.css +++ b/static/lucky/dist/style.css @@ -1 +1 @@ -body{font:20px "Hiragino Sans GB",sans-serif;background:#eee}ul li{list-style:none}#container{width:900px;margin:10px auto;position:relative;background:url(https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif) no-repeat 45% 25%}#balls{padding:0;margin:0;list-style:none;height:500px}#balls li,#lucky-balls li{position:absolute;left:420px;top:470px;padding:0;width:60px;height:60px;overflow:hidden;font-size:16px;background:#333;color:#ddd;opacity:.5;text-align:center;line-height:60px;border-radius:30px;word-break:keep-all;cursor:pointer}#go{width:200px;height:50px;display:block;margin:0 auto;font-size:22px;border:0;background:0;color:#999}#balls li.selected{color:#fff;background:#f60;font-size:50px;height:200px;width:200px;line-height:200px;border-radius:100px;-webkit-transition:.3s ease-in;-webkit-transition-property:width,height,font;z-index:100}#lucky-balls{padding:20px;margin:10px 0;list-style:none}#lucky-balls li{position:relative;left:auto!important;top:auto!important;width:60px!important;height:60px!important;float:left;margin:5px 10px;font-weight:700;color:#fff;background:#f60} +body{font:20px "Hiragino Sans GB",sans-serif;background:#eee}ul li{list-style:none}#container{width:900px;margin:10px auto;position:relative;background:url(https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-32.gif) no-repeat 45% 25%}#balls{padding:0;margin:0;list-style:none;height:500px}#balls li,#lucky-balls li{position:absolute;left:420px;top:470px;padding:0;width:40px;height:40px;overflow:hidden;font-size:12px;background:#333;color:#ddd;opacity:.5;text-align:center;line-height:43px;border-radius:30px;word-break:keep-all;cursor:pointer}#go{width:200px;height:50px;display:block;margin:0 auto;font-size:22px;border:0;background:0;color:#999}#balls li.selected{color:#fff;background:#f60;font-size:40px;height:200px;width:200px;line-height:128px;border-radius:100px;-webkit-transition:.3s ease-in;-webkit-transition-property:width,height,font;z-index:100}#lucky-balls{padding:20px;margin:10px 0;list-style:none}#lucky-balls li{position:relative;left:auto!important;top:auto!important;width:40px!important;height:40px!important;float:left;margin:5px 10px;font-weight:700;color:#fff;background:#f60} diff --git a/static/lucky/src/data.js b/static/lucky/src/data.js index c091fd1..577a6ae 100644 --- a/static/lucky/src/data.js +++ b/static/lucky/src/data.js @@ -1,7 +1,9 @@ define([ - "马云", "马化腾", "李彦宏", "周鸿祎", - "玉伯", "沉鱼", "丹侠", "贯高", "邵帅", "陆辉", "南伯", "崔护", "偏右", "远尘", - "臻儿", "左宜", "张初尘", "初成", "琼羽", "异草", "闭月", - "周爱民", "陈皓", "winter", "army", "hax", "老赵", "sofish", "罗龙浩" + "梓胥", + "李磊", "俊义", "兰玉", + "泥巴", "对剑", "希普", "牧木", "夏雩", "衡芜", "钝刀", "苍新", "琳心", "玉鼎", "冯衡", "伍举", "长松", "卫海", "伯川", "道潜", "丁勉", "竹棒", "妙才", "许由", "祢衡", "赵盾", "斗子文", "寇恂", "极天", "秦天", "裴秀", "花朝", "静俭", "墨颜", "王维", "马武", "公孙龙", "甘德", "流珠", "路悠", "樽空", "沐峰", "清筠", "绝伦", "星辰", "羽单", "伯兮", "郝思文", "聂壹", "南岸", "明恽", "君乾", + "飞天", "文赢", "义均", "文和", "曹彬", "晁错", "兔葵", "苏星河", "太常", "北湖", "弘殷", "吕蒙", "颜良", "庄辛", "崇幻", "贝儿", "柏平", "小毛", "战尘", "子盛", "问柏", "湛然", "独慕", "浴尘", "公与", "桑美", "晏婴", "严成方", "连挚", "汪信之", "楚天", "良臣", "暮城", "塔石", "薇达", "行洋", "明何", "昔空", "蓝玉", "韩当", "丛英", "吞佛", "真岚", "仲文", "吕方", "郑天寿", "一恒", "誉少", "无竞", "九弦", + "玉伯", "冒顿", "啸生", "尹曰", "臻儿", "籽沐", "余化", "玉郎", "右丞", "默哈", "血诺", "桐杰", "镜曦", "沉鱼", "贯高", "陆辉", "浩初", "天材", "偏右", "云谦", "乔花", "展新", "张初尘", "宫煌", + "宗玄", "一正", "若夷", "普渡", "晴汐", "徒离", + "仲景", "大禹", "徐盛", "木合", "郭淮", "方嘉", "李渔", "长皓", "渔樵", "惜年", "沧溟", "东隅", "海涛", "磻溪" ]); - diff --git a/static/lucky/src/lucky.js b/static/lucky/src/lucky.js index a1c593b..605a149 100644 --- a/static/lucky/src/lucky.js +++ b/static/lucky/src/lucky.js @@ -8,7 +8,6 @@ define(function(require, exports, module) { var HIT_SPEED = 100; var RIGIDITY = 4; - module.exports = { users: [], diff --git a/static/lucky/src/style.css b/static/lucky/src/style.css index 722589e..7956931 100644 --- a/static/lucky/src/style.css +++ b/static/lucky/src/style.css @@ -27,15 +27,15 @@ ul li { left: 420px; top: 470px; padding: 0; - width: 60px; - height: 60px; + width: 40px; + height: 40px; overflow: hidden; - font-size: 16px; + font-size: 12px; background: #333; color: #ddd; opacity: .5; text-align: center; - line-height: 60px; + line-height: 43px; border-radius: 30px; word-break: keep-all; cursor: pointer; @@ -55,10 +55,10 @@ ul li { #balls li.selected { color: #fff; background: #f60; - font-size: 50px; + font-size: 40px; height: 200px; width: 200px; - line-height: 200px; + line-height: 128px; border-radius: 100px; -webkit-transition: 0.3s ease-in; -webkit-transition-property: width, height, font; @@ -75,8 +75,8 @@ ul li { position: relative; left: auto !important; top: auto !important; - width: 60px !important; - height: 60px !important; + width: 40px !important; + height: 40px !important; float: left; margin: 5px 10px; font-weight: bold; diff --git a/static/lucky/src/user.js b/static/lucky/src/user.js index 2cda780..6eae52e 100644 --- a/static/lucky/src/user.js +++ b/static/lucky/src/user.js @@ -5,10 +5,10 @@ define(function(require, exports, module) { var CANVAS_HEIGHT = 500; var CANVAS_WIDTH = 900; - var BALL_WIDTH = 60; - var BALL_HEIGHT = 60; - var LUCKY_BALL_WIDTH = 200; - var LUCKY_BALL_HEIGHT = 200; + var BALL_WIDTH = 40; + var BALL_HEIGHT = 40; + var LUCKY_BALL_WIDTH = 120; + var LUCKY_BALL_HEIGHT = 120; var MAX_ZINDEX = 100; var DURATION_MIN = 100;