1 | <?php |
||
16 | class TextToSpeechWidget extends Widget |
||
17 | { |
||
18 | public $playButtonSelector = '#play-button'; |
||
19 | |||
20 | public $pauseButtonSelector = '#pause-button'; |
||
21 | |||
22 | public $stopButtonSelector = '#stop-button'; |
||
23 | |||
24 | public $targetSelector; |
||
25 | |||
26 | public $containerClass = 'text-to-speech-container'; |
||
27 | |||
28 | public $buttonClass = 'text-to-speech-button'; |
||
29 | |||
30 | /** |
||
31 | * @var string If enabled, the {{$targetSelector}} attribute has no effect and only the text from the property will be read - on start. |
||
32 | */ |
||
33 | public $text; |
||
34 | |||
35 | public $buttons; |
||
36 | |||
37 | public $playSVG = <<<'PLAYSVG' |
||
38 | <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" |
||
39 | viewBox="0 0 60 60" style="enable-background:new 0 0 60 60;" xml:space="preserve"> |
||
40 | <g> |
||
41 | <path d="M45.563,29.174l-22-15c-0.307-0.208-0.703-0.231-1.031-0.058C22.205,14.289,22,14.629,22,15v30 |
||
42 | c0,0.371,0.205,0.711,0.533,0.884C22.679,45.962,22.84,46,23,46c0.197,0,0.394-0.059,0.563-0.174l22-15 |
||
43 | C45.836,30.64,46,30.331,46,30S45.836,29.36,45.563,29.174z M24,43.107V16.893L43.225,30L24,43.107z"/> |
||
44 | <path d="M30,0C13.458,0,0,13.458,0,30s13.458,30,30,30s30-13.458,30-30S46.542,0,30,0z M30,58C14.561,58,2,45.439,2,30 |
||
45 | S14.561,2,30,2s28,12.561,28,28S45.439,58,30,58z"/> |
||
46 | </g> |
||
47 | <g> |
||
48 | </g> |
||
49 | <g> |
||
50 | </g> |
||
51 | <g> |
||
52 | </g> |
||
53 | <g> |
||
54 | </g> |
||
55 | <g> |
||
56 | </g> |
||
57 | <g> |
||
58 | </g> |
||
59 | <g> |
||
60 | </g> |
||
61 | <g> |
||
62 | </g> |
||
63 | <g> |
||
64 | </g> |
||
65 | <g> |
||
66 | </g> |
||
67 | <g> |
||
68 | </g> |
||
69 | <g> |
||
70 | </g> |
||
71 | <g> |
||
72 | </g> |
||
73 | <g> |
||
74 | </g> |
||
75 | <g> |
||
76 | </g> |
||
77 | </svg> |
||
78 | PLAYSVG; |
||
79 | |||
80 | public $stopSVG = <<<'STOPSVG' |
||
81 | <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" |
||
82 | viewBox="0 0 60 60" style="enable-background:new 0 0 60 60;" xml:space="preserve"> |
||
83 | <g> |
||
84 | <path d="M45.563,29.174l-22-15c-0.307-0.208-0.703-0.231-1.031-0.058C22.205,14.289,22,14.629,22,15v30 |
||
85 | c0,0.371,0.205,0.711,0.533,0.884C22.679,45.962,22.84,46,23,46c0.197,0,0.394-0.059,0.563-0.174l22-15 |
||
86 | C45.836,30.64,46,30.331,46,30S45.836,29.36,45.563,29.174z M24,43.107V16.893L43.225,30L24,43.107z"/> |
||
87 | <path d="M30,0C13.458,0,0,13.458,0,30s13.458,30,30,30s30-13.458,30-30S46.542,0,30,0z M30,58C14.561,58,2,45.439,2,30 |
||
88 | S14.561,2,30,2s28,12.561,28,28S45.439,58,30,58z"/> |
||
89 | </g> |
||
90 | <g> |
||
91 | </g> |
||
92 | <g> |
||
93 | </g> |
||
94 | <g> |
||
95 | </g> |
||
96 | <g> |
||
97 | </g> |
||
98 | <g> |
||
99 | </g> |
||
100 | <g> |
||
101 | </g> |
||
102 | <g> |
||
103 | </g> |
||
104 | <g> |
||
105 | </g> |
||
106 | <g> |
||
107 | </g> |
||
108 | <g> |
||
109 | </g> |
||
110 | <g> |
||
111 | </g> |
||
112 | <g> |
||
113 | </g> |
||
114 | <g> |
||
115 | </g> |
||
116 | <g> |
||
117 | </g> |
||
118 | <g> |
||
119 | </g> |
||
120 | </svg> |
||
121 | STOPSVG; |
||
122 | |||
123 | public $pauseSVG = <<<'PAUSESVG' |
||
124 | <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" |
||
125 | viewBox="0 0 60 60" style="enable-background:new 0 0 60 60;" xml:space="preserve"> |
||
126 | <g> |
||
127 | <path d="M45.563,29.174l-22-15c-0.307-0.208-0.703-0.231-1.031-0.058C22.205,14.289,22,14.629,22,15v30 |
||
128 | c0,0.371,0.205,0.711,0.533,0.884C22.679,45.962,22.84,46,23,46c0.197,0,0.394-0.059,0.563-0.174l22-15 |
||
129 | C45.836,30.64,46,30.331,46,30S45.836,29.36,45.563,29.174z M24,43.107V16.893L43.225,30L24,43.107z"/> |
||
130 | <path d="M30,0C13.458,0,0,13.458,0,30s13.458,30,30,30s30-13.458,30-30S46.542,0,30,0z M30,58C14.561,58,2,45.439,2,30 |
||
131 | S14.561,2,30,2s28,12.561,28,28S45.439,58,30,58z"/> |
||
132 | </g> |
||
133 | <g> |
||
134 | </g> |
||
135 | <g> |
||
136 | </g> |
||
137 | <g> |
||
138 | </g> |
||
139 | <g> |
||
140 | </g> |
||
141 | <g> |
||
142 | </g> |
||
143 | <g> |
||
144 | </g> |
||
145 | <g> |
||
146 | </g> |
||
147 | <g> |
||
148 | </g> |
||
149 | <g> |
||
150 | </g> |
||
151 | <g> |
||
152 | </g> |
||
153 | <g> |
||
154 | </g> |
||
155 | <g> |
||
156 | </g> |
||
157 | <g> |
||
158 | </g> |
||
159 | <g> |
||
160 | </g> |
||
161 | <g> |
||
162 | </g> |
||
163 | </svg> |
||
164 | PAUSESVG; |
||
165 | |||
166 | public function init() |
||
177 | |||
178 | public function run() |
||
199 | |||
200 | public function createButton($label, $id, $svg) |
||
208 | } |