Added ability to select by Pokédex number, added git head revision to output comments, minor fixes

This commit is contained in:
Michiel Sikma 2014-08-26 21:40:57 +02:00
parent 3520b84ced
commit 804e6bd2e5
16 changed files with 328 additions and 58 deletions

View File

@ -37,7 +37,7 @@ Here are some examples:
To clarify, the following classes can be used:
* <code>pkmn-<strong>name</strong></code> Pokémon name*
* <code>pkmn-<strong>name</strong></code> Pokémon name* or Pokédex number
* <code>color-regular</code>, <code>color-shiny</code> shiny or regular icon
* <code>dir-left</code>, <code>dir-right</code> direction the icon faces (some Pokémon, such as Roselia, have a different icon when facing right—by default, those that do not have a separate icon will be flipped using the CSS `transform` attribute)
* <code>gender-male</code>, <code>gender-female</code> gender of the icon (in case of gender differences, such as Meowstic)
@ -45,6 +45,8 @@ To clarify, the following classes can be used:
*Note: for Pokémon names, simplified versions without special characters are used, e.g. "flabebe" rather than "Flabébé". See the [icon overview page](https://github.com/msikma/pokesprite/wiki/Overview) for a full list of supported names.
You can select which Pokémon to display using its index number too, e.g. `<span class="pkmn-004"></span>` for Charmander.
The tag name used is also important: if a `<span>` is used, the icon is displayed as an `inline-block`. If a `<div>` is used, it's a `block`.
### Item icons

View File

@ -2,16 +2,16 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<!--
PokéSprite 1.0 <https://github.com/msikma/pokesprite>
PokéSprite r21 <https://github.com/msikma/pokesprite>
(C) 2014, Michiel Sikma <dada@doubla.de> and PokéSprite contributors
(C) 1995-2014 Nintendo/Creatures Inc./GAME FREAK Inc.
For a full list of contributors, view the project commit history.
Generated on 2014-08-15 22:15:12.
Generated on 2014-08-26 19:34:32.
-->
<head>
<meta charset="utf-8" />
<title>PokéSprite 1.0 Icon Overview</title>
<title>PokéSprite r21 Icon Overview</title>
<!-- Pokémon icons -->
<link type="text/css" href="pokesprite.css" rel="stylesheet" media="screen" />
<script charset="utf-8" src="pokesprite.js" ></script>
@ -29,8 +29,8 @@ Generated on 2014-08-15 22:15:12.
<body>
<div id="top">
<div class="description">
<h1>PokéSprite 1.0 Icon Overview</h1>
<p>The following list is a complete overview of all icons and the HTML necessary to display them. It was generated on <span class="time">2014-08-15 22:15:12</span>.</p>
<h1>PokéSprite r21 Icon Overview</h1>
<p>The following list is a complete overview of all icons and the HTML necessary to display them. It was generated on <span class="time">2014-08-26 19:34:32</span>.</p>
<p>For more information about the project, visit <a href="https://github.com/msikma/pokesprite">https://github.com/msikma/pokesprite</a>.</p>
</div>
<table class="table pkspr-overview">

View File

@ -1,7 +1,7 @@
@charset "UTF-8";/*!
* PokéSprite 1.0 <https://github.com/msikma/pokesprite>
* PokéSprite r21 <https://github.com/msikma/pokesprite>
* (C) 2014, Michiel Sikma <dada@doubla.de> and PokéSprite contributors
* (C) 1995-2014 Nintendo/Creatures Inc./GAME FREAK Inc.
* For a full list of contributors, view the project commit history.
* Generated on 2014-08-15 19:15:08.
* Generated on 2014-08-26 19:34:32.
*/.pkspr{display:inline-block;position:relative;vertical-align:baseline}.pkspr>i{background-image:url("pokesprite.png");content:' ';display:block}.pksprspan{display:inline-block}.pksprblock{display:block}.pksprspan.display-over{height:1px;vertical-align:middle}.pksprspan.display-over>i{position:absolute;top:-20px;left:0}.pkspr.pkspr-faux-right{-moz-transform:scaleX(-1);-o-transform:scaleX(-1);-webkit-transform:scaleX(-1);filter:FlipH;-ms-filter:'FlipH';transform:scaleX(-1)}.pkspr[class*='pkmn-'],.pkspr[class*='pkmn-']>i{width:40px}.pkspr[class*='pkmn-'],.pkspr[class*='pkmn-']>i{height:30px}.pkspr[class*='body-style-'],.pkspr[class*='body-style-']>i{width:32px}.pkspr[class*='body-style-'],.pkspr[class*='body-style-']>i{height:32px}.pkspr[class*='apricorn-'],.pkspr[class*='apricorn-']>i{width:30px}.pkspr[class*='apricorn-'],.pkspr[class*='apricorn-']>i{height:30px}.pkspr[class*='battle-item-'],.pkspr[class*='battle-item-']>i{width:30px}.pkspr[class*='battle-item-'],.pkspr[class*='battle-item-']>i{height:30px}.pkspr[class*='berry-'],.pkspr[class*='berry-']>i{width:30px}.pkspr[class*='berry-'],.pkspr[class*='berry-']>i{height:30px}.pkspr[class*='ev-item-'],.pkspr[class*='ev-item-']>i{width:30px}.pkspr[class*='ev-item-'],.pkspr[class*='ev-item-']>i{height:30px}.pkspr[class*='evo-item-'],.pkspr[class*='evo-item-']>i{width:30px}.pkspr[class*='evo-item-'],.pkspr[class*='evo-item-']>i{height:30px}.pkspr[class*='flute-'],.pkspr[class*='flute-']>i{width:30px}.pkspr[class*='flute-'],.pkspr[class*='flute-']>i{height:30px}.pkspr[class*='fossil-'],.pkspr[class*='fossil-']>i{width:30px}.pkspr[class*='fossil-'],.pkspr[class*='fossil-']>i{height:30px}.pkspr[class*='gem-'],.pkspr[class*='gem-']>i{width:30px}.pkspr[class*='gem-'],.pkspr[class*='gem-']>i{height:30px}.pkspr[class*='hm-'],.pkspr[class*='hm-']>i{width:30px}.pkspr[class*='hm-'],.pkspr[class*='hm-']>i{height:30px}.pkspr[class*='hold-item-'],.pkspr[class*='hold-item-']>i{width:30px}.pkspr[class*='hold-item-'],.pkspr[class*='hold-item-']>i{height:30px}.pkspr[class*='incense-'],.pkspr[class*='incense-']>i{width:30px}.pkspr[class*='incense-'],.pkspr[class*='incense-']>i{height:30px}.pkspr[class*='other-item-'],.pkspr[class*='other-item-']>i{width:30px}.pkspr[class*='other-item-'],.pkspr[class*='other-item-']>i{height:30px}.pkspr[class*='key-item-'],.pkspr[class*='key-item-']>i{width:30px}.pkspr[class*='key-item-'],.pkspr[class*='key-item-']>i{height:30px}.pkspr[class*='mail-'],.pkspr[class*='mail-']>i{width:30px}.pkspr[class*='mail-'],.pkspr[class*='mail-']>i{height:30px}.pkspr[class*='medicine-'],.pkspr[class*='medicine-']>i{width:30px}.pkspr[class*='medicine-'],.pkspr[class*='medicine-']>i{height:30px}.pkspr[class*='mega-stone-'],.pkspr[class*='mega-stone-']>i{width:30px}.pkspr[class*='mega-stone-'],.pkspr[class*='mega-stone-']>i{height:30px}.pkspr[class*='mulch-'],.pkspr[class*='mulch-']>i{width:30px}.pkspr[class*='mulch-'],.pkspr[class*='mulch-']>i{height:30px}.pkspr[class*='plate-'],.pkspr[class*='plate-']>i{width:30px}.pkspr[class*='plate-'],.pkspr[class*='plate-']>i{height:30px}.pkspr[class*='pokeball-'],.pkspr[class*='pokeball-']>i{width:30px}.pkspr[class*='pokeball-'],.pkspr[class*='pokeball-']>i{height:30px}.pkspr[class*='scarf-'],.pkspr[class*='scarf-']>i{width:30px}.pkspr[class*='scarf-'],.pkspr[class*='scarf-']>i{height:30px}.pkspr[class*='shard-'],.pkspr[class*='shard-']>i{width:30px}.pkspr[class*='shard-'],.pkspr[class*='shard-']>i{height:30px}.pkspr[class*='tm-'],.pkspr[class*='tm-']>i{width:30px}.pkspr[class*='tm-'],.pkspr[class*='tm-']>i{height:30px}.pkspr[class*='valuable-item-'],.pkspr[class*='valuable-item-']>i{width:30px}.pkspr[class*='valuable-item-'],.pkspr[class*='valuable-item-']>i{height:30px}.pkspr[class*='wonder-launcher-'],.pkspr[class*='wonder-launcher-']>i{width:30px}.pkspr[class*='wonder-launcher-'],.pkspr[class*='wonder-launcher-']>i{height:30px}.pkspr[class*='status-'],.pkspr[class*='status-']>i{width:10px}.pkspr[class*='status-'],.pkspr[class*='status-']>i{height:10px}

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,14 @@
/*
PokéSprite 1.0 <https://github.com/msikma/pokesprite>
PokéSprite r21 <https://github.com/msikma/pokesprite>
(C) 2014, Michiel Sikma <dada@doubla.de> and PokéSprite contributors
(C) 1995-2014 Nintendo/Creatures Inc./GAME FREAK Inc.
For a full list of contributors, view the project commit history.
Generated on 2014-08-15 19:15:08.
Generated on 2014-08-26 19:34:32.
*/
window.PkSpr=function(){var a=this;a.A="pkspr";a.B={pkmn:{w:40,h:30},etc:{},"body-style":{w:32,h:32},apricorn:{w:30,h:30},"battle-item":{w:30,h:30},berry:{w:30,h:30},"ev-item":{w:30,h:30},"evo-item":{w:30,h:30},flute:{w:30,h:30},fossil:{w:30,h:30},gem:{w:30,h:30},hm:{w:30,h:30},"hold-item":{w:30,h:30},incense:{w:30,h:30},"other-item":{w:30,h:30},"key-item":{w:30,h:30},mail:{w:30,h:30},medicine:{w:30,h:30},"mega-stone":{w:30,h:30},mulch:{w:30,h:30},plate:{w:30,h:30},pokeball:{w:30,h:30},scarf:{w:30,
h:30},shard:{w:30,h:30},tm:{w:30,h:30},"valuable-item":{w:30,h:30},"wonder-launcher":{w:30,h:30},status:{w:10,h:10}};a.J={pkmn:{bulbasaur:{".":{".":{regular:{x:0,y:0},shiny:{x:40,y:0}}}},ivysaur:{".":{".":{regular:{x:80,y:0},shiny:{x:120,y:0}}}},venusaur:{".":{".":{regular:{x:160,y:0},shiny:{x:200,y:0}}},mega:{".":{regular:{x:240,y:0},shiny:{x:280,y:0}}}},charmander:{".":{".":{regular:{x:320,y:0},shiny:{x:360,y:0}}}},charmeleon:{".":{".":{regular:{x:400,y:0},shiny:{x:440,y:0}}}},charizard:{".":{".":{regular:{x:480,
window.PkSpr=function(){var a=this;a.A="pkspr";a.C={pkmn:{w:40,h:30},etc:{},"body-style":{w:32,h:32},apricorn:{w:30,h:30},"battle-item":{w:30,h:30},berry:{w:30,h:30},"ev-item":{w:30,h:30},"evo-item":{w:30,h:30},flute:{w:30,h:30},fossil:{w:30,h:30},gem:{w:30,h:30},hm:{w:30,h:30},"hold-item":{w:30,h:30},incense:{w:30,h:30},"other-item":{w:30,h:30},"key-item":{w:30,h:30},mail:{w:30,h:30},medicine:{w:30,h:30},"mega-stone":{w:30,h:30},mulch:{w:30,h:30},plate:{w:30,h:30},pokeball:{w:30,h:30},scarf:{w:30,
h:30},shard:{w:30,h:30},tm:{w:30,h:30},"valuable-item":{w:30,h:30},"wonder-launcher":{w:30,h:30},status:{w:10,h:10}};a.B={pkmn:{bulbasaur:{".":{".":{regular:{x:0,y:0},shiny:{x:40,y:0}}}},ivysaur:{".":{".":{regular:{x:80,y:0},shiny:{x:120,y:0}}}},venusaur:{".":{".":{regular:{x:160,y:0},shiny:{x:200,y:0}}},mega:{".":{regular:{x:240,y:0},shiny:{x:280,y:0}}}},charmander:{".":{".":{regular:{x:320,y:0},shiny:{x:360,y:0}}}},charmeleon:{".":{".":{regular:{x:400,y:0},shiny:{x:440,y:0}}}},charizard:{".":{".":{regular:{x:480,
y:0},shiny:{x:520,y:0}}},"mega-x":{".":{regular:{x:560,y:0},shiny:{x:600,y:0}}},"mega-y":{".":{regular:{x:640,y:0},shiny:{x:680,y:0}}}},squirtle:{".":{".":{regular:{x:720,y:0},shiny:{x:760,y:0}}}},wartortle:{".":{".":{regular:{x:800,y:0},shiny:{x:840,y:0}}}},blastoise:{".":{".":{regular:{x:880,y:0},shiny:{x:920,y:0}}},mega:{".":{regular:{x:960,y:0},shiny:{x:1E3,y:0}}}},caterpie:{".":{".":{regular:{x:1040,y:0},shiny:{x:1080,y:0}}}},metapod:{".":{".":{regular:{x:1120,y:0},shiny:{x:1160,y:0}}}},butterfree:{".":{".":{regular:{x:1200,
y:0},shiny:{x:1240,y:0}}}},weedle:{".":{".":{regular:{x:0,y:30},shiny:{x:40,y:30}}}},kakuna:{".":{".":{regular:{x:80,y:30},shiny:{x:120,y:30}}}},beedrill:{".":{".":{regular:{x:160,y:30},shiny:{x:200,y:30}}}},pidgey:{".":{".":{regular:{x:240,y:30},shiny:{x:280,y:30}}}},pidgeotto:{".":{".":{regular:{x:320,y:30},shiny:{x:360,y:30}}}},pidgeot:{".":{".":{regular:{x:400,y:30},shiny:{x:440,y:30}}}},rattata:{".":{".":{regular:{x:480,y:30},shiny:{x:520,y:30}}}},raticate:{".":{".":{regular:{x:560,y:30},shiny:{x:600,
y:30}}}},spearow:{".":{".":{regular:{x:640,y:30},shiny:{x:680,y:30}}}},fearow:{".":{".":{regular:{x:720,y:30},shiny:{x:760,y:30}}}},ekans:{".":{".":{regular:{x:800,y:30},shiny:{x:840,y:30}}}},arbok:{".":{".":{regular:{x:880,y:30},shiny:{x:920,y:30}}}},pikachu:{".":{".":{regular:{x:960,y:30},shiny:{x:1E3,y:30}}}},raichu:{".":{".":{regular:{x:1040,y:30},shiny:{x:1080,y:30}}}},sandshrew:{".":{".":{regular:{x:1120,y:30},shiny:{x:1160,y:30}}}},sandslash:{".":{".":{regular:{x:1200,y:30},shiny:{x:1240,y:30}}}},
@ -166,9 +166,10 @@ y:2192},ground:{x:1080,y:2192},ice:{x:1110,y:2192},normal:{x:1140,y:2192},poison
y:2222},"relic-crown":{x:420,y:2222},"relic-gold":{x:450,y:2222},"relic-silver":{x:480,y:2222},"relic-statue":{x:510,y:2222},"relic-vase":{x:540,y:2222},"shoal-salt":{x:570,y:2222},"shoal-shell":{x:600,y:2222},"slowpoke-tail":{x:630,y:2222},"star-piece":{x:660,y:2222},stardust:{x:690,y:2222},"tiny-mushroom":{x:720,y:2222}},"wonder-launcher":{"ability-urge":{x:750,y:2222},antidote:{x:780,y:2222},awakening:{x:810,y:2222},"burn-heal":{x:840,y:2222},"dire-hit-1":{x:870,y:2222},"dire-hit-2":{x:900,y:2222},
"dire-hit-3":{x:930,y:2222},ether:{x:960,y:2222},"full-heal":{x:990,y:2222},"full-restore":{x:1020,y:2222},"guard-spec":{x:1050,y:2222},"hyper-potion":{x:1080,y:2222},"ice-heal":{x:1110,y:2222},"item-drop":{x:1140,y:2222},"item-urge":{x:1170,y:2222},"max-potion":{x:1200,y:2222},"max-revive":{x:1230,y:2222},"paralyze-heal":{x:0,y:2252},potion:{x:30,y:2252},"reset-urge":{x:60,y:2252},revive:{x:90,y:2252},"super-potion":{x:120,y:2252},"x-accuracy-1":{x:150,y:2252},"x-accuracy-2":{x:180,y:2252},"x-accuracy-3":{x:210,
y:2252},"x-accuracy-6":{x:240,y:2252},"x-attack-1":{x:270,y:2252},"x-attack-2":{x:300,y:2252},"x-attack-3":{x:330,y:2252},"x-attack-6":{x:360,y:2252},"x-defense-1":{x:390,y:2252},"x-defense-2":{x:420,y:2252},"x-defense-3":{x:450,y:2252},"x-defense-6":{x:480,y:2252},"x-sp-atk-1":{x:510,y:2252},"x-sp-atk-2":{x:540,y:2252},"x-sp-atk-3":{x:570,y:2252},"x-sp-atk-6":{x:600,y:2252},"x-sp-def-1":{x:630,y:2252},"x-sp-def-2":{x:660,y:2252},"x-sp-def-3":{x:690,y:2252},"x-sp-def-6":{x:720,y:2252},"x-speed-1":{x:750,
y:2252},"x-speed-2":{x:780,y:2252},"x-speed-3":{x:810,y:2252},"x-speed-6":{x:840,y:2252}},status:{"holding-item":{x:942,y:2252},pentagon:{x:952,y:2252},"pokerus-cured":{x:962,y:2252},shiny:{x:972,y:2252}}};a.process_dom=function(){a.K(a.H)};a.decorate=function(c){!1==a.S(c)&&(c=[c]);var b,d,e,f;b=0;for(d=c.length;b<d;++b)e=c[b],e=(f="string"==typeof e||e instanceof String)?document.getElementById(e):e,a.C(e,a.A)?a.F(e):a.H(0,e)};a.M=function(c){window.console&&console.warn("Couldn't decorate icon with the following properties: %o",
c)};a.F=function(c){if(!a.T(c)){var b=a.Q(c),d=a.R(b.type),e=a.O(b),f=e.coords,e=e.U,h=null==d||null==d.x;null==f?a.M(b):(h&&(d={w:f.I,h:f.G}),b=a.L(c),a.W(b,f),h&&a.Y(c,b,d),e.N&&a.X(c),a.V(c))}};a.X=function(c){a.D(c,"pkspr-faux-right")};a.L=function(c){var a=document.createElement("i");c.appendChild(a);return a};a.W=function(a,b){a.style.backgroundPosition=-b.x+"px "+-b.y+"px"};a.Y=function(a,b,d){a.style.width=d.I+"px";a.style.height=d.G+"px";b.style.width=d.I+"px";b.style.height=d.G+"px"};a.O=
function(c){var b=a.J,d,e,f,h,g={type:null,slug:null,form:".",dir:".",color:"regular"},k={flipped:!1};for(e in g){if(0<=b.x)break;f=c[e];h=g[e];if(d=b[f])b=d;else if(d=b[h])b=d,"right"==f&&(k.N=!0);else{b=null;break}}return{coords:b,U:k}};a.R=function(c){for(var b in a.B)if(b==c)return a.B[b];return null};a.Q=function(c){var b=c.className;if(null==b)return null;c={type:null,slug:null,color:null,form:null,gender:null,dir:null};for(var d in a.B)c[d]={k:"type",v:"slug"};var e,f,h,g,k,l=b.split(" "),
b=0;for(e=l.length;b<e;++b)for(g in k=l[b],c)h=c[g],f=k.indexOf(g+"-"),0==f&&(f=k.substring(g.length+1),null===h?c[g]=f:(c[h.Z]=g,c[h.$]=f));for(d in a.B)delete c[d];return c};a.S=function(a){return"[object Array]"===toString.call(a)};a.H=function(c,b){null==b&&(b=document);var d,e=a.P(b);for(d=0;d<e.length;++d)a.F(e[d])};a.P=function(c){null==c&&(c=document);try{return c.querySelectorAll("span."+a.A+",div."+a.A)}catch(b){}var d,e,f,h,g=[],k=["span","div"];for(d=0;d<k.length;++d)for(h=c.getElementsByTagName(k[d]),
e=0;e<h.length;++e)f=h[e],a.C(f,a.A)&&g.push(f);return g};a.T=function(c){return a.C(c,a.A+"-decorated")};a.V=function(c){a.D(c," "+a.A+"-decorated")};a.D=function(a,b){a.className+=" "+b};a.C=function(a,b){return-1<(" "+a.className+" ").indexOf(" "+b+" ")};a.K=function(a){function b(){try{k.doScroll("left")}catch(a){setTimeout(b,50);return}d("poll")}function d(b){if("readystatechange"!=b.type||"complete"==g.readyState)("load"==b.type?e:g)[n](m+b.type,d,!1),!f&&(f=!0)&&a.call(e,b.type||b)}var e=window,
f=!1,h=!0,g=e.document,k=g.documentElement,l=g.addEventListener?"addEventListener":"attachEvent",n=g.addEventListener?"removeEventListener":"detachEvent",m=g.addEventListener?"":"on";if("complete"==g.readyState)a.call(e,"lazy");else{if(g.createEventObject&&k.doScroll){try{h=!e.frameElement}catch(p){}h&&b()}g[l](m+"DOMContentLoaded",d,!1);g[l](m+"readystatechange",d,!1);e[l](m+"load",d,!1)}};return a}();
y:2252},"x-speed-2":{x:780,y:2252},"x-speed-3":{x:810,y:2252},"x-speed-6":{x:840,y:2252}},status:{"holding-item":{x:942,y:2252},pentagon:{x:952,y:2252},"pokerus-cured":{x:962,y:2252},shiny:{x:972,y:2252}}};var k,m;a.process_dom=function(){a.L(a.I)};a.decorate=function(b){!1==a.U(b)&&(b=[b]);var c,d,e,f;c=0;for(d=b.length;c<d;++c)e=b[c],e=(f="string"==typeof e||e instanceof String)?document.getElementById(e):e,a.D(e,a.A)?a.G(e):a.I(0,e)};a.N=function(b){window.console&&console.warn("Couldn't decorate icon with the following properties: %o",
b)};a.G=function(b){if(!a.V(b)){var c=a.S(b),d=a.T(c.type),e=a.Q(c),f=e.coords,e=e.Z,h=null==d||null==d.x;null==f?a.N(c):(h&&(d={w:f.K,h:f.H}),c=a.M(b),a.aa(c,f),h&&a.ca(b,c,d),e.O&&a.ba(b),a.$(b))}};a.ba=function(b){a.F(b,"pkspr-faux-right")};a.M=function(b){var a=document.createElement("i");b.appendChild(a);return a};a.aa=function(b,a){b.style.backgroundPosition=-a.x+"px "+-a.y+"px"};a.ca=function(a,c,d){a.style.width=d.K+"px";a.style.height=d.H+"px";c.style.width=d.K+"px";c.style.height=d.H+"px"};
a.Q=function(b){var c=a.B,d,e,f,h,g={type:null,slug:null,form:".",dir:".",color:"regular"},l={flipped:!1};for(e in g){if(0<=c.x)break;f=b[e];h=g[e];if(d=c[f])c=d;else if(d=c[h])c=d,"right"==f&&(l.O=!0);else{c=null;break}}return{coords:c,Z:l}};a.T=function(b){for(var c in a.C)if(c==b)return a.C[c];return null};a.S=function(b){var c=b.className;if(null==c)return null;b={type:null,slug:null,color:null,form:null,gender:null,dir:null};for(var d in a.C)b[d]={k:"type",v:"slug"};var e,f,h,g,l,m=c.split(" "),
c=0;for(e=m.length;c<e;++c)for(g in l=m[c],b)h=b[g],f=l.indexOf(g+"-"),0==f&&(f=l.substring(g.length+1),null===h?b[g]=f:(b[h.ea]=g,b[h.fa]=f));"pkmn"==b.type&&a.W(b.J)&&(b.J=k[b.J]);for(d in a.C)delete b[d];return b};a.Y=function(){void 0==m&&(m=new RegExp(/(?!000)^[0-9]{3}$/))};a.P=function(){var b,c,d;if(void 0==k&&(k={},null!=a.B&&null!=a.B.X))for(d=Object.keys(a.B.X),b=1,c=d.length;b<=c;++b)k[("000"+b).slice(-3)]=d[b-1]};a.W=function(a){return m.test(a)};a.U=function(a){return"[object Array]"===
toString.call(a)};a.I=function(b,c){null==c&&(c=document);var d,e=a.R(c);for(d=0;d<e.length;++d)a.G(e[d])};a.R=function(b){null==b&&(b=document);try{return b.querySelectorAll("span."+a.A+",div."+a.A)}catch(c){}var d,e,f,h,g=[],l=["span","div"];for(d=0;d<l.length;++d)for(h=b.getElementsByTagName(l[d]),e=0;e<h.length;++e)f=h[e],a.D(f,a.A)&&g.push(f);return g};a.V=function(b){return a.D(b,a.A+"-decorated")};a.$=function(b){a.F(b," "+a.A+"-decorated")};a.F=function(a,c){a.className+=" "+c};a.D=function(a,
c){return-1<(" "+a.className+" ").indexOf(" "+c+" ")};a.L=function(a){function c(){try{l.doScroll("left")}catch(a){setTimeout(c,50);return}d("poll")}function d(c){if("readystatechange"!=c.type||"complete"==g.readyState)("load"==c.type?e:g)[m](n+c.type,d,!1),!f&&(f=!0)&&a.call(e,c.type||c)}var e=window,f=!1,h=!0,g=e.document,l=g.documentElement,k=g.addEventListener?"addEventListener":"attachEvent",m=g.addEventListener?"removeEventListener":"detachEvent",n=g.addEventListener?"":"on";if("complete"==
g.readyState)a.call(e,"lazy");else{if(g.createEventObject&&l.doScroll){try{h=!e.frameElement}catch(p){}h&&c()}g[k](n+"DOMContentLoaded",d,!1);g[k](n+"readystatechange",d,!1);e[k](n+"load",d,!1)}};a.Y();a.P();a.da=void 0;return a}();Object.keys||(Object.keys=function(){var a=Object.prototype.hasOwnProperty;return function(k){if("object"!==typeof k&&("function"!==typeof k||null===k))throw new TypeError("Object.keys called on non-object");var m=[],b;for(b in k)a.call(k,b)&&m.push(b);return m}}());

Binary file not shown.

Before

Width:  |  Height:  |  Size: 590 KiB

After

Width:  |  Height:  |  Size: 590 KiB

View File

@ -1,10 +1,10 @@
@charset 'UTF-8';
/*!
* PokéSprite 1.0 <https://github.com/msikma/pokesprite>
* PokéSprite r21 <https://github.com/msikma/pokesprite>
* (C) 2014, Michiel Sikma <dada@doubla.de> and PokéSprite contributors
* (C) 1995-2014 Nintendo/Creatures Inc./GAME FREAK Inc.
* For a full list of contributors, view the project commit history.
* Generated on 2014-08-15 19:15:08.
* Generated on 2014-08-26 19:34:32.
*/
$pkspr-sprite-url: 'pokesprite.png';

View File

@ -35,15 +35,15 @@ $s['img_slug_lang'] = 'eng';
// Copyright strings
$s['copy_a'] = '2014';
$s['copy_z'] = date('Y');
$s['version'] = '1.0';
$s['title_str'] = 'PokéSprite';
$s['revision'] = '[unknown]';
$s['website'] = 'https://github.com/msikma/pokesprite';
$s['website_txt'] = '<'.$s['website'].'>';
$s['main_contributor'] = 'Michiel Sikma <dada@doubla.de>';
$s['other_contributors'] = 'PokéSprite contributors';
$s['contributors'] = implode(' and ', array($s['main_contributor'], $s['other_contributors']));
$s['copyright_str'] = '(C) '.($s['copy_a'] != $s['copy_z'] ? $s['copy_a'].'-'.$s['copy_z'] : $s['copy_a']).', '.$s['contributors'];
$s['copyright_gf'] = '(C) 1995-'.$s['copy_z'].' Nintendo/Creatures Inc./GAME FREAK Inc.';
$s['copyright_website'] = 'https://github.com/msikma/pokesprite';
$s['title_str'] = 'PokéSprite '.$s['version'];
$s['title_str_site'] = $s['title_str'].' <'.$s['copyright_website'].'>';
$s['copyright_contrib_notice'] = 'For a full list of contributors, view the project commit history.';
$s['script_date'] = date('Y-m-d H:i:s');
@ -71,6 +71,8 @@ $s['dir_output'] = './output/';
$s['dir_mode'] = 0777;
// If set, which Pokémon to include (debugging only)
$s['pkmn_range'] = null;
// Whether to index numbers instead of slugs in the overview (debugging only)
$s['html_no_slugs'] = false;
// Github project base directory
$s['github_base_dir'] = 'https://raw.github.com/msikma/pokesprite/master/';
@ -125,6 +127,7 @@ $s['usage_tpl'] = 'usage.tpl';
// Whether to generate a Markdown overview
$s['generate_markdown'] = false;
// Base CSS selector (identifies an element as ours)
$s['css_base_selector'] = 'pkspr';
// Base SCSS/JS variable name

View File

@ -37,7 +37,7 @@ class I18n
'overview_class' => 'Class',
'overview_file' => 'File',
'generated_on' => "Generated on %s.",
'info' => "<frm=cyan::bold>%s</frm>\n<frm=purple>Generates optimized Pokémon SCSS sprite\n%s\n\n</frm>",
'info' => "<frm=cyan::bold>%s %s %s</frm>\n<frm=purple>Generates optimized Pokémon SCSS sprite\n%s\n\n</frm>",
'icon_dir_failure' => "<frm=red>Couldn't open icon directory (%s). Skipping.</frm>\n",
'dir_create' => "Creating output directory.\n",
'dir_error' => "<frm=red>Couldn't create directories.</frm>\n",

View File

@ -223,6 +223,10 @@ class IconOverview extends IconTplFactory
$cls_female = 'gender-female';
$cls_right = 'dir-right';
// Whether to use slug classes or Pokédex classes in the overview.
// (For debugging only.)
$use_idx_classes = Settings::get('html_no_slugs');
// If we're only using shiny icons, omit the "color-shiny" class,
// as no regular icons means the fallback will always be shiny.
$only_shiny = (
@ -234,7 +238,12 @@ class IconOverview extends IconTplFactory
if ($icon['type'] == 'pkmn') {
// For Pokémon sprite icons.
$classes[] = $icon['type'].'-'.$icon['slug'];
if ($use_idx_classes) {
$classes[] = $icon['type'].'-'.$icon['id'];
}
else {
$classes[] = $icon['type'].'-'.$icon['slug'];
}
if ($icon['version'] != 'regular' && !$only_shiny) {
$classes[] = $cls_shiny;
}
@ -354,7 +363,7 @@ class IconOverview extends IconTplFactory
'css_output' => str_replace('.scss', '.css', Settings::get('scss_output')),
'title_str_html' => htmlspecialchars(Settings::get('title_str')),
'script_date_html' => htmlspecialchars(Settings::get('script_date')),
'copyright_website_html' => htmlspecialchars(Settings::get('copyright_website')),
'website_html' => htmlspecialchars(Settings::get('website')),
));
$this->overview['html'] = $this->process_output($markup);

View File

@ -23,7 +23,7 @@ class Usage extends TemplateFormatter
'css-female-sel:', 'css-right-sel:', 'css-inline-sel:',
'css-block-sel:', 'path-pngcrush:', 'dir-pkmn:', 'dir-resources:',
'pkmn-lang:', 'lang:',
// For debugging purposes only (undocumented):
// Undocumented (debugging only):
'pkmn-range:',
);
/** @var string[] Arguments that may have a value. */
@ -37,6 +37,8 @@ class Usage extends TemplateFormatter
'exclude-pkmn', 'exclude-shiny', 'exclude-regular', 'exclude-forms',
'exclude-icon-sets', 'verbose', 'monochrome', 'help', 'no-pngcrush',
'generate-markdown',
// Undocumented (debugging only):
'html-no-slugs',
);
/** @var mixed[] Settings parsed from the command-line options. */
@ -115,6 +117,9 @@ class Usage extends TemplateFormatter
if ($arg == 'generate-markdown') {
$s['generate_markdown'] = true;
}
if ($arg == 'html-no-slugs') {
$s['html_no_slugs'] = true;
}
if ($arg == 'include-right') {
$val_int = intval($val);
if (!is_numeric($val) || $val_int < 0 || $val_int > 2) {
@ -231,8 +236,8 @@ class Usage extends TemplateFormatter
}
$usage_vars = array(
'website' => Settings::get('copyright_website'),
'version' => Settings::get('version'),
'website' => Settings::get('website'),
'revision' => Settings::get('revision'),
'error' => $error_str,
'copyright' => (
Settings::get('copyright_str').

View File

@ -1,8 +1,8 @@
#!/usr/bin/php
<?php
// PokéSprite 1.0
// --------------
// PokéSprite
// ----------
// This simple script generates an image sprite containing small icons of
// all Pokémon in the National Pokédex (along with several other types of
// icons), and the pertaining SCSS and JS files. It was built for people
@ -75,6 +75,12 @@ Settings::load_settings_file('includes/defaults.php');
$usage = new Usage();
$cl_settings = $usage->get_user_settings();
// Check the current revision number for user feedback and for
// inclusion in the output files.
$revision = trim(shell_exec('git rev-list HEAD --count 2> /dev/null'));
$revision = $revision ? $revision : '[unknown]';
$cl_settings['revision'] = $revision;
if ($usage->needs_usage) {
// Display usage and exit.
$usage->load_tpl_file(
@ -101,7 +107,9 @@ I18n::add_output_filter(array('PkSpr\TerminalFormatter', 'format'));
// Print basic program info.
print(I18n::lf('info', array(
$title_str_site,
$title_str,
$revision,
$website_txt,
$copyright_gf
)));
$generated_on = I18n::lf('generated_on', array($script_date));
@ -272,7 +280,7 @@ if ($generate_optimized === true) {
if (file_exists($dir_output.$img_output)) {
unlink($dir_output.$img_output);
}
$crush_cmd = $pngcrush_path.' -l 9 -q -text b author "Pokémon Sprite Generator v'.$version.'" -text b copyright "'.$copyright_gf.'" '.$dir_output.$img_output_tmp.' '.$dir_output.$img_output;
$crush_cmd = $pngcrush_path.' -l 9 -q -text b author "Pokémon Sprite Generator r'.$revision.'" -text b copyright "'.$copyright_gf.'" '.$dir_output.$img_output_tmp.' '.$dir_output.$img_output;
exec($crush_cmd);
if (file_exists($dir_output.$img_output)) {
@ -321,7 +329,9 @@ $icon_js->set_icon_sizes($set_sizes);
// For the generation of the HTML, SCSS and JS files, a number of
// base variables are used.
$base_vars = array(
'title_str_site' => $title_str_site,
'title_str' => $title_str,
'revision' => $revision,
'website_txt' => $website_txt,
'copyright_str' => $copyright_str,
'copyright_gf' => $copyright_gf,
'copyright_contrib_notice' => $copyright_contrib_notice,

View File

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<!--
{{$title_str_site}}
{{$title_str}} r{{$revision}} {{$website_txt}}
{{$copyright_str}}
{{$copyright_gf}}
{{$copyright_contrib_notice}}
@ -11,7 +11,7 @@
-->
<head>
<meta charset="utf-8" />
<title>{{$title_str_html}} Icon Overview</title>
<title>{{$title_str}} r{{$revision}} Icon Overview</title>
<!-- Pokémon icons -->
<link type="text/css" href="{{$css_output}}" rel="stylesheet" media="screen" />
<script charset="utf-8" src="{{$js_output}}" ></script>
@ -29,9 +29,9 @@
<body>
<div id="top">
<div class="description">
<h1>{{$title_str_html}} Icon Overview</h1>
<h1>{{$title_str}} r{{$revision}} Icon Overview</h1>
<p>The following list is a complete overview of all icons and the HTML necessary to display them. It was generated on <span class="time">{{$script_date_html}}</span>.</p>
<p>For more information about the project, visit <a href="{{$copyright_website_html}}">{{$copyright_website_html}}</a>.</p>
<p>For more information about the project, visit <a href="{{$website_html}}">{{$website_html}}</a>.</p>
</div>
{{$icons}}
<p>End of overview. <a href="#top">Back to top.</a></p>

View File

@ -1,5 +1,5 @@
/** @preserve
* {{$title_str_site}}
* {{$title_str}} r{{$revision}} {{$website_txt}}
* {{$copyright_str}}
* {{$copyright_gf}}
* {{$copyright_contrib_notice}}
@ -43,7 +43,22 @@ window["PkSpr"] = (function()
* @const
* @type {!Object}
*/
self.PKSPR_DATA = {{$coords_json}};
self.PKSPR_DATA = {{$coords_json}};
/**
* Index linking Pokédex numbers to slugs. Generated on runtime.
*
* @type {?Object}
*/
var pkmn_idx_to_slug;
/**
* Regular Expression used to check whether an identifier
* is a valid dex number.
*
* @type {?RegExp}
*/
var numeric_regexp;
/**
* Schedules the DOM to be processed completely as soon as it's ready.
@ -78,7 +93,7 @@ window["PkSpr"] = (function()
var obj, node, is_str, is_node;
for (a = 0, z = val.length; a < z; ++a) {
obj = val[a];
is_str = typeof obj == 'string' || obj instanceof String;
is_str = typeof obj == "string" || obj instanceof String;
is_node = obj.nodeName !== null;
// Fetch the object by its ID if necessary.
@ -168,9 +183,15 @@ window["PkSpr"] = (function()
return true;
}
/**
* Adds a class to the icon signifying it is to be mirrored in CSS.
*
* @param {Element} node The icon node.
* @param {string} dir Direction the icon should face.
*/
self.set_icon_direction = function(node, dir)
{
self.add_class(node, '{{$var_base_name}}-faux-right');
self.add_class(node, "{{$var_base_name}}-faux-"+dir);
}
/**
@ -353,6 +374,14 @@ window["PkSpr"] = (function()
}
}
// Check to see if this is a Pokémon icon that uses the number
// as the identifier rather than the slug.
if (node_attrs.type == "pkmn"
&& self.is_numeric_pkmn(node_attrs.slug)) {
// Replace the index number with the slug.
node_attrs.slug = pkmn_idx_to_slug[node_attrs.slug];
}
// Clean the output up a bit.
for (spr_type in self.PKSPR_TYPES) {
delete node_attrs[spr_type];
@ -361,6 +390,54 @@ window["PkSpr"] = (function()
return node_attrs;
}
/**
* Compiles a regular expression for use by PkSpr.is_numeric_pkmn().
*/
self.prepare_numeric_check = function()
{
if (numeric_regexp != undefined) {
return;
}
// 000 is always false.
numeric_regexp = new RegExp(/(?!000)^[0-9]{3}$/);
}
/**
* Generates a list of Pokédex numbers linked to their respective slugs.
*/
self.generate_idx_list = function()
{
var a, z, pkmn;
if (pkmn_idx_to_slug != undefined) {
return;
}
pkmn_idx_to_slug = {};
// In case we don't have any Pokémon icons in this compile.
if (self.PKSPR_DATA == null
|| self.PKSPR_DATA.pkmn == null) {
return;
}
pkmn = Object.keys(self.PKSPR_DATA.pkmn);
for (a = 1, z = pkmn.length; a <= z; ++a) {
// Fast zero-padding hardcoded to work for 3 digits.
pkmn_idx_to_slug[("000"+a).slice(-3)] = pkmn[a - 1];
}
}
/**
* Determines whether a Pokémon identifier is a dex number or not.
*
* @param {?string} pkmn The Pokémon identifier (slug or ID).
* @return {boolean} Whether it is or isn't a numeric identifier.
*/
self.is_numeric_pkmn = function(pkmn)
{
return numeric_regexp.test(pkmn);
}
/**
* Determines whether something is an array.
*
@ -415,8 +492,8 @@ window["PkSpr"] = (function()
}
catch(e) {}
// Can't use querySelectorAll(), so we'll do this the hard way.
// Grab all elements of those types and check for the
// Can't use document.querySelectorAll(), so we'll do this
// the hard way. Grab all elements of those types and check for the
// base identifier class.
var a, b;
var result, results, elements = [];
@ -542,8 +619,53 @@ window["PkSpr"] = (function()
}
}
/**
* Runs a couple of initialization functions.
*/
self.initialize = function()
{
// Compile our numeric check regular expression.
self.prepare_numeric_check();
// Generate a list of slugs by Pokédex number.
self.generate_idx_list();
}()
return self;
})();
/**
* Object.keys() prototype method polyfill (simplified).
*
* For compatibility purposes, we'll define a polyfill so older browsers
* won't choke on Object.keys(), which the code requires.
*
* Source: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys>
*/
if (!Object.keys) {
Object.keys = (function()
{
"use strict";
var hasOwnProperty = Object.prototype.hasOwnProperty;
return function(obj)
{
if (typeof obj !== "object" && (typeof obj !== "function" || obj === null)) {
throw new TypeError("Object.keys called on non-object");
}
var result = [], prop, i;
for (prop in obj) {
if (hasOwnProperty.call(obj, prop)) {
result.push(prop);
}
}
return result;
};
}());
}
/* All done. */
})();

View File

@ -1,6 +1,6 @@
@charset 'UTF-8';
/*!
* {{$title_str_site}}
* {{$title_str}} r{{$revision}} {{$website_txt}}
* {{$copyright_str}}
* {{$copyright_gf}}
* {{$copyright_contrib_notice}}

View File

@ -1,4 +1,4 @@
<frm=::bold>PokéSprite {{$version}}</frm>
<frm=::bold>PokéSprite {{$revision}}</frm>
{{$copyright}}
{{$error}}
Usage: