From 3bedc052976b8d78bd465183bd4a1d4c756288cf Mon Sep 17 00:00:00 2001 From: emkael Date: Thu, 3 Jul 2014 23:53:27 +0200 Subject: utf-8 encoding --- how.js | 80 ++++++++++++++++++++++++++++++++--------------------------------- how.php | 38 +++++++++++++++---------------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/how.js b/how.js index a45b743..26d2baa 100644 --- a/how.js +++ b/how.js @@ -1,4 +1,4 @@ -// rozstawienie stołów po wirtualnej sali +// rozstawienie stoĹ‚Ăłw po wirtualnej sali var Tables = function(viewport, quantity) { var that = this; @@ -8,33 +8,33 @@ var Tables = function(viewport, quantity) { that.tables = []; - that.singleDiv = jQuery('
').css({position: 'absolute'}).addClass('table'); // reprezentacja pojedynczego stołu + that.singleDiv = jQuery('
').css({position: 'absolute'}).addClass('table'); // reprezentacja pojedynczego stoĹ‚u that.direction = undefined; - that.setDirection = function(direction) { // ustawia orientację sali/ustawienie stołów - var alignment = direction.split('-'); // dzielimy kierunek na składową horyzontalną i wertykalną - var rows = 2; // stoły stoją w dwóch rzędach + that.setDirection = function(direction) { // ustawia orientacjÄ™ sali/ustawienie stoĹ‚Ăłw + var alignment = direction.split('-'); // dzielimy kierunek na skĹ‚adowÄ… horyzontalnÄ… i wertykalnÄ… + var rows = 2; // stoĹ‚y stojÄ… w dwĂłch rzÄ™dach var cols = parseInt(Math.ceil(that.quantity / 2)); // i w tylu kolumnach, ilu trzeba - if (alignment[0] == 'top' || alignment[0] == 'bottom') { // chyba, że stoją w drugą stronę - rows = cols; // to wtedy w tylu rzędach, ilu kolumnach i w w tylu kolumnach, ile 2. + if (alignment[0] == 'top' || alignment[0] == 'bottom') { // chyba, ĹĽe stojÄ… w drugÄ… stronÄ™ + rows = cols; // to wtedy w tylu rzÄ™dach, ilu kolumnach i w w tylu kolumnach, ile 2. cols = 2; } - var width = that.viewport.width / cols; // wyznaczamy rozmiar obszaru zajmowanego przez pojedynczy stół + var width = that.viewport.width / cols; // wyznaczamy rozmiar obszaru zajmowanego przez pojedynczy stół var height = that.viewport.height / rows; - that.dim = Math.min(width, height) * 0.5; // stół zajmuje dłuższym bokiem (mimo, że jest kwadratowy, jeden bok jest względnie dłuższy wobec w/w obszaru) połowę przeznaczonego obszaru + that.dim = Math.min(width, height) * 0.5; // stół zajmuje dĹ‚uĹĽszym bokiem (mimo, ĹĽe jest kwadratowy, jeden bok jest wzglÄ™dnie dĹ‚uĹĽszy wobec w/w obszaru) poĹ‚owÄ™ przeznaczonego obszaru that.singleDiv.css({height: that.dim, width: that.dim}); var positions = []; for (var i = 0; i < that.quantity; i++) { // pozycjonujemy kolejne stoliki (w przestrzeni (0,0) - (1,1)) var position = { top: 0, left: 0 }; switch (alignment[1]) { - case 'straight': // w dwóch rzędach/kolumnach + case 'straight': // w dwĂłch rzÄ™dach/kolumnach position.top = parseInt(Math.floor(2 * i / that.quantity)); position.left = i % parseInt((that.quantity+1) / 2); break; - case 'uturn': // w dwóch rzędach/kolumnach, ale zakręcają + case 'uturn': // w dwĂłch rzÄ™dach/kolumnach, ale zakrÄ™cajÄ… position.top = parseInt(Math.floor(2 * i / that.quantity)); position.left = Math.min(i, (that.quantity-1-i)); break; - case 'snake': // wężykiem + case 'snake': // wężykiem position.top = i % 4; position.top = Math.min(position.top, 3 - position.top); position.left = parseInt(Math.floor(i / 2)); @@ -42,7 +42,7 @@ var Tables = function(viewport, quantity) { } positions[i] = position; } - if (that.quantity % 2) { // nieparzysty stolik wysuwamy na środek, dla wężyka - ostatni, dla pozostałych - środkowy + if (that.quantity % 2) { // nieparzysty stolik wysuwamy na Ĺ›rodek, dla wężyka - ostatni, dla pozostaĹ‚ych - Ĺ›rodkowy var skewed = (alignment[1] == 'snake') ? (that.quantity - 1) : ((that.quantity - 1) / 2); positions[skewed].top = 0.5; } @@ -79,7 +79,7 @@ var Tables = function(viewport, quantity) { } } - that.getPosition = function(position, size) { // podaje współrzędne pikselowe dla danej pozycji zawodnika (/[0-9]+[WNES]/) lub stołu + that.getPosition = function(position, size) { // podaje współrzÄ™dne pikselowe dla danej pozycji zawodnika (/[0-9]+[WNES]/) lub stoĹ‚u var pos = position.toString().match(/^(\d+)([NEWS]?)$/); if (!pos) { throw 'Illegal position'; @@ -91,25 +91,25 @@ var Tables = function(viewport, quantity) { var offset = { left: parseInt(that.tables[tableNo-1].css('left')), top: parseInt(that.tables[tableNo-1].css('top')) }; switch (pos[2]) { - case 'N': // N u góry + case 'N': // N u gĂłry offset.left += that.dim / 2; break; case 'E': // E po prawej offset.left += that.dim; offset.top += that.dim / 2; break; - case 'S': // S u dołu + case 'S': // S u doĹ‚u offset.left += that.dim / 2; offset.top += that.dim; break; case 'W': // W po lewej offset.top += that.dim / 2; break; - default: // stół od lewej góry + default: // stół od lewej gĂłry offset.top += that.dim / 2; offset.left += that.dim / 2; } - if (size) { // jeśli podajemy rozmiar pikselowy stolika, dostajemy korektę na środek stołu + if (size) { // jeĹ›li podajemy rozmiar pikselowy stolika, dostajemy korektÄ™ na Ĺ›rodek stoĹ‚u offset.top -= size/2; offset.left -= size/2; } @@ -127,11 +127,11 @@ var Tables = function(viewport, quantity) { // para. var Pair = function(startingPosition, number, movement) { var that = this; - that.players = [ startingPosition, startingPosition.replace("N", "S").replace("E", "W") ]; // para składa się z 2 graczy, N gra z S, E gra z W + that.players = [ startingPosition, startingPosition.replace("N", "S").replace("E", "W") ]; // para skĹ‚ada siÄ™ z 2 graczy, N gra z S, E gra z W that.number = number; that.movement = movement; that.containers = []; - that.size = that.movement.tables.dim * 0.3; // para ma rozmiar 30% obszaru stolika. sprawdzić, czy nie gra Klichowicz. + that.size = that.movement.tables.dim * 0.3; // para ma rozmiar 30% obszaru stolika. sprawdzić, czy nie gra Klichowicz. that.colour = '#'+('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6); // para ma jeden kolor, ale losowy for (var i = 0; i < 2; i++) { that.containers[i] = jQuery('
').addClass('player').css({backgroundColor: that.colour, position: 'absolute', lineHeight: that.size+'px', width: that.size, height: that.size, borderRadius: that.size}).text(that.number); @@ -139,13 +139,13 @@ var Pair = function(startingPosition, number, movement) { that.moveTo = function(position) { for (var i = 0; i < 2; i++) { - if (position) { // przesuwamy parę na określoną pozycję + if (position) { // przesuwamy parÄ™ na okreĹ›lonÄ… pozycjÄ™ that.players[i] = position; var pos = that.movement.tables.getPosition(position, that.size); that.containers[i].animate(pos, 1000); position = position.replace('N', 'S').replace('E', 'W'); } - else { // albo kończymy turniej i ściągamy ją do rogu + else { // albo koĹ„czymy turniej i Ĺ›ciÄ…gamy jÄ… do rogu that.containers[i].animate({left: 0, top: 0}, 1000); } } @@ -154,12 +154,12 @@ var Pair = function(startingPosition, number, movement) { that.display = function() { for (var i = 0; i < 2; i++) { movement.viewport.container.append(that.containers[i]); - that.containers[i].animate(that.movement.tables.getPosition(that.players[i], that.size), 1000); // wypuszczamy zawodników na salę + that.containers[i].animate(that.movement.tables.getPosition(that.players[i], that.size), 1000); // wypuszczamy zawodnikĂłw na salÄ™ } } } -// pudełko rozdaniowe +// pudeĹ‚ko rozdaniowe var Set = function(startingPosition, movement, number) { var that = this; that.movement = movement; @@ -169,20 +169,20 @@ var Set = function(startingPosition, movement, number) { that.size = that.movement.tables.dim * 0.2; that.container = jQuery('
').addClass('cards').css({position: 'absolute', width: that.size, height: that.size*1.5, backgroundColor: that.colour, top: that.movement.viewport.height-that.size}).text(that.number); - that.getPosition = function(position) { // translacja pozycji na pozycję w pikselach + that.getPosition = function(position) { // translacja pozycji na pozycjÄ™ w pikselach var pos; - if (parseInt(position) == pos && position > 0) { // jeśli rozdanie leży na stole, to leży na stole + if (parseInt(position) == pos && position > 0) { // jeĹ›li rozdanie leĹĽy na stole, to leĹĽy na stole pos = that.movement.tables.getPosition(position, that.size); } - else { // jesli nie lezy na stole, leży na zbiornicy + else { // jesli nie lezy na stole, leĹĽy na zbiornicy var after = parseInt(position); pos = that.movement.tables.getPosition(after, that.size); var afterPos = that.movement.tables.getPosition(after%that.movement.tables.quantity+1, that.size); - if (after == that.movement.tables.quantity) { // zbiornica na końcu sali + if (after == that.movement.tables.quantity) { // zbiornica na koĹ„cu sali pos.top = Math.min(Math.max(0, pos.top + (pos.top - afterPos.top) * (position - after)), that.movement.viewport.height - that.size); pos.left = Math.min(Math.max(0, pos.left + (pos.left - afterPos.left) * (position - after)), that.movement.viewport.width - that.size); } - else { // zbiornica między stołami + else { // zbiornica miÄ™dzy stoĹ‚ami pos.top = Math.min(Math.max(0, pos.top + (afterPos.top - pos.top) * (position - after)), that.movement.viewport.height - that.size); pos.left = Math.min(Math.max(0, pos.left + (afterPos.left - pos.left) * (position - after)), that.movement.viewport.width - that.size); } @@ -197,13 +197,13 @@ var Set = function(startingPosition, movement, number) { that.container.animate(that.getPosition(position), 1000); } else { - that.container.animate({left: 0, top: that.movement.viewport.height - that.size}, 1000); // na koniec turnieju ściągamy rozdania + that.container.animate({left: 0, top: that.movement.viewport.height - that.size}, 1000); // na koniec turnieju Ĺ›ciÄ…gamy rozdania } } that.display = function() { that.movement.viewport.container.append(that.container); - that.moveTo(that.position); // rozdania puszczane na salę + that.moveTo(that.position); // rozdania puszczane na salÄ™ } } @@ -233,7 +233,7 @@ var Movement = function(viewport, movement, tables, summary) { else { // komplet zaczyna na zbiornicy emptySets++; for (var j = i - emptySets + 1; j <= i; j++) { - that.data.sets[j] = lastTable + 0.25 + 0.5*(j - i + emptySets)/(emptySets+1); // więc jest na wirtualnym stoliku ułamkowym + that.data.sets[j] = lastTable + 0.25 + 0.5*(j - i + emptySets)/(emptySets+1); // wiÄ™c jest na wirtualnym stoliku uĹ‚amkowym } } } @@ -242,19 +242,19 @@ var Movement = function(viewport, movement, tables, summary) { that.sets[i].display(); } - // krok głównej pętli rotacji + // krok gĹ‚Ăłwnej pÄ™tli rotacji that.step = function() { if (summary) { - summary.update(that); // aktualizacja tabelki krzyżowej + summary.update(that); // aktualizacja tabelki krzyĹĽowej } if (that.round < that.data.rounds) { // przechodzimy do kolejnej rundy... for (var p in that.pairs) { var position = that.pairs[p].players[0]; var ind = that.data.movement.indexOf(position); - if (ind > -1) { // pary chodzące (obecne w rotacji z movements.json) chodzą + if (ind > -1) { // pary chodzÄ…ce (obecne w rotacji z movements.json) chodzÄ… that.pairs[p].moveTo(that.data.movement[(ind+1)%that.data.movement.length]); } - else { // pozostałe siedzą, ale musimy je najpierw usadzić + else { // pozostaĹ‚e siedzÄ…, ale musimy je najpierw usadzić that.pairs[p].moveTo(position); } } @@ -265,7 +265,7 @@ var Movement = function(viewport, movement, tables, summary) { that.round++; return true; } - else { // ...albo zwijamy się z sali + else { // ...albo zwijamy siÄ™ z sali for (var p in that.pairs) { that.pairs[p].moveTo(); } @@ -277,14 +277,14 @@ var Movement = function(viewport, movement, tables, summary) { } } -// tabelka krzyżówki +// tabelka krzyĹĽĂłwki var Summary = function(pairs) { var that = this; that.pairs = pairs; that.table = jQuery('').addClass('summary'); - // generujemy tabelką z pustymi komórkami, ew. nagłówkami + // generujemy tabelkÄ… z pustymi komĂłrkami, ew. nagĹ‚Ăłwkami for (var i = 0; i <= that.pairs; i++) { var row = jQuery(''); for (var j = 0; j <= that.pairs; j++) { @@ -314,7 +314,7 @@ var Summary = function(pairs) { played[t] = { set: movement.data.sets.indexOf(t), pairs: [] }; } - // oznaczanie rozdań (kompletów) rozegranych przez pary + // oznaczanie rozdaĹ„ (kompletĂłw) rozegranych przez pary for (var p in movement.pairs) { played[parseInt(movement.pairs[p].players[0])].pairs.push(parseInt(p)); } diff --git a/how.php b/how.php index cd4a5a0..b5cf158 100644 --- a/how.php +++ b/how.php @@ -1,17 +1,17 @@ = 1; $j--) { // tyle par ruchomych, ile rund - $pos = array_search($j, $positions); // odnajdujemy pary ruchome w kolejności X, X-1, ..., 2, 1 - $movement[] = ceil(($pos+1)/2).$lines[$pos%2]; // i ich pozycję w tablicy $positions tłumaczymy na pozycję na sali (xN/E), tworząc wstęgę rotacji + $pos = array_search($j, $positions); // odnajdujemy pary ruchome w kolejnoĹ›ci X, X-1, ..., 2, 1 + $movement[] = ceil(($pos+1)/2).$lines[$pos%2]; // i ich pozycjÄ™ w tablicy $positions tĹ‚umaczymy na pozycjÄ™ na sali (xN/E), tworzÄ…c wstÄ™gÄ™ rotacji } - // pozostałe pary - z automatu stacjonarne - // kompilujemy strukturę + // pozostaĹ‚e pary - z automatu stacjonarne + // kompilujemy strukturÄ™ $movements[$id] = [ 'tables' => $tables, 'rounds' => $rounds, @@ -53,7 +53,7 @@ for ($i = 0; $i < count($file); $i++) { 'positions' => $positions ]; } - // segmenty nieparzyste to dane ogólne - liczba rund i stołów + // segmenty nieparzyste to dane ogĂłlne - liczba rund i stoĹ‚Ăłw else { $matches = []; preg_match('/.*(-\d+).*RUNDY.*?(\d+).*STOLIKI.*/s', $file[$i], $matches); -- cgit v1.2.3