diff --git a/docs/omnireader/old/.htaccess b/docs/omnireader/old/.htaccess
new file mode 100644
index 00000000..2f0109d5
--- /dev/null
+++ b/docs/omnireader/old/.htaccess
@@ -0,0 +1,6 @@
+#RewriteEngine On
+#RewriteCond %{HTTP_HOST} ^www.bookpauk.ru$ [NC]
+#RewriteRule ^(.*)$ http://bookpauk.ru/$1 [R=301,L]
+
+Options None
+Options +ExecCGI
diff --git a/docs/omnireader/old/apple-touch-icon-precomposed.png b/docs/omnireader/old/apple-touch-icon-precomposed.png
new file mode 100644
index 00000000..660c29e7
Binary files /dev/null and b/docs/omnireader/old/apple-touch-icon-precomposed.png differ
diff --git a/docs/omnireader/old/apple-touch-icon.png b/docs/omnireader/old/apple-touch-icon.png
new file mode 100644
index 00000000..660c29e7
Binary files /dev/null and b/docs/omnireader/old/apple-touch-icon.png differ
diff --git a/docs/omnireader/old/config/config.js b/docs/omnireader/old/config/config.js
new file mode 100644
index 00000000..9d3456b0
--- /dev/null
+++ b/docs/omnireader/old/config/config.js
@@ -0,0 +1,2 @@
+ siteroot = 'http://omnireader.ru:11080/';
+ doRedirect = '';
diff --git a/docs/omnireader/old/config/config.php b/docs/omnireader/old/config/config.php
new file mode 100644
index 00000000..c51fd1ee
--- /dev/null
+++ b/docs/omnireader/old/config/config.php
@@ -0,0 +1,5 @@
+
diff --git a/docs/omnireader/old/f.php b/docs/omnireader/old/f.php
new file mode 100644
index 00000000..326f8b96
--- /dev/null
+++ b/docs/omnireader/old/f.php
@@ -0,0 +1,447 @@
+ 0,
+ 'w' => 0,
+ 'd' => 0,
+ 'i' => 0,
+ 'm' => 0
+ );
+
+ $length = strlen($str);
+ $block_size = ($length > 5*3000) ? 3000 : $length;
+ $counter = 0;
+ for ( $i = 0; $i < $length; $i++ ) {
+ $char = ord($str[$i]);
+
+ //non-russian characters
+ if ($char < 128 || $char > 256)
+ continue;
+ //CP866
+ if (($char > 159 && $char < 176) || ($char > 223 && $char < 242)) $charsets['d']+=LOWERCASE;
+ if (($char > 127 && $char < 160)) $charsets['d']+=UPPERCASE;
+
+ //KOI8-R
+ if (($char > 191 && $char < 223)) $charsets['k']+=LOWERCASE;
+ if (($char > 222 && $char < 256)) $charsets['k']+=UPPERCASE;
+
+ //WIN-1251
+ if ($char > 223 && $char < 256) $charsets['w']+=LOWERCASE;
+ if ($char > 191 && $char < 224) $charsets['w']+=UPPERCASE;
+
+ //MAC
+ if ($char > 221 && $char < 255) $charsets['m']+=LOWERCASE;
+ if ($char > 127 && $char < 160) $charsets['m']+=UPPERCASE;
+
+ //ISO-8859-5
+ if ($char > 207 && $char < 240) $charsets['i']+=LOWERCASE;
+ if ($char > 175 && $char < 208) $charsets['i']+=UPPERCASE;
+
+ $counter++;
+ if ($counter > $block_size) {
+ $counter = 0;
+ $i += (int)($length/2 - 2*$block_size);
+ }
+ }
+
+ arsort($charsets);
+ if (preg_match('//u', $str))
+ return 'u';
+ else
+ return key($charsets);
+ }
+
+ function getTag($tagName, $book) {
+ $from_tag = '<' . $tagName . '>';
+ $to_tag = '' . $tagName . '>';
+ $from = strpos($book, $from_tag);
+ $to = strpos($book, $to_tag);
+ if ($from === FALSE || $to === FALSE)
+ return '';
+ $from += strlen($from_tag);
+ return trim(substr($book, $from, $to - $from));
+ }
+
+ function getMetaInfoAndFilter($book, &$meta_info) {
+ $meta_info['author'] = '';
+ $meta_info['title'] = getTag('title', $book);
+
+ $out = $book;
+
+ //fb2 ??? ---------------------
+ if (strpos($meta_info['title'], '
') !== FALSE) {
+ $s = str_replace('
', '', $meta_info['title']);
+ $a = explode('', $s);
+ $meta_info['author'] = parseHtml($a[1], TRUE);
+ $meta_info['title'] = parseHtml($a[2], TRUE);
+ if ($meta_info['title'] === NULL || $meta_info['title'] === '') {
+ $s = parseHtml($s, TRUE);
+ $meta_info['author'] = '';
+ $meta_info['title'] = $s;
+ }
+ }
+
+ //samlib ----------------------
+ $samlib_start_sign = '';
+ $samlib_book_idx = strpos($book, $samlib_start_sign);
+ if ($samlib_book_idx !== FALSE) {
+ $samlib_author = getTag('h3', $book);
+ $meta_info['author'] = substr($samlib_author, 0, strpos($samlib_author, ': '));
+ $meta_info['title'] = getTag('h2', $book);;
+ $samlib_book_idx += strlen($samlib_start_sign);
+ $samlib_book_end_idx = strpos($book, '');
+ $samlib_book_end_idx = ($samlib_book_end_idx === FALSE ? strlen($book) : $samlib_book_end_idx);
+ $out = '' . $meta_info['author'] . '' . $meta_info['title'] . ' ' .
+ substr($book, $samlib_book_idx, $samlib_book_end_idx - $samlib_book_idx);
+ $out = preg_replace("/  [;]*\s*[\r\n]/", ' ', $out);
+ }
+
+ return $out;
+ }
+
+ function filterTextAndGzip($meta_info, $txtin) {
+ global $use_gzip;
+
+ if (strpos($txtin, '') === FALSE) {
+ $len = strlen($txtin);
+ $counts = array();
+
+ $flag = 0;
+ $c = 0;
+ for ($i = 0; $i < $len; $i++) {
+ if ($txtin[$i] == chr(10) || $i == 0) {
+ $counts[$c]++;
+ if ($c > 0)
+ $counts[0]++;
+ $c = 0;
+ $flag = 1;
+ } else
+ if ($txtin[$i] != ' ')
+ $flag = 0;
+ else
+ if ($flag)
+ $c++;
+ }
+
+ arsort($counts);
+ $key = 0;
+ if (count($counts) > 1) {
+ next($counts);
+ $key = key($counts);
+ }
+
+ //$txtout .= print_r($counts, TRUE);
+ //$txtout .= $key;
+
+ $txtout = '';
+ $flag = 0;
+ $c = 0;
+ for ($i = 0; $i < $len; $i++) {
+ if ($txtin[$i] == chr(10) || $i == 0) {
+ $c = 0;
+ $flag = 1;
+ } else
+ if ($txtin[$i] != ' ') {
+ if ($c >= $key && $flag)
+ $txtout .= '
';
+ $flag = 0;
+ }
+ else
+ if ($flag)
+ $c++;
+ $txtout .= $txtin[$i];
+ }
+ } else
+ $txtout = $txtin;
+
+ $txtout = 'no_file' . '|' . $meta_info['author'] . '|' . $meta_info['title'] .
+ '<<>>' . $txtout;
+
+ $supportsGzip = strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false;
+ if ($use_gzip && $supportsGzip && getParam('meta') == '' && getParam('curl') == '') {
+ $txtout = gzencode($txtout, 9);
+ header('Content-Encoding: gzip');
+ }
+
+ return $txtout;
+ }
+
+ function myErrorHandler($errno, $errstr, $errfile, $errline)
+ {
+ if (!(error_reporting() & $errno)) {
+ // Этот код ошибки не включен в error_reporting
+ return;
+ }
+
+ if ($errno == 8 /*|| $errno == 2*/)
+ return;
+ //throw new Exception("[$errno]: ($errstr) at $errfile line $errline");
+ throw new Exception("$errstr");
+
+ // Не запускаем внутренний обработчик ошибок PHP
+ return TRUE; // сюда хода нет, но пусть будет как шаблон
+ }
+
+ function unzip($filein) {
+ $zip = new ZipArchive;
+ $result = '';
+ if ($zip->open($filein) === TRUE) {
+ $filename = '';
+ $max_size = -1;
+ for($i = 0; $i < $zip->numFiles; $i++) {
+ $stat = $zip->statIndex($i);
+ $size = $stat['size'];
+ if ($size > $max_size) {
+ $max_size = $size;
+ $filename = $zip->getNameIndex($i);
+ $fp = $zip->getStream($filename);
+ if (!$fp)
+ throw new Exception("zip->getStream failed");
+ $result = stream_get_contents($fp);
+ fclose($fp);
+ }
+ }
+ $zip->close();
+ } else
+ throw new Exception("zip->open failed");
+
+ return $result;
+ }
+
+ function create_guid($namespace = '') {
+ $uid = md5(uniqid("", true));
+ $data = $namespace;
+ $data .= $_SERVER['REQUEST_TIME'];
+ $data .= $_SERVER['HTTP_USER_AGENT'];
+ $data .= $_SERVER['LOCAL_ADDR'];
+ $data .= $_SERVER['LOCAL_PORT'];
+ $data .= $_SERVER['REMOTE_ADDR'];
+ $data .= $_SERVER['REMOTE_PORT'];
+ $hash = strtoupper(hash('ripemd128', $uid . $guid . md5($data)));
+ return $hash;
+ }
+
+ function microtime_float()
+ {
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+ }
+
+ function curlExec(/* Array */$curlOptions='', /* Array */$curlHeaders='', /* Array */$postFields='')
+ {
+ $newUrl = '';
+ $maxRedirection = 10;
+ do
+ {
+ if ($maxRedirection<1) die('Error: reached the limit of redirections');
+
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+ if (!empty($curlOptions)) curl_setopt_array($ch, $curlOptions);
+ if (!empty($curlHeaders)) curl_setopt($ch, CURLOPT_HTTPHEADER, $curlHeaders);
+ if (!empty($postFields))
+ {
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
+ }
+
+ if (!empty($newUrl)) curl_setopt($ch, CURLOPT_URL, $newUrl); // redirect needed
+ curl_setopt($ch, CURLOPT_HEADER, 1);
+
+ $response = curl_exec($ch);
+ // Then, after your curl_exec call:
+ $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
+ $header = substr($response, 0, $header_size);
+ $curlResult = substr($response, $header_size);
+
+ $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $info = curl_getinfo($ch);
+ if (getParam('curl') != '') {;
+ throw new Exception(" " . str_replace("[", " [", print_r($info, TRUE)) . " $header END");
+ }
+
+ if ($code == 301 || $code == 302 || $code == 303 || $code == 307)
+ {
+ if (array_key_exists('redirect_url', $info) && !empty($info['redirect_url'])) {
+ $newUrl = trim($info['redirect_url']);
+ } else {
+ preg_match('/Location:(.*?)\n/', $header, $matches);
+ $newUrl = trim(array_pop($matches));
+ }
+ curl_close($ch);
+
+ $maxRedirection--;
+ continue;
+ }
+ else // no more redirection
+ {
+ if ($curlResult === FALSE || $info['http_code'] != 200) {
+ $curlResult = "ERROR ". $info['http_code'];
+ if (curl_error($ch))
+ $curlResult .= " ". curl_error($ch);
+ throw new Exception($curlResult);
+ } else {
+ $code = 0; //OK
+ curl_close($ch);
+ }
+ }
+ }
+ while($code);
+ return $curlResult;
+ }
+{
+ set_error_handler("myErrorHandler");
+// set_time_limit(300);
+
+ $url = getParam('url');
+ try {
+ $body = '';
+ if ($url == '')
+ throw new Exception("не задан адрес книги");
+
+ $meta_info = array();
+ $time_start = $time = microtime_float();
+
+ $pid = create_guid();
+ $dir = 'txt/';
+ $encoding = getParam('encoding');
+
+ if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0)
+ $url = 'http://' . $url;
+ $url = str_replace('"', '', $url);
+ $url = str_replace('\'', '', $url);
+ $url = str_replace(']', '%5D', str_replace('[', '%5B', $url));
+
+ $options = array(
+ CURLOPT_RETURNTRANSFER => TRUE,
+ CURLOPT_TIMEOUT => 300,
+ CURLOPT_URL => $url,
+ CURLOPT_BUFFERSIZE => 1024*128,
+ CURLOPT_NOPROGRESS => FALSE,
+ CURLOPT_USERAGENT => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6",
+ CURLOPT_PROGRESSFUNCTION => function(
+ $DownloadSize, $Downloaded, $UploadSize, $Uploaded
+ ) {
+ // If $Downloaded exceeds, returning non-0 breaks the connection!
+ return ($Downloaded > (50 * 1024 * 1024)) ? 1 : 0;
+ }
+ );
+
+ $out = curlExec($options);
+
+ $meta_info['time_curl'] = microtime_float() - $time;
+ $time = microtime_float();
+
+ //zip
+ if ($out[0] == chr(0x50) && $out[1] == chr(0x4B) && $out[2] == chr(0x03) && $out[3] == chr(0x04)) {
+ $zipped_file = $tmp_dir . "/{$pid}-temp.zip";
+ file_put_contents($zipped_file, $out);
+ $out = unzip($zipped_file);
+ if (file_exists($zipped_file)) unlink($zipped_file);
+ }
+
+ //pdf
+/* if ($out[0] == chr(0x25) && $out[1] == chr(0x50) && $out[2] == chr(0x44) && $out[3] == chr(0x46)) {
+ $a = new PDF2Text();
+ $a->reset();
+ $a->decodePDF($out);
+ $out = $a->output();
+ file_put_contents('/tmp/1', $out);
+ }*/
+
+ $meta_info['time_unzip'] = microtime_float() - $time;
+ $time = microtime_float();
+
+ //decoding and parsing
+ if ($out !== FALSE) {
+ if ($encoding == '')
+ $encoding = getEncoding($out);
+
+ switch ($encoding) {
+ case 'k':
+ $out = mb_convert_encoding($out, 'cp1251', 'KOI8-R');
+ break;
+ case 'w':
+ break;
+ case 'd':
+ $out = mb_convert_encoding($out, 'cp1251', 'cp866');
+ break;
+ case 'i':
+ $out = mb_convert_encoding($out, 'cp1251', 'ISO-8859-5');
+ break;
+ case 'm':
+ $out = mb_convert_encoding($out, 'cp1251', 'MACINTOSH');
+ break;
+ case 'u':
+ $out = mb_convert_encoding($out, 'cp1251', 'UTF-8');
+ break;
+ }
+ //$out = $encoding . '===' . $out;
+
+//file_put_contents('/tmp/bpr1', $out);
+ $meta_info['time_decodepage'] = microtime_float() - $time;
+ $time = microtime_float();
+
+ $out = getMetaInfoAndFilter($out, $meta_info);
+
+ $meta_info['time_metainfo'] = microtime_float() - $time;
+ $time = microtime_float();
+
+ $out = parseHtml($out);
+
+ $meta_info['time_parsehtml'] = microtime_float() - $time;
+ $time = microtime_float();
+
+ $out = filterTextAndGzip($meta_info, $out);
+
+ $meta_info['time_filter_gzip'] = microtime_float() - $time;
+ $meta_info['time_total'] = microtime_float() - $time_start;
+
+ $meta = getParam('meta');
+ if ($meta != '') {
+ $info = '';
+ foreach ($meta_info as $key => $value) {
+ if (strpos($key, 'time') !== FALSE)
+ $info .= sprintf("%06.3f", $value) . " $key ";
+ else
+ $info .= "$key: $value ";
+ }
+ throw new Exception(" " . $info);
+ }
+
+ header('Content-Type: text/plain; charset=windows-1251');
+ echo $out;
+//file_put_contents('/tmp/bpr2', $out);
+ return;
+ } else
+ throw new Exception("ошибка загрузки файла. Попробуйте еще раз.");
+ } catch (Exception $e) {
+ header('Content-Type: text/html; charset=windows-1251');
+ $err = $e->getMessage();
+ if (strpos($err, 'ERROR 404') !== FALSE)
+ $err = 'страница не найдена';
+ $body = "Ошибка загрузки книги: " . ($url == '' ? '' : "($url) ") . $err;
+ }
+ echo $body;
+}
+?>
diff --git a/docs/omnireader/old/favicon.ico b/docs/omnireader/old/favicon.ico
new file mode 100644
index 00000000..30a42031
Binary files /dev/null and b/docs/omnireader/old/favicon.ico differ
diff --git a/docs/omnireader/old/index.html b/docs/omnireader/old/index.html
new file mode 100644
index 00000000..7107acf0
--- /dev/null
+++ b/docs/omnireader/old/index.html
@@ -0,0 +1,279 @@
+
+
+
+
+
+
+
+
+ Omni Reader - браузерная онлайн-читалка
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JavaScript disabled
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Omni Reader - браузерная онлайн-читалка.
+ Добро пожаловать!
+
+
+
Адрес книги (URL):
+
+
+
+
+
+
+
+
+
Возможности читалки:
+
- загрузка любой страницы интернета
+
- подключение к интернету не обязательно для чтения книги после ее загрузки
+
- возможность изменить цвет фона, текста, размер и тип шрифта, размер панели статуса
+
- запоминание текущей позиции и настроек в браузере
+
- переход на заданную страницу
+
- плавный скроллинг текста
+
- управление кликом для сенсорных экранов
+
- регистрация не требуется
+
+ В качестве URL можно задавать html-страничку с книгой, либо прямую ссылку на файл из онлайн-библиотеки (например, скопировав адрес ссылки или кнопки "скачать fb2").
+ Поддерживаемые форматы: html, txt, fb2, fb2.zip
+
+ Вы можете добавить в свой браузер закладку, указав в ее свойствах вместо адреса следующий код:
+
javascript:location.href='http://omnireader.ru:11080/?url='+location.href;
+ Тогда, нажав на получившуюся кнопку на любой странице интернета, вы автоматически откроете ее в Omni Reader.
+
+ Для Chrome на Android можно вызывать закладку по ее имени (имя стоит сделать попроще) в адресной строке браузера, поскольку стандартный вызов такой закладки не работает.
+
+ Количество и нумерация страниц в читалке зависит от размера окна браузера.
+
+ Популярные ресурсы с книгами и электронные библиотеки:
+
samlib.ru
+
flibusta.is
+
fantasy-worlds.org
+
www.litmir.co
+
lib.ru
+
+ При необходимости загрузить файл с локального диска в читалку , можно воспользоваться одним из файлообменных
+ сервисов. Рекомендуемые файлообменники:
+
fayloobmennik.cloud
+
zaix.ru
+
+ После загрузки файла на обменник, прямую ссылку на файл необходимо скопировать в поле "Адрес книги" (см. выше).
+
+ Известные проблемы:
+
- при изменении/применении настроек бывают сбои из-за масштабирования страницы. Помогает обновление страницы в браузере.
+
+
+
+
+
Управление:
+
M - МЕНЮ
+
PgUp, Left, Shift+Space, Backspace - страницу назад
+
PgDown, Right, Space, Enter - страницу вперёд
+
Home - в начало книги
+
End - в конец книги
+
Up - строчку назад
+
Down - строчку вперёд
+
A, Shift+A - изменить размер шрифта
+
S - показать/скрыть полосу прокрутки
+
T - включить/отключить управление кликом
+
F, F11, ` (апостроф) - вкл./выкл. полный экран
+
Z, Shift+Down - плавный скроллинг текста
+
Shift+Left/Shift+Right - увеличить/уменьшить интервал скроллинга
+
R - принудительно обновить книгу в обход кэша
+
+ Управление на сенсорных экранах (кликом):
+
PgUp-------Up------PgUp
+
PgDown---Menu---PgDown
+
PgDown---Down---PgDown
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docs/omnireader/old/info.txt b/docs/omnireader/old/info.txt
new file mode 100644
index 00000000..9b6cf7f5
--- /dev/null
+++ b/docs/omnireader/old/info.txt
@@ -0,0 +1 @@
+omnireader.ru
\ No newline at end of file
diff --git a/docs/omnireader/old/js/bpr318.js b/docs/omnireader/old/js/bpr318.js
new file mode 100644
index 00000000..5bbd526a
--- /dev/null
+++ b/docs/omnireader/old/js/bpr318.js
@@ -0,0 +1,1253 @@
+version = 'v3.1.8';
+
+function splitRGB(color) //обработка цвета
+{
+ var matches = color.match(/^#?([\dabcdef]{2})([\dabcdef]{2})([\dabcdef]{2})$/i);
+ if (!matches)
+ return false;
+ for (var i=1, rgb = new Array(3); i<=3; i++)
+ rgb[i-1] = parseInt(matches[i],16);
+ return rgb;
+}
+
+function rgb2hex(r,g,b)
+{
+ if(r>255) r=255; //0_o быдлокодинг такой быдлокодинг
+ if(g>255) g=255;
+ if(b>255) b=255;
+ return '#'+Number(r).toString(16).toUpperCase().replace(/^(.)$/,'0$1') +
+ Number(g).toString(16).toUpperCase().replace(/^(.)$/,'0$1') +
+ Number(b).toString(16).toUpperCase().replace(/^(.)$/,'0$1');
+}
+
+function base64color(arr) //цвет обрамления
+{
+ var r=arr[0];
+ var g=arr[1];
+ var b=arr[2];
+ if(r>63) r=63; //0_o быдлокодинг такой быдлокодинг
+ if(g>63) g=63;
+ if(b>63) b=63;
+ var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
+ var enc1 = r >> 2;
+ var enc2 = ((r & 3) << 4) | (g >> 4);
+ var enc3 = ((g & 15) << 2) | (b >> 6);
+ var enc4 = b & 63;
+ return keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
+}
+
+function setColors() {
+ var fc = splitRGB(cfg.fontcolor);
+ var bg = splitRGB(cfg.bgcolor);
+ var Q=[Math.round((fc[0]+3*bg[0])/16),Math.round((fc[1]+3*bg[1])/16),Math.round((fc[2]+3*bg[2])/16)];
+ var M=[Math.round((fc[0]+bg[0])/8),Math.round((fc[1]+bg[1])/8),Math.round((fc[2]+bg[2])/8)];
+
+ var middlecolor=rgb2hex(M[0]*4,M[1]*4,M[2]*4);
+
+ colorMiddleB64=base64color(M);
+ colorQuarterB64=base64color(Q);;
+ if (fc[0]+fc[0]+fc[0]>bg[0]+bg[1]+bg[2]) {
+ linkcolor=rgb2hex(Math.round(3*(fc[0]+bg[0])/4),Math.round(3*(fc[1]+bg[1])/4),Math.round(3*(fc[2]+bg[2])/4));
+ } else {
+ linkcolor=rgb2hex(Math.round((fc[0]+bg[0])/4),Math.round((fc[1]+bg[1])/4),Math.round((fc[2]+bg[2])/4));
+ }
+
+ document.body.link=document.body.vLink=
+ document.body.aLink=
+ gdb('comm').style.color=
+ gdb('footer').style.color=linkcolor;
+
+ document.body.style.color=gdb('book').style.color=gdb('main').style.color=
+ gdb('pageGoto').style.color=
+ gdb('cross').style.backgroundColor=
+ gdb('mcross').style.backgroundColor=gdb('clrdiv').style.color=
+ gdb('clrdiv2').style.color=
+ gdb('btnOk').style.color=
+ cfg.fontcolor;
+
+ document.body.style.backgroundColor='#000000';
+
+ gdb('win').style.backgroundColor=gdb('comm').style.backgroundColor=
+ gdb('cross').style.color=
+ gdb('mcross').style.color=
+ gdb('clrdiv').style.backgroundColor=gdb('clrdiv2').style.backgroundColor=
+ cfg.bgcolor;
+
+ var hr=document.getElementsByTagName('HR');
+ gdb('colorSelect').children[2].style.borderColor=gdb('colorSelect').children[2].children[1].style.borderColor=
+ gdb('colorSelect').children[2].children[2].style.borderColor=hr[0].style.color=hr[0].style.backgroundColor=
+ gdb('comm').style.borderColor=middlecolor;
+
+ hr=null;
+
+ //
+ handlerAdd(gdb('cross'),'mouseover',function() {gdb('cross').style.color=middlecolor;});
+ handlerAdd(gdb('cross'),'mouseout',function() {gdb('cross').style.color=cfg.bgcolor;});
+ handlerAdd(gdb('mcross'),'mouseover',function() {gdb('mcross').style.color=middlecolor;});
+ handlerAdd(gdb('mcross'),'mouseout',function() {gdb('mcross').style.color=cfg.bgcolor;});
+
+}
+
+function handlerAdd(object, event, handler) {
+ if (object.addEventListener)
+ object.addEventListener(event, handler, false);
+ else
+ if (object.attachEvent)
+ object.attachEvent('on' + event, handler);
+ else
+ object['on' + event] = handler;
+}
+
+function handlerRemove(object, event, handler) {
+ if (object.removeEventListener)
+ object.removeEventListener(event, handler, false);
+ else
+ if (object.detachEvent)
+ object.detachEvent('on' + event, handler);
+}
+
+//ниже: ловим клаву
+function key(event) {
+ if (!event) event = window.event;
+ var thekey=event.keyCode ? event.keyCode + 32 : event.charCode;
+ tM(event.shiftKey,event.ctrlKey,thekey, event);
+}
+
+var m_legend = {
+ 40: {30: 'PgUp', 100: 'PgDown'},
+ 60: {40: 'Up', 60: 'Menu', 100: 'Down'},
+ 100: {30: 'PgUp', 100: 'PgDown'}
+};
+
+function processClick(w, h) {
+ var e = '';
+ if (typeof(event) == 'string') {
+ e = event;
+ } else {
+ loops: {
+ for (var perx in m_legend) {
+ for (var pery in m_legend[perx]) {
+ if (w < perx && h < pery) {
+ e = m_legend[perx][pery];
+ break loops;
+ }
+ }
+ }
+ }
+ if (e != '')
+ button = 1;
+ }
+
+ switch (e) {
+ case 'Down' ://Down
+ setTop(null, cfg.step);
+ break;
+ case 'Up' ://Up
+ setTop(null, -cfg.step);
+ break;
+ case 'PgDown' ://PgDown
+ setTop(null, phei - cfg.step);
+ break;
+ case 'PgUp' ://PgUp
+ setTop(null, -(phei - cfg.step));
+ break;
+ case 'Menu' ://M
+ menu();
+ break;
+ default :
+ // Nothing
+ break;
+ }
+ if (doRepeatClick && e != '' && e != 'Menu') {
+ if (mTimer > 20)
+ mTimer = mTimer*0.5;
+ processClickTimeout=setTimeout('processClick('+w+','+h+')', mTimer);
+ }
+}
+
+
+function mClick(event) {
+ if (cfg.by_click) {
+ var win = gdb('win');
+ var w = event.clientX/win.offsetWidth*100;
+ var h = event.clientY/win.offsetHeight*100;
+
+ doRepeatClick = 1;
+ mTimer = 1000;
+ processClick(w, h);
+ ie8SafePreventEvent(event);
+ }
+}
+
+function mClickUp(event) {
+ mTouchEnd(event);
+}
+
+function mTouchStart(event) {
+ if (cfg.by_click) {
+ if (event.touches.length == 1) {
+ event.preventDefault();
+ e = event.touches[0];
+ var win = gdb('win');
+ var w = e.clientX/win.offsetWidth*100;
+ var h = e.clientY/win.offsetHeight*100;
+
+ doRepeatClick = 1;
+ mTimer = 1000;
+ processClick(w, h);
+ }
+ }
+}
+
+function mTouchEnd(event) {
+ doRepeatClick = 0;
+ if (processClickTimeout != null)
+ clearTimeout(processClickTimeout);
+}
+
+function openLink(event, obj, target) {
+ if (target == null)
+ target = '_blank';
+ window.open(obj.href, target);
+ ie8SafePreventEvent(event);
+ return false;
+}
+
+function toggleFullScreen() {
+ if ((document.fullScreenElement && document.fullScreenElement !== null) ||
+ (!document.mozFullScreen && !document.webkitIsFullScreen)) {
+ if (document.documentElement.requestFullScreen) {
+ document.documentElement.requestFullScreen();
+ } else if (document.documentElement.mozRequestFullScreen) {
+ document.documentElement.mozRequestFullScreen();
+ } else if (document.documentElement.webkitRequestFullScreen) {
+ document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
+ }
+ } else {
+ if (document.cancelFullScreen) {
+ document.cancelFullScreen();
+ } else if (document.mozCancelFullScreen) {
+ document.mozCancelFullScreen();
+ } else if (document.webkitCancelFullScreen) {
+ document.webkitCancelFullScreen();
+ }
+ }
+}
+
+function ie8SafePreventEvent(e) {
+ if (e.preventDefault) {
+ e.preventDefault()
+ } else
+ if (e.stop)
+ e.stop();
+
+ e.returnValue = false;
+ if (e.stopPropagation)
+ e.stopPropagation();
+}
+//ниже: ловим нажатия клавиш
+function tM(shift,ctrl,key, event) {
+ var srcEl = event.srcElement? event.srcElement : event.target;
+ //alert(srcEl.tagName);
+ //alert(key);
+ if (!ctrl && (srcEl.tagName == 'BODY' || srcEl.tagName == 'DIV'))
+ switch (key)
+ {
+ case 72 ://Down
+ if (shift)
+ toggleScroll();
+ else
+ setTop(null, cfg.step);
+ ie8SafePreventEvent(event);
+ break;
+ case 70 ://Up
+ setTop(null, -cfg.step);
+ ie8SafePreventEvent(event);
+ break;
+ case 66 ://PgDown
+ case 45 ://Enter
+ setTop(null, phei - cfg.step);
+ ie8SafePreventEvent(event);
+ break;
+ case 64 ://Space
+ shift ? setTop(null, -(phei - cfg.step)) : setTop(null, phei - cfg.step);
+ ie8SafePreventEvent(event);
+ break;
+ case 65 ://PgUp
+ case 40 ://BackSpace
+ setTop(null, -(phei - cfg.step));
+ ie8SafePreventEvent(event);
+ break;
+ case 67 ://End
+ setTop(clih - phei);
+ ie8SafePreventEvent(event);
+ break;
+ case 68 ://Home
+ setTop(0);
+ ie8SafePreventEvent(event);
+ break;
+ case 109: //M
+ menu();
+ ie8SafePreventEvent(event);
+ break;
+ case 97: //A
+ shift ? incFont(-1) : incFont(1);
+ ie8SafePreventEvent(event);
+ break;
+ case 115: //S
+ gdb('id_scroll').checked = !gdb('id_scroll').checked;
+ showScroll();
+ ie8SafePreventEvent(event);
+ break;
+ case 116: //T
+ gdb('id_by_click').checked = !gdb('id_by_click').checked;
+ byClick();
+ ie8SafePreventEvent(event);
+ break;
+ case 224://`
+ case 102://F
+ toggleFullScreen();
+ ie8SafePreventEvent(event);
+ break;
+ case 122://Z
+ toggleScroll();
+ ie8SafePreventEvent(event);
+ break;
+ case 59://Escape
+ if (sti) {
+ toggleScroll();
+ ie8SafePreventEvent(event);
+ }
+ break;
+ case 71://Right
+ if (shift) {
+ gdb('id_sc_int').value = cfg.sc_int - 1;
+ scrollInterval();
+ } else {
+ setTop(null, phei - cfg.step);
+ ie8SafePreventEvent(event);
+ }
+
+ break;
+ case 69://Left
+ if (shift) {
+ gdb('id_sc_int').value = cfg.sc_int + 1;
+ scrollInterval();
+ } else {
+ setTop(null, -(phei - cfg.step));
+ ie8SafePreventEvent(event);
+ }
+ break;
+ case 114:
+ reloadBook();
+ break;
+ default :
+ // Nothing
+ break;
+ }
+ return false;
+}
+
+//колесо
+function wheel(event) {
+ var delta = 0;
+ if (!event)
+ event = window.event;
+ if (event.wheelDelta)
+ delta = event.wheelDelta/120;
+ else
+ if (event.detail)
+ delta = -event.detail/3;
+ if (delta)
+ handle(delta);
+ return false;
+}
+
+function handle(delta) {
+ if (delta < 0)
+ setTop(null, cfg.step);
+ else
+ setTop(null, -cfg.step);
+}
+
+//ниже: упрошаемс, в финальной версии набо бы убрать
+function gdb(id)
+{
+ return document.getElementById(id);
+}
+
+function supports_html5_storage() {
+ try {
+ return 'localStorage' in window && window['localStorage'] !== null;
+} catch (e) {
+ return false;
+ }
+}
+
+function saveLocalValue(key, value, expires_days, no_escape) {
+ if (value != null) {
+ if (no_escape == null)
+ localStorage[key] = escape(value);
+ else
+ localStorage[key] = value;
+ if (expires_days == null)
+ expires_days = 0;
+ localStorage[key+'=timestamp'] = (new Date()) + ';' + expires_days;
+ }
+ else {
+ localStorage.removeItem(key);
+ localStorage.removeItem(key+'=timestamp');
+ }
+}
+
+//кукисы и localStorage
+function saveValue(name, value, expires_days, no_escape) {
+ var key = escape(name);
+ if (is_storage) {
+ try {
+ saveLocalValue(key, value, expires_days, no_escape);
+ } catch (e) {
+ //alert('LocalStorage, ошибка: ' + e.message);
+ var size = 0;
+ //С начала - хоть какой-то механизм очереди
+ for ( var i = 0; i < localStorage.length; i++ ) {
+ var lkey = localStorage.key( i );
+
+ var v = localStorage[lkey];
+ //lkeys = lkeys + unescape(lkey) + ":" + (v != null ? v.length : 0) + "\n";
+
+ if (v != null && v.length > 10000) {
+ size += v.length;
+ localStorage.removeItem(lkey);
+ localStorage.removeItem(lkey+'=timestamp');
+ i = 0;
+ if (size > value.length)
+ break;
+ }
+ }
+ //Чистка протухших, с конца
+ for ( var i = localStorage.length; i >= 0 ; i-- ) {
+ var lkey = unescape(localStorage.key( i ));
+ loadValue(lkey);
+ }
+
+ try { saveLocalValue(key, value, expires_days, no_escape) } catch(e) {};
+ //alert(size);
+ //LocalStorage.clear();
+ }
+ if (document.cookie != '')
+ document.cookie = '';
+ } else {
+ var exp = new Date();
+ if (expires_days)
+ exp.setHours(exp.getHours() + 24*expires_days);
+ document.cookie = key + "=" + escape(value) +
+ ((expires_days) ? "; expires=" + exp.toUTCString() : "") +
+ "; path=/";
+ }
+}
+
+function getCookie(name) {
+ var setStr = null;
+ var cookie = " " + document.cookie;
+ var search = " " + name + "=";
+ var offset = 0;
+ var end = 0;
+ if (cookie.length > 0) {
+ offset = cookie.indexOf(search);
+ if (offset != -1) {
+ offset += search.length;
+ end = cookie.indexOf(";", offset)
+ if (end == -1)
+ end = cookie.length;
+ setStr = unescape(cookie.substring(offset, end));
+ }
+ }
+ return(setStr);
+}
+
+function loadValue(name, no_escape) {
+ var value = null;
+ if (is_storage) {
+ var key = escape(name);
+ value = localStorage[key];
+ var ts = localStorage[key+'=timestamp'];
+ if (value != null && no_escape == null)
+ value = unescape(value);
+ if (ts != null) {
+ ts = ts.split(";");
+ var exp = new Date(ts[0]);
+ exp.setHours(exp.getHours() + 24*ts[1]);
+ if (exp < new Date()) {
+ value = null;
+ localStorage.removeItem(key);
+ localStorage.removeItem(key+'=timestamp');
+ }
+ } else {
+ localStorage.removeItem(key);
+ localStorage.removeItem(key+'=timestamp');
+ }
+ }
+ if (value == null)
+ value = getCookie(escape(name));
+ if (value == null)
+ value = getCookie(name);
+ return(value);
+}
+
+//счётчик страниц и процентов
+function tMh() {
+ if (!sti || gdb('main').scrollTop%cfg.step == 0) {
+ var top = Math.round(gdb('main').scrollTop/cfg.step)*cfg.step;
+ gdb('main').scrollTop = top;
+
+ pcount = Math.ceil( clih / (phei-cfg.step) );
+ if (clih == phei)
+ pcount = 1;
+ var page = Math.floor((top - cfg.step) / (phei-cfg.step) + 2);
+ percent = Math.round(top / (clih-phei) * 10000) / 100; //(top==0) ? 0 :
+ if (clih == phei)
+ percent = 100;
+ gdb('pagePercent').innerHTML=' [ ' + percent.toFixed(2) + '%' + ' ] ';
+ gdb('pageCount').children[1].innerHTML=page + '/' + pcount;
+ gdb('pageGoto').value=page;
+
+ if (stadc == null)
+ stadc = setTimeout('addCook()', 300);
+ };
+ if (sttmh != null) {
+ clearTimeout(sttmh);
+ sttmh = null;
+ }
+}
+
+//переход на страницу
+function goTo() {
+ var gpage=parseInt(gdb('pageGoto').value);
+ setTop((((gpage-2)*(phei-cfg.step) + cfg.step)/cfg.step).toFixed(0)*cfg.step);
+}
+
+function pageGoto(gpag) {
+ if (gpa) {
+ var gpage=parseInt(gdb('pageGoto').value);
+ gpage = gpag ? (gpage > 1 ? gpage-1 : 1) : (gpage20)
+ timer=timer/2;
+ } else
+ timer=300;
+}
+
+function pageMove(arrow) {
+ handlerAdd(document,'mouseup',pageMoveClear);
+ if (timer>20) timer=timer*0.9;
+ setTop(null, (arrow ? cfg.step-phei : phei-cfg.step));
+ pageMoveTimeout=setTimeout('pageMove('+arrow+')',timer);
+}
+
+function pageMoveShow(pS,nS) {
+ pageMoveTemp = pageMoveTemp ? 0 : 1;
+ gdb('pageCount').children[0].style.visibility=
+ gdb('pageCount').children[2].style.visibility=
+ pageMoveTemp ? 'visible' : 'hidden';
+}
+
+function pageMoveClear() {
+ if (timer<300) {
+ clearTimeout(pageMoveTimeout);
+ handlerRemove(document,'mouseup',pageMoveClear);
+ timer=300;
+ }
+}
+
+//время
+function showTime()
+{
+ var tmN=new Date();
+ var dH=''+tmN.getHours();dH=dH.length<2?'0'+dH:dH;
+ var dM=''+tmN.getMinutes();dM=dM.length<2?'0'+dM:dM;
+ var tmp=dH+':'+dM;
+ if (bookloaded)
+ gdb('tm').innerHTML=tmp;
+ else
+ gdb('tm').innerHTML=version;
+ var t=setTimeout('showTime()',60000);
+}
+
+function setSelectedFontItem() {
+ if (colorFontTemp == 0) {
+ gdb('fontItemBack').style.color = 'green';
+ gdb('fontItemBack').style.textDecoration = 'underline';
+ gdb('fontItemText').style.color = 'black';
+ gdb('fontItemText').style.textDecoration = 'none';
+ } else {
+ gdb('fontItemText').style.color = 'green';
+ gdb('fontItemText').style.textDecoration = 'underline';
+ gdb('fontItemBack').style.color = 'black';
+ gdb('fontItemBack').style.textDecoration = 'none';
+ }
+}
+
+//меню выбора настроек шрифта
+function colorMenu() {
+ handlerAdd(document,'mousemove', mouseMoved);
+ colorFontTemp=0;
+ setSelectedFontItem();
+ colorFont=cfg.fontcolor;
+ colorBg=cfg.bgcolor;
+ colorSize=Math.round(cfg.step*0.8);
+ gdb('fcolor').value=colorFont;
+ gdb('bcolor').value=colorBg;
+ gdb('fsize').value=colorSize;
+ gdb('ffamily').value=cfg.fontfamily;
+ if (gdb('ffamily').value != cfg.fontfamily)
+ gdb('ffamily2').value=cfg.fontfamily;
+ else
+ gdb('ffamily2').value='';
+
+ colorAddary=new Array(255,1,1);
+ colorClrary=new Array(360);
+ for(i=0;i<6;i++) {
+ for(j=0;j<60;j++) {
+ colorClrary[60*i+j]=new Array(3);
+ for(k=0;k<3;k++) {
+ colorClrary[60*i+j][k]=colorAddary[k];
+ colorAddary[k]+=((Math.floor(65049010/Math.pow(3,i*3+k))%3)-1)*4;
+ }
+ }
+ }
+ gdb('colorSelect').style.display='block';
+}
+
+function mouseMoved(e) {
+ var sy = e.pageX-parseInt(gdb('colorSelect').style.left)-454;
+ var sx = e.pageY-parseInt(gdb('colorSelect').style.top)-300;
+ //alert(sy+'lk'+sx);
+ if (sy>-256&&sx>-256&&sx<256&&sy<256) {
+ var quad=new Array(-180,360,180,0);
+ var xa=Math.abs(sx);
+ var ya=Math.abs(sy);
+ var d=ya*45/xa;
+ if (ya>xa)
+ d=90-(xa*45/ya);
+ var deg=Math.floor(Math.abs(quad[2*((sy<0)?0:1)+((sx<0)?0:1)]-d));
+ var n=0;
+ var c="000000";
+ var r=Math.sqrt((xa*xa)+(ya*ya));
+ if(sx!=0 || sy!=0) {
+ for(i=0;i<3;i++) {
+ r2=colorClrary[deg][i]*r/128;
+ if (r>128)
+ r2+=Math.floor(r-128)*2;
+ if (r2>255)
+ r2=255;
+ n=256*n+Math.floor(r2);
+ }
+ c=(n.toString(16)).toUpperCase();
+ while (c.length<6)
+ c="0"+c;
+ }
+ gdb('clrdiv').style.backgroundColor=colorFontTemp ? colorBg : "#"+c;
+ gdb('clrdiv').style.color=colorFontTemp ? "#"+c : colorFont;
+ tempColor="#"+c;
+ }
+ return false;
+}
+
+function colorSet() {
+ var clrdiv2=gdb('clrdiv2').style;
+ if (colorFontTemp)
+ clrdiv2.color=gdb('fcolor').value=colorFont=tempColor;
+ else
+ clrdiv2.backgroundColor=gdb('bcolor').value=colorBg=tempColor;
+}
+
+function colorChange(type, value) { //навести марафет
+ var value=value.toUpperCase();
+ if(type==2 || type==1) {
+ if (value.charAt(0)!='#')
+ value='#'+value;
+ value=value.length==7 ? value :
+ (value.length==4 ?
+ value.substr(0,2)+value.substr(1,1)+value.substr(2,1)+value.substr(2,1)+value.substr(3,1)+value.substr(3,1) :
+ (type==2 ? cfg.bgcolor : cfg.fontcolor)
+ ); //сделать человечески
+ if (type==2)
+ gdb('bcolor').value = value;
+ else
+ gdb('fcolor').value = value;
+ }
+
+ var clrdiv2=gdb('clrdiv2').style;
+ var clrdiv=gdb('clrdiv').style;
+ if (type == 4)
+ clrdiv2.fontFamily = value;
+ if (type==3 && parseInt(value) > 4 && parseInt(value) < 201)
+ clrdiv2.fontSize=clrdiv.fontSize=parseInt(value)+'px';
+ if (type==2)
+ clrdiv2.backgroundColor=clrdiv.backgroundColor=value;
+ if (type==1)
+ clrdiv2.color=clrdiv.color=value;
+ return false;
+}
+
+function saveSettings() {
+ saveValue('colorSetting', cfg.fontcolor+'|'+cfg.bgcolor+'|'+cfg.step+'|'+cfg.fontfamily+'|'+cfg.scroller+'|'+cfg.sp_size+'|'+cfg.sc_int+'|'+cfg.by_click, 36500);
+}
+
+function colorSubmit() {
+ cfg.fontcolor=gdb('fcolor').value;
+ cfg.bgcolor=gdb('bcolor').value;
+ cfg.step=Math.round(parseInt(gdb('fsize').value)/0.8);
+ cfg.fontfamily=gdb('ffamily2').value;
+ if (!cfg.fontfamily)
+ cfg.fontfamily = gdb('ffamily').value;
+ gdb('main').style.font=Math.round(cfg.step*0.8)+"px/"+cfg.step+"px Trebuchet Ms";
+ gdb('main').style.fontFamily=cfg.fontfamily;
+ saveSettings();
+ setColors();
+ onRes();
+}
+
+function colorClose() {
+ handlerRemove(document,'mousemove', mouseMoved);
+ gdb('colorSelect').style.display='none';
+ tempColor=null;
+ colorFontTemp=null;
+ colorFont=null;
+ colorBg=null;
+ colorSize=null;
+ colorAddary=null;
+ colorClrary=null;
+}
+
+function incFont(i) {
+ foSize=Math.round(cfg.step*0.8);
+ foSize += i;
+ if (foSize < 5 || foSize > 200)
+ return;
+ cfg.step=Math.round(foSize/0.8);
+ gdb('main').style.fontSize = foSize + 'px';
+ gdb('main').style.lineHeight = cfg.step + 'px';
+ saveSettings();
+ onRes();
+}
+
+function mainScroll() {
+ if (sttmh == null)
+ sttmh = setTimeout('tMh()', 500);
+}
+
+//ниже: в кукисы
+function addCook() {
+ saveValue('bpr-book-' + tit, gdb('main').scrollTop + '|' + gdb('main').scrollHeight + '|' + gdb('main').innerHTML.length, 36500);
+ if (stadc) {
+ clearTimeout(stadc);
+ stadc = null;
+ }
+}
+
+//ниже: меню
+function menu() {
+ if (gdb('comm').style.display != 'block')
+ gdb('comm').style.display="block";
+ else {
+ gdb('leg').style.display="none";
+ gdb('comm').style.display="none";
+ }
+}
+
+//ниже: легенда
+function legend(ca) {
+ if (ca) {
+ gdb('leg').style.display="block";
+ gdb('leg').style.left=Math.round((widt-((widt/100)*60))/2) + 'px';
+ gdb('leg').style.top=Math.round((hei-((hei/100)*60))/2) + 'px';
+ } else {
+ gdb('leg').style.display="none";
+ }
+}
+
+function setScroll(u) {
+ u = (u == null) ? true : u;
+
+ gdb('id_scroll').checked = cfg.scroller;
+ if (cfg.scroller)
+ gdb('main').style.overflowY = 'auto';
+ else
+ gdb('main').style.overflowY = 'hidden';
+ if (u)
+ onRes();
+}
+
+function showScroll() {
+ cfg.scroller = gdb('id_scroll').checked;
+ setScroll();
+ saveSettings();
+ return true;
+}
+
+function setSPSize(u) {
+ u = (u == null) ? true : u;
+
+ gdb('id_sp_size').value = cfg.sp_size;
+
+ gdb('footer').style.height = cfg.sp_size + 'px';
+ gdb('fhr').style.bottom = cfg.sp_size + 'px';
+ if (cfg.sp_size == 0)
+ gdb('fhr').style.display = 'none';
+ else
+ gdb('fhr').style.display = 'block';
+
+ if (cfg.sp_size > 2)
+ gdb('footer').style.font=(cfg.sp_size - 3)+"px/"+(cfg.sp_size-1)+"px 'Trebuchet Ms', Sans-Serif";
+
+ if (u)
+ onRes();
+}
+
+function statusPanel() {
+ var s = parseInt(gdb('id_sp_size').value);
+ if (s >= 0 && s <= 200)
+ cfg.sp_size = s;
+ setSPSize();
+ saveSettings();
+ return false;
+}
+
+function setTop(v, i) {
+ if (i != null)
+ gdb('main').scrollTop += i;
+ else
+ gdb('main').scrollTop = v;
+ tMh();
+ p_top = gdb('main').scrollTop;
+}
+
+function scrollText() {
+ setTop(null, 1);
+}
+
+function toggleScroll(u) {
+ u = (u == null) ? true : u;
+
+ //alert('ok');
+ if (sti) {
+ clearTimeout(sti);
+ sti = null;
+ if (u)
+ tMh();
+ } else
+ sti = setInterval('scrollText()', cfg.sc_int);
+ return false;
+}
+
+function setScrollInt(u) {
+ u = (u == null) ? true : u;
+
+ gdb('id_sc_int').value = cfg.sc_int;
+ toggleScroll(u);
+ toggleScroll(u);
+}
+
+function scrollInterval() {
+ var s = parseInt(gdb('id_sc_int').value);
+ if (s > 0 && s <= 999)
+ cfg.sc_int = s;
+ setScrollInt(false);
+ saveSettings();
+ return false;
+}
+
+function setByClick() {
+ gdb('id_by_click').checked = cfg.by_click;
+}
+
+function byClick() {
+ cfg.by_click = gdb('id_by_click').checked;
+ setByClick();
+ saveSettings();
+ return true;
+}
+
+function reloadBook() {
+ if (is_storage) {
+ saveValue('bpr-link-' + tit, null);
+ saveValue('bpr-cached-book-'+tit, null);
+ }
+ window.location.href = window.location.href;
+ return false;
+}
+
+function blinkReloadButton() {
+ blinkCount++;
+ if (blinkCount%2 == 1)
+ gdb('reload').style.color = cfg.bgcolor;
+ else
+ gdb('reload').style.color = linkcolor;
+ if (blinkCount > 30) {
+ gdb('reload').style.color = linkcolor;
+ if (stblinkRB != null) {
+ clearTimeout(stblinkRB);
+ stblinkRB == null;
+ }
+ }
+}
+
+//ниже: ловим изменение размеров окна
+//ниже: ловим размеры рабочей области
+function gerT() {
+ var w, h, hh;
+ w = Math.round(window.innerWidth ?
+ window.innerWidth :
+ (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
+ h = Math.round(window.innerHeight ?
+ window.innerHeight :
+ (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
+ hh = Math.floor((h - (cfg.sp_size + 8)) / cfg.step) * cfg.step;
+ return {w:w, h:h, hh:hh};
+}
+
+function onRes(u) {
+ var focused = document.activeElement;
+ //alert(focused.tagName);
+ if (focused == null || focused.tagName != 'INPUT') {
+ var g = gerT();
+ hei = g.h;
+ phei = g.hh;
+ widt = g.w;
+
+ gdb('header').style.height = Math.round((hei - (cfg.sp_size + 3) - phei)/2)+'px';
+ gdb('main').style.height=phei+'px';
+ gdb('win').style.height=hei+'px';
+
+ //alert(widt + '/' +gdb('tr').style.width +gdb('main').style.width+gdb('tr').style.width)
+ clih = gdb('main').scrollHeight;
+
+ gdb('colorSelect').style.top=Math.round((hei-600)/2)+'px';
+ gdb('colorSelect').style.left=Math.round((widt-300)/2)+'px'; //754
+ gdb('comm').style.left=Math.round((widt-264)/2) + 'px';
+ gdb('comm').style.top=Math.round((hei-264)/2) + 'px';
+ if (u || u == null) {
+ if (pclih != clih && pclih > 0) {
+ var n_top = Math.round(p_top/pclih*clih);
+ setTop(n_top);
+ } else
+ tMh();
+ pclih = clih;
+ }
+
+ ow = widt - (gdb('id_lp').clientWidth + gdb('id_rp').clientWidth) - 10;
+ if (ow < 0)
+ ow = 0;
+ gdb('orig').style.width = ow + 'px';
+ gdb('orig').style.left = gdb('id_lp').clientWidth + 'px';
+ } else
+ setTimeout('onRes()', 500);
+}
+
+//--------------------------------------------------------------------------------------------------
+//загрузка
+function loadBook(book) {
+
+ gdb('main').innerHTML = book;
+
+ //ниже: добываем тайтл
+ var book_author = loadValue('bpr-author-' + tit);
+ book_author = (book_author == null ? '' : book_author);
+ var book_title = loadValue('bpr-title-' + tit);
+ book_title = (book_title == null ? '' : book_title);
+ var doc_title = tit;
+ if (book_author + book_title != '')
+ doc_title = book_author + (book_author != '' ? ' - ' : '') + book_title;
+
+ if (tit != '')
+ document.title = doc_title;
+
+ bookloaded = true;
+ gdb('win').style.display = gdb('footer').style.display = 'block';
+ onRes(false);
+ setTimeout('handlerAdd(window,"resize",onRes)',1); //ещё одно чудо от осла !!проверить
+ gdb('orig_href').href = tit;
+ gdb('orig_href').innerHTML = doc_title;
+ showTime();
+
+ pclih = gdb('main').scrollHeight;
+ var s_top = 0;
+ var lv = loadValue('bpr-book-' + tit);
+ if (lv) {
+ // Восстановим позицию в тексте
+ var cpos = lv.split('|');
+ var ntl = gdb('main').innerHTML.length;
+ if (cpos[0]) {
+ if (cpos[1] > 0 && ntl > 0) {
+ var tp = cpos[0]/cpos[1]*cpos[2];
+ s_top = Math.round(tp/ntl*pclih);
+ }
+ else
+ s_top = cpos[0]; // Старый вариант
+ }
+ }
+ setTop(s_top);
+ onRes(false);
+
+ gdb('loading').style.display='none';
+}
+
+function parseBook(book, cached, save_to_cache) {
+ var meta_sign = '<<>>';
+ var meta_idx = book.indexOf(meta_sign);
+ if (meta_idx >= 0) {
+ var meta_info = book.substr(0, meta_idx).split('|');
+ var book_link = meta_info[0];
+ var book_author = meta_info[1];
+ var book_title = meta_info[2];
+ if (book_link != null) {
+ book = book.substr(meta_idx + meta_sign.length);
+ if (is_storage) {
+ if (book_link != 'no_file') {
+ saveValue('bpr-link-' + tit, book_link, 10);
+ }
+ if (save_to_cache) {
+ saveValue('bpr-cached-book-'+tit, book, 30, 1);
+ }
+
+ saveValue('bpr-author-' + tit, book_author, 10);
+ saveValue('bpr-title-' + tit, book_title, 10);
+ }
+ }
+ }
+ loadBook(book);
+ if (cached != null) {
+ blinkCount = 0;
+ stblinkRB = setInterval('blinkReloadButton()', 500);
+ }
+}
+
+function getDefaultSettings() {
+ var def = {};
+ def.bgcolor='#ebe2c9';
+ def.fontcolor='#000000';
+ def.step = 26;
+ def.fontfamily = 'Trebuchet Ms';
+ def.scroller = true;
+ def.sp_size = 22;
+ def.sc_int = 50;
+ def.by_click = true;
+
+ return def;
+}
+
+function loadSettings() {
+ if (location.hash == '#RestoreDefaults') {
+ saveSettings();
+ } else {
+ var lv = loadValue('colorSetting');
+ if (lv) {
+ var colorSetting=lv.split('|');
+ cfg.fontcolor=colorSetting[0];
+ cfg.bgcolor=colorSetting[1];
+ cfg.step=parseInt(colorSetting[2]);
+ if (colorSetting[3])
+ cfg.fontfamily=colorSetting[3];
+ if (colorSetting[4] != null)
+ cfg.scroller = colorSetting[4].toLowerCase() == 'true';
+ if (colorSetting[5] != null)
+ cfg.sp_size = parseInt(colorSetting[5]);
+ if (colorSetting[6] != null)
+ cfg.sc_int = parseInt(colorSetting[6]);
+ if (colorSetting[7] != null)
+ cfg.by_click = colorSetting[7].toLowerCase() == 'true';
+ }
+ }
+}
+
+function applySettings() {
+ setScroll(false);
+ setSPSize(false);
+ setScrollInt(false);
+ setByClick();
+
+ gdb('main').style.font=Math.round(cfg.step*0.8)+"px/"+cfg.step+"px "+cfg.fontfamily;
+ gdb('clrdiv2').style.fontSize=Math.round(cfg.step*0.8)+'px';
+
+ setColors();
+}
+
+function parseQuery(qry) {
+ var params = {};
+ var a = qry.split('&');
+ for (var i = 0; i < a.length; i++) {
+ var b = a[i].split('=');
+ params[decodeURIComponent(b[0])] = decodeURIComponent(b[1]);
+ }
+ return params;
+}
+
+function objectEquals(obj1, obj2) {
+ for (var i in obj1) {
+ if (obj1.hasOwnProperty(i)) {
+ if (!obj2.hasOwnProperty(i)) return false;
+ if (obj1[i] != obj2[i]) return false;
+ }
+ }
+ for (var i in obj2) {
+ if (obj2.hasOwnProperty(i)) {
+ if (!obj1.hasOwnProperty(i)) return false;
+ if (obj1[i] != obj2[i]) return false;
+ }
+ }
+ return true;
+}
+
+function checkRedirect() {
+ if (typeof doRedirect == 'string' && doRedirect != '') {
+ var settings = JSON.stringify(cfg);
+ window.location.href = doRedirect + '?sets=' + btoa(settings) + '&' + window.location.search.substr(1);
+ return true;
+ }
+
+ var qry = location.search.substr(1);
+ var params = parseQuery(qry);
+ if ('sets' in params) {
+ var settings = atob(params.sets);
+ var newCfg = JSON.parse(settings);
+ if (objectEquals(cfg, getDefaultSettings())) {
+ cfg = newCfg;
+ saveSettings();
+ applySettings();
+ }
+
+ var qry = location.search.substr(1);
+ var url = qry.split('url=')[1] || '';
+ if (url != '')
+ window.location.href = siteroot + '?url=' + url;
+ else
+ window.location.href = siteroot;
+ return true;
+ }
+
+ return false;
+}
+
+function onLoa() {
+ DOM = document.getElementById;
+ Netscape4 = document.layer;
+ Netscape6 = Mozilla = (navigator.appName == "Netscape") && DOM;
+ Netscape7 = navigator.userAgent.indexOf("Netscape/7") >= 0;
+ Opera5 = window.opera && DOM;
+ Opera6 = Opera5 && window.print;
+ Opera7 = Opera5 && navigator.userAgent.indexOf("Opera 7") >= 0;
+ Opera8 = navigator.userAgent.indexOf("Opera/8") >= 0;
+ Opera9 = navigator.userAgent.indexOf("Opera/9") >= 0;
+ IE = document.all && !Opera5;
+ Firefox = navigator.userAgent.indexOf("Firefox") >= 0;
+
+ is_storage = supports_html5_storage();
+
+ bookloaded = false;
+
+ handlerAdd(document,'keydown', key); //ловим нажатие кнопки
+
+ if (window.addEventListener)
+ window.addEventListener('DOMMouseScroll', wheel, false);
+ window.onmousewheel = document.onmousewheel = wheel;
+
+ sti = null;
+ sttmh = null;
+ stadc = null;
+
+ blinkCount = 0;
+ stblinkRB = null;
+
+ gdb('main').onscroll = mainScroll;
+ pageMoveTemp=0; //индикатор скрытости стрелочек
+
+ cfg = getDefaultSettings();
+ loadSettings();
+ applySettings();
+
+ link = '';
+ flink = '';
+ percent = 0.00;
+ gpa = 1;
+ timer=300;
+
+ doRepeatClick = 0;
+ processClickTimeout = null;
+
+ pcount = 1;
+ clih = 0;
+ pclih = 0;
+ p_top = 0;
+
+ tit='';
+
+ if (checkRedirect())
+ return;
+
+ try {
+ var qry = location.search.substr(1);
+ var url = qry.split('url=')[1] || '';
+ var furl = siteroot + 'f.php?url=' + url;
+ gdb('loading').style.display='block';
+
+ if (url.length > 0) {
+ if ('ontouchstart' in document.documentElement) {
+ handlerAdd(gdb('win'),'touchstart', mTouchStart); //ловим тачпад
+ handlerAdd(gdb('win'),'touchend', mTouchEnd); //ловим тачпад
+ } else {
+ handlerAdd(gdb('win'),'mousedown', mClick); //ловим нажатие мыши
+ handlerAdd(gdb('win'),'mouseup', mClickUp); //ловим нажатие мыши
+ }
+ }
+
+ if(url.length > 0) {
+ tit = url;
+
+ var cached = loadValue('bpr-link-' + tit);
+ if (cached != null && is_storage) {
+ furl = siteroot + cached;
+ }
+
+ var cached_book = loadValue('bpr-cached-book-'+tit, 1);
+ if (cached_book != null) {
+ parseBook(cached_book, 1, 0);
+ } else {
+ var request = new XMLHttpRequest();
+ request.open('GET', furl, true);
+ request.onreadystatechange = function() {
+ if (request.readyState == 4) {
+ if(request.status == 200) {
+ parseBook(request.responseText, cached, 1);
+ } else {
+ if (cached != null)
+ reloadBook();
+ else {
+ tit = 'http error';
+ loadBook('Ошибка загрузки книги: ' + request.status + ' ' + request.statusText);
+ }
+ }
+ }
+ };
+ request.send(null);
+ }
+ } else {
+ loadBook(gdb('dop').innerHTML + gdb('leg').innerHTML);
+ bookloaded = false;
+ setTop(0);
+
+ gdb('top100').style.display = 'none';
+ gdb('id_add').style.height = (cfg.step - gdb('main').scrollHeight%cfg.step) + 'px';
+
+ gdb('book').focus();
+ }
+ } catch (e) {
+ tit = '';
+ loadBook('Ошибка загрузки книги: ' + e.message);
+ }
+ showTime();
+}
+
diff --git a/docs/omnireader/old/js/bpricon.gif b/docs/omnireader/old/js/bpricon.gif
new file mode 100644
index 00000000..e22d6c3a
Binary files /dev/null and b/docs/omnireader/old/js/bpricon.gif differ
diff --git a/docs/omnireader/old/js/colo58.png b/docs/omnireader/old/js/colo58.png
new file mode 100644
index 00000000..aeedf1a4
Binary files /dev/null and b/docs/omnireader/old/js/colo58.png differ
diff --git a/docs/omnireader/old/js/load.gif b/docs/omnireader/old/js/load.gif
new file mode 100644
index 00000000..48447b09
Binary files /dev/null and b/docs/omnireader/old/js/load.gif differ
diff --git a/docs/omnireader/old/js/stylex.css b/docs/omnireader/old/js/stylex.css
new file mode 100644
index 00000000..912d1a7f
--- /dev/null
+++ b/docs/omnireader/old/js/stylex.css
@@ -0,0 +1,438 @@
+*
+{
+margin:0px;
+padding:0px;
+}
+
+body
+{
+font: 21px/26px 'Comic Sans Ms', Fantasy;
+color: #FFFFFF;
+padding: 0;
+margin: 0;
+background-color: 0;
+}
+
+hr {
+position:absolute;
+left:1%;
+width: 98%;
+height: 1px;
+bottom: 22px;
+color:#000000;
+border: none;
+z-index:6;
+}
+
+#win {
+ display:none;
+ width: 100%;
+}
+
+#main {
+width: 94.9%;
+padding-left: 2.5%;
+padding-right: 2.5%;
+font: 21px/26px 'Trebuchet Ms', Sans-Serif;
+color: #220;
+float:left;
+position:relative;
+top:0px;
+text-align: justify;
+overflow:hidden;
+overflow-y:auto;
+/*border:1px solid #000;*/
+}
+
+#main span
+{
+display:block;
+text-indent:7%;
+clear:both;
+padding:0px;
+}
+
+#main p
+{
+display:block;
+text-indent:7%;
+clear:both;
+padding:0px;
+}
+
+#main dd
+{
+display:block;
+text-indent:7%;
+clear:both;
+padding:0px;
+}
+
+#main div
+{
+text-indent:7%;
+clear:both;
+padding:0px;
+}
+
+
+#main span p
+{
+text-indent:0;
+}
+
+#main span div
+{
+text-indent:0;
+}
+
+div#main img
+{
+border:0px;
+vertical-align:top;float:left;
+
+padding:0px;
+line-height:0px;
+font-size:0px;
+}
+
+div.podk
+{
+position:absolute;
+border:3px solid #220;
+display:none;
+z-index:9;
+height:280px;
+width:264px;
+font: bold 16px 'Trebuchet Ms', Sans-Serif;
+display:none;
+}
+
+div.podk span
+{
+ text-align:center;
+ font: 21px/21px 'Trebuchet Ms', Sans-Serif;
+}
+
+div.melem {
+ padding-left: 20px;
+ line-height: 25px;
+}
+
+div.melem label {
+ cursor: pointer;
+}
+
+div.melem label input {
+ cursor: pointer;
+ position: relative;
+ border:0;
+ left: 10px;
+ top: 5px;
+}
+
+div.melem input
+{
+background-color:transparent;
+border:0px solid #fff;
+font: bold 14px 'Trebuchet Ms', Sans-Serif;
+text-align:center;
+height: 18px;
+border:1px solid #000;
+}
+
+div.melem b
+{
+cursor:pointer;
+}
+
+
+.over
+{
+display:block;
+color:#500;
+background-color:black;
+text-align:center;
+vertical-align:middle;
+width:100%;
+height:10050px;
+position:absolute;
+right:0px;
+bottom:0px;
+z-index:15;
+}
+
+div#loading
+{
+background-color:black;
+font: 40px 'Trebuchet Ms', Sans-Serif;
+align:center;
+color:#FFFFFF;
+position:absolute;
+left:48%;
+bottom:50%;
+z-index:16;
+}
+
+a
+{
+ text-decoration:none;
+}
+a:hover
+{
+ text-decoration:underline;
+}
+
+div#footer div a:hover, div#comm div a:hover
+{
+ text-decoration:none;
+}
+
+#tl
+{
+width:14px;
+float:left;
+}
+#tr
+{
+width:14px;
+float:right;
+}
+
+.header
+{
+ height: 0px;
+}
+
+
+.footer {
+ display: none;
+ font: 18px/21px 'Trebuchet Ms', Sans-Serif;
+ width:100%;
+ height:22px;
+ position:absolute;
+ bottom:0px;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.page, .cpage
+{
+ position:relative;
+ float: left;
+ vertical-align: bottom;
+ border: 0px solid yellow;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.cpage
+{
+ cursor:pointer;
+}
+
+#tm
+{
+}
+
+#pageCount
+{
+}
+
+#pagePercent
+{
+}
+
+#bmain
+{
+}
+
+div#pageCount div
+{
+overflow:hidden;
+float:left;
+cursor:pointer;
+text-align:center;
+visibility:hidden;
+}
+
+.l
+{
+left:17px;
+float:left;
+margin-left:0;
+}
+.t
+{
+top:4px;
+}
+.b
+{
+bottom:4px;
+}
+.r
+{
+right:17px;
+float:right;
+}
+.a
+{
+position:absolute;
+line-height:0px;
+}
+
+.addr {
+ width:80%;
+ margin-left: 21%;
+}
+
+#book
+{
+border-right:0px solid #fff !important;
+}
+.book
+{
+background-color:transparent;
+border:2px groove #000;
+font: bold 16px 'Trebuchet Ms', Sans-Serif;
+height: 26px;
+padding:0;
+margin:0;
+display:block;
+float:left;
+}
+#btnOk
+{
+ height: 30px;
+}
+
+#book:hover
+{
+border-left:2px ridge #000;
+}
+.book:hover
+{
+border:2px ridge #000;
+}
+
+#leg
+{
+font: bold 12px Verdana, Sans-Serif;
+line-height:12px;
+width:60%;
+height:60%;
+background-color:#fff;
+color:#000;
+border:4px double black;
+padding:20px;
+text-align: justify;
+z-index:16;
+position:absolute;
+overflow:scroll;
+top:0;
+left:0;
+display:none;
+}
+#leg b
+{
+color: #AA2222;
+}
+
+
+
+
+
+
+/*келв аьюмоч фаепч START*/
+div#colorSelect
+{
+width:758px;
+height:600px;
+z-index:20;
+display:none;
+position:absolute;
+color:#220;
+}
+div.colorImage
+{
+width:600px;
+height:600px;
+background:url(/js/colo58.png);
+float:right;
+cursor:crosshair;
+}
+div.colorMenu
+{
+overflow:hidden;
+width:150px;
+height:330px;
+border: 3px solid #000;
+position:relative;
+background-color:white;
+font: 20px/22px 'Trebuchet Ms', Sans-Serif;
+top:150px;
+}
+div.colorMenu div div
+{
+cursor:pointer;
+float:left;
+width:76px;
+}
+div.colorMenu div input
+{
+float:right;
+height:18px;
+width:70px;
+border: 1px solid #000;
+margin:1px 0px;
+display:block;
+}
+
+div.colorMenu div select
+{
+ width: 70px;
+}
+
+div.colorExample
+{
+position:absolute;
+width:150px;
+height:78px;
+font: 21px/78px 'Trebuchet Ms', Sans-Serif;
+text-align:center;
+}
+div.colorCross
+{
+position:absolute;
+top:143px;
+left:147px;
+width:14px;
+height:14px;
+z-index:21;
+cursor:pointer;
+line-height:7px;
+}
+
+div.menuCross
+{
+font: 21px/26px 'Comic Sans Ms', Fantasy;
+position:absolute;
+top:-8px;
+left: 258px;
+width:14px;
+height:14px;
+z-index:21;
+cursor:pointer;
+line-height:7px;
+}
+/*келв аьюмоч фаепч END*/
+
+.test {
+ border: 1px solid #FFFFFF;
+}
+
+
+#cbscroll {
+ padding-top: 3px;
+ padding-left: 30px;
+}
diff --git a/docs/omnireader/old/parser.php b/docs/omnireader/old/parser.php
new file mode 100644
index 00000000..a3188419
--- /dev/null
+++ b/docs/omnireader/old/parser.php
@@ -0,0 +1,96 @@
+ chr(9),
+ 'TH' => chr(9),
+ 'TR' => chr(13) . chr(10) . '',
+ 'BR' => chr(13) . chr(10) . '
',
+ 'BR/' => chr(13) . chr(10) . '
',
+ 'DD' => chr(13) . chr(10) . '
',
+ 'P' => chr(13) . chr(10) . '
',
+ 'HR' => chr(13) . chr(10),
+ 'LI' => chr(13) . chr(10),
+ 'OL' => chr(13) . chr(10),
+ '/OL' => chr(13) . chr(10),
+ 'TABLE' => chr(13) . chr(10),
+ '/TABLE' => chr(13) . chr(10),
+ 'TITLE' => ' ',
+ '/TITLE' => ' ',
+ 'UL' => chr(13) . chr(10) . ' ',
+ '/UL' => chr(13) . chr(10),
+
+ // fb2
+ 'EMPTY-LINE/' => '
',
+ 'STANZA' => '
',
+ 'V' => '
',
+ '/POEM' => '
',
+ 'SUBTITLE' => '
',
+ '/SUBTITLE' => ' ',
+ );
+
+ $inner_cut = array(
+ 'HEAD' => 1,
+ 'SCRIPT' => 1,
+ 'STYLE' => 1,
+ //fb2
+ 'BINARY' => 1,
+ 'DESCRIPTION' => 1,
+ );
+
+ if ($remove_tags)
+ $substs = $inner_cut = array();
+
+
+ $data = str_replace(' ', ' ', $data);
+
+ $i = 0;
+ $len = strlen($data);
+ $out = '';
+ $cut_counter = 0;
+ $cut_tag = '';
+ while ($i < $len) {
+ $left = strpos($data, '<', $i);
+ if ($left !== FALSE) {
+ $right = strpos($data, '>', $left + 1);
+ if ($right !== FALSE) {
+ $tag = trim(substr($data, $left + 1, $right - $left - 1));
+ $first_space = strpos($tag, ' ');
+ if ($first_space !== FALSE)
+ $tag = substr($tag, 0, $first_space);
+ $tag = strtoupper($tag);
+
+ if (!$cut_counter) {
+ $out .= substr($data, $i, $left - $i);
+ if (isset($substs[$tag]))
+ $out .= $substs[$tag];
+ }
+
+ if (isset($inner_cut[$tag]) && (!$cut_counter || $cut_tag == $tag))
+ {
+ if (!$cut_counter)
+ $cut_tag = $tag;
+ $cut_counter++;
+ }
+ if ($tag != '' && $tag[0] == '/' && $cut_tag == substr($tag, 1)) {
+ $cut_counter = ($cut_counter > 0) ? $cut_counter - 1 : 0;
+ if (!$cut_counter)
+ $cut_tag = '';
+ }
+ //$close_tag = substr($tag, 1);
+ //$out .= " $cut_counter, $cut_tag == $close_tag";
+
+ $i = $right + 1;
+ } else
+ break;
+ }
+ else
+ break;
+ }
+ if ($i < $len && !$cut_counter)
+ $out .= substr($data, $i, $len - $i);
+ return $out;
+}
+
+?>
diff --git a/docs/omnireader/old/robots.txt b/docs/omnireader/old/robots.txt
new file mode 100644
index 00000000..3140a6c2
--- /dev/null
+++ b/docs/omnireader/old/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /?*url=
diff --git a/docs/omnireader/old/test.php b/docs/omnireader/old/test.php
new file mode 100644
index 00000000..181c9e97
--- /dev/null
+++ b/docs/omnireader/old/test.php
@@ -0,0 +1,4 @@
+
diff --git a/docs/omnireader/old/txt/.htaccess b/docs/omnireader/old/txt/.htaccess
new file mode 100644
index 00000000..4fea9844
--- /dev/null
+++ b/docs/omnireader/old/txt/.htaccess
@@ -0,0 +1,2 @@
+AddType 'text/plain; charset=windows-1251' .txz .txt
+AddEncoding gzip .txz
\ No newline at end of file
diff --git a/docs/omnireader/omnireader b/docs/omnireader/omnireader
index 3d2e0761..22d954e4 100644
--- a/docs/omnireader/omnireader
+++ b/docs/omnireader/omnireader
@@ -23,3 +23,26 @@ server {
root /home/liberama/public;
}
}
+
+server {
+ listen 11080;
+ server_name omnireader.ru;
+
+ client_max_body_size 50m;
+
+ gzip on;
+ gzip_min_length 1024;
+ gzip_proxied expired no-cache no-store private auth;
+ gzip_types *;
+
+ root /home/oldreader;
+
+ index index.html;
+
+ # Обработка php файлов с помощью fpm
+ location ~ \.php$ {
+ try_files $uri =404;
+ include /etc/nginx/fastcgi.conf;
+ fastcgi_pass unix:/run/php/php7.2-fpm.sock;
+ }
+}
diff --git a/docs/omnireader/readme.txt b/docs/omnireader/readme.txt
index 6720f750..0fcc4188 100644
--- a/docs/omnireader/readme.txt
+++ b/docs/omnireader/readme.txt
@@ -4,6 +4,17 @@ mkdir /home/liberama
chown www-data /home/liberama
chgrp www-data /home/liberama
+### oldreader
+# ubuntu 18
+apt install php7.2 php7.2-curl php7.2-mbstring php7.2-fpm
+service php7.2-fpm restart
+
+mkdir /home/oldreader
+chown www-data /home/oldreader
+chgrp www-data /home/oldreader
+sudo -u www-data cp -r ./old/* /home/oldreader
+###
+
apt install nginx
cp omnireader /etc/nginx/sites-available/omnireader