Compare commits
53 Commits
2a242ff7ed
...
issue-40
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
246f410953 | ||
| ba3f2e954a | |||
|
|
fbffeec3a3 | ||
| 817b573258 | |||
|
|
d08bdc0893 | ||
| b052fa50db | |||
|
|
efad44ea57 | ||
| 23f3d647e0 | |||
|
|
954cadd874 | ||
| 2b33c35049 | |||
|
|
fcfc0bd58a | ||
| 31e65c4730 | |||
|
|
6fb933a86c | ||
| e76edbb531 | |||
|
|
081aa0f7a4 | ||
| 0afea8ead6 | |||
|
|
41b7d5778d | ||
|
|
cee945f561 | ||
| f806edb7b3 | |||
|
|
76ae18e82a | ||
|
|
23220819d5 | ||
| a839befc41 | |||
|
|
7a5e7a5d9d | ||
| 611628c753 | |||
|
|
4fdd43dc4e | ||
| 5512990704 | |||
|
|
9187702634 | ||
|
|
4b2dedc8f2 | ||
| a3e8c19795 | |||
|
|
178853874f | ||
|
|
0b3d25d013 | ||
| 42c61feff8 | |||
|
|
b4aa26ee17 | ||
| bfe04f94ca | |||
|
|
5d75992372 | ||
| dcbb7e21f3 | |||
|
|
db3f7772a6 | ||
| 625193e99e | |||
| 0df6753bd2 | |||
|
|
e5f44b92e4 | ||
|
|
283c5b905e | ||
| de000d0403 | |||
|
|
2f55d8491a | ||
| 6f29248e8b | |||
|
|
817479415f | ||
| b0ba390cb5 | |||
|
|
9f3c5a1487 | ||
| b66e08bc5b | |||
|
|
f82fbd0e5a | ||
| 556e7adfab | |||
|
|
ec776f837e | ||
| fbac17281a | |||
|
|
501a64e0c7 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@
|
|||||||
Homestead.json
|
Homestead.json
|
||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
.env
|
.env
|
||||||
|
database/printer.db
|
||||||
|
|||||||
23
app/Decorators/HideLinesDecorator.php
Normal file
23
app/Decorators/HideLinesDecorator.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 20:47
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
class HideLinesDecorator extends TextConverterDecorator
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* usuwa linijki z tekstu które zaczynają zię od znaku #
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
return preg_replace('/^\s*[!#].*?$[\r\n]?/m', '', $this->text->getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 19:03
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators\Interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
interface TextConverterDecoratorInterface
|
||||||
|
{
|
||||||
|
public function getText(): string;
|
||||||
|
|
||||||
|
}
|
||||||
20
app/Decorators/NewLineDecorator.php
Normal file
20
app/Decorators/NewLineDecorator.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 20:23
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
class NewLineDecorator extends TextConverterDecorator
|
||||||
|
{
|
||||||
|
private $replaceElements = ['<br>', '<br />', '<br/>'];
|
||||||
|
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
return str_replace($this->replaceElements, "\n", $this->text->getText());
|
||||||
|
}
|
||||||
|
}
|
||||||
35
app/Decorators/RandomElementsDecorator.php
Normal file
35
app/Decorators/RandomElementsDecorator.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 20:52
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
class RandomElementsDecorator extends TextConverterDecorator
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* poniższy kod wybieraz tekstu fragmenty w podwójnych nawiasach kwadratowych, rozdziela je po przecinkach
|
||||||
|
* następnie losuje element i podmienia go w miejsce oryginalnego fragmentu
|
||||||
|
*/
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
$re = "#\[\[(.*?)\]\]#s";
|
||||||
|
$newText = $this->text->getText();
|
||||||
|
preg_match_all($re, $newText, $found, PREG_SET_ORDER, 0);
|
||||||
|
foreach ($found as $elements) {
|
||||||
|
$data = explode(',', $elements[1]);
|
||||||
|
$data = array_filter($data, function ($el) {
|
||||||
|
return strlen(trim($el));
|
||||||
|
});
|
||||||
|
$data = array_values($data);
|
||||||
|
$pos = strpos($newText, $elements[0]);
|
||||||
|
$newText = substr_replace($newText, $data[mt_rand(0, count($data) - 1)], $pos, strlen($elements[0]));
|
||||||
|
}
|
||||||
|
return $newText;
|
||||||
|
}
|
||||||
|
}
|
||||||
33
app/Decorators/RandomNumberDecorator.php
Normal file
33
app/Decorators/RandomNumberDecorator.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 21:28
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
class RandomNumberDecorator extends TextConverterDecorator
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* przeszukiwanie tekstu pod katem zawartości [ liczba, liczba2 ] i zamienianiu tego na randomową liczbę z przedziału
|
||||||
|
* liczba - liczba2
|
||||||
|
* obojętnie czy ujemną czy nie
|
||||||
|
*/
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
$text = $this->text->getText();
|
||||||
|
$re = '/\[\s*(-?\d+)\s*\,\s*(-?\d+)\s*\]/';
|
||||||
|
preg_match_all($re, $text, $matches, PREG_SET_ORDER, 0);
|
||||||
|
|
||||||
|
foreach ($matches as $match) {
|
||||||
|
$pos = strpos($text, $match[0]);
|
||||||
|
$text = substr_replace($text, mt_rand($match[1], $match[2]), $pos, strlen($match[0]));
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
28
app/Decorators/Text.php
Normal file
28
app/Decorators/Text.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 20:35
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Decorators\Interfaces\TextConverterDecoratorInterface;
|
||||||
|
|
||||||
|
class Text implements TextConverterDecoratorInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
private $text;
|
||||||
|
|
||||||
|
public function __construct(string $text)
|
||||||
|
{
|
||||||
|
$this->text = $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
return $this->text;
|
||||||
|
}
|
||||||
|
}
|
||||||
25
app/Decorators/TextBreakDecorator.php
Normal file
25
app/Decorators/TextBreakDecorator.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 21:32
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
class TextBreakDecorator extends TextConverterDecorator
|
||||||
|
{
|
||||||
|
|
||||||
|
private $lineLength = 32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* łamie tekst w miejscu spacji do długości 32 znaki na linię
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
return wordwrap($this->text->getText(), $this->lineLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
app/Decorators/TextConverterDecorator.php
Normal file
21
app/Decorators/TextConverterDecorator.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 19:06
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
use App\Decorators\Interfaces\TextConverterDecoratorInterface;
|
||||||
|
|
||||||
|
abstract class TextConverterDecorator implements TextConverterDecoratorInterface
|
||||||
|
{
|
||||||
|
protected $text;
|
||||||
|
|
||||||
|
public function __construct(TextConverterDecoratorInterface $text)
|
||||||
|
{
|
||||||
|
$this->text = $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
app/Decorators/TraficarDecorator.php
Normal file
27
app/Decorators/TraficarDecorator.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 22:20
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Paper\Traficar;
|
||||||
|
|
||||||
|
class TraficarDecorator extends TextConverterDecorator
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
$text = $this->text->getText();
|
||||||
|
if (strstr($text, '[traficar]')) {
|
||||||
|
$traficar = new Traficar();
|
||||||
|
$nearest = $traficar->nearestCarText();
|
||||||
|
$text = str_replace('[traficar]', $nearest, $text);
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
app/Decorators/VocabularyWordDecorator.php
Normal file
35
app/Decorators/VocabularyWordDecorator.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 28.02.2019
|
||||||
|
* Time: 22:20
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Decorators;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Paper\Vocabulary;
|
||||||
|
|
||||||
|
class VocabularyWordDecorator extends TextConverterDecorator
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getText(): string
|
||||||
|
{
|
||||||
|
$text = $this->text->getText();
|
||||||
|
if (strstr($text, '[vocabulary_word]')
|
||||||
|
|| strpos($text, '[vocabulary_short]')
|
||||||
|
|| strpos($text, '[vocabulary_long]')) {
|
||||||
|
$voc = new Vocabulary();
|
||||||
|
$randomWord = $voc->getRandomWord();
|
||||||
|
$word = $voc->getWord($randomWord);
|
||||||
|
|
||||||
|
$text = str_replace('[vocabulary_word]', $word->word, $text);
|
||||||
|
$text = str_replace('[vocabulary_short]', $word->short, $text);
|
||||||
|
$text = str_replace('[vocabulary_long]', $word->long, $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
93
app/Http/Controllers/AirlyController.php
Normal file
93
app/Http/Controllers/AirlyController.php
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 10.02.2017
|
||||||
|
* Time: 20:10
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
set_time_limit(-1);
|
||||||
|
|
||||||
|
use App\Paper\Airly;
|
||||||
|
use App\Paper\Paper;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class AirlyController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
private $paper = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->paper = new Paper();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get:/airly_all
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function airly_all()
|
||||||
|
{
|
||||||
|
$airly = new Airly();
|
||||||
|
$this->paper->sendImagePrint($airly->icon);
|
||||||
|
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||||
|
$airly->setStations(config('paper.airly.stations'));
|
||||||
|
|
||||||
|
foreach ($airly->getStations() as $stationId) {
|
||||||
|
$stationInfo = $airly->getStationInfo($stationId);
|
||||||
|
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||||
|
$dataText = $airly->getInformationText($stationId);
|
||||||
|
$this->paper->sendPrint('', $dataText);
|
||||||
|
}
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function airly_rzeczypospolitej()
|
||||||
|
{
|
||||||
|
$airly = new Airly();
|
||||||
|
$this->paper->sendImagePrint($airly->icon);
|
||||||
|
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||||
|
$airly->setStations([config('paper.airly.rzeczypospolitej')]);
|
||||||
|
|
||||||
|
foreach ($airly->getStations() as $stationId) {
|
||||||
|
$stationInfo = $airly->getStationInfo($stationId);
|
||||||
|
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||||
|
$dataText = $airly->getInformationText($stationId);
|
||||||
|
$this->paper->sendPrint('', $dataText);
|
||||||
|
}
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function airly_grunwaldzka()
|
||||||
|
{
|
||||||
|
$airly = new Airly();
|
||||||
|
$this->paper->sendImagePrint($airly->icon);
|
||||||
|
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||||
|
$airly->setStations([config('paper.airly.grunwaldzka')]);
|
||||||
|
|
||||||
|
foreach ($airly->getStations() as $stationId) {
|
||||||
|
$stationInfo = $airly->getStationInfo($stationId);
|
||||||
|
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||||
|
$dataText = $airly->getInformationText($stationId);
|
||||||
|
$this->paper->sendPrint('', $dataText);
|
||||||
|
}
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function airly_sowinskiego()
|
||||||
|
{
|
||||||
|
$airly = new Airly();
|
||||||
|
$this->paper->sendImagePrint($airly->icon);
|
||||||
|
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||||
|
$airly->setStations([config('paper.airly.sowinskiego')]);
|
||||||
|
|
||||||
|
foreach ($airly->getStations() as $stationId) {
|
||||||
|
$stationInfo = $airly->getStationInfo($stationId);
|
||||||
|
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||||
|
$dataText = $airly->getInformationText($stationId);
|
||||||
|
$this->paper->sendPrint('', $dataText);
|
||||||
|
}
|
||||||
|
return back();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,25 +2,125 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Paper\CinemaMultikino;
|
|
||||||
use DiDom\Query;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use DiDom\Document;
|
|
||||||
use App\Paper\Paper;
|
use App\Paper\Paper;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class Keyboard extends Controller
|
class Keyboard extends Controller
|
||||||
{
|
{
|
||||||
|
public function press(Request $request, $key)
|
||||||
private $paper;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
{
|
||||||
$this->paper = new Paper();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function press($key)
|
$keyboardData = DB::table('keyboard')->where('key', $key)->first();
|
||||||
{
|
|
||||||
$this->paper->sendPrint($key);
|
if (isset($keyboardData) && isset($keyboardData->action)) {
|
||||||
|
|
||||||
|
|
||||||
|
$keyboardAction = explode('_', $keyboardData->action);
|
||||||
|
|
||||||
|
switch ($keyboardAction[0]) {
|
||||||
|
case 'settings':
|
||||||
|
$settings = new Settings();
|
||||||
|
$settings->printMappedKeys();
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'airly':
|
||||||
|
$airly = new AirlyController();
|
||||||
|
switch ($keyboardAction[1]) {
|
||||||
|
case 'all':
|
||||||
|
$airly->airly_all();
|
||||||
|
break;
|
||||||
|
case 'rzeczypospolitej':
|
||||||
|
$airly->airly_rzeczypospolitej();
|
||||||
|
break;
|
||||||
|
case 'grunwaldzka':
|
||||||
|
$airly->airly_grunwaldzka();
|
||||||
|
break;
|
||||||
|
case 'sowinskiego':
|
||||||
|
$airly->airly_sowinskiego();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'note':
|
||||||
|
switch ($keyboardAction[1]) {
|
||||||
|
case 'last':
|
||||||
|
$main = new Main();
|
||||||
|
$main->noteLast();
|
||||||
|
break;
|
||||||
|
case $keyboardAction[1] > 0:
|
||||||
|
$main = new Main();
|
||||||
|
$main->printNote((int)$keyboardAction[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'repertoire':
|
||||||
|
switch ($keyboardAction[1]) {
|
||||||
|
case 'all':
|
||||||
|
switch ($keyboardAction[2]) {
|
||||||
|
case 'today':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->today_repertoire($request);
|
||||||
|
break;
|
||||||
|
case 'tomorrow':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->tomorrow_repertoire($request);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'helios':
|
||||||
|
switch ($keyboardAction[2]) {
|
||||||
|
case 'today':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->today_helios($request);
|
||||||
|
break;
|
||||||
|
case 'tomorrow':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->tomorrow_helios($request);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'multikino':
|
||||||
|
switch ($keyboardAction[2]) {
|
||||||
|
case 'today':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->today_multikino($request);
|
||||||
|
break;
|
||||||
|
case 'tomorrow':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->tomorrow_multikino($request);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'cinemacity':
|
||||||
|
switch ($keyboardAction[2]) {
|
||||||
|
case 'today':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->today_cinemacity($request);
|
||||||
|
break;
|
||||||
|
case 'tomorrow':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->tomorrow_cinemacity($request);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'gdynskiecentrumfilmowe':
|
||||||
|
switch ($keyboardAction[2]) {
|
||||||
|
case 'today':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->today_gdynskiecentrumfilmowe($request);
|
||||||
|
break;
|
||||||
|
case 'tomorrow':
|
||||||
|
$repertoire = new Repertoire();
|
||||||
|
$repertoire->tomorrow_gdynskiecentrumfilmowe($request);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,8 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
set_time_limit(-1);
|
set_time_limit(-1);
|
||||||
|
|
||||||
use App\Paper\Airly;
|
|
||||||
use App\Paper\Paper;
|
use App\Paper\Paper;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
|
|
||||||
use Mike42\Escpos\Printer;
|
|
||||||
use Intervention\Image\ImageManagerStatic as Image;
|
use Intervention\Image\ImageManagerStatic as Image;
|
||||||
use Mike42\Escpos\EscposImage;
|
use Mike42\Escpos\EscposImage;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -34,6 +31,7 @@ class Main extends Controller
|
|||||||
* post::/printImage
|
* post::/printImage
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function imagePrint(Request $request)
|
public function imagePrint(Request $request)
|
||||||
{
|
{
|
||||||
@@ -51,7 +49,7 @@ class Main extends Controller
|
|||||||
|
|
||||||
|
|
||||||
$image = $image->greyscale()
|
$image = $image->greyscale()
|
||||||
->resize(300, null, function ($constraint) {
|
->resize(370, null, function ($constraint) {
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
$constraint->upsize();
|
$constraint->upsize();
|
||||||
});
|
});
|
||||||
@@ -108,13 +106,10 @@ class Main extends Controller
|
|||||||
// Header("Content-type: image/png");
|
// Header("Content-type: image/png");
|
||||||
imagepng($output, $fileName, 9); //to print to screen
|
imagepng($output, $fileName, 9); //to print to screen
|
||||||
|
|
||||||
|
|
||||||
$connector = new FilePrintConnector("/dev/usb/lp0");
|
|
||||||
$printer = new Printer($connector);
|
|
||||||
$img = EscposImage::load($fileName, false);
|
$img = EscposImage::load($fileName, false);
|
||||||
$printer->bitImage($img);
|
$this->paper->getPrinter()->bitImage($img);
|
||||||
|
|
||||||
$printer->feed(4);
|
$this->paper->getPrinter()->feed(4);
|
||||||
|
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
@@ -139,25 +134,30 @@ class Main extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get:/airly
|
* get:/filte/{$filter?}
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @param null $filter
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function airly(Request $request)
|
public function filterView(Request $request, $filter = 'empty')
|
||||||
{
|
{
|
||||||
$airly = new Airly();
|
$notes = DB::select('SELECT *, CASE WHEN icon IS NULL
|
||||||
$this->paper->sendImagePrint($airly->icon);
|
THEN \'empty\'
|
||||||
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
ELSE icon
|
||||||
$airly->setStations(config('paper.airly.stations'));
|
END AS new_icon FROM note WHERE type = "note" AND new_icon = :icon ORDER BY updated_at DESC', ['icon' => $filter]);
|
||||||
|
$templates = DB::select('SELECT *, CASE WHEN icon IS NULL
|
||||||
foreach ($airly->getStations() as $stationId) {
|
THEN \'empty\'
|
||||||
$stationInfo = $airly->getStationInfo($stationId);
|
ELSE icon
|
||||||
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
END AS new_icon FROM note WHERE type = "template" AND new_icon = :icon ORDER BY updated_at DESC', ['icon' => $filter]);
|
||||||
$dataText = $airly->getInformationText($stationId);
|
return view('list', [
|
||||||
$this->paper->sendPrint('', $dataText);
|
'filter' => $filter,
|
||||||
}
|
'notes' => $notes,
|
||||||
return back();
|
'templates' => $templates,
|
||||||
|
'title' => $request->old('title'),
|
||||||
|
'text' => $request->old('text'),
|
||||||
|
'icon_selected' => $request->old('icon'),
|
||||||
|
'icons' => $this->paper->getIcons()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,15 +168,26 @@ class Main extends Controller
|
|||||||
*/
|
*/
|
||||||
public function printText(Request $request, $id)
|
public function printText(Request $request, $id)
|
||||||
{
|
{
|
||||||
$note = DB::table('note')->where('id', $id)->first();
|
$note = $this->printNote($id);
|
||||||
$this->paper->sendPrint($note->topic, $note->text, $note->icon);
|
|
||||||
$request->session()->flash('print_status', 'Wydrukowano notatkę: ' . $note->topic . '!');
|
$request->session()->flash('print_status', 'Wydrukowano notatkę: ' . $note->topic . '!');
|
||||||
return back();
|
return back();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function printNote($noteId)
|
||||||
|
{
|
||||||
|
$note = DB::table('note')->where('id', $noteId)->first();
|
||||||
|
$this->paper->sendPrint($note->topic, $note->text, $note->icon);
|
||||||
|
return $note;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function noteLast()
|
||||||
|
{
|
||||||
|
$note = DB::table('note')->orderBy('id', 'desc')->first();
|
||||||
|
$this->printNote($note->id);
|
||||||
|
}
|
||||||
|
|
||||||
private function templateReplace($input)
|
private function templateReplace($input)
|
||||||
{
|
{
|
||||||
|
|
||||||
return str_replace(['[d]', '[m]', '[y]', '[h]', '[i]', '[s]'],
|
return str_replace(['[d]', '[m]', '[y]', '[h]', '[i]', '[s]'],
|
||||||
[date('d'), date('m'), date('Y'), date('H'), date('i'), date('s')],
|
[date('d'), date('m'), date('Y'), date('H'), date('i'), date('s')],
|
||||||
$input);
|
$input);
|
||||||
@@ -191,7 +202,7 @@ class Main extends Controller
|
|||||||
* @param $slug
|
* @param $slug
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function edit(Request $request, $id, $slug)
|
public function edit(Request $request, $id, $slug = null)
|
||||||
{
|
{
|
||||||
$note = DB::table('note')->where('id', $id)->first();
|
$note = DB::table('note')->where('id', $id)->first();
|
||||||
if ($request->isMethod('post')) {
|
if ($request->isMethod('post')) {
|
||||||
@@ -205,11 +216,13 @@ class Main extends Controller
|
|||||||
'text' => $this->templateReplace($request->input('text')),
|
'text' => $this->templateReplace($request->input('text')),
|
||||||
'icon' => $request->input('icon'),
|
'icon' => $request->input('icon'),
|
||||||
'type' => self::NOTE,
|
'type' => self::NOTE,
|
||||||
|
'private' => $request->input('private', 0),
|
||||||
'created_at' => time(),
|
'created_at' => time(),
|
||||||
'updated_at' => time()
|
'updated_at' => time()
|
||||||
]);
|
]);
|
||||||
$note = DB::table('note')->where('id', $id)->first();
|
$note = DB::table('note')->where('id', $id)->first();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
DB::table('note')
|
DB::table('note')
|
||||||
->where('id', $note->id)
|
->where('id', $note->id)
|
||||||
->update([
|
->update([
|
||||||
@@ -217,6 +230,7 @@ class Main extends Controller
|
|||||||
'topic_slug' => str_slug($request->input('title'), '_'),
|
'topic_slug' => str_slug($request->input('title'), '_'),
|
||||||
'text' => $request->input('text'),
|
'text' => $request->input('text'),
|
||||||
'icon' => $request->input('icon'),
|
'icon' => $request->input('icon'),
|
||||||
|
'private' => $request->input('private', 0),
|
||||||
'updated_at' => time(),
|
'updated_at' => time(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -227,6 +241,7 @@ class Main extends Controller
|
|||||||
return redirect()->route('list');
|
return redirect()->route('list');
|
||||||
} elseif ($request->exists('print')) {
|
} elseif ($request->exists('print')) {
|
||||||
$this->paper->sendPrint($request->input('title'), $request->input('text'), $request->input('icon'));
|
$this->paper->sendPrint($request->input('title'), $request->input('text'), $request->input('icon'));
|
||||||
|
$request->session()->flash('print_status', 'Wydrukowano notatkę: ' . (strlen($request->input('title')) ? $request->input('title') : substr($request->input('text'), 0, 20)) . '!');
|
||||||
}
|
}
|
||||||
return redirect()->route('edit', ['id' => $note->id, 'slug' => $note->topic_slug]);
|
return redirect()->route('edit', ['id' => $note->id, 'slug' => $note->topic_slug]);
|
||||||
} else {
|
} else {
|
||||||
@@ -235,6 +250,7 @@ class Main extends Controller
|
|||||||
'text' => $note->text,
|
'text' => $note->text,
|
||||||
'icon_selected' => $note->icon,
|
'icon_selected' => $note->icon,
|
||||||
'type' => $note->type,
|
'type' => $note->type,
|
||||||
|
'private' => $note->private,
|
||||||
'id' => $note->id,
|
'id' => $note->id,
|
||||||
'icons' => $this->paper->getIcons(),
|
'icons' => $this->paper->getIcons(),
|
||||||
'topic_slug' => $note->topic_slug,
|
'topic_slug' => $note->topic_slug,
|
||||||
@@ -258,6 +274,7 @@ class Main extends Controller
|
|||||||
'text' => $request->input('text'),
|
'text' => $request->input('text'),
|
||||||
'icon' => $request->input('icon'),
|
'icon' => $request->input('icon'),
|
||||||
'type' => self::NOTE,
|
'type' => self::NOTE,
|
||||||
|
'private' => $request->input('private', 0),
|
||||||
'created_at' => time(),
|
'created_at' => time(),
|
||||||
'updated_at' => time()
|
'updated_at' => time()
|
||||||
]);
|
]);
|
||||||
@@ -271,6 +288,7 @@ class Main extends Controller
|
|||||||
'text' => $request->input('text'),
|
'text' => $request->input('text'),
|
||||||
'icon' => $request->input('icon'),
|
'icon' => $request->input('icon'),
|
||||||
'type' => self::TEMPLATE,
|
'type' => self::TEMPLATE,
|
||||||
|
'private' => $request->input('private', 0),
|
||||||
'created_at' => time(),
|
'created_at' => time(),
|
||||||
'updated_at' => time()
|
'updated_at' => time()
|
||||||
]);
|
]);
|
||||||
|
|||||||
27
app/Http/Controllers/Plivo.php
Normal file
27
app/Http/Controllers/Plivo.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Paper\Paper;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Plivo extends Controller
|
||||||
|
{
|
||||||
|
/** @var Paper */
|
||||||
|
private $paper;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->paper = new Paper();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function recieveSms(Request $request)
|
||||||
|
{
|
||||||
|
if ($request->isMethod('post')) {
|
||||||
|
$this->paper->sendPrint('SMS od '. $request->input('From'), $request->input('Text')."\n\n".date('d-m-Y H:i'), 'envelope-o');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
119
app/Http/Controllers/Settings.php
Normal file
119
app/Http/Controllers/Settings.php
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 10.02.2017
|
||||||
|
* Time: 20:10
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
set_time_limit(-1);
|
||||||
|
|
||||||
|
use App\Paper\Paper;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Settings extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
private $paper = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->paper = new Paper();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get:/
|
||||||
|
* @param Request $request
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function mainView(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$keyboard = DB::select('SELECT * FROM keyboard');
|
||||||
|
return view('settings', [
|
||||||
|
'keyboard' => $keyboard,
|
||||||
|
'actions' => $this->getActions()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMappedKeys()
|
||||||
|
{
|
||||||
|
$keys = DB::table('keyboard')->get();
|
||||||
|
$text = '';
|
||||||
|
$actions = $this->getActions('');
|
||||||
|
foreach ($keys as $key) {
|
||||||
|
$text .= '[' . $key->key . '] ' . $actions[$key->action] . "\n";
|
||||||
|
}
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function printMappedKeys()
|
||||||
|
{
|
||||||
|
$this->paper->sendPrint('Zmapowane klawisze', $this->getMappedKeys());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save(Request $request)
|
||||||
|
{
|
||||||
|
foreach ($request->input('key') as $keyid => $keyValue) {
|
||||||
|
DB::table('keyboard')
|
||||||
|
->where('id', $keyid)
|
||||||
|
->update([
|
||||||
|
'action' => $keyValue,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return redirect()->route('settingsList');
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getActions($noActionText = 'Bez akcji')
|
||||||
|
{
|
||||||
|
$actions = [];
|
||||||
|
$actions[''] = $noActionText;
|
||||||
|
|
||||||
|
$actions['separator0'] = 'separator';
|
||||||
|
|
||||||
|
$actions['settings_list'] = 'Lista zmapowanych klawiszy';
|
||||||
|
|
||||||
|
$actions['separator1'] = 'separator';
|
||||||
|
|
||||||
|
$actions['repertoire_all_today'] = 'Repertuar wszystkie kina dzisiaj';
|
||||||
|
$actions['repertoire_all_tomorrow'] = 'Repertuar wszystkie kina jutro';
|
||||||
|
|
||||||
|
$actions['repertoire_helios_today'] = 'Repertuar Helios dzisiaj';
|
||||||
|
$actions['repertoire_helios_tomorrow'] = 'Repertuar Helios jutro';
|
||||||
|
|
||||||
|
$actions['repertoire_multikino_today'] = 'Repertuar Multikino dzisiaj';
|
||||||
|
$actions['repertoire_multikino_tomorrow'] = 'Repertuar Multikino jutro';
|
||||||
|
|
||||||
|
$actions['repertoire_cinemacity_today'] = 'Repertuar Cinema-City dzisiaj';
|
||||||
|
$actions['repertoire_cinemacity_tomorrow'] = 'Repertuar Cinema-City jutro';
|
||||||
|
|
||||||
|
$actions['repertoire_gdynskiecentrumfilmowe_today'] = 'Repertuar Gdyńskie Centrum filmowe dzisiaj';
|
||||||
|
$actions['repertoire_gdynskiecentrumfilmowe_tomorrow'] = 'Repertuar Gdyńskie Centrum filmowe jutro';
|
||||||
|
|
||||||
|
$actions['separator2'] = 'separator';
|
||||||
|
$actions['airly_all'] = 'Airly wszystkie stacje';
|
||||||
|
$actions['airly_rzeczypospolitej'] = 'Airly (Rzeczypospolitej)';
|
||||||
|
$actions['airly_grunwaldzka'] = 'Airly (Grunwaldzka)';
|
||||||
|
$actions['airly_sowinskiego'] = 'Airly (Sowińskiego)';
|
||||||
|
|
||||||
|
// $actions['separator3'] = 'separator';
|
||||||
|
// $actions['spacex_next_flight'] = 'Najbliższy lot SpaceX';
|
||||||
|
// $actions['spacex_prev_flight'] = 'Poprzedni lot SpaceX';
|
||||||
|
// $actions['spacex_all_next_summary'] = 'Wszystkie zaplanowane loty SpaceX (skrót)';
|
||||||
|
|
||||||
|
$actions['separator4'] = 'separator';
|
||||||
|
$actions['note_last'] = 'Ostatnia zapisana notatka';
|
||||||
|
|
||||||
|
|
||||||
|
$actions['separator5'] = 'separator';
|
||||||
|
|
||||||
|
$notes = DB::select('SELECT * FROM note WHERE type = "note" ORDER BY updated_at DESC');
|
||||||
|
foreach ($notes as $note) {
|
||||||
|
$actions['note_' . $note->id] = 'Notatka: ' . $note->topic;
|
||||||
|
}
|
||||||
|
return $actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,6 +12,6 @@ class VerifyCsrfToken extends BaseVerifier
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
//
|
'sms'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
15
app/Interfaces/PrinterElementInterface.php
Normal file
15
app/Interfaces/PrinterElementInterface.php
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 27.02.2019
|
||||||
|
* Time: 23:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
interface PrinterElementInterface
|
||||||
|
{
|
||||||
|
public function render(): string;
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ class Airly
|
|||||||
return $this->stations;
|
return $this->stations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setStations($stations){
|
public function setStations(array $stations){
|
||||||
$this->stations = $stations;
|
$this->stations = $stations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ class CinemaCinemaCity implements Cinema
|
|||||||
if (is_null($this->cinemaId) || is_null($this->day))
|
if (is_null($this->cinemaId) || is_null($this->day))
|
||||||
throw new \Exception('Day or cinemaid not set.');
|
throw new \Exception('Day or cinemaid not set.');
|
||||||
|
|
||||||
// if (!is_array($this->cinemaId)) {
|
|
||||||
// $this->cinemaId = (array)$this->cinemaId;
|
|
||||||
// }
|
|
||||||
$url = 'https://www.cinema-city.pl/pgm-list-byfeat?si=' . $this->cinemaId . '&sort=cin&bd=' . $this->day;
|
$url = 'https://www.cinema-city.pl/pgm-list-byfeat?si=' . $this->cinemaId . '&sort=cin&bd=' . $this->day;
|
||||||
|
|
||||||
return file_get_contents($url);
|
return file_get_contents($url);
|
||||||
@@ -41,9 +38,6 @@ class CinemaCinemaCity implements Cinema
|
|||||||
$document = json_decode($document);
|
$document = json_decode($document);
|
||||||
|
|
||||||
|
|
||||||
// $cinemaData = [];
|
|
||||||
// $text = "Repertuar Cinema-City\n";
|
|
||||||
// $text .= str_replace('/', '-', $this->day) . "\n\n";
|
|
||||||
$movies = [];
|
$movies = [];
|
||||||
|
|
||||||
$date = date('d/m/Y', strtotime($this->day));
|
$date = date('d/m/Y', strtotime($this->day));
|
||||||
@@ -55,9 +49,6 @@ class CinemaCinemaCity implements Cinema
|
|||||||
foreach ($movieData->BD as $projections) {
|
foreach ($movieData->BD as $projections) {
|
||||||
if ($projections->date == $date) {
|
if ($projections->date == $date) {
|
||||||
foreach ($projections->P as $projection) {
|
foreach ($projections->P as $projection) {
|
||||||
|
|
||||||
// var_dump($projection);
|
|
||||||
// die();
|
|
||||||
$movie['hours'][] = $projection->time;
|
$movie['hours'][] = $projection->time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,37 +3,28 @@
|
|||||||
namespace App\Paper;
|
namespace App\Paper;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Decorators\HideLinesDecorator;
|
||||||
|
use App\Decorators\NewLineDecorator;
|
||||||
|
use App\Decorators\RandomElementsDecorator;
|
||||||
|
use App\Decorators\RandomNumberDecorator;
|
||||||
|
use App\Decorators\Text;
|
||||||
|
use App\Decorators\TextBreakDecorator;
|
||||||
|
use App\Decorators\TraficarDecorator;
|
||||||
|
use App\Decorators\VocabularyWordDecorator;
|
||||||
|
|
||||||
class HtmlToPos
|
class HtmlToPos
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
private function handleNewLine($text)
|
|
||||||
{
|
|
||||||
return str_replace(['<br>', '<br/>', '<br />'], "\n", $text);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function convert($html = '')
|
public function convert($html = '')
|
||||||
{
|
{
|
||||||
$posText = $this->handleNewLine($html);
|
$text = new Text($html);
|
||||||
|
$text = new NewLineDecorator($text);
|
||||||
/**
|
$text = new HideLinesDecorator($text);
|
||||||
* usuwa linijki które na początku mają ! albo #
|
$text = new RandomElementsDecorator($text);
|
||||||
*/
|
$text = new RandomNumberDecorator($text);
|
||||||
$posText = preg_replace('/^\s*[!#].*?$[\r\n]/m', '', $posText);
|
$text = new VocabularyWordDecorator($text);
|
||||||
|
$text = new TraficarDecorator($text);
|
||||||
/**
|
$text = new TextBreakDecorator($text);
|
||||||
* przeszukiwanie tekstu pod katem zawartości [ liczba, liczba2 ] i zamienianiu tego na randomową liczbę z przedziału
|
return $text->getText();
|
||||||
* liczba - liczba2
|
|
||||||
* obojętnie czy ujemną czy nie
|
|
||||||
*/
|
|
||||||
$re = '/\[\s*(-?\d+)\s*\,\s*(-?\d+)\s*\]/';
|
|
||||||
preg_match_all($re, $html, $matches, PREG_SET_ORDER, 0);
|
|
||||||
foreach ($matches as $match) {
|
|
||||||
$pos = strpos($posText, $match[0]);
|
|
||||||
$posText = substr_replace($posText, mb_rand($match[1], $match[2]), $pos, strlen($match[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $posText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,7 @@ namespace App\Paper;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
|
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
|
||||||
use Mike42\Escpos\Printer;
|
use Mike42\Escpos\Printer;
|
||||||
use App\Paper\HtmlToPos;
|
|
||||||
use Mike42\Escpos\EscposImage;
|
use Mike42\Escpos\EscposImage;
|
||||||
use Mockery\Exception;
|
|
||||||
|
|
||||||
class Paper
|
class Paper
|
||||||
{
|
{
|
||||||
@@ -23,11 +21,21 @@ class Paper
|
|||||||
try {
|
try {
|
||||||
$this->connector = new FilePrintConnector("/dev/usb/lp0");
|
$this->connector = new FilePrintConnector("/dev/usb/lp0");
|
||||||
$this->printer = new Printer($this->connector);
|
$this->printer = new Printer($this->connector);
|
||||||
}catch (Exception $e){
|
} catch (\Exception $e) {
|
||||||
die($e->getMessage());
|
die($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getConnector()
|
||||||
|
{
|
||||||
|
return $this->connector;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPrinter()
|
||||||
|
{
|
||||||
|
return $this->printer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sendHeaderPrint($title)
|
public function sendHeaderPrint($title)
|
||||||
{
|
{
|
||||||
@@ -42,11 +50,15 @@ class Paper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendImagePrint($image, $imageLocal = true)
|
public function sendImagePrint($image, $imageLocal = true, $icon = true)
|
||||||
{
|
{
|
||||||
if ($image) {
|
if ($image) {
|
||||||
if ($imageLocal) {
|
if ($imageLocal) {
|
||||||
$img = EscposImage::load($this->imageDirectory . basename($image).'.png');
|
if ($icon) {
|
||||||
|
$img = EscposImage::load($this->imageDirectory . basename($image) . '.png');
|
||||||
|
} else {
|
||||||
|
$img = EscposImage::load($image);
|
||||||
|
}
|
||||||
} else { //image not local so then remote image
|
} else { //image not local so then remote image
|
||||||
$extension = strtolower(pathinfo($image, PATHINFO_EXTENSION));
|
$extension = strtolower(pathinfo($image, PATHINFO_EXTENSION));
|
||||||
|
|
||||||
@@ -61,15 +73,35 @@ class Paper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function saveToHistory($title, $text, $textSource, $image)
|
||||||
|
{
|
||||||
|
DB::table('history')
|
||||||
|
->insertGetId([
|
||||||
|
'topic' => $title,
|
||||||
|
'topic_slug' => str_slug($title, '_'),
|
||||||
|
'text' => $text,
|
||||||
|
'text_source' => $textSource,
|
||||||
|
'icon' => $image,
|
||||||
|
'created_at' => time(),
|
||||||
|
'updated_at' => time()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sendPrint($title, $text = '', $image = false, $imageLocal = true)
|
public function sendPrint($title, $text = '', $image = false, $imageLocal = true)
|
||||||
{
|
{
|
||||||
$this->sendImagePrint($image, $imageLocal);
|
$this->sendImagePrint($image, $imageLocal);
|
||||||
|
|
||||||
$this->sendHeaderPrint($title);
|
$this->sendHeaderPrint($title);
|
||||||
$htmlToPos = new HtmlToPos();
|
$htmlToPos = new HtmlToPos();
|
||||||
$this->printer->text($htmlToPos->convert($text));
|
$convertedData = $htmlToPos->convert($text);
|
||||||
|
|
||||||
|
//zapisuje do pamięci dane o drukowanej notatce, jesli obrazek nie jest ikoną to nie zapisuje go
|
||||||
|
$this->saveToHistory($title, $convertedData, $text, $imageLocal ? $image : '');
|
||||||
|
if (is_array($convertedData)) {
|
||||||
|
$this->printer->text($convertedData['text']);
|
||||||
|
} else {
|
||||||
|
$this->printer->text($htmlToPos->convert($text));
|
||||||
|
}
|
||||||
$this->printer->feed(3);
|
$this->printer->feed(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +115,7 @@ class Paper
|
|||||||
*/
|
*/
|
||||||
public function getIcons()
|
public function getIcons()
|
||||||
{
|
{
|
||||||
$icons = ["address-card-o","anchor","archive-3","at","balance-scale","ban","bar-chart-o","barcode","battery-empty","battery-full","battery-half","battery-quarter","battery-three-quarters","bed","beer","bell-o","bell-slash-o","bicycle","birthday-cake","bolt","bomb","book","bug","building-o","bullhorn","bus","camera","car","chain","chat-2","check","cloud","code","coffee","cog","cutlery","dashboard","database","diamond","dollar","dribbble","envelope-o","envira","exclamation-triangle","female","file-text-o","film","fingerprint","fire-extinguisher","fire","flag-o","flask","floppy-o","folder-o","folder-open-o","frown-o","gamepad","gift","git","glass","graduation-cap","grav","group","hand-o-left","heart-o","home","lemon-o","lightbulb-o","list-alt","location-arrow","lock","male","map-1","map-marker","microchip","money","moon-o","music","paper-plane","paperclip","paw","pencil","phone","pie-chart","piggy-bank","plane","question-circle-o","rocket","search","ship","shopping-cart","smile-o","snowflake-o","steam","subway","success","support","thermometer-2","thumbs-o-down","thumbs-o-up","ticket","times","trash-o","tree","trophy","truck","umbrella","usd","warning","wifi","wpexplorer","wrench","youtube-play"];
|
$icons = ["address-card-o", "anchor", "archive-3", "at", "balance-scale", "ban", "bar-chart-o", "barcode", "battery-empty", "battery-full", "battery-half", "battery-quarter", "battery-three-quarters", "bed", "beer", "bell-o", "bell-slash-o", "bicycle", "birthday-cake", "bolt", "bomb", "book", "bug", "building-o", "bullhorn", "bus", "camera", "car", "chain", "chat-2", "check", "cloud", "code", "coffee", "cog", "cutlery", "dashboard", "database", "diamond", "dollar", "dribbble", "envelope-o", "envira", "exclamation-triangle", "female", "file-text-o", "film", "fingerprint", "fire-extinguisher", "fire", "flag-o", "flask", "floppy-o", "folder-o", "folder-open-o", "frown-o", "gamepad", "gift", "git", "glass", "graduation-cap", "grav", "group", "hand-o-left", "heart-o", "home", "lemon-o", "lightbulb-o", "list-alt", "location-arrow", "lock", "male", "map-1", "map-marker", "microchip", "money", "moon-o", "music", "paper-plane", "paperclip", "paw", "pencil", "phone", "pie-chart", "piggy-bank", "plane", "question-circle-o", "rocket", "search", "ship", "shopping-cart", "smile-o", "snowflake-o", "steam", "subway", "success", "support", "thermometer-2", "thumbs-o-down", "thumbs-o-up", "ticket", "times", "trash-o", "tree", "trophy", "truck", "umbrella", "usd", "warning", "wifi", "wpexplorer", "wrench", "youtube-play"];
|
||||||
|
|
||||||
|
|
||||||
$iconsDatabase = [];
|
$iconsDatabase = [];
|
||||||
|
|||||||
30
app/Paper/PrinterElements/PrinterDocument.php
Normal file
30
app/Paper/PrinterElements/PrinterDocument.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 27.02.2019
|
||||||
|
* Time: 23:49
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Paper\PrinterElements;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Interfaces\PrinterElementInterface;
|
||||||
|
|
||||||
|
class PrinterDocument implements PrinterElementInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
private $elements = [];
|
||||||
|
|
||||||
|
public function render(): string
|
||||||
|
{
|
||||||
|
foreach ($this->elements as $element) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addElement(PrinterElementInterface $element)
|
||||||
|
{
|
||||||
|
$this->elements[] = $element;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
app/Paper/PrinterElements/TitlePrinterElement.php
Normal file
27
app/Paper/PrinterElements/TitlePrinterElement.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 27.02.2019
|
||||||
|
* Time: 23:45
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Paper\PrinterElements;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Interfaces\PrinterElementInterface;
|
||||||
|
|
||||||
|
class TitlePrinterElement implements PrinterElementInterface
|
||||||
|
{
|
||||||
|
private $title;
|
||||||
|
|
||||||
|
public function __construct($title)
|
||||||
|
{
|
||||||
|
$this->title = $title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render(): string
|
||||||
|
{
|
||||||
|
return $this->title;
|
||||||
|
}
|
||||||
|
}
|
||||||
108
app/Paper/Traficar.php
Normal file
108
app/Paper/Traficar.php
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: k
|
||||||
|
* Date: 30.06.2018
|
||||||
|
* Time: 18:29
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Paper;
|
||||||
|
|
||||||
|
|
||||||
|
class Traficar
|
||||||
|
{
|
||||||
|
|
||||||
|
private $homeCoords = ['lat' => 54.417475, 'lng' => 18.481913];
|
||||||
|
|
||||||
|
private $traficarJson;
|
||||||
|
//dystans w kilometrach w którym auta brane są pod uwagę
|
||||||
|
const CLOSEST_DISTANCE = 2.5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $lat1
|
||||||
|
* @param $lon1
|
||||||
|
* @param $lat2
|
||||||
|
* @param $lon2
|
||||||
|
* @return float zwracana jest odległość w kilometrach
|
||||||
|
*/
|
||||||
|
private function distance($lat1, $lon1, $lat2, $lon2)
|
||||||
|
{
|
||||||
|
|
||||||
|
$theta = $lon1 - $lon2;
|
||||||
|
$dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
|
||||||
|
$dist = acos($dist);
|
||||||
|
$dist = rad2deg($dist);
|
||||||
|
$miles = $dist * 60 * 1.1515;
|
||||||
|
return ($miles * 1.609344);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pobiera informacje o najbliższym trafficarze względem punktu podanego jako domowy i zwraca Sformatowane
|
||||||
|
* informacje na jego temat lub jesli nie ma auta to podaje informację że nie ma dostępnego.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function nearestCarText()
|
||||||
|
{
|
||||||
|
$info = $this->nearestCarInfo();
|
||||||
|
$formatedInfo = 'Brak aut w promieniu ' . self::CLOSEST_DISTANCE . 'km od domu.';
|
||||||
|
if ($info['car'] != []) {
|
||||||
|
$formatedInfo = "Najbliższy traficar:\n" .
|
||||||
|
'Model: ' . $info['car']['model'] . "\n" .
|
||||||
|
'Numer boczny: ' . $info['car']['orderNumber'] . "\n" .
|
||||||
|
'Rejestracja: ' . $info['car']['regNumber'] . "\n" .
|
||||||
|
'Lokalizacja: ' . $info['car']['location'] . "\n" .
|
||||||
|
'Odległość: ' . $info['distance'] . "km\n\n" .
|
||||||
|
'Traficarów w promieniu ' . self::CLOSEST_DISTANCE . 'km: ' . $this->getTotalCarsInArea() . "\n";
|
||||||
|
}
|
||||||
|
return $formatedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pobiera informacje na temat aut traficatowych i zapisuje do pamięci
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private function getTraficarJson()
|
||||||
|
{
|
||||||
|
if (is_null($this->traficarJson)) {
|
||||||
|
$this->traficarJson = json_decode(file_get_contents('https://api.traficar.pl/eaw-rest-api/car?shapeId=5'), 1);
|
||||||
|
}
|
||||||
|
return $this->traficarJson;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* zwraca ilość aut w podanym promieniu
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
private function getTotalCarsInArea()
|
||||||
|
{
|
||||||
|
$trafcarData = $this->getTraficarJson();
|
||||||
|
$numberOfCarsInArea = 0;
|
||||||
|
foreach ($trafcarData['cars'] as $car) {
|
||||||
|
$distance = $this->distance($this->homeCoords['lat'], $this->homeCoords['lng'], $car['latitude'], $car['longitude']);
|
||||||
|
if ($distance < self::CLOSEST_DISTANCE) {
|
||||||
|
$numberOfCarsInArea++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $numberOfCarsInArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nearestCarInfo()
|
||||||
|
{
|
||||||
|
$trafcarData = $this->getTraficarJson();
|
||||||
|
$closestCar = [];
|
||||||
|
$closestDistance = 1000;
|
||||||
|
foreach ($trafcarData['cars'] as $car) {
|
||||||
|
|
||||||
|
$distance = $this->distance($this->homeCoords['lat'], $this->homeCoords['lng'], $car['latitude'], $car['longitude']);
|
||||||
|
if ($distance < self::CLOSEST_DISTANCE && $distance < $closestDistance) {
|
||||||
|
$closestDistance = $distance;
|
||||||
|
$closestCar = $car;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ['car' => $closestCar, 'distance' => round($closestDistance, 2),];
|
||||||
|
}
|
||||||
|
}
|
||||||
88
app/Paper/Vocabulary.php
Normal file
88
app/Paper/Vocabulary.php
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Paper;
|
||||||
|
|
||||||
|
use DiDom\Document;
|
||||||
|
use DiDom\Query;
|
||||||
|
|
||||||
|
|
||||||
|
class Vocabulary
|
||||||
|
{
|
||||||
|
|
||||||
|
const URL = 'https://www.vocabulary.com/';
|
||||||
|
const EXAMPLES_URL = 'https://corpus.vocabulary.com/api/1.0/';
|
||||||
|
|
||||||
|
|
||||||
|
public function getWordData($word)
|
||||||
|
{
|
||||||
|
return new Document($this->getWordUrl($word), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getWordUrl($word)
|
||||||
|
{
|
||||||
|
$word = trim($word);
|
||||||
|
return self::URL . 'dictionary/definition.ajax?search=' . $word . '&lang=en';
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getWordExamplesUrl($word, $maxResult = 10, $offset = 0)
|
||||||
|
{
|
||||||
|
$word = trim($word);
|
||||||
|
return sprintf('%sexamples.json?query=%s&maxResults=%d&startOffset=%d', self::EXAMPLES_URL, $word, $maxResult, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWord($word)
|
||||||
|
{
|
||||||
|
$document = $this->getWordData($word);
|
||||||
|
|
||||||
|
|
||||||
|
$wordData = new \stdClass();
|
||||||
|
$wordPageSelector = $document->first('.wordPage');
|
||||||
|
$wordData->lang = $wordPageSelector->attr('data-lang');
|
||||||
|
$wordData->word = $wordPageSelector->attr('data-word');
|
||||||
|
$wordData->next = $wordPageSelector->attr('data-next');
|
||||||
|
$wordData->prev = $wordPageSelector->attr('data-prev');
|
||||||
|
$wordData->short = trim($document->first('p.short')->text());
|
||||||
|
$wordData->long = trim($document->first('p.long')->text());
|
||||||
|
|
||||||
|
$wordData->instances = [];
|
||||||
|
foreach ($document->find('.ordinal ') as $ordinal) {
|
||||||
|
$definition = [];
|
||||||
|
$definition['type'] = $ordinal->first('h3')->first('a')->attr('title');
|
||||||
|
$definition['definition'] = trim($ordinal->first('//h3[@class="definition"][1]/text()[2]', Query::TYPE_XPATH));
|
||||||
|
$definition['example'] = ($example = $ordinal->first('//div[@class="example"]', Query::TYPE_XPATH)) ? $example->text() : '';
|
||||||
|
|
||||||
|
foreach ($ordinal->find('.instances') as $instance) {
|
||||||
|
$in = [];
|
||||||
|
$in['type'] = str_replace(' ', '_', trim(strtolower($instance->first('dt::text()')), ': '));
|
||||||
|
$in['words'] = $instance->find('dd a::text()');
|
||||||
|
$in['definition'] = $instance->first('div.definition::text()');
|
||||||
|
$definition[$in['type']] = $in;
|
||||||
|
}
|
||||||
|
|
||||||
|
$wordData->instances[] = $definition;
|
||||||
|
}
|
||||||
|
$wordData->examples = $this->getExamples($word, 3);
|
||||||
|
|
||||||
|
|
||||||
|
return $wordData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getRandomWordUrl()
|
||||||
|
{
|
||||||
|
return self::URL . 'randomword.json';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRandomWord()
|
||||||
|
{
|
||||||
|
$data = json_decode(file_get_contents($this->getRandomWordUrl()));
|
||||||
|
if ($data->status != 0) {
|
||||||
|
throw new Exception('error');
|
||||||
|
}
|
||||||
|
return $data->result->word;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getExamples($word, $maxResult = 10, $offset = 0)
|
||||||
|
{
|
||||||
|
return json_decode(file_get_contents($this->getWordExamplesUrl($word, $maxResult, $offset)), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.6.4",
|
"php": ">=7.0.0",
|
||||||
"imangazaliev/didom": "^1.9",
|
"imangazaliev/didom": "^1.9",
|
||||||
"intervention/image": "^2.3",
|
"intervention/image": "^2.3",
|
||||||
"laravel/framework": "5.4.*",
|
"laravel/framework": "5.4.*",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ return [
|
|||||||
| any other location as required by the application or its packages.
|
| any other location as required by the application or its packages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'name' => 'Laravel',
|
'name' => 'Paper.Pi',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -64,7 +64,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'timezone' => 'UTC',
|
'timezone' => 'Europe/Warsaw',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ return [
|
|||||||
|
|
||||||
'sqlite' => [
|
'sqlite' => [
|
||||||
'driver' => 'sqlite',
|
'driver' => 'sqlite',
|
||||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
'database' => database_path(env('DB_DATABASE','database.sqlite')),
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -11,5 +11,8 @@ return ['airly' =>
|
|||||||
[
|
[
|
||||||
'api_key' => '8b6d77b2950e4e018b0684912bf7b9ed',
|
'api_key' => '8b6d77b2950e4e018b0684912bf7b9ed',
|
||||||
'stations' => ['2210', '2256', '2180'],
|
'stations' => ['2210', '2256', '2180'],
|
||||||
|
'rzeczypospolitej' => 2210,
|
||||||
|
'grunwaldzka' => 2256,
|
||||||
|
'sowinskiego' => 2180,
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
BIN
database/printer_example.db
Normal file
BIN
database/printer_example.db
Normal file
Binary file not shown.
140
public/css/app.css
vendored
140
public/css/app.css
vendored
@@ -20,6 +20,14 @@ textarea.content {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.note-title {
|
||||||
|
line-height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1.header span.icon.display-inline-block {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
form {
|
form {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
@@ -28,6 +36,23 @@ form {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex.space-between {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex.header {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex .header {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
@@ -37,7 +62,7 @@ form {
|
|||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon:hover {
|
.icons .icon:hover {
|
||||||
background-color: #1e90ff4d;
|
background-color: #1e90ff4d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,342 +80,455 @@ form {
|
|||||||
height: 29px;
|
height: 29px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.address-card-o {
|
.icon.address-card-o {
|
||||||
background-position-x: -0px;
|
background-position-x: -0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.anchor {
|
.icon.anchor {
|
||||||
background-position-x: -25px;
|
background-position-x: -25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.archive-3 {
|
.icon.archive-3 {
|
||||||
background-position-x: -50px;
|
background-position-x: -50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.at {
|
.icon.at {
|
||||||
background-position-x: -75px;
|
background-position-x: -75px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.balance-scale {
|
.icon.balance-scale {
|
||||||
background-position-x: -100px;
|
background-position-x: -100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.ban {
|
.icon.ban {
|
||||||
background-position-x: -125px;
|
background-position-x: -125px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bar-chart-o {
|
.icon.bar-chart-o {
|
||||||
background-position-x: -150px;
|
background-position-x: -150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.barcode {
|
.icon.barcode {
|
||||||
background-position-x: -175px;
|
background-position-x: -175px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.battery-empty {
|
.icon.battery-empty {
|
||||||
background-position-x: -200px;
|
background-position-x: -200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.battery-full {
|
.icon.battery-full {
|
||||||
background-position-x: -225px;
|
background-position-x: -225px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.battery-half {
|
.icon.battery-half {
|
||||||
background-position-x: -250px;
|
background-position-x: -250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.battery-quarter {
|
.icon.battery-quarter {
|
||||||
background-position-x: -275px;
|
background-position-x: -275px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.battery-three-quarters {
|
.icon.battery-three-quarters {
|
||||||
background-position-x: -300px;
|
background-position-x: -300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bed {
|
.icon.bed {
|
||||||
background-position-x: -325px;
|
background-position-x: -325px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.beer {
|
.icon.beer {
|
||||||
background-position-x: -350px;
|
background-position-x: -350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bell-o {
|
.icon.bell-o {
|
||||||
background-position-x: -375px;
|
background-position-x: -375px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bell-slash-o {
|
.icon.bell-slash-o {
|
||||||
background-position-x: -400px;
|
background-position-x: -400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bicycle {
|
.icon.bicycle {
|
||||||
background-position-x: -425px;
|
background-position-x: -425px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.birthday-cake {
|
.icon.birthday-cake {
|
||||||
background-position-x: -450px;
|
background-position-x: -450px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bolt {
|
.icon.bolt {
|
||||||
background-position-x: -475px;
|
background-position-x: -475px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bomb {
|
.icon.bomb {
|
||||||
background-position-x: -500px;
|
background-position-x: -500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.book {
|
.icon.book {
|
||||||
background-position-x: -525px;
|
background-position-x: -525px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bug {
|
.icon.bug {
|
||||||
background-position-x: -550px;
|
background-position-x: -550px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.building-o {
|
.icon.building-o {
|
||||||
background-position-x: -575px;
|
background-position-x: -575px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bullhorn {
|
.icon.bullhorn {
|
||||||
background-position-x: -600px;
|
background-position-x: -600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.bus {
|
.icon.bus {
|
||||||
background-position-x: -625px;
|
background-position-x: -625px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.camera {
|
.icon.camera {
|
||||||
background-position-x: -650px;
|
background-position-x: -650px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.car {
|
.icon.car {
|
||||||
background-position-x: -675px;
|
background-position-x: -675px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.chain {
|
.icon.chain {
|
||||||
background-position-x: -700px;
|
background-position-x: -700px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.chat-2 {
|
.icon.chat-2 {
|
||||||
background-position-x: -725px;
|
background-position-x: -725px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.check {
|
.icon.check {
|
||||||
background-position-x: -750px;
|
background-position-x: -750px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.cloud {
|
.icon.cloud {
|
||||||
background-position-x: -775px;
|
background-position-x: -775px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.code {
|
.icon.code {
|
||||||
background-position-x: -800px;
|
background-position-x: -800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.coffee {
|
.icon.coffee {
|
||||||
background-position-x: -825px;
|
background-position-x: -825px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.cog {
|
.icon.cog {
|
||||||
background-position-x: -850px;
|
background-position-x: -850px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.cutlery {
|
.icon.cutlery {
|
||||||
background-position-x: -875px;
|
background-position-x: -875px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.dashboard {
|
.icon.dashboard {
|
||||||
background-position-x: -900px;
|
background-position-x: -900px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.database {
|
.icon.database {
|
||||||
background-position-x: -925px;
|
background-position-x: -925px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.diamond {
|
.icon.diamond {
|
||||||
background-position-x: -950px;
|
background-position-x: -950px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.dollar {
|
.icon.dollar {
|
||||||
background-position-x: -975px;
|
background-position-x: -975px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.dribbble {
|
.icon.dribbble {
|
||||||
background-position-x: -1000px;
|
background-position-x: -1000px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.envelope-o {
|
.icon.envelope-o {
|
||||||
background-position-x: -1025px;
|
background-position-x: -1025px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.envira {
|
.icon.envira {
|
||||||
background-position-x: -1050px;
|
background-position-x: -1050px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.exclamation-triangle {
|
.icon.exclamation-triangle {
|
||||||
background-position-x: -1075px;
|
background-position-x: -1075px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.female {
|
.icon.female {
|
||||||
background-position-x: -1100px;
|
background-position-x: -1100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.file-text-o {
|
.icon.file-text-o {
|
||||||
background-position-x: -1125px;
|
background-position-x: -1125px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.film {
|
.icon.film {
|
||||||
background-position-x: -1150px;
|
background-position-x: -1150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.fingerprint {
|
.icon.fingerprint {
|
||||||
background-position-x: -1175px;
|
background-position-x: -1175px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.fire-extinguisher {
|
.icon.fire-extinguisher {
|
||||||
background-position-x: -1200px;
|
background-position-x: -1200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.fire {
|
.icon.fire {
|
||||||
background-position-x: -1225px;
|
background-position-x: -1225px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.flag-o {
|
.icon.flag-o {
|
||||||
background-position-x: -1250px;
|
background-position-x: -1250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.flask {
|
.icon.flask {
|
||||||
background-position-x: -1275px;
|
background-position-x: -1275px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.floppy-o {
|
.icon.floppy-o {
|
||||||
background-position-x: -1300px;
|
background-position-x: -1300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.folder-o {
|
.icon.folder-o {
|
||||||
background-position-x: -1325px;
|
background-position-x: -1325px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.folder-open-o {
|
.icon.folder-open-o {
|
||||||
background-position-x: -1350px;
|
background-position-x: -1350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.frown-o {
|
.icon.frown-o {
|
||||||
background-position-x: -1375px;
|
background-position-x: -1375px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.gamepad {
|
.icon.gamepad {
|
||||||
background-position-x: -1400px;
|
background-position-x: -1400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.gift {
|
.icon.gift {
|
||||||
background-position-x: -1425px;
|
background-position-x: -1425px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.git {
|
.icon.git {
|
||||||
background-position-x: -1450px;
|
background-position-x: -1450px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.glass {
|
.icon.glass {
|
||||||
background-position-x: -1475px;
|
background-position-x: -1475px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.graduation-cap {
|
.icon.graduation-cap {
|
||||||
background-position-x: -1500px;
|
background-position-x: -1500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.grav {
|
.icon.grav {
|
||||||
background-position-x: -1525px;
|
background-position-x: -1525px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.group {
|
.icon.group {
|
||||||
background-position-x: -1550px;
|
background-position-x: -1550px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.hand-o-left {
|
.icon.hand-o-left {
|
||||||
background-position-x: -1575px;
|
background-position-x: -1575px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.heart-o {
|
.icon.heart-o {
|
||||||
background-position-x: -1600px;
|
background-position-x: -1600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.home {
|
.icon.home {
|
||||||
background-position-x: -1625px;
|
background-position-x: -1625px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.lemon-o {
|
.icon.lemon-o {
|
||||||
background-position-x: -1650px;
|
background-position-x: -1650px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.lightbulb-o {
|
.icon.lightbulb-o {
|
||||||
background-position-x: -1675px;
|
background-position-x: -1675px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.list-alt {
|
.icon.list-alt {
|
||||||
background-position-x: -1700px;
|
background-position-x: -1700px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.location-arrow {
|
.icon.location-arrow {
|
||||||
background-position-x: -1725px;
|
background-position-x: -1725px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.lock {
|
.icon.lock {
|
||||||
background-position-x: -1750px;
|
background-position-x: -1750px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.male {
|
.icon.male {
|
||||||
background-position-x: -1775px;
|
background-position-x: -1775px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.map-1 {
|
.icon.map-1 {
|
||||||
background-position-x: -1800px;
|
background-position-x: -1800px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.map-marker {
|
.icon.map-marker {
|
||||||
background-position-x: -1825px;
|
background-position-x: -1825px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.microchip {
|
.icon.microchip {
|
||||||
background-position-x: -1850px;
|
background-position-x: -1850px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.money {
|
.icon.money {
|
||||||
background-position-x: -1875px;
|
background-position-x: -1875px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.moon-o {
|
.icon.moon-o {
|
||||||
background-position-x: -1900px;
|
background-position-x: -1900px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.music {
|
.icon.music {
|
||||||
background-position-x: -1925px;
|
background-position-x: -1925px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.paper-plane {
|
.icon.paper-plane {
|
||||||
background-position-x: -1950px;
|
background-position-x: -1950px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.paperclip {
|
.icon.paperclip {
|
||||||
background-position-x: -1975px;
|
background-position-x: -1975px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.paw {
|
.icon.paw {
|
||||||
background-position-x: -2000px;
|
background-position-x: -2000px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.pencil {
|
.icon.pencil {
|
||||||
background-position-x: -2025px;
|
background-position-x: -2025px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.phone {
|
.icon.phone {
|
||||||
background-position-x: -2050px;
|
background-position-x: -2050px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.pie-chart {
|
.icon.pie-chart {
|
||||||
background-position-x: -2075px;
|
background-position-x: -2075px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.piggy-bank {
|
.icon.piggy-bank {
|
||||||
background-position-x: -2100px;
|
background-position-x: -2100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.plane {
|
.icon.plane {
|
||||||
background-position-x: -2125px;
|
background-position-x: -2125px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.question-circle-o {
|
.icon.question-circle-o {
|
||||||
background-position-x: -2150px;
|
background-position-x: -2150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.rocket {
|
.icon.rocket {
|
||||||
background-position-x: -2175px;
|
background-position-x: -2175px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.search {
|
.icon.search {
|
||||||
background-position-x: -2200px;
|
background-position-x: -2200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.ship {
|
.icon.ship {
|
||||||
background-position-x: -2225px;
|
background-position-x: -2225px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.shopping-cart {
|
.icon.shopping-cart {
|
||||||
background-position-x: -2250px;
|
background-position-x: -2250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.smile-o {
|
.icon.smile-o {
|
||||||
background-position-x: -2275px;
|
background-position-x: -2275px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.snowflake-o {
|
.icon.snowflake-o {
|
||||||
background-position-x: -2300px;
|
background-position-x: -2300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.steam {
|
.icon.steam {
|
||||||
background-position-x: -2325px;
|
background-position-x: -2325px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.subway {
|
.icon.subway {
|
||||||
background-position-x: -2350px;
|
background-position-x: -2350px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.success {
|
.icon.success {
|
||||||
background-position-x: -2375px;
|
background-position-x: -2375px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.support {
|
.icon.support {
|
||||||
background-position-x: -2400px;
|
background-position-x: -2400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.thermometer-2 {
|
.icon.thermometer-2 {
|
||||||
background-position-x: -2425px;
|
background-position-x: -2425px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.thumbs-o-down {
|
.icon.thumbs-o-down {
|
||||||
background-position-x: -2450px;
|
background-position-x: -2450px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.thumbs-o-up {
|
.icon.thumbs-o-up {
|
||||||
background-position-x: -2475px;
|
background-position-x: -2475px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.ticket {
|
.icon.ticket {
|
||||||
background-position-x: -2500px;
|
background-position-x: -2500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.times {
|
.icon.times {
|
||||||
background-position-x: -2525px;
|
background-position-x: -2525px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.trash-o {
|
.icon.trash-o {
|
||||||
background-position-x: -2550px;
|
background-position-x: -2550px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.tree {
|
.icon.tree {
|
||||||
background-position-x: -2575px;
|
background-position-x: -2575px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.trophy {
|
.icon.trophy {
|
||||||
background-position-x: -2600px;
|
background-position-x: -2600px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.truck {
|
.icon.truck {
|
||||||
background-position-x: -2625px;
|
background-position-x: -2625px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.umbrella {
|
.icon.umbrella {
|
||||||
background-position-x: -2650px;
|
background-position-x: -2650px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.usd {
|
.icon.usd {
|
||||||
background-position-x: -2675px;
|
background-position-x: -2675px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.warning {
|
.icon.warning {
|
||||||
background-position-x: -2700px;
|
background-position-x: -2700px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.wifi {
|
.icon.wifi {
|
||||||
background-position-x: -2725px;
|
background-position-x: -2725px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.wpexplorer {
|
.icon.wpexplorer {
|
||||||
background-position-x: -2750px;
|
background-position-x: -2750px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.wrench {
|
.icon.wrench {
|
||||||
background-position-x: -2775px;
|
background-position-x: -2775px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon.youtube-play {
|
.icon.youtube-play {
|
||||||
background-position-x: -2800px;
|
background-position-x: -2800px;
|
||||||
}
|
}
|
||||||
BIN
public/icons/icon-128.png
Normal file
BIN
public/icons/icon-128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
BIN
public/icons/icon-16.png
Normal file
BIN
public/icons/icon-16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 544 B |
BIN
public/icons/icon-256.png
Normal file
BIN
public/icons/icon-256.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
public/icons/icon-32.png
Normal file
BIN
public/icons/icon-32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
public/icons/icon-512.png
Normal file
BIN
public/icons/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
public/icons/icon-64.png
Normal file
BIN
public/icons/icon-64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -1,4 +1,4 @@
|
|||||||
var content, preview, selfPrinter;
|
var content, title, preview, selfPrinter;
|
||||||
var Printer = function () {
|
var Printer = function () {
|
||||||
|
|
||||||
|
|
||||||
@@ -8,6 +8,7 @@ var Printer = function () {
|
|||||||
this.delete = document.querySelector('.js-delete');
|
this.delete = document.querySelector('.js-delete');
|
||||||
|
|
||||||
content = this.content = document.querySelector('.js-content');
|
content = this.content = document.querySelector('.js-content');
|
||||||
|
title = this.title = document.querySelector('input[name="title"]');
|
||||||
|
|
||||||
|
|
||||||
selfPrinter = this;
|
selfPrinter = this;
|
||||||
@@ -21,7 +22,7 @@ var Printer = function () {
|
|||||||
this.delete.addEventListener('click', this.confirmDelete);
|
this.delete.addEventListener('click', this.confirmDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelectorAll('.icon').forEach(function (e) {
|
document.querySelectorAll('.icons .icon').forEach(function (e) {
|
||||||
e.addEventListener('click', function () {
|
e.addEventListener('click', function () {
|
||||||
selfPrinter.selectIcon(this.title);
|
selfPrinter.selectIcon(this.title);
|
||||||
});
|
});
|
||||||
@@ -32,7 +33,7 @@ var Printer = function () {
|
|||||||
/**
|
/**
|
||||||
* resetuje wybór ikony
|
* resetuje wybór ikony
|
||||||
*/
|
*/
|
||||||
this.selectIcon = function(iconTitle){
|
this.selectIcon = function (iconTitle) {
|
||||||
document.querySelectorAll('.icon').forEach(function (e, i) {
|
document.querySelectorAll('.icon').forEach(function (e, i) {
|
||||||
e.classList.remove('selected');
|
e.classList.remove('selected');
|
||||||
});
|
});
|
||||||
@@ -42,7 +43,7 @@ var Printer = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.restoreContentHeight = function () {
|
this.restoreContentHeight = function () {
|
||||||
if(!!localStorage.getItem('contentHeight')){
|
if (!!localStorage.getItem('contentHeight')) {
|
||||||
document.querySelector('.js-content').style.height = localStorage.getItem('contentHeight')
|
document.querySelector('.js-content').style.height = localStorage.getItem('contentHeight')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -56,6 +57,7 @@ var Printer = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.clear = function () {
|
this.clear = function () {
|
||||||
|
selfPrinter.title.value = '';
|
||||||
selfPrinter.content.innerHTML = '';
|
selfPrinter.content.innerHTML = '';
|
||||||
selfPrinter.selectIcon('empty');
|
selfPrinter.selectIcon('empty');
|
||||||
};
|
};
|
||||||
|
|||||||
34
public/manifest.json
Normal file
34
public/manifest.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "PaperPi",
|
||||||
|
"short_name": "PaperPi",
|
||||||
|
"start_url": ".",
|
||||||
|
"display": "standalone",
|
||||||
|
"background_color": "#277dd1",
|
||||||
|
"description": "Raspberry Pi printer webapp",
|
||||||
|
"orientation": "portrait",
|
||||||
|
"icons": [{
|
||||||
|
"src": "/icon-16.png",
|
||||||
|
"sizes": "16x16",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "/icon-32.png",
|
||||||
|
"sizes": "32x32",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "/icon-64.png",
|
||||||
|
"sizes": "64x64",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "/icon-128.png",
|
||||||
|
"sizes": "128x128",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "/icon-256.png",
|
||||||
|
"sizes": "256x256",
|
||||||
|
"type": "image/png"
|
||||||
|
}, {
|
||||||
|
"src": "/icon-512.png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}]
|
||||||
|
}
|
||||||
@@ -1,11 +1,22 @@
|
|||||||
@extends('layouts.base')
|
@extends('layouts.base')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<style>
|
<style>
|
||||||
body .column .ui.form textarea:not([rows]) {max-height: inherit; height: 20em}
|
body .column .ui.form textarea:not([rows]) {
|
||||||
|
max-height: inherit;
|
||||||
|
height: 20em
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
|
@if(Session::has('print_status'))
|
||||||
|
<div class="ui info message">
|
||||||
|
<div class="header">
|
||||||
|
{{ Session::get('print_status') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
<div class="ui one column middle aligned stackable grid">
|
<div class="ui one column middle aligned stackable grid">
|
||||||
<div class="ui column">
|
<div class="ui column">
|
||||||
@if($type == 'template')
|
@if($type == 'template')
|
||||||
@@ -13,8 +24,8 @@
|
|||||||
@else
|
@else
|
||||||
<h2><a href="/">Lista</a> » Edycja notatki</h2>
|
<h2><a href="/">Lista</a> » Edycja notatki</h2>
|
||||||
@endif
|
@endif
|
||||||
@include('form.create')
|
@include('form.create')
|
||||||
<br><br>
|
<br><br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,17 +12,11 @@
|
|||||||
name="text">{{ $text }}</textarea>
|
name="text">{{ $text }}</textarea>
|
||||||
<input type="hidden" name="icon" id="icon" value="{{ $icon_selected }}"/>
|
<input type="hidden" name="icon" id="icon" value="{{ $icon_selected }}"/>
|
||||||
<div class="icons">
|
<div class="icons">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<span class="icon @if(!isset($icon_selected) ) selected @endif empty" title="empty"></span>
|
<span class="icon @if(!isset($icon_selected) ) selected @endif empty" title="empty"></span>
|
||||||
@foreach ($icons as $icon)<span
|
@foreach ($icons as $icon)<span
|
||||||
class="icon {{ str_before($icon, '.') }} @if(isset($icon_selected) && $icon == basename($icon_selected)) selected @endif " title="{{ $icon }}">
|
class="icon {{ str_before($icon, '.') }} @if(isset($icon_selected) && $icon == basename($icon_selected)) selected @endif "
|
||||||
|
title="{{ $icon }}">
|
||||||
</span>@endforeach
|
</span>@endforeach
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -38,9 +32,12 @@
|
|||||||
<button class="ui reset button js-reset" type="reset">Wyczyść</button>
|
<button class="ui reset button js-reset" type="reset">Wyczyść</button>
|
||||||
@if(isset($id))
|
@if(isset($id))
|
||||||
<button class="ui delete button js-delete red" type="submit" name="delete">Usuń</button>
|
<button class="ui delete button js-delete red" type="submit" name="delete">Usuń</button>
|
||||||
|
|
||||||
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<div class="ui @if(isset($private) && $private == 1) checked @endif checkbox">
|
||||||
|
<input name="private" id="private" @if(isset($private) && $private == 1) checked="checked" @endif value="1" type="checkbox">
|
||||||
|
<label for="private">Prywatna notatka</label>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,10 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.slim.min.js"></script>
|
||||||
<script src="/js/semantic.min.js"></script>
|
<script src="/js/semantic.min.js"></script>
|
||||||
<script src="/js/printer.js"></script>
|
<script src="/js/printer.js"></script>
|
||||||
|
<link rel="shortcut" type="image/png" href="/icon-16.png"/>
|
||||||
|
<link rel="icon" type="image/png" href="/icon-256.png" />
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<link rel="manifest" href="/manifest.json">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|||||||
@@ -12,8 +12,10 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<h1 class="ui header">Szybka notatka</h1>
|
<div class="flex header space-between">
|
||||||
|
<h1 class="ui header">Szybka notatka</h1>
|
||||||
|
<a class="ui right floated" href="/settings">Ustawienia</a>
|
||||||
|
</div>
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<div class="ui one column middle aligned stackable grid">
|
<div class="ui one column middle aligned stackable grid">
|
||||||
<div class="ui column">
|
<div class="ui column">
|
||||||
@@ -45,23 +47,28 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui container">
|
<div class="ui container">
|
||||||
<h1 class="ui header">Lista notatek</h1>
|
<h1 class="ui header"> @if(isset($filter)) <a href="/">Lista notatek</a> z ikonką <span
|
||||||
|
class="icon {{ $filter }} display-inline-block"></span>@else Lista notatek @endif</h1>
|
||||||
<div class="ui middle aligned divided list">
|
<div class="ui middle aligned divided list">
|
||||||
|
|
||||||
@foreach($notes as $note)
|
@foreach($notes as $note)
|
||||||
<div class="item">
|
@if($note->private != 1 || substr($_SERVER['REMOTE_ADDR'],0,9) == '192.168.0')
|
||||||
<div class="right floated content">
|
<div class="item">
|
||||||
<form method="post" action="/print/{{ $note->id }}">
|
<div class="left floated content">
|
||||||
{{ csrf_field() }}
|
<a href="/filter/{{ $note->icon }}" class="left floated"><span
|
||||||
<button type="primary" class="ui tiny button primary">Drukuj</button>
|
class="icon @if($note->icon){{ $note->icon }} @else empty @endif "
|
||||||
</form>
|
title="{{ $note->icon }}"></span></a><a class="note-title"
|
||||||
|
href="/edit/{{ $note->id }}/{{ $note->topic_slug?$note->topic_slug:str_limit($note->text, 30, '...') }}">{{ $note->topic?$note->topic:str_limit($note->text, 30, '...') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="right floated content">
|
||||||
|
<form method="post" action="/print/{{ $note->id }}">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
<button type="primary" class="ui tiny button primary">Drukuj</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
@endif
|
||||||
<a href="/edit/{{ $note->id }}/{{ $note->topic_slug?$note->topic_slug:str_limit($note->text, 30, '...') }}"><span
|
|
||||||
class="icon {{ $note->icon }} "
|
|
||||||
title="{{ $note->icon }}"></span>{{ $note->topic?$note->topic:str_limit($note->text, 30, '...') }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
<h1 class="ui header">Szablony notatek</h1>
|
<h1 class="ui header">Szablony notatek</h1>
|
||||||
|
|||||||
54
resources/views/settings.blade.php
Normal file
54
resources/views/settings.blade.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
@extends('layouts.base')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="ui container">
|
||||||
|
@if(Session::has('print_status'))
|
||||||
|
<div class="ui info message">
|
||||||
|
<div class="header">
|
||||||
|
{{ Session::get('print_status') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="flex header space-between">
|
||||||
|
<h1 class="ui header">Ustawienia</h1>
|
||||||
|
<a class="ui right floated" href="/">Notatki</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui container">
|
||||||
|
|
||||||
|
<h3 class="ui header">Przypisanie klawiszy</h3>
|
||||||
|
|
||||||
|
<form class="ui form" method="POST">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
@foreach($keyboard as $element)
|
||||||
|
<div class="inline fields">
|
||||||
|
<div class="three wide field">
|
||||||
|
Klawisz: {{ $element->key }}
|
||||||
|
</div>
|
||||||
|
<div class="left floated content">
|
||||||
|
<div class="field">
|
||||||
|
Akcja:
|
||||||
|
<select class="ui" name="key[{{ $element->id }}]">
|
||||||
|
@foreach($actions as $actionKey => $action)
|
||||||
|
@if($action == 'separator')
|
||||||
|
<optgroup label=""></optgroup>
|
||||||
|
@else
|
||||||
|
<option @if($element->action == $actionKey)selected="selected"
|
||||||
|
@endif
|
||||||
|
value="{{ $actionKey }}">{{ $action }}</optionvalue>
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
<button class="ui blue button" type="submit">Zapisz</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -12,18 +12,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Route::get('/', 'Main@listView')->name('list');
|
Route::get('/', 'Main@listView')->name('list');
|
||||||
|
Route::get('/filter/{icon?}', 'Main@filterView');
|
||||||
|
Route::get('/settings', 'Settings@mainView')->name('settingsList');
|
||||||
|
Route::post('/settings', 'Settings@save');
|
||||||
//Route::post('/', 'Main@listView');
|
//Route::post('/', 'Main@listView');
|
||||||
Route::get('/edit/{id}/{slug}', 'Main@edit')->name('edit');
|
Route::get('/edit/{id}/{slug?}', 'Main@edit')->name('edit');
|
||||||
Route::post('/print/{id}/', 'Main@printText')->name('print');
|
Route::post('/print/{id}/', 'Main@printText')->name('print');
|
||||||
Route::post('/edit/{id}/{slug}', 'Main@edit');
|
Route::post('/edit/{id}/{slug?}', 'Main@edit');
|
||||||
|
|
||||||
|
Route::post('/sms', 'Plivo@recieveSms');
|
||||||
|
|
||||||
Route::post('/printImage', 'Main@imagePrint');
|
Route::post('/printImage', 'Main@imagePrint');
|
||||||
|
|
||||||
Route::post('/', 'Main@main');
|
Route::post('/', 'Main@main');
|
||||||
|
|
||||||
|
|
||||||
Route::get('/airly', 'Main@airly');
|
Route::get('/airly', 'AirlyController@airly_all');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
71
tests/Unit/VocabularyTest.php
Normal file
71
tests/Unit/VocabularyTest.php
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Unit;
|
||||||
|
|
||||||
|
use App\Paper\Vocabulary;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class VocabularyTest extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
public function testGetExistingWordData()
|
||||||
|
{
|
||||||
|
$voc = new Vocabulary();
|
||||||
|
$data = $voc->getWordData('random');
|
||||||
|
$this->assertNotEmpty($data);
|
||||||
|
$element = $data->find('.wordPage[data-word="random"]');
|
||||||
|
$this->assertCount(1, $element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetNonExistingWordData()
|
||||||
|
{
|
||||||
|
$nonExistingWord = time();
|
||||||
|
$voc = new Vocabulary();
|
||||||
|
$data = $voc->getWordData($nonExistingWord);
|
||||||
|
$this->assertNotEmpty($data);
|
||||||
|
$element = $data->find('.wordPage[data-word="random"]');
|
||||||
|
$this->assertCount(0, $element);
|
||||||
|
|
||||||
|
$elementNotFound = $data->find('.noresults[data-search="' . $nonExistingWord . '"]');
|
||||||
|
$this->assertCount(1, $elementNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetExistingWord()
|
||||||
|
{
|
||||||
|
$dummyWord = 'dummy';
|
||||||
|
$vot = new Vocabulary();
|
||||||
|
$word = $vot->getWord($dummyWord);
|
||||||
|
|
||||||
|
$this->assertEquals('en', $word->lang);
|
||||||
|
$this->assertEquals('dummy', $word->word);
|
||||||
|
$this->assertEquals('dump', $word->next);
|
||||||
|
$this->assertEquals('dumbstruck', $word->prev);
|
||||||
|
$this->assertEquals('Have you ever seen an entertainer make a doll look like it’s talking? The entertainer is using a dummy — a doll made to look like a person.', $word->short);
|
||||||
|
$this->assertEquals("A dummy is a type of doll that looks like a person. Entertainers called ventriloquists can make dummies appear to talk. The automobile industry uses dummies in cars to study how safe cars are during a crash. A dummy can also be anything that looks real but doesn’t work: a fake. Actors in a play might use certain props that are dummies, such as a dummy laptop. Dummy is also an insult used to mean “an ignorant person.”", $word->long);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetRandomWord()
|
||||||
|
{
|
||||||
|
$vot = new Vocabulary();
|
||||||
|
$word = $vot->getRandomWord();
|
||||||
|
$this->assertNotNull($word);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testGetRandomWordData()
|
||||||
|
{
|
||||||
|
$vot = new Vocabulary();
|
||||||
|
$word = $vot->getRandomWord();
|
||||||
|
$this->assertNotNull($word);
|
||||||
|
|
||||||
|
$wordData = $vot->getWord($word);
|
||||||
|
|
||||||
|
$this->assertEquals('en', $wordData->lang);
|
||||||
|
$this->assertNotEmpty($wordData->word);
|
||||||
|
$this->assertNotEmpty($wordData->next);
|
||||||
|
$this->assertNotEmpty($wordData->prev);
|
||||||
|
$this->assertNotEmpty($wordData->short);
|
||||||
|
$this->assertNotEmpty($wordData->long);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user