├── keys.png ├── logo.png ├── pop.mp3 ├── pop.ogg ├── Chewy.ttf ├── swosh.mp3 ├── swosh.ogg ├── icons ├── 360.png ├── css.png ├── html5.png ├── scores.png └── reflexion.png ├── pbar-ani.gif ├── background.jpg ├── rotate-right.png ├── scores_exemple.png ├── jplayer.blue.monday.jpg ├── jplayer.blue.monday.video.play.png ├── jplayer.blue.monday.video.play.hover.png ├── README ├── jquery-css-transform.js ├── jquery.ba-hashchange.min.js ├── index.css ├── modernizr.custom.js ├── md5.js ├── i18n.js ├── index.html ├── jquery.tmpl.min.js ├── jplayer.blue.monday.css ├── game.html ├── game.css ├── game.desktop.js ├── jquery.jplayer.min.js ├── LICENSE └── game.js /keys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/keys.png -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/logo.png -------------------------------------------------------------------------------- /pop.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/pop.mp3 -------------------------------------------------------------------------------- /pop.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/pop.ogg -------------------------------------------------------------------------------- /Chewy.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/Chewy.ttf -------------------------------------------------------------------------------- /swosh.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/swosh.mp3 -------------------------------------------------------------------------------- /swosh.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/swosh.ogg -------------------------------------------------------------------------------- /icons/360.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/icons/360.png -------------------------------------------------------------------------------- /icons/css.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/icons/css.png -------------------------------------------------------------------------------- /pbar-ani.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/pbar-ani.gif -------------------------------------------------------------------------------- /background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/background.jpg -------------------------------------------------------------------------------- /icons/html5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/icons/html5.png -------------------------------------------------------------------------------- /icons/scores.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/icons/scores.png -------------------------------------------------------------------------------- /rotate-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/rotate-right.png -------------------------------------------------------------------------------- /scores_exemple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/scores_exemple.png -------------------------------------------------------------------------------- /icons/reflexion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/icons/reflexion.png -------------------------------------------------------------------------------- /jplayer.blue.monday.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/jplayer.blue.monday.jpg -------------------------------------------------------------------------------- /jplayer.blue.monday.video.play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/jplayer.blue.monday.video.play.png -------------------------------------------------------------------------------- /jplayer.blue.monday.video.play.hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gre/same-game-gravity/HEAD/jplayer.blue.monday.video.play.hover.png -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | --- Same Game Gravity For Desktop --- 2 | 3 | Copyright (C) 2011 @greweb 4 | Licence: GPL v3 - https://github.com/gre/same-game-gravity 5 | 6 | Same Game Gravity is a mind-bending ball removal puzzle game where you try 7 | to remove all of the balls from the board. Balls can only be removed when 8 | they are grouped with more balls of the same color. 9 | The balls are influenced by gravity. 10 | -------------------------------------------------------------------------------- /jquery-css-transform.js: -------------------------------------------------------------------------------- 1 | (function(a){function b(a){var b=["transform","WebkitTransform","msTransform","MozTransform","OTransform"],c;while(c=b.shift())if(typeof a.style[c]!="undefined")return c;return"transform"}var c=null,d=a.fn.css;a.fn.css=function(e,f){c===null&&(typeof a.cssProps!="undefined"?c=a.cssProps:typeof a.props!="undefined"?c=a.props:c={}),typeof c.transform=="undefined"&&(e=="transform"||typeof e=="object"&&typeof e.transform!="undefined")&&(c.transform=b(this.get(0)));if(c.transform!="transform")if(e=="transform"){e=c.transform;if(typeof f=="undefined"&&jQuery.style)return jQuery.style(this.get(0),e)}else typeof e=="object"&&typeof e.transform!="undefined"&&(e[c.transform]=e.transform,delete e.transform);return d.apply(this,arguments)}})(jQuery); 2 | -------------------------------------------------------------------------------- /jquery.ba-hashchange.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery hashchange event - v1.3 - 7/21/2010 3 | * http://benalman.com/projects/jquery-hashchange-plugin/ 4 | * 5 | * Copyright (c) 2010 "Cowboy" Ben Alman 6 | * Dual licensed under the MIT and GPL licenses. 7 | * http://benalman.com/about/license/ 8 | */ 9 | (function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$(' 32 | 33 | 34 | 43 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /jquery.tmpl.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Templates Plugin 1.0.0pre 3 | * http://github.com/jquery/jquery-tmpl 4 | * Requires jQuery 1.4.2 5 | * 6 | * Copyright Software Freedom Conservancy, Inc. 7 | * Dual licensed under the MIT or GPL Version 2 licenses. 8 | * http://jquery.org/license 9 | */ 10 | (function(a){var r=a.fn.domManip,d="_tmplitem",q=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,b={},f={},e,p={key:0,data:{}},i=0,c=0,l=[];function g(g,d,h,e){var c={data:e||(e===0||e===false)?e:d?d.data:{},_wrap:d?d._wrap:null,tmpl:null,parent:d||null,nodes:[],calls:u,nest:w,wrap:x,html:v,update:t};g&&a.extend(c,g,{nodes:[],parent:d});if(h){c.tmpl=h;c._ctnt=c._ctnt||c.tmpl(a,c);c.key=++i;(l.length?f:b)[i]=c}return c}a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(f,d){a.fn[f]=function(n){var g=[],i=a(n),k,h,m,l,j=this.length===1&&this[0].parentNode;e=b||{};if(j&&j.nodeType===11&&j.childNodes.length===1&&i.length===1){i[d](this[0]);g=this}else{for(h=0,m=i.length;h0?this.clone(true):this).get();a(i[h])[d](k);g=g.concat(k)}c=0;g=this.pushStack(g,f,i.selector)}l=e;e=null;a.tmpl.complete(l);return g}});a.fn.extend({tmpl:function(d,c,b){return a.tmpl(this[0],d,c,b)},tmplItem:function(){return a.tmplItem(this[0])},template:function(b){return a.template(b,this[0])},domManip:function(d,m,k){if(d[0]&&a.isArray(d[0])){var g=a.makeArray(arguments),h=d[0],j=h.length,i=0,f;while(i").join(">").split('"').join(""").split("'").join("'")}});a.extend(a.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){b={}},afterManip:function(f,b,d){var e=b.nodeType===11?a.makeArray(b.childNodes):b.nodeType===1?[b]:[];d.call(f,b);m(e);c++}});function j(e,g,f){var b,c=f?a.map(f,function(a){return typeof a==="string"?e.key?a.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+d+'="'+e.key+'" $2'):a:j(a,e,a._ctnt)}):e;if(g)return c;c=c.join("");c.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(f,c,e,d){b=a(e).get();m(b);if(c)b=k(c).concat(b);if(d)b=b.concat(k(d))});return b?b:k(c)}function k(c){var b=document.createElement("div");b.innerHTML=c;return a.makeArray(b.childNodes)}function o(b){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+a.trim(b).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(m,l,k,g,b,c,d){var j=a.tmpl.tag[k],i,e,f;if(!j)throw"Unknown template tag: "+k;i=j._default||[];if(c&&!/\w$/.test(b)){b+=c;c=""}if(b){b=h(b);d=d?","+h(d)+")":c?")":"";e=c?b.indexOf(".")>-1?b+h(c):"("+b+").call($item"+d:b;f=c?e:"(typeof("+b+")==='function'?("+b+").call($item):("+b+"))"}else f=e=i.$1||"null";g=h(g);return"');"+j[l?"close":"open"].split("$notnull_1").join(b?"typeof("+b+")!=='undefined' && ("+b+")!=null":"true").split("$1a").join(f).split("$1").join(e).split("$2").join(g||i.$2||"")+"__.push('"})+"');}return __;")}function n(c,b){c._wrap=j(c,true,a.isArray(b)?b:[q.test(b)?b:a(b).html()]).join("")}function h(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function s(b){var a=document.createElement("div");a.appendChild(b.cloneNode(true));return a.innerHTML}function m(o){var n="_"+c,k,j,l={},e,p,h;for(e=0,p=o.length;e=0;h--)m(j[h]);m(k)}function m(j){var p,h=j,k,e,m;if(m=j.getAttribute(d)){while(h.parentNode&&(h=h.parentNode).nodeType===1&&!(p=h.getAttribute(d)));if(p!==m){h=h.parentNode?h.nodeType===11?0:h.getAttribute(d)||0:0;if(!(e=b[m])){e=f[m];e=g(e,b[h]||f[h]);e.key=++i;b[i]=e}c&&o(m)}j.removeAttribute(d)}else if(c&&(e=a.data(j,"tmplItem"))){o(e.key);b[e.key]=e;h=a.data(j.parentNode,"tmplItem");h=h?h.key:0}if(e){k=e;while(k&&k.key!=h){k.nodes.push(j);k=k.parent}delete e._ctnt;delete e._wrap;a.data(j,"tmplItem",e)}function o(a){a=a+n;e=l[a]=l[a]||g(e,b[e.parent.key+n]||e.parent)}}}function u(a,d,c,b){if(!a)return l.pop();l.push({_:a,tmpl:d,item:this,data:c,options:b})}function w(d,c,b){return a.tmpl(a.template(d),c,b,this)}function x(b,d){var c=b.options||{};c.wrapped=d;return a.tmpl(a.template(b.tmpl),b.data,c,b.item)}function v(d,c){var b=this._wrap;return a.map(a(a.isArray(b)?b.join(""):b).filter(d||"*"),function(a){return c?a.innerText||a.textContent:a.outerHTML||s(a)})}function t(){var b=this.nodes;a.tmpl(null,null,null,this).insertBefore(b[0]);a(b).remove()}})(jQuery); 11 | -------------------------------------------------------------------------------- /jplayer.blue.monday.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Skin for jPlayer Plugin (jQuery JavaScript Library) 3 | * http://www.happyworm.com/jquery/jplayer 4 | * 5 | * Skin Name: Blue Monday 6 | * 7 | * Copyright (c) 2010 Happyworm Ltd 8 | * Dual licensed under the MIT and GPL licenses. 9 | * - http://www.opensource.org/licenses/mit-license.php 10 | * - http://www.gnu.org/copyleft/gpl.html 11 | * 12 | * Author: Silvia Benvenuti 13 | * Skin Version: 3.0 (jPlayer 2.0.0) 14 | * Date: 20th December 2010 15 | */ 16 | 17 | div.jp-audio, 18 | div.jp-video { 19 | 20 | /* Edit the font-size to counteract inherited font sizing. 21 | * Eg. 1.25em = 1 / 0.8em 22 | */ 23 | 24 | font-size:1.25em; 25 | 26 | font-family:Verdana, Arial, sans-serif; 27 | line-height:1.6; 28 | color: #666; 29 | } 30 | div.jp-audio { 31 | width:420px; 32 | } 33 | div.jp-video-270p { 34 | width:480px; 35 | } 36 | div.jp-video-360p { 37 | width:640px; 38 | } 39 | div.jp-interface { 40 | position: relative; 41 | background-color:#eee; 42 | /* width:418px; */ 43 | width:100%; 44 | border:1px solid #009be3; 45 | } 46 | div.jp-audio div.jp-type-single div.jp-interface { 47 | height:80px; 48 | border-bottom:none; 49 | } 50 | div.jp-audio div.jp-type-playlist div.jp-interface { 51 | height:80px; 52 | } 53 | div.jp-video div.jp-type-single div.jp-interface { 54 | height:60px; 55 | border-bottom:none; 56 | } 57 | div.jp-video div.jp-type-playlist div.jp-interface { 58 | height:60px; 59 | } 60 | div.jp-interface ul.jp-controls { 61 | list-style-type:none; 62 | padding:0; 63 | margin: 0; 64 | } 65 | div.jp-interface ul.jp-controls li { 66 | /* position: absolute; */ 67 | display:inline; 68 | } 69 | div.jp-interface ul.jp-controls a { 70 | position: absolute; 71 | overflow:hidden; 72 | text-indent:-9999px; 73 | } 74 | a.jp-play, 75 | a.jp-pause { 76 | width:40px; 77 | height:40px; 78 | z-index:1; 79 | } 80 | div.jp-audio div.jp-type-single a.jp-play, 81 | div.jp-audio div.jp-type-single a.jp-pause { 82 | top:20px; 83 | left:40px; 84 | } 85 | div.jp-audio div.jp-type-playlist a.jp-play, 86 | div.jp-audio div.jp-type-playlist a.jp-pause { 87 | top:20px; 88 | left:48px; 89 | } 90 | div.jp-video a.jp-play, 91 | div.jp-video a.jp-pause { 92 | top:15px; 93 | } 94 | div.jp-video-270p div.jp-type-single a.jp-play, 95 | div.jp-video-270p div.jp-type-single a.jp-pause { 96 | left:195px; 97 | } 98 | div.jp-video-270p div.jp-type-playlist a.jp-play, 99 | div.jp-video-270p div.jp-type-playlist a.jp-pause { 100 | left:220px; 101 | } 102 | div.jp-video-360p div.jp-type-single a.jp-play, 103 | div.jp-video-360p div.jp-type-single a.jp-pause { 104 | left:275px; 105 | } 106 | div.jp-video-360p div.jp-type-playlist a.jp-play, 107 | div.jp-video-360p div.jp-type-playlist a.jp-pause { 108 | left:300px; 109 | } 110 | a.jp-play { 111 | background: url("jplayer.blue.monday.jpg") 0 0 no-repeat; 112 | } 113 | a.jp-play:hover { 114 | background: url("jplayer.blue.monday.jpg") -41px 0 no-repeat; 115 | } 116 | a.jp-pause { 117 | background: url("jplayer.blue.monday.jpg") 0 -42px no-repeat; 118 | display: none; 119 | } 120 | a.jp-pause:hover { 121 | background: url("jplayer.blue.monday.jpg") -41px -42px no-repeat; 122 | } 123 | div.jp-audio div.jp-type-single a.jp-stop { 124 | top:26px; 125 | left:90px; 126 | } 127 | div.jp-audio div.jp-type-playlist a.jp-stop { 128 | top:26px; 129 | left:126px; 130 | } 131 | div.jp-video a.jp-stop { 132 | top:21px; 133 | } 134 | div.jp-video-270p div.jp-type-single a.jp-stop { 135 | left:245px; 136 | } 137 | div.jp-video-270p div.jp-type-playlist a.jp-stop { 138 | left:298px; 139 | } 140 | div.jp-video-360p div.jp-type-single a.jp-stop { 141 | left:325px; 142 | } 143 | div.jp-video-360p div.jp-type-playlist a.jp-stop { 144 | left:378px; 145 | } 146 | a.jp-stop { 147 | background: url("jplayer.blue.monday.jpg") 0 -83px no-repeat; 148 | width:28px; 149 | height:28px; 150 | z-index:1; 151 | } 152 | a.jp-stop:hover { 153 | background: url("jplayer.blue.monday.jpg") -29px -83px no-repeat; 154 | } 155 | div.jp-audio div.jp-type-playlist a.jp-previous { 156 | left:20px; 157 | top:26px; 158 | } 159 | div.jp-video div.jp-type-playlist a.jp-previous { 160 | top:21px; 161 | } 162 | div.jp-video-270p div.jp-type-playlist a.jp-previous { 163 | left:192px; 164 | } 165 | div.jp-video-360p div.jp-type-playlist a.jp-previous { 166 | left:272px; 167 | } 168 | a.jp-previous { 169 | background: url("jplayer.blue.monday.jpg") 0 -112px no-repeat; 170 | width:28px; 171 | height:28px; 172 | } 173 | a.jp-previous:hover { 174 | background: url("jplayer.blue.monday.jpg") -29px -112px no-repeat; 175 | } 176 | div.jp-audio div.jp-type-playlist a.jp-next { 177 | left:88px; 178 | top:26px; 179 | } 180 | div.jp-video div.jp-type-playlist a.jp-next { 181 | top:21px; 182 | } 183 | div.jp-video-270p div.jp-type-playlist a.jp-next { 184 | left:260px; 185 | } 186 | div.jp-video-360p div.jp-type-playlist a.jp-next { 187 | left:340px; 188 | } 189 | a.jp-next { 190 | background: url("jplayer.blue.monday.jpg") 0 -141px no-repeat; 191 | width:28px; 192 | height:28px; 193 | } 194 | a.jp-next:hover { 195 | background: url("jplayer.blue.monday.jpg") -29px -141px no-repeat; 196 | } 197 | div.jp-progress { 198 | position: absolute; 199 | overflow:hidden; 200 | background-color: #ddd; 201 | } 202 | div.jp-audio div.jp-type-single div.jp-progress { 203 | top:32px; 204 | left:130px; 205 | width:122px; 206 | height:15px; 207 | } 208 | div.jp-audio div.jp-type-playlist div.jp-progress { 209 | top:32px; 210 | left:164px; 211 | width:122px; 212 | height:15px; 213 | } 214 | div.jp-video div.jp-progress { 215 | top:0px; 216 | left:0px; 217 | width:100%; 218 | height:10px; 219 | } 220 | div.jp-seek-bar { 221 | background: url("jplayer.blue.monday.jpg") 0 -202px repeat-x; 222 | width:0px; 223 | /* height:15px; */ 224 | height:100%; 225 | cursor: pointer; 226 | } 227 | div.jp-play-bar { 228 | background: url("jplayer.blue.monday.jpg") 0 -218px repeat-x ; 229 | width:0px; 230 | /* height:15px; */ 231 | height:100%; 232 | } 233 | 234 | /* The seeking class is added/removed inside jPlayer */ 235 | div.jp-seeking-bg { 236 | background: url("pbar-ani.gif"); 237 | } 238 | 239 | a.jp-mute, 240 | a.jp-unmute { 241 | width:18px; 242 | height:15px; 243 | } 244 | div.jp-audio div.jp-type-single a.jp-mute, 245 | div.jp-audio div.jp-type-single a.jp-unmute { 246 | top:32px; 247 | left:274px; 248 | } 249 | div.jp-audio div.jp-type-playlist a.jp-mute, 250 | div.jp-audio div.jp-type-playlist a.jp-unmute { 251 | top:32px; 252 | left:296px; 253 | } 254 | div.jp-video a.jp-mute, 255 | div.jp-video a.jp-unmute { 256 | top:27px; 257 | } 258 | div.jp-video-270p div.jp-type-single a.jp-mute, 259 | div.jp-video-270p div.jp-type-single a.jp-unmute { 260 | left:304px; 261 | } 262 | div.jp-video-270p div.jp-type-playlist a.jp-unmute, 263 | div.jp-video-270p div.jp-type-playlist a.jp-mute { 264 | left:363px; 265 | } 266 | div.jp-video-360p div.jp-type-single a.jp-mute, 267 | div.jp-video-360p div.jp-type-single a.jp-unmute { 268 | left:384px; 269 | } 270 | div.jp-video-360p div.jp-type-playlist a.jp-mute, 271 | div.jp-video-360p div.jp-type-playlist a.jp-unmute { 272 | left:443px; 273 | } 274 | a.jp-mute { 275 | background: url("jplayer.blue.monday.jpg") 0 -186px no-repeat; 276 | } 277 | a.jp-mute:hover { 278 | background: url("jplayer.blue.monday.jpg") -19px -170px no-repeat; 279 | } 280 | a.jp-unmute { 281 | background: url("jplayer.blue.monday.jpg") 0 -170px no-repeat; 282 | display: none; 283 | } 284 | a.jp-unmute:hover { 285 | background: url("jplayer.blue.monday.jpg") -19px -186px no-repeat; 286 | } 287 | div.jp-volume-bar { 288 | position: absolute; 289 | overflow:hidden; 290 | background: url("jplayer.blue.monday.jpg") 0 -250px repeat-x; 291 | width:46px; 292 | height:5px; 293 | cursor: pointer; 294 | } 295 | div.jp-audio div.jp-type-single div.jp-volume-bar { 296 | top:37px; 297 | left:302px; 298 | } 299 | div.jp-audio div.jp-type-playlist div.jp-volume-bar { 300 | top:37px; 301 | left:324px; 302 | } 303 | div.jp-video div.jp-volume-bar { 304 | top:32px; 305 | } 306 | div.jp-video-270p div.jp-type-single div.jp-volume-bar { 307 | left:332px; 308 | } 309 | div.jp-video-270p div.jp-type-playlist div.jp-volume-bar { 310 | left:391px; 311 | } 312 | div.jp-video-360p div.jp-type-single div.jp-volume-bar { 313 | left:412px; 314 | } 315 | div.jp-video-360p div.jp-type-playlist div.jp-volume-bar { 316 | left:471px; 317 | } 318 | div.jp-volume-bar-value { 319 | background: url("jplayer.blue.monday.jpg") 0 -256px repeat-x; 320 | width:0px; 321 | height:5px; 322 | } 323 | div.jp-current-time, 324 | div.jp-duration { 325 | position: absolute; 326 | font-size:.64em; 327 | font-style:oblique; 328 | } 329 | div.jp-duration { 330 | text-align: right; 331 | } 332 | div.jp-audio div.jp-type-single div.jp-current-time, 333 | div.jp-audio div.jp-type-single div.jp-duration { 334 | top:49px; 335 | left:130px; 336 | width:122px; 337 | } 338 | div.jp-audio div.jp-type-playlist div.jp-current-time, 339 | div.jp-audio div.jp-type-playlist div.jp-duration { 340 | top:49px; 341 | left:164px; 342 | width:122px; 343 | } 344 | div.jp-video div.jp-current-time, 345 | div.jp-video div.jp-duration { 346 | top:10px; 347 | left:0px; 348 | width:98%; 349 | padding:0 1%; 350 | } 351 | div.jp-playlist { 352 | /* width:418px; */ 353 | width:100%; 354 | background-color:#ccc; 355 | border:1px solid #009be3; 356 | border-top:none; 357 | } 358 | div.jp-playlist ul { 359 | list-style-type:none; 360 | margin:0; 361 | padding:0 20px; 362 | /* background-color:#ccc; */ 363 | /* border:1px solid #009be3; */ 364 | /* border-top:none; */ 365 | /* width:378px; */ 366 | font-size:.72em; 367 | } 368 | 369 | 370 | div.jp-type-single div.jp-playlist li { 371 | padding:5px 0 5px 20px; 372 | font-weight:bold; 373 | } 374 | div.jp-type-playlist div.jp-playlist li { 375 | padding:5px 0 4px 20px; 376 | border-bottom:1px solid #eee; 377 | } 378 | /* 379 | div.jp-video div.jp-playlist li { 380 | padding:5px 0 5px 20px; 381 | font-weight:bold; 382 | } 383 | */ 384 | div.jp-type-playlist div.jp-playlist li.jp-playlist-last { 385 | padding:5px 0 5px 20px; 386 | border-bottom:none; 387 | } 388 | div.jp-type-playlist div.jp-playlist li.jp-playlist-current { 389 | list-style-type:square; 390 | list-style-position:inside; 391 | padding-left:8px; 392 | } 393 | div.jp-type-playlist div.jp-playlist a { 394 | color: #666; 395 | text-decoration: none; 396 | } 397 | div.jp-type-playlist div.jp-playlist a:hover { 398 | color:#0d88c1; 399 | } 400 | div.jp-type-playlist div.jp-playlist a.jp-playlist-current { 401 | color:#0d88c1; 402 | } 403 | div.jp-type-playlist div.jp-playlist div.jp-free-media { 404 | display:inline; 405 | margin-left:20px; 406 | } 407 | 408 | div.jp-video div.jp-video-play { 409 | background: transparent url("jplayer.blue.monday.video.play.png") no-repeat center; 410 | /* position: relative; */ 411 | position: absolute; 412 | cursor:pointer; 413 | z-index:2; 414 | } 415 | div.jp-video div.jp-video-play:hover { 416 | background: transparent url("jplayer.blue.monday.video.play.hover.png") no-repeat center; 417 | } 418 | div.jp-video-270p div.jp-video-play { 419 | top:-270px; 420 | width:480px; 421 | height:270px; 422 | } 423 | div.jp-video-360p div.jp-video-play { 424 | top:-360px; 425 | width:640px; 426 | height:360px; 427 | } 428 | 429 | div.jp-jplayer { 430 | width:0px; 431 | height:0px; 432 | } 433 | div.jp-video div.jp-jplayer { 434 | border:1px solid #009be3; 435 | border-bottom:none; 436 | z-index:1; 437 | } 438 | div.jp-video-270p div.jp-jplayer { 439 | width:480px; 440 | height:270px; 441 | } 442 | div.jp-video-360p div.jp-jplayer { 443 | width:640px; 444 | height:360px; 445 | } 446 | div.jp-jplayer { 447 | background-color: #000000; 448 | } 449 | -------------------------------------------------------------------------------- /game.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Same Game Gravity 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 228 | 229 | 232 | 233 | 236 | 237 | 243 | 244 | 245 | 256 | 257 | 258 | 259 | 260 | -------------------------------------------------------------------------------- /game.css: -------------------------------------------------------------------------------- 1 | @font-face { src: url(Chewy.ttf); font-family: Chewy; } 2 | 3 | html { background: black; color: white; } 4 | 5 | body { background: black; color: white; overflow: hidden; padding: 0; margin: 0; font-size: 30px; font-family: Chewy, arial, serif; } 6 | 7 | p { margin: 4px 0; } 8 | 9 | h1, h2, h3, h4, h5 { text-align: center; text-shadow: 0px 2px 5px black; margin: 4px; } 10 | 11 | h1 { font-size: 1.8em; } 12 | 13 | h2 { font-size: 1.5em; } 14 | 15 | h3 { font-size: 1.2em; } 16 | 17 | a, canvas, * { -webkit-tap-highlight-color: rgba(0, 0, 0, 0); -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; -o-user-select: none; user-select: none; } 18 | 19 | a { color: #ffffcc; text-decoration: none; text-shadow: 0px 2px 4px black; } 20 | a[href^=http] { text-decoration: underline; } 21 | a.button { text-shadow: none; } 22 | 23 | .actions a { text-shadow: none; } 24 | 25 | .center { text-align: center; } 26 | 27 | ul { margin: 0; } 28 | 29 | dd { margin: 0; padding: 0; } 30 | 31 | #support { font-size: 0.8em; } 32 | 33 | #main.enabletransition > section { -moz-transition-duration: 1s, 0s; -webkit-transition-duration: 1s, 0s; -o-transition-duration: 1s, 0s; transition-duration: 1s, 0s; } 34 | #main > section { background: black url(background.jpg) no-repeat 50% 0%; z-index: -1; position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; -moz-transition-delay: 0s, 1s; -webkit-transition-delay: 0s, 1s; -o-transition-delay: 0s, 1s; transition-delay: 0s, 1s; -webkit-transition-property: -webkit-transform, opacity; -moz-transition-property: -moz-transform, opacity; -o-transition-property: -o-transform, opacity; transition-property: transform, opacity; -moz-transform: translateY(-100%); -webkit-transform: translateY(-100%); -o-transform: translateY(-100%); -ms-transform: translateY(-100%); transform: translateY(-100%); clear: both; } 35 | #main > section .content { min-height: 74%; } 36 | #main > section.current { -moz-transition-delay: 0s, 0s; -webkit-transition-delay: 0s, 0s; -o-transition-delay: 0s, 0s; transition-delay: 0s, 0s; -moz-transform: translateY(0%); -webkit-transform: translateY(0%); -o-transform: translateY(0%); -ms-transform: translateY(0%); transform: translateY(0%); opacity: 1; z-index: 0; } 37 | #main > section.after { opacity: 0; -moz-transition-delay: 0s, 1s; -webkit-transition-delay: 0s, 1s; -o-transition-delay: 0s, 1s; transition-delay: 0s, 1s; -moz-transform: translateY(100%); -webkit-transform: translateY(100%); -o-transform: translateY(100%); -ms-transform: translateY(100%); transform: translateY(100%); } 38 | 39 | #main > section.current a.button, #main > section.current .actions a { z-index: 100; } 40 | 41 | a { -moz-transition-duration: 400ms; -webkit-transition-duration: 400ms; -o-transition-duration: 400ms; transition-duration: 400ms; -moz-transition-property: color border-color text-shadow; -webkit-transition-property: color border-color text-shadow; -o-transition-property: color border-color text-shadow; transition-property: color border-color text-shadow; } 42 | a:hover { text-shadow: 0px 0px 4px white; border-color: white; color: white; } 43 | a.button:hover { background-color: white; } 44 | 45 | .actions { margin: 0 10px; } 46 | .actions a:hover { background-color: white; } 47 | .actions a:first-child { float: left; } 48 | .actions a:first-child:last-child { float: none; } 49 | .actions a:last-child { float: right; } 50 | 51 | a.button, .actions a { background: #ffffcc; color: black; padding: 4px 16px; -moz-border-radius: 20px; -webkit-border-radius: 20px; -o-border-radius: 20px; -ms-border-radius: 20px; -khtml-border-radius: 20px; border-radius: 20px; } 52 | 53 | .gameVersionType { font-size: 0.5em; vertical-align: top; color: red; } 54 | 55 | .gameVersion { font-size: 0.5em; vertical-align: top; color: #aaaaaa; } 56 | 57 | dl.menu { padding: 0; margin: 0; text-align: center; } 58 | 59 | #menu .actions { margin: 15px 30px; text-align: center; } 60 | #menu .difficulty a { font-size: 1.2em; background: black; margin: 15px 30px; display: block; -moz-border-radius: 20px; -webkit-border-radius: 20px; -o-border-radius: 20px; -ms-border-radius: 20px; -khtml-border-radius: 20px; border-radius: 20px; border: 4px solid; } 61 | #menu footer { text-align: center; clear: both; font-size: 20px; background: black; } 62 | #menu .icons img { opacity: 0.3; -moz-transition-duration: 0.5s; -webkit-transition-duration: 0.5s; -o-transition-duration: 0.5s; transition-duration: 0.5s; } 63 | #menu .icons img:hover { opacity: 1; } 64 | 65 | .difficulty.hard { color: #ff9999; border-color: #ff9999; } 66 | .difficulty.hard a { color: #ff9999; border-color: #ff9999; } 67 | .difficulty.normal { color: #9999ff; border-color: #9999ff; } 68 | .difficulty.normal a { color: #9999ff; border-color: #9999ff; } 69 | .difficulty.easy { color: #99ff99; border-color: #99ff99; } 70 | .difficulty.easy a { color: #99ff99; border-color: #99ff99; } 71 | .difficulty a:hover { border-color: white; color: white; } 72 | 73 | #main > #game { background: black; } 74 | 75 | #game .gameStatus { height: 30px; padding: 0 20px; position: relative; z-index: 100; } 76 | #game .gameStatus .timeline { display: inline-block; background: white; height: 25px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -o-border-radius: 10px; -ms-border-radius: 10px; -khtml-border-radius: 10px; border-radius: 10px; position: absolute; right: 5px; top: 5px; -moz-transition-property: width; -webkit-transition-property: width; -o-transition-property: width; transition-property: width; -moz-transition-timing-function: linear; -webkit-transition-timing-function: linear; -o-transition-timing-function: linear; transition-timing-function: linear; } 77 | #game .gameStatus .timeline.reset { -moz-transition-duration: 0s; -webkit-transition-duration: 0s; -o-transition-duration: 0s; transition-duration: 0s; width: 99%; } 78 | #game .gameStatus .timeline.count-20s { -moz-transition-duration: 20s; -webkit-transition-duration: 20s; -o-transition-duration: 20s; transition-duration: 20s; width: 10%; } 79 | #game .gameStatus.warning .timeline { background: #dd0000; } 80 | #game .gameStatus .remainingSeconds { color: black; font-size: 20px; position: absolute; top: 0px; right: 5px; } 81 | #game .gameStatus.warning .remainingSeconds { color: white; } 82 | 83 | #gameContainer { position: relative; } 84 | 85 | #game .turnleft, #game .turnright { z-index: 100; position: absolute; top: 265px; background: url(rotate-right.png) black no-repeat; color: white; opacity: 0.5; height: 80px; width: 50px; -moz-border-radius-topleft: 10px; -webkit-border-top-left-radius: 10px; -o-border-top-left-radius: 10px; -ms-border-top-left-radius: 10px; -khtml-border-top-left-radius: 10px; border-top-left-radius: 10px; -moz-border-radius-bottomleft: 10px; -webkit-border-bottom-left-radius: 10px; -o-border-bottom-left-radius: 10px; -ms-border-bottom-left-radius: 10px; -khtml-border-bottom-left-radius: 10px; border-bottom-left-radius: 10px; border: 2px solid white; border-right: none; cursor: pointer; -moz-transition-duration: 0.5s, 0.2s; -webkit-transition-duration: 0.5s, 0.2s; -o-transition-duration: 0.5s, 0.2s; transition-duration: 0.5s, 0.2s; } 86 | #game .turnleft:hover, #game .turnright:hover { opacity: 1; } 87 | #game .turnleft { left: -15px; -moz-transform: scaleX(-1); -webkit-transform: scaleX(-1); -o-transform: scaleX(-1); -ms-transform: scaleX(-1); transform: scaleX(-1); -moz-transition-property: left, color; -webkit-transition-property: left, color; -o-transition-property: left, color; transition-property: left, color; } 88 | #game .turnleft:hover { left: -10px; } 89 | #game .turnright { right: -15px; -moz-transition-property: right, color; -webkit-transition-property: right, color; -o-transition-property: right, color; transition-property: right, color; } 90 | #game .turnright:hover { right: -10px; } 91 | 92 | #gameContainer { position: relative; } 93 | 94 | #game canvas { padding: 0; position: absolute; top: 0; left: 0; -moz-transition-duration: 1s; -webkit-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s; -moz-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; -o-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; transform-origin: 50% 50%; } 95 | #game canvas.main { z-index: 2; } 96 | #game canvas.highlight { z-index: 1; } 97 | 98 | #gameContainer .destroyNumber { z-index: 2; display: block; text-align: center; padding-top: 10px; font-size: 1.2em; opacity: 1; -moz-transform: scale(1.5, 1.5); -webkit-transform: scale(1.5, 1.5); -o-transform: scale(1.5, 1.5); -ms-transform: scale(1.5, 1.5); transform: scale(1.5, 1.5); -moz-transform: translate(0, 0); -webkit-transform: translate(0, 0); -o-transform: translate(0, 0); -ms-transform: translate(0, 0); transform: translate(0, 0); } 99 | #gameContainer .destroyNumber.startTransition { opacity: 0; -moz-transition-delay: 1s, 0.1s; -webkit-transition-delay: 1s, 0.1s; -o-transition-delay: 1s, 0.1s; transition-delay: 1s, 0.1s; -moz-transition-duration: 1s, 1.5s; -webkit-transition-duration: 1s, 1.5s; -o-transition-duration: 1s, 1.5s; transition-duration: 1s, 1.5s; -moz-transition-property: opacity, all; -webkit-transition-property: opacity, all; -o-transition-property: opacity, all; transition-property: opacity, all; -moz-transform: scale(0, 0); -webkit-transform: scale(0, 0); -o-transform: scale(0, 0); -ms-transform: scale(0, 0); transform: scale(0, 0); -moz-transform: translate(0, 100px); -webkit-transform: translate(0, 100px); -o-transform: translate(0, 100px); -ms-transform: translate(0, 100px); transform: translate(0, 100px); } 100 | 101 | #game .main { z-index: 1; } 102 | 103 | #finish { padding: 10px; } 104 | #finish .scoreContainer { border-bottom: 2px dashed white; padding-bottom: 2px; } 105 | #finish .score { opacity: 0; -moz-transition-delay: 2s; -webkit-transition-delay: 2s; -o-transition-delay: 2s; transition-delay: 2s; -moz-transition-duration: 0s; -webkit-transition-duration: 0s; -o-transition-duration: 0s; transition-duration: 0s; -moz-transition-property: opacity; -webkit-transition-property: opacity; -o-transition-property: opacity; transition-property: opacity; } 106 | #finish.current .score { opacity: 1; -moz-transition-delay: 1s; -webkit-transition-delay: 1s; -o-transition-delay: 1s; transition-delay: 1s; -moz-transition-duration: 1s; -webkit-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s; } 107 | #finish .bestDestroyed li { opacity: 0; -moz-transition-delay: 2s; -webkit-transition-delay: 2s; -o-transition-delay: 2s; transition-delay: 2s; -moz-transition-duration: 0s; -webkit-transition-duration: 0s; -o-transition-duration: 0s; transition-duration: 0s; -moz-transition-property: opacity; -webkit-transition-property: opacity; -o-transition-property: opacity; transition-property: opacity; } 108 | #finish.current .bestDestroyed li { -moz-transition-duration: 1s; -webkit-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s; opacity: 1; } 109 | #finish.current .bestDestroyed li:nth-child(1) { -moz-transition-delay: 0.5s; -webkit-transition-delay: 0.5s; -o-transition-delay: 0.5s; transition-delay: 0.5s; } 110 | #finish.current .bestDestroyed li:nth-child(2) { -moz-transition-delay: 0.9s; -webkit-transition-delay: 0.9s; -o-transition-delay: 0.9s; transition-delay: 0.9s; } 111 | #finish.current .bestDestroyed li:nth-child(3) { -moz-transition-delay: 1.3s; -webkit-transition-delay: 1.3s; -o-transition-delay: 1.3s; transition-delay: 1.3s; } 112 | #finish.current .bestDestroyed li:nth-child(4) { -moz-transition-delay: 1.7s; -webkit-transition-delay: 1.7s; -o-transition-delay: 1.7s; transition-delay: 1.7s; } 113 | #finish.current .score.score1 { -moz-transition-delay: 0s; -webkit-transition-delay: 0s; -o-transition-delay: 0s; transition-delay: 0s; } 114 | #finish.current .score.score2 { -moz-transition-delay: 2s; -webkit-transition-delay: 2s; -o-transition-delay: 2s; transition-delay: 2s; } 115 | #finish.current .score.score3 { -moz-transition-delay: 2.5s; -webkit-transition-delay: 2.5s; -o-transition-delay: 2.5s; transition-delay: 2.5s; } 116 | #finish.current .score.score4 { -moz-transition-delay: 3s; -webkit-transition-delay: 3s; -o-transition-delay: 3s; transition-delay: 3s; } 117 | #finish .score.score1, #finish .score.score2, #finish .score.score3 { text-align: right; display: block; } 118 | #finish .actions { -moz-transform: translateY(300px); -webkit-transform: translateY(300px); -o-transform: translateY(300px); -ms-transform: translateY(300px); transform: translateY(300px); -moz-transition-delay: 2s; -webkit-transition-delay: 2s; -o-transition-delay: 2s; transition-delay: 2s; } 119 | #finish.current .actions { -moz-transform: translateY(0px); -webkit-transform: translateY(0px); -o-transform: translateY(0px); -ms-transform: translateY(0px); transform: translateY(0px); -moz-transition-delay: 3s; -webkit-transition-delay: 3s; -o-transition-delay: 3s; transition-delay: 3s; -moz-transition-duration: 1s; -webkit-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s; } 120 | #finish .remainingBlocksScoreDesc { padding-left: 10px; } 121 | #finish ul.bestDestroyed { font-size: 0.9em; padding-left: 5px; margin: 0; list-style: none; display: inline-block; } 122 | #finish ul.bestDestroyed li { list-style: none; display: inline-block; } 123 | #finish ul.bestDestroyed li .bull { background: white; padding: 8px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -o-border-radius: 10px; -ms-border-radius: 10px; -khtml-border-radius: 10px; border-radius: 10px; display: inline-block; } 124 | #finish ul.bestDestroyed li:after { padding-right: 5px; content: " , "; color: white; } 125 | #finish ul.bestDestroyed li:last-child:after { content: ""; } 126 | 127 | .newRecord { font-size: 0.4em; color: red; vertical-align: top; } 128 | 129 | #main > .help .content { padding: 10px; } 130 | #main > .help .content p { margin: 4px; } 131 | 132 | #highscores .share { margin-top: 20px; text-align: center; } 133 | #highscores .levelProgress { font-size: 0.7em; width: 96%; margin: 5px 2%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box; padding: 2px 10px; border: 2px solid white; -moz-border-radius: 10px; -webkit-border-radius: 10px; -o-border-radius: 10px; -ms-border-radius: 10px; -khtml-border-radius: 10px; border-radius: 10px; overflow: hidden; position: relative; } 134 | #highscores .levelProgress .levelContainer { float: left; color: white; } 135 | #highscores .levelProgress .totalScoreContainer { text-align: right; } 136 | #highscores .levelProgress .progress { position: absolute; top: 0; left: 0; height: 100%; background: red; z-index: -1; -moz-border-radius: 4px; -webkit-border-radius: 4px; -o-border-radius: 4px; -ms-border-radius: 4px; -khtml-border-radius: 4px; border-radius: 4px; } 137 | #highscores .difficulties { display: table; width: 100%; text-align: center; } 138 | #highscores .difficulties dt { font-size: 0.6em; } 139 | #highscores .difficulties dd { font-size: 0.8em; background: black; display: inline-block; padding: 2px 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -o-border-radius: 10px; -ms-border-radius: 10px; -khtml-border-radius: 10px; border-radius: 10px; min-width: 60%; } 140 | #highscores .difficulties > dl { display: table-cell; margin: 1%; } 141 | #highscores .share { padding: 10px; font-size: 0.8em; } 142 | 143 | #user_scores .content { font-size: 0.6em; text-align: center; min-height: 80%; } 144 | 145 | #share { display: inline-block; background: white; -moz-border-radius: 8px; -webkit-border-radius: 8px; -o-border-radius: 8px; -ms-border-radius: 8px; -khtml-border-radius: 8px; border-radius: 8px; padding: 8px; } 146 | 147 | ul.download { text-align: center; } 148 | ul.download, ul.download li { padding: 0; margin: 0; list-style: none; vertical-align: top; } 149 | ul.download li { padding: 10px; display: inline-block; } 150 | 151 | img.device-icon { height: 50px; border: 4px solid transparent; -webkit-transition: 0.4s; -moz-transition: 0.4s; -o-transition: 0.4s; transition: 0.4s; border-radius: 10px; padding: 5px; } 152 | 153 | img.device-icon.android { padding: 5px 8px; } 154 | 155 | img.device-icon.android:hover { border-color: #a4ca39; } 156 | 157 | img.device-icon.desktop:hover { border-color: #ffaa22; } 158 | 159 | img.device-icon.iphone { padding: 5px 15px; } 160 | 161 | img.device-icon.iphone:hover, img.device-icon.ipad:hover { border-color: #999999; } 162 | 163 | img.device-icon.ipad { padding: 5px 10px; } 164 | 165 | img.device-icon.facebook:hover { border-color: #496ba4; } 166 | 167 | img.device-icon.chromeapp:hover { border-color: yellow; } 168 | 169 | img.qrcode { display: none; } 170 | -------------------------------------------------------------------------------- /game.desktop.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Desktop version 3 | * Copyright (C) 2011 @greweb 4 | * GPL v3 - https://github.com/gre/same-game-gravity 5 | */ 6 | (function(){ 7 | var util = window.util = window.util||{}; 8 | var game = window.samegame = window.samegame||{}; 9 | 10 | var Ticker = util.Ticker; 11 | var Timer = util.Timer; 12 | var TimeProgression = util.TimeProgression; 13 | var Color = game.Color; 14 | var Colors = game.Colors; 15 | var Sound = util.Sound; 16 | var i18n = util.i18n; 17 | var ShareText = game.ShareText; 18 | var LevelProgressBar = game.LevelProgressBar; 19 | var GameStorage = game.Storage; 20 | 21 | $(document).ready(function(){ 22 | setTimeout(function(){ // Wait before enabling transition to not do transition for the first load 23 | $('#main').addClass('enabletransition'); 24 | }, 500); 25 | $('a[href^=http]').click(function(e){ 26 | e.preventDefault(); 27 | window.open($(this).attr('href')); 28 | }) 29 | }); 30 | 31 | var Orientation = util.Orientation = function() { 32 | var orientationDelayed = 0; 33 | var orientation = 0; 34 | var cssOrientation = 0; 35 | var delay = null; 36 | 37 | var rotateNodes; 38 | 39 | var setCssOrientation = function(o) { 40 | cssOrientation = o; 41 | rotateNodes.css('transform', 'rotate('+o+'deg)'); 42 | } 43 | var setOrientation = function(o) { 44 | orientation = o; 45 | if(delay) clearTimeout(delay); 46 | delay = setTimeout(function(){ 47 | delay = null; 48 | orientationDelayed = o; 49 | }, 500); 50 | } 51 | /* convert any %90 orientation to a valid orientation (-90, 0, 90, 180) */ 52 | var normalizeOrientation = function(o) { 53 | while(o<0) o += 360; 54 | return (o+90)%360 - 90; 55 | } 56 | var addOrientation = function(add) { 57 | setCssOrientation(cssOrientation+add); 58 | setOrientation( normalizeOrientation(orientation + add) ); 59 | } 60 | 61 | var LEFT_ARROW = 37, UP_ARROW = 38, RIGHT_ARROW = 39, DOWN_ARROW = 40; 62 | 63 | window.onkeydown = function(e){ 64 | switch (e.keyCode) { 65 | case LEFT_ARROW: e.preventDefault(); addOrientation(-90); break; 66 | case RIGHT_ARROW: e.preventDefault(); addOrientation(90); break; 67 | case UP_ARROW: case DOWN_ARROW: e.preventDefault(); break; // prevent scrolling 68 | default: return true; 69 | } 70 | return false; 71 | }; 72 | 73 | return { 74 | init: function() { 75 | rotateNodes = $('#gameContainer').find('canvas'); 76 | }, 77 | resetOrientation: function() { 78 | setOrientation(0); 79 | }, 80 | turnRight: function() { 81 | addOrientation(90); 82 | }, 83 | turnLeft: function() { 84 | addOrientation(-90); 85 | }, 86 | fromRealPosition: function(p, maxX, maxY, translateX, translateY) { 87 | if(!translateX) translateX=0; 88 | if(!translateY) translateY=0; 89 | var o = orientationDelayed; 90 | if(o==90) return {x: p.y, y: maxX-p.x-translateX }; 91 | if(o==-90) return {x: maxY-p.y-translateY, y: p.x }; 92 | if(o==180) return {x: maxX-p.x-translateX, y: maxY-p.y-translateY }; 93 | return p; 94 | }, 95 | toRealPosition: function(p, maxX, maxY, translateX, translateY) { 96 | if(!translateX) translateX=0; 97 | if(!translateY) translateY=0; 98 | var o = orientationDelayed; 99 | if(o==-90) return {x: p.y, y: maxX-p.x-translateX }; 100 | if(o==90) return {x: maxY-p.y-translateY, y: p.x }; 101 | if(o==180) return {x: maxX-p.x-translateX, y: maxY-p.y-translateY }; 102 | return p; 103 | }, 104 | get: function(){ 105 | return orientationDelayed; 106 | } 107 | } 108 | }(); 109 | $(document).ready(Orientation.init); 110 | 111 | $(document).ready(function(){ 112 | $('#game .turnleft').click(function(e){ 113 | e.preventDefault(); 114 | e.stopPropagation(); 115 | Orientation.turnLeft(); 116 | }); 117 | $('#game .turnright').click(function(e){ 118 | e.preventDefault(); 119 | e.stopPropagation(); 120 | Orientation.turnRight(); 121 | }); 122 | }); 123 | 124 | var Locale = util.Locale = { 125 | get: function(){ return navigator.userLanguage ? navigator.userLanguage.substring(0,2) : navigator.language.substring(0,2) } 126 | }; 127 | 128 | game.Intent = { 129 | share: function(text) { 130 | var url = "http://twitter.com/intent/tweet?text="+escape(text); 131 | window.open(url); 132 | } 133 | }; 134 | 135 | var currentGame = null; 136 | /// The game controller 137 | var sg = game.SameGame = (function() { 138 | var colors; 139 | // game constants 140 | var gridSizeByDifficulty = [ 141 | {w:8, h:8}, 142 | {w:12, h: 12}, 143 | {w: 16, h: 16} 144 | ]; 145 | var colorNumberByDifficulty = [3, 4, 5]; 146 | var gameTimeoutByDifficulty = [2e4, 2e4, 2e4]; 147 | var difficulties = ["easy", "normal", "hard"]; 148 | 149 | var gameNeverLaunched = GameStorage.gameNeverLaunched(); 150 | 151 | var audioPop, audioSwosh; 152 | 153 | // Some Controller utils functions 154 | var scene = function(name) { 155 | var section = $('#'+name); 156 | section.nextAll().addClass('after') 157 | section.removeClass('after'); 158 | section.prevAll().removeClass('after'); 159 | section.addClass('current').siblings().removeClass('current'); 160 | } 161 | var _functions = []; 162 | var onRouteChange = function(call) { 163 | _functions.push(call); 164 | } 165 | var callRouteChangeFunctions = function() { 166 | for(var i=0; i<_functions.length; ++i) 167 | _functions[i](); 168 | _functions = []; 169 | } 170 | var redirect = function(path) { 171 | sg.route(path); 172 | } 173 | 174 | var retrieveGame = function() { 175 | if(currentGame!==null && !currentGame.isFinished()) return currentGame; 176 | return GameStorage.retrieveGame(); 177 | } 178 | 179 | var hasGameSaved = function() { 180 | return currentGame!==null && !currentGame.isFinished() || GameStorage.hasGameSaved(); 181 | } 182 | 183 | return { 184 | init: function() { 185 | audioPop = new Sound(['pop.mp3', 'pop.ogg'], 2); 186 | audioSwosh = new Sound(['swosh.mp3', 'swosh.ogg'], 4); 187 | }, 188 | route: function(path) { 189 | callRouteChangeFunctions(); 190 | if(path=='/') return this.index(); 191 | if(path=='/menu') return this.menu(); 192 | if(path=='/game/continue') return this.continueGame(); 193 | if(path=='/game/new') return this.newGame(); 194 | if(path=='/game/new/easy') return this.newGame(0); 195 | if(path=='/game/new/normal') return this.newGame(1); 196 | if(path=='/game/new/hard') return this.newGame(2); 197 | if(path=='/highscores') return this.highscores(); 198 | if(path=='/highscores/users') return this.user_scores(); 199 | if(path=='/help') return this.help(); 200 | if(path=='/help/1') return this.help(1); 201 | if(path=='/help/2') return this.help(2); 202 | if(path=='/help/3') return this.help(3); 203 | if(path=='/help/4') return this.help(4); 204 | return this.index(); 205 | }, 206 | index: function() { 207 | if(gameNeverLaunched) { 208 | gameNeverLaunched = false; 209 | return redirect('/help'); 210 | } 211 | return this.menu(); 212 | }, 213 | menu: function() { 214 | var c = $('#menu .continueGame'); 215 | if(hasGameSaved()) 216 | c.show(); 217 | else 218 | c.hide(); 219 | scene('menu'); 220 | }, 221 | user_scores: function() { 222 | var node = $('#user_scores'); 223 | window.SCORE && SCORE.fetch(); 224 | scene('user_scores'); 225 | }, 226 | highscores: function() { 227 | var highscores = $('#highscores'); 228 | var scores = [GameStorage.getDifficultyScore(0), GameStorage.getDifficultyScore(1), GameStorage.getDifficultyScore(2)]; 229 | var easy = scores[0] || 0, normal = scores[1] || 0, hard = scores[2] || 0; 230 | var totalScore = GameStorage.getTotalScore(); 231 | var levelProgress = new LevelProgressBar(totalScore).get(); 232 | 233 | var shareText = new ShareText({ 234 | level: levelProgress.level, 235 | totalscore: totalScore, 236 | easy: easy, 237 | normal: normal, 238 | hard: hard, 239 | version: "web" 240 | }).toString(); 241 | 242 | highscores.find('.totalScore').text(totalScore+''); 243 | highscores.find('.level').text(levelProgress.level); 244 | highscores.find('.progress').css('width', (levelProgress.progress*100)+'%'); 245 | highscores.find('.easyScore').text(easy); 246 | highscores.find('.normalScore').text(normal); 247 | highscores.find('.hardScore').text(hard); 248 | highscores.find('.share a').unbind().click(function(e){ 249 | e.preventDefault(); 250 | game.Intent.share(shareText); 251 | }); 252 | 253 | highscores.find('.resetHighscores').unbind().bind('click', function(){ 254 | if(confirm(i18n.get("confirm_reset_highscores"))) { 255 | GameStorage.resetScores(); 256 | sg.highscores(); 257 | } 258 | }); 259 | scene('highscores'); 260 | }, 261 | help: function(num) { 262 | if(!num) num = 1; 263 | scene('help-'+num); 264 | }, 265 | newGame: function(difficulty) { 266 | if(!difficulty) difficulty = 0; 267 | currentGame = new game.Game({ 268 | gridSize: gridSizeByDifficulty[difficulty], 269 | colors: colors=Colors.get(colorNumberByDifficulty[difficulty]), 270 | container: '#game', 271 | rendererClass: 'GameCanvasRenderer', 272 | difficulty: difficulty, 273 | drawHover: true, 274 | globalTimer: new Timer().pause(), 275 | keepSquare: true 276 | }); 277 | this.game(); 278 | }, 279 | continueGame: function() { 280 | if(!hasGameSaved()) return redirect('/'); 281 | try { 282 | currentGame = retrieveGame(); 283 | } catch(e) { 284 | GameStorage.cleanGameSave(); 285 | return redirect('/'); 286 | } 287 | this.game(); 288 | }, 289 | game: function() { 290 | if(!currentGame) return hasGameSaved() ? redirect('/game/continue') : redirect('/'); 291 | GameStorage.saveGame(currentGame); 292 | 293 | var timeout = gameTimeoutByDifficulty[currentGame.params.difficulty]; 294 | var ticker = new Ticker(); 295 | var gameEndProgression = new TimeProgression(timeout); 296 | var globalTimer = currentGame.params.globalTimer; 297 | 298 | var audioEnabled = false; 299 | setTimeout(function(){ audioEnabled = true; }, 500); 300 | 301 | currentGame.bindAll(); 302 | currentGame.bind('game-blockDestroy', function(){ 303 | gameEndProgression = new TimeProgression(timeout); 304 | if(audioEnabled) audioPop.play(); 305 | }); 306 | currentGame.bind('game-gravityChange', function(e, data){ 307 | var nb = 0; 308 | for(var i=0; i0) audioSwosh.play(); 311 | }) 312 | currentGame.bind('game-change', function(){ 313 | if(currentGame && !currentGame.isFinished()) GameStorage.saveGame(currentGame); 314 | }); 315 | currentGame.bind('game-finish', function(){ 316 | currentGame.unbindAll(); 317 | ticker.stop().removeListeners(); 318 | globalTimer.pause(); 319 | GameStorage.cleanGameSave(); 320 | sg.endGame(gameEndProgression == null); 321 | }); 322 | 323 | onRouteChange(function(){ 324 | gameEndProgression = null; 325 | if(currentGame) { 326 | currentGame.unbindAll(); 327 | } 328 | ticker.stop().removeListeners(); 329 | globalTimer.pause(); 330 | }); 331 | 332 | ticker.addListener(function(){ 333 | if(gameEndProgression && gameEndProgression.isOver()) { 334 | currentGame.trigger('game-finish'); 335 | gameEndProgression = null; 336 | } 337 | else { 338 | currentGame.render(); 339 | game.RemainingSecondsBar.updateRemainingSeconds(gameEndProgression, timeout); 340 | } 341 | }).start(); 342 | globalTimer.start(); 343 | 344 | scene('game'); 345 | }, 346 | endGame: function(timeoutReach) { 347 | if(!currentGame) return this.menu(); 348 | var finish = $('#finish'); 349 | var destroyed = currentGame.getAllDestroyed().sort(function(a, b){ 350 | return b.nb - a.nb; 351 | }).splice(0, 4); 352 | for(var i=0; i"); 439 | for(var o in requiredSupport) { 440 | var text = requiredSupport[o]; 441 | if(!support[o]) { 442 | requiredNode.append('
  • '+text+'
  • '); 443 | } 444 | } 445 | var recommendedNode = $("
      "); 446 | for(var o in recommendedSupport) { 447 | var text = recommendedSupport[o]; 448 | if(!support[o]) { 449 | recommendedNode.append('
    • '+text+'
    • '); 450 | } 451 | } 452 | var lang = util.Locale.get(); 453 | var node = $('
      '); 454 | node.append('

      SAME

      '); 455 | node.append('

      '+(lang=='fr' ? 'Mettez à jour votre navigateur' : 'Update your browser')+'

      '); 456 | if(requiredNode.find('li').size()>0) { 457 | node.append('

      '+(lang=='fr' ? 'Fonctionnalités requises non supportées:' : 'Required support :')+'

      '); 458 | node.append(requiredNode); 459 | node.append('

      '+(lang=='fr' ? 'Merci de mettre à jour votre navigateur pour pouvoir jouer au jeu.' : 'Please update your browser to make the game work.')+'

      '); 460 | node.append('

      '+(lang=='fr' ? 'Navigateurs recommandés: Firefox 4 ou Chrome' : 'Recommended browser: Firefox 4 or Chrome')+'

      '); 461 | } 462 | else if(recommendedNode.find('li').size()>0) { 463 | node.append('

      '+(lang=='fr' ? 'Fonctionnalités recommandées non supportées:' : 'Recommended support :')+'

      '); 464 | node.append(recommendedNode); 465 | node.append('

      '+(lang=='fr' ? 'Merci de mettre à jour votre navigateur pour avoir une meilleure expérience de jeu.' : 'Please update your browser to have a better experience.')+'

      '); 466 | for(var append=0; append<2; ++append) { 467 | var valid = $(''+(lang=='fr' ? 'Passer' : 'Pass')+''); 468 | $(valid).click(function(){ 469 | node.remove(); 470 | startGame(); 471 | }); 472 | var p = $('

      ').append(valid); 473 | if(!append) 474 | node.find('h1:first').after(p); 475 | else 476 | node.append(p); 477 | } 478 | } 479 | else { 480 | return startGame(); 481 | } 482 | $('body').append(node); 483 | }); 484 | 485 | }()); 486 | 487 | 488 | -------------------------------------------------------------------------------- /jquery.jplayer.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jPlayer Plugin for jQuery JavaScript Library 3 | * http://www.happyworm.com/jquery/jplayer 4 | * 5 | * Copyright (c) 2009 - 2010 Happyworm Ltd 6 | * Dual licensed under the MIT and GPL licenses. 7 | * - http://www.opensource.org/licenses/mit-license.php 8 | * - http://www.gnu.org/copyleft/gpl.html 9 | * 10 | * Author: Mark J Panaghiston 11 | * Version: 2.0.0 12 | * Date: 20th December 2010 13 | */ 14 | 15 | (function(c,h){c.fn.jPlayer=function(a){var b=typeof a==="string",d=Array.prototype.slice.call(arguments,1),f=this;a=!b&&d.length?c.extend.apply(null,[true,a].concat(d)):a;if(b&&a.charAt(0)==="_")return f;b?this.each(function(){var e=c.data(this,"jPlayer"),g=e&&c.isFunction(e[a])?e[a].apply(e,d):e;if(g!==e&&g!==h){f=g;return false}}):this.each(function(){var e=c.data(this,"jPlayer");if(e){e.option(a||{})._init();e.option(a||{})}else c.data(this,"jPlayer",new c.jPlayer(a,this))});return f};c.jPlayer= 16 | function(a,b){if(arguments.length){this.element=c(b);this.options=c.extend(true,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};c.jPlayer.event={ready:"jPlayer_ready",resize:"jPlayer_resize",error:"jPlayer_error",warning:"jPlayer_warning",loadstart:"jPlayer_loadstart",progress:"jPlayer_progress",suspend:"jPlayer_suspend",abort:"jPlayer_abort",emptied:"jPlayer_emptied",stalled:"jPlayer_stalled",play:"jPlayer_play",pause:"jPlayer_pause",loadedmetadata:"jPlayer_loadedmetadata", 17 | loadeddata:"jPlayer_loadeddata",waiting:"jPlayer_waiting",playing:"jPlayer_playing",canplay:"jPlayer_canplay",canplaythrough:"jPlayer_canplaythrough",seeking:"jPlayer_seeking",seeked:"jPlayer_seeked",timeupdate:"jPlayer_timeupdate",ended:"jPlayer_ended",ratechange:"jPlayer_ratechange",durationchange:"jPlayer_durationchange",volumechange:"jPlayer_volumechange"};c.jPlayer.htmlEvent=["loadstart","abort","emptied","stalled","loadedmetadata","loadeddata","canplaythrough","ratechange"];c.jPlayer.pause= 18 | function(){c.each(c.jPlayer.prototype.instances,function(a,b){b.data("jPlayer").status.srcSet&&b.jPlayer("pause")})};c.jPlayer.timeFormat={showHour:false,showMin:true,showSec:true,padHour:false,padMin:true,padSec:true,sepHour:":",sepMin:":",sepSec:""};c.jPlayer.convertTime=function(a){a=new Date(a*1E3);var b=a.getUTCHours(),d=a.getUTCMinutes();a=a.getUTCSeconds();b=c.jPlayer.timeFormat.padHour&&b<10?"0"+b:b;d=c.jPlayer.timeFormat.padMin&&d<10?"0"+d:d;a=c.jPlayer.timeFormat.padSec&&a<10?"0"+a:a;return(c.jPlayer.timeFormat.showHour? 19 | b+c.jPlayer.timeFormat.sepHour:"")+(c.jPlayer.timeFormat.showMin?d+c.jPlayer.timeFormat.sepMin:"")+(c.jPlayer.timeFormat.showSec?a+c.jPlayer.timeFormat.sepSec:"")};c.jPlayer.uaMatch=function(a){a=a.toLowerCase();var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,f=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||a.indexOf("compatible")<0&&f.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};c.jPlayer.browser={};var m=c.jPlayer.uaMatch(navigator.userAgent); 20 | if(m.browser){c.jPlayer.browser[m.browser]=true;c.jPlayer.browser.version=m.version}c.jPlayer.prototype={count:0,version:{script:"2.0.0",needFlash:"2.0.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:"metadata",volume:0.8,muted:false,backgroundColor:"#000000",cssSelectorAncestor:"#jp_interface_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute", 21 | volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",currentTime:".jp-current-time",duration:".jp-duration"},idPrefix:"jp",errorAlerts:false,warningAlerts:false},instances:{},status:{src:"",media:{},paused:true,format:{},formatType:"",waitForPlay:true,waitForLoad:true,srcSet:false,video:false,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0},_status:{volume:h,muted:false,width:0,height:0},internal:{ready:false,instance:h,htmlDlyCmdId:h},solution:{html:true, 22 | flash:true},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:true,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:true,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:false,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:false,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:false,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:true,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"', 23 | flashCanPlay:false,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:false,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=c.extend({},this.status,this._status);this.internal=c.extend({},this.internal);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css={};this.css.cs={};this.css.jq={};this.status.volume=this._limitValue(this.options.volume,0,1);this.status.muted= 24 | this.options.muted;this.status.width=this.element.css("width");this.status.height=this.element.css("height");this.element.css({"background-color":this.options.backgroundColor});c.each(this.options.supplied.toLowerCase().split(","),function(e,g){var i=g.replace(/^\s+|\s+$/g,"");if(a.format[i]){var j=false;c.each(a.formats,function(n,k){if(i===k){j=true;return false}});j||a.formats.push(i)}});c.each(this.options.solution.toLowerCase().split(","),function(e,g){var i=g.replace(/^\s+|\s+$/g,"");if(a.solution[i]){var j= 25 | false;c.each(a.solutions,function(n,k){if(i===k){j=true;return false}});j||a.solutions.push(i)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")===""&&this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=c.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=c.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:h});this.internal.video=c.extend({},{id:this.options.idPrefix+ 26 | "_video_"+this.count,jq:h});this.internal.flash=c.extend({},{id:this.options.idPrefix+"_flash_"+this.count,jq:h,swf:this.options.swfPath+(this.options.swfPath!==""&&this.options.swfPath.slice(-1)!=="/"?"/":"")+"Jplayer.swf"});this.internal.poster=c.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:h});c.each(c.jPlayer.event,function(e,g){if(a.options[e]!==h){a.element.bind(g+".jPlayer",a.options[e]);a.options[e]=h}});this.htmlElement.poster=document.createElement("img");this.htmlElement.poster.id= 27 | this.internal.poster.id;this.htmlElement.poster.onload=function(){if(!a.status.video||a.status.waitForPlay)a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=c("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.require.audio=false;this.require.video=false;c.each(this.formats,function(e,g){a.require[a.format[g].media]=true});this.html.audio.available=false;if(this.require.audio){this.htmlElement.audio= 28 | document.createElement("audio");this.htmlElement.audio.id=this.internal.audio.id;this.html.audio.available=!!this.htmlElement.audio.canPlayType}this.html.video.available=false;if(this.require.video){this.htmlElement.video=document.createElement("video");this.htmlElement.video.id=this.internal.video.id;this.html.video.available=!!this.htmlElement.video.canPlayType}this.flash.available=this._checkForFlash(10);this.html.canPlay={};this.flash.canPlay={};c.each(this.formats,function(e,g){a.html.canPlay[g]= 29 | a.html[a.format[g].media].available&&""!==a.htmlElement[a.format[g].media].canPlayType(a.format[g].codec);a.flash.canPlay[g]=a.format[g].flashCanPlay&&a.flash.available});this.html.desired=false;this.flash.desired=false;c.each(this.solutions,function(e,g){if(e===0)a[g].desired=true;else{var i=false,j=false;c.each(a.formats,function(n,k){if(a[a.solutions[0]].canPlay[k])if(a.format[k].media==="video")j=true;else i=true});a[g].desired=a.require.audio&&!i||a.require.video&&!j}});this.html.support={}; 30 | this.flash.support={};c.each(this.formats,function(e,g){a.html.support[g]=a.html.canPlay[g]&&a.html.desired;a.flash.support[g]=a.flash.canPlay[g]&&a.flash.desired});this.html.used=false;this.flash.used=false;c.each(this.solutions,function(e,g){c.each(a.formats,function(i,j){if(a[g].support[j]){a[g].used=true;return false}})});this.html.used||this.flash.used||this._error({type:c.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:c.jPlayer.errorMsg.NO_SOLUTION, 31 | hint:c.jPlayer.errorHint.NO_SOLUTION});this.html.active=false;this.html.audio.gate=false;this.html.video.gate=false;this.flash.active=false;this.flash.gate=false;if(this.flash.used){var b="id="+escape(this.internal.self.id)+"&vol="+this.status.volume+"&muted="+this.status.muted;if(c.browser.msie&&Number(c.browser.version)<=8){var d='';f[1]='';f[2]='';f[3]='';f[4]='';b=document.createElement(d);for(d=0;d0?100*d/this.status.duration:0;if(typeof a.seekable==="object"&&a.seekable.length>0){e=this.status.duration>0?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100;g=100*a.currentTime/a.seekable.end(a.seekable.length-1)}else{e=100;g=f}if(b)f=g=d=0;this.status.seekPercent=e;this.status.currentPercentRelative=g;this.status.currentPercentAbsolute=f;this.status.currentTime=d},_resetStatus:function(){this.status=c.extend({},this.status,c.jPlayer.prototype.status)}, 43 | _trigger:function(a,b,d){a=c.Event(a);a.jPlayer={};a.jPlayer.version=c.extend({},this.version);a.jPlayer.status=c.extend(true,{},this.status);a.jPlayer.html=c.extend(true,{},this.html);a.jPlayer.flash=c.extend(true,{},this.flash);if(b)a.jPlayer.error=c.extend({},b);if(d)a.jPlayer.warning=c.extend({},d);this.element.trigger(a)},jPlayerFlashEvent:function(a,b){if(a===c.jPlayer.event.ready&&!this.internal.ready){this.internal.ready=true;this.version.flash=b.version;this.version.needFlash!==this.version.flash&& 44 | this._error({type:c.jPlayer.error.VERSION,context:this.version.flash,message:c.jPlayer.errorMsg.VERSION+this.version.flash,hint:c.jPlayer.errorHint.VERSION});this._trigger(a)}if(this.flash.gate)switch(a){case c.jPlayer.event.progress:this._getFlashStatus(b);this._updateInterface();this._trigger(a);break;case c.jPlayer.event.timeupdate:this._getFlashStatus(b);this._updateInterface();this._trigger(a);break;case c.jPlayer.event.play:this._seeked();this._updateButtons(true);this._trigger(a);break;case c.jPlayer.event.pause:this._updateButtons(false); 45 | this._trigger(a);break;case c.jPlayer.event.ended:this._updateButtons(false);this._trigger(a);break;case c.jPlayer.event.error:this.status.waitForLoad=true;this.status.waitForPlay=true;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media);this._error({type:c.jPlayer.error.URL, 46 | context:b.src,message:c.jPlayer.errorMsg.URL,hint:c.jPlayer.errorHint.URL});break;case c.jPlayer.event.seeking:this._seeking();this._trigger(a);break;case c.jPlayer.event.seeked:this._seeked();this._trigger(a);break;default:this._trigger(a)}return false},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration}, 47 | _updateButtons:function(a){this.status.paused=!a;if(this.css.jq.play.length&&this.css.jq.pause.length)if(a){this.css.jq.play.hide();this.css.jq.pause.show()}else{this.css.jq.play.show();this.css.jq.pause.hide()}},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&this.css.jq.playBar.width(this.status.currentPercentRelative+"%");this.css.jq.currentTime.length&&this.css.jq.currentTime.text(c.jPlayer.convertTime(this.status.currentTime)); 48 | this.css.jq.duration.length&&this.css.jq.duration.text(c.jPlayer.convertTime(this.status.duration))},_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},setMedia:function(a){var b=this;this._seeked();clearTimeout(this.internal.htmlDlyCmdId);var d=this.html.audio.gate,f=this.html.video.gate,e=false;c.each(this.formats,function(g,i){var j=b.format[i].media==="video"; 49 | c.each(b.solutions,function(n,k){if(b[k].support[i]&&b._validString(a[i])){var l=k==="html";if(j)if(l){b.html.audio.gate=false;b.html.video.gate=true;b.flash.gate=false}else{b.html.audio.gate=false;b.html.video.gate=false;b.flash.gate=true}else if(l){b.html.audio.gate=true;b.html.video.gate=false;b.flash.gate=false}else{b.html.audio.gate=false;b.html.video.gate=false;b.flash.gate=true}if(b.flash.active||b.html.active&&b.flash.gate||d===b.html.audio.gate&&f===b.html.video.gate)b.clearMedia();else if(d!== 50 | b.html.audio.gate&&f!==b.html.video.gate){b._html_pause();b.status.video&&b.internal.video.jq.css({width:"0px",height:"0px"});b._resetStatus()}if(j){if(l){b._html_setVideo(a);b.html.active=true;b.flash.active=false}else{b._flash_setVideo(a);b.html.active=false;b.flash.active=true}b.css.jq.videoPlay.length&&b.css.jq.videoPlay.show();b.status.video=true}else{if(l){b._html_setAudio(a);b.html.active=true;b.flash.active=false}else{b._flash_setAudio(a);b.html.active=false;b.flash.active=true}b.css.jq.videoPlay.length&& 51 | b.css.jq.videoPlay.hide();b.status.video=false}e=true;return false}});if(e)return false});if(e){if(this._validString(a.poster))if(this.htmlElement.poster.src!==a.poster)this.htmlElement.poster.src=a.poster;else this.internal.poster.jq.show();else this.internal.poster.jq.hide();this.status.srcSet=true;this.status.media=c.extend({},a);this._updateButtons(false);this._updateInterface()}else{this.status.srcSet&&!this.status.waitForPlay&&this.pause();this.html.audio.gate=false;this.html.video.gate=false; 52 | this.flash.gate=false;this.html.active=false;this.flash.active=false;this._resetStatus();this._updateInterface();this._updateButtons(false);this.internal.poster.jq.hide();this.html.used&&this.require.video&&this.internal.video.jq.css({width:"0px",height:"0px"});this.flash.used&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._error({type:c.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:c.jPlayer.errorMsg.NO_SUPPORT,hint:c.jPlayer.errorHint.NO_SUPPORT})}}, 53 | clearMedia:function(){this._resetStatus();this._updateButtons(false);this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);if(this.html.active)this._html_clearMedia();else this.flash.active&&this._flash_clearMedia()},load:function(){if(this.status.srcSet)if(this.html.active)this._html_load();else this.flash.active&&this._flash_load();else this._urlNotSetError("load")},play:function(a){a=typeof a==="number"?a:NaN;if(this.status.srcSet)if(this.html.active)this._html_play(a);else this.flash.active&& 54 | this._flash_play(a);else this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a=typeof a==="number"?a:NaN;if(this.status.srcSet)if(this.html.active)this._html_pause(a);else this.flash.active&&this._flash_pause(a);else this._urlNotSetError("pause")},pauseOthers:function(){var a=this;c.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){if(this.status.srcSet)if(this.html.active)this._html_pause(0);else this.flash.active&& 55 | this._flash_pause(0);else this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);if(this.status.srcSet)if(this.html.active)this._html_playHead(a);else this.flash.active&&this._flash_playHead(a);else this._urlNotSetError("playHead")},mute:function(){this.status.muted=true;this.html.used&&this._html_mute(true);this.flash.used&&this._flash_mute(true);this._updateMute(true);this._updateVolume(0);this._trigger(c.jPlayer.event.volumechange)},unmute:function(){this.status.muted=false; 56 | this.html.used&&this._html_mute(false);this.flash.used&&this._flash_mute(false);this._updateMute(false);this._updateVolume(this.status.volume);this._trigger(c.jPlayer.event.volumechange)},_updateMute:function(a){if(this.css.jq.mute.length&&this.css.jq.unmute.length)if(a){this.css.jq.mute.hide();this.css.jq.unmute.show()}else{this.css.jq.mute.show();this.css.jq.unmute.hide()}},volume:function(a){a=this._limitValue(a,0,1);this.status.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&this._flash_volume(a); 57 | this.status.muted||this._updateVolume(a);this._trigger(c.jPlayer.event.volumechange)},volumeBar:function(a){if(!this.status.muted&&this.css.jq.volumeBar){var b=this.css.jq.volumeBar.offset();a=a.pageX-b.left;b=this.css.jq.volumeBar.width();this.volume(a/b)}},volumeBarValue:function(a){this.volumeBar(a)},_updateVolume:function(a){this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.width(a*100+"%")},_volumeFix:function(a){var b=0.0010*Math.random();return a+(a<0.5?b:-b)},_cssSelectorAncestor:function(a, 58 | b){this.options.cssSelectorAncestor=a;b&&c.each(this.options.cssSelector,function(d,f){self._cssSelector(d,f)})},_cssSelector:function(a,b){var d=this;if(typeof b==="string")if(c.jPlayer.prototype.options.cssSelector[a]){this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer");this.options.cssSelector[a]=b;this.css.cs[a]=this.options.cssSelectorAncestor+" "+b;this.css.jq[a]=b?c(this.css.cs[a]):[];this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(f){d[a](f);c(this).blur(); 59 | return false});b&&this.css.jq[a].length!==1&&this._warning({type:c.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:c.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:c.jPlayer.warningHint.CSS_SELECTOR_COUNT})}else this._warning({type:c.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:c.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:c.jPlayer.warningHint.CSS_SELECTOR_METHOD});else this._warning({type:c.jPlayer.warning.CSS_SELECTOR_STRING, 60 | context:b,message:c.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:c.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar){var b=this.css.jq.seekBar.offset();a=a.pageX-b.left;b=this.css.jq.seekBar.width();this.playHead(100*a/b)}},playBar:function(a){this.seekBar(a)},currentTime:function(){},duration:function(){},option:function(a,b){var d=a;if(arguments.length===0)return c.extend(true,{},this.options);if(typeof a==="string"){var f=a.split(".");if(b===h){for(var e=c.extend(true, 61 | {},this.options),g=0;g=9||this.htmlElement.media.load()}},_html_load:function(){if(this.status.waitForLoad){this.status.waitForLoad=false;this.htmlElement.media.src=this.status.src; 65 | try{this.htmlElement.media.load()}catch(a){}}clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this;this._html_load();this.htmlElement.media.play();if(!isNaN(a))try{this.htmlElement.media.currentTime=a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},100);return}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this;a>0?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);this.htmlElement.media.pause();if(!isNaN(a))try{this.htmlElement.media.currentTime= 66 | a}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},100);return}a>0&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this;this._html_load();try{if(typeof this.htmlElement.media.seekable==="object"&&this.htmlElement.media.seekable.length>0)this.htmlElement.media.currentTime=a*this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1)/100;else if(this.htmlElement.media.duration>0&&!isNaN(this.htmlElement.media.duration))this.htmlElement.media.currentTime= 67 | a*this.htmlElement.media.duration/100;else throw"e";}catch(d){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},100);return}this.status.waitForLoad||this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.video.jq.css({width:this.status.width,height:this.status.height})}}},_html_volume:function(a){if(this.html.audio.available)this.htmlElement.audio.volume= 68 | a;if(this.html.video.available)this.htmlElement.video.volume=a},_html_mute:function(a){if(this.html.audio.available)this.htmlElement.audio.muted=a;if(this.html.video.available)this.htmlElement.video.muted=a},_flash_setAudio:function(a){var b=this;try{c.each(this.formats,function(f,e){if(b.flash.support[e]&&a[e]){switch(e){case "m4a":b._getMovie().fl_setAudio_m4a(a[e]);break;case "mp3":b._getMovie().fl_setAudio_mp3(a[e])}b.status.src=a[e];b.status.format[e]=true;b.status.formatType=e;return false}}); 69 | if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var b=this;try{c.each(this.formats,function(f,e){if(b.flash.support[e]&&a[e]){switch(e){case "m4v":b._getMovie().fl_setVideo_m4v(a[e])}b.status.src=a[e];b.status.format[e]=true;b.status.formatType=e;return false}});if(this.options.preload==="auto"){this._flash_load();this.status.waitForLoad=false}}catch(d){this._flashError(d)}},_flash_clearMedia:function(){this.internal.flash.jq.css({width:"0px", 70 | height:"0px"});try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=false},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=false;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}if(a>0){this.status.waitForLoad=false;this._flash_checkWaitForPlay()}}, 71 | _flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){if(this.status.waitForPlay){this.status.waitForPlay=false;this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();if(this.status.video){this.internal.poster.jq.hide();this.internal.flash.jq.css({width:this.status.width,height:this.status.height})}}},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}}, 72 | _flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_checkForFlash:function(a){var b=false,d;if(window.ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+a);b=true}catch(f){}else if(navigator.plugins&&navigator.mimeTypes.length>0)if(d=navigator.plugins["Shockwave Flash"])if(navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,"$1")>=a)b=true;return c.browser.msie&& 73 | Number(c.browser.version)>=9?false:b},_validString:function(a){return a&&typeof a==="string"},_limitValue:function(a,b,d){return ad?d:a},_urlNotSetError:function(a){this._error({type:c.jPlayer.error.URL_NOT_SET,context:a,message:c.jPlayer.errorMsg.URL_NOT_SET,hint:c.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){this._error({type:c.jPlayer.error.FLASH,context:this.internal.flash.swf,message:c.jPlayer.errorMsg.FLASH+a.message,hint:c.jPlayer.errorHint.FLASH})},_error:function(a){this._trigger(c.jPlayer.event.error, 74 | a);if(this.options.errorAlerts)this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(c.jPlayer.event.warning,h,a);if(this.options.errorAlerts)this._alert("Warning!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)}};c.jPlayer.error={FLASH:"e_flash",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support", 75 | URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};c.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.", 76 | VERSION:"jPlayer "+c.jPlayer.prototype.version.script+" needs Jplayer.swf version "+c.jPlayer.prototype.version.needFlash+" but found "};c.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};c.jPlayer.warning= 77 | {CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};c.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of methodCssSelectors found did not equal one: ",CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."}; 78 | c.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}})(jQuery); 79 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /game.js: -------------------------------------------------------------------------------- 1 | /* 2 | * game.js - Same Game Gravity 3 | * Copyright (C) 2011 @greweb 4 | * GPL v3 - https://github.com/gre/same-game-gravity 5 | */ 6 | (function(){ 7 | 8 | var util = window.util = window.util||{}; 9 | var game = window.samegame = window.samegame||{}; 10 | 11 | var device_iPhone = (/iphone/gi).test(navigator.userAgent); 12 | var device_iPad = (/ipad/gi).test(navigator.userAgent); 13 | var device_android = (/android/gi).test(navigator.userAgent); 14 | var onMobile = device_android||device_iPad||device_iPhone; 15 | 16 | game.GAME_BAR_SIZE = 30; // can be overrided 17 | 18 | var i18n = util.i18n = function() { 19 | var lang; 20 | 21 | var dictionaries = {} 22 | 23 | var defaultDict = 'en'; 24 | 25 | var updateDOM = function(ctx) { 26 | var dict = dictionaries[lang]; 27 | if(!dict) dict = dictionaries['en']; 28 | if(ctx) { 29 | for(var key in dict) { 30 | $('.i18n-'+key, ctx).text(dict[key]); 31 | $(ctx).filter('.i18n-'+key).text(dict[key]); 32 | } 33 | } 34 | else 35 | for(var key in dict) 36 | $('.i18n-'+key).text(dict[key]); 37 | }; 38 | 39 | return { 40 | get: function(key/*, params...*/) { 41 | var dict = dictionaries[lang]; 42 | if(!dict) dict = dictionaries[defaultDict]; 43 | var value = dict[key]; 44 | if(!value) value = dictionaries[defaultDict][key]; 45 | value += ""; // make it string anyway 46 | if(arguments.length > 1) { 47 | for(var i=1; i')[0]); 84 | else { 85 | var audio = $('