├── .gitignore ├── examples ├── nette │ ├── document_root │ │ ├── robots.txt │ │ ├── favicon.png │ │ ├── css │ │ │ ├── print.css │ │ │ └── screen.css │ │ ├── index.php │ │ ├── .htaccess │ │ └── js │ │ │ └── texyla-init.js │ ├── app │ │ ├── .htaccess │ │ ├── presenters │ │ │ ├── BasePresenter.php │ │ │ ├── HomepagePresenter.php │ │ │ └── TexylaPresenter.php │ │ ├── bootstrap.php │ │ └── classes │ │ │ ├── TexylaLoader.php │ │ │ └── MyTexy.php │ └── libs │ │ ├── .htaccess │ │ ├── WebLoader │ │ └── readme.txt │ │ └── jsmin.php ├── libs │ └── .htaccess └── php-plain │ ├── files │ └── readme.txt │ ├── favicon.png │ ├── filesplugin │ ├── paths.php │ ├── thumbnail.php │ ├── upload.php │ └── files.php │ ├── preview.php │ ├── process.php │ ├── ForumTexy.php │ ├── index.html │ └── AdminTexy.php ├── texyla ├── icons │ ├── bold.png │ ├── code.png │ ├── del.png │ ├── div.png │ ├── edit.png │ ├── h1.png │ ├── h2.png │ ├── h3.png │ ├── h4.png │ ├── hr.png │ ├── html.png │ ├── img.png │ ├── left.png │ ├── link.png │ ├── ol.png │ ├── sub.png │ ├── sup.png │ ├── text.png │ ├── ul.png │ ├── web.png │ ├── center.png │ ├── close.png │ ├── codeJs.png │ ├── color.png │ ├── files.png │ ├── flash.png │ ├── indent.png │ ├── italic.png │ ├── notexy.png │ ├── right.png │ ├── submit.png │ ├── symbol.png │ ├── syntax.png │ ├── table.png │ ├── upload.png │ ├── acronym.png │ ├── codeCss.png │ ├── codeHtml.png │ ├── codePhp.png │ ├── codeSql.png │ ├── comment.png │ ├── emoticon.png │ ├── gravatar.png │ ├── imgUpload.png │ ├── justify.png │ ├── olRomans.png │ ├── preview.png │ ├── unindent.png │ ├── youtube.png │ ├── blockquote.png │ ├── codeInline.png │ ├── htmlPreview.png │ ├── img_gallery.png │ ├── olAlphabetBig.png │ ├── olRomansSmall.png │ ├── textTransform.png │ └── olAlphabetSmall.png ├── img │ ├── loader.gif │ ├── menu.gif │ └── separator.gif ├── plugins │ ├── files │ │ ├── icons │ │ │ ├── up.png │ │ │ ├── excel.png │ │ │ ├── file.png │ │ │ ├── flash.png │ │ │ ├── pdf.png │ │ │ ├── word.png │ │ │ ├── folder.png │ │ │ ├── newdir.png │ │ │ └── upload.png │ │ └── files.js │ ├── table │ │ ├── table-background.gif │ │ ├── table-selection.gif │ │ └── table.js │ ├── resizableTextarea │ │ └── resizableTextarea.js │ ├── link │ │ └── link.js │ ├── youtube │ │ └── youtube.js │ ├── img │ │ └── img.js │ ├── symbol │ │ └── symbol.js │ ├── emoticon │ │ └── emoticon.js │ ├── keys │ │ └── keys.js │ ├── color │ │ └── color.js │ ├── textTransform │ │ └── textTransform.js │ └── gravatar │ │ └── gravatar.js ├── js │ ├── ajaxupload.js │ ├── buttons.js │ ├── window.js │ ├── view.js │ ├── texyla.js │ ├── selection.js │ ├── texy.js │ └── dom.js ├── languages │ ├── en.js │ ├── cs.js │ └── sk.js └── css │ └── style.css ├── emoticons ├── silk │ ├── grin.png │ ├── wink.png │ ├── smile.png │ ├── tongue.png │ ├── unhappy.png │ ├── surprised.png │ └── cfg.php └── texy │ ├── cool.gif │ ├── eek.gif │ ├── mad.gif │ ├── razz.gif │ ├── sad.gif │ ├── wink.gif │ ├── biggrin.gif │ ├── neutral.gif │ ├── redface.gif │ ├── smile.gif │ ├── confused.gif │ └── cfg.php ├── themes └── default │ ├── menu.gif │ ├── button.png │ ├── loader.gif │ ├── separator.gif │ ├── button-vista.png │ └── theme.css ├── mit.txt └── gpl.txt /.gitignore: -------------------------------------------------------------------------------- 1 | nbproject 2 | .idea -------------------------------------------------------------------------------- /examples/nette/document_root/robots.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/libs/.htaccess: -------------------------------------------------------------------------------- 1 | Order Allow,Deny 2 | Deny from all -------------------------------------------------------------------------------- /examples/nette/app/.htaccess: -------------------------------------------------------------------------------- 1 | Order Allow,Deny 2 | Deny from all -------------------------------------------------------------------------------- /examples/nette/libs/.htaccess: -------------------------------------------------------------------------------- 1 | Order Allow,Deny 2 | Deny from all -------------------------------------------------------------------------------- /examples/php-plain/files/readme.txt: -------------------------------------------------------------------------------- 1 | zde budou ukládány nahrané soubory -------------------------------------------------------------------------------- /texyla/icons/bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/bold.png -------------------------------------------------------------------------------- /texyla/icons/code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/code.png -------------------------------------------------------------------------------- /texyla/icons/del.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/del.png -------------------------------------------------------------------------------- /texyla/icons/div.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/div.png -------------------------------------------------------------------------------- /texyla/icons/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/edit.png -------------------------------------------------------------------------------- /texyla/icons/h1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/h1.png -------------------------------------------------------------------------------- /texyla/icons/h2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/h2.png -------------------------------------------------------------------------------- /texyla/icons/h3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/h3.png -------------------------------------------------------------------------------- /texyla/icons/h4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/h4.png -------------------------------------------------------------------------------- /texyla/icons/hr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/hr.png -------------------------------------------------------------------------------- /texyla/icons/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/html.png -------------------------------------------------------------------------------- /texyla/icons/img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/img.png -------------------------------------------------------------------------------- /texyla/icons/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/left.png -------------------------------------------------------------------------------- /texyla/icons/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/link.png -------------------------------------------------------------------------------- /texyla/icons/ol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/ol.png -------------------------------------------------------------------------------- /texyla/icons/sub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/sub.png -------------------------------------------------------------------------------- /texyla/icons/sup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/sup.png -------------------------------------------------------------------------------- /texyla/icons/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/text.png -------------------------------------------------------------------------------- /texyla/icons/ul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/ul.png -------------------------------------------------------------------------------- /texyla/icons/web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/web.png -------------------------------------------------------------------------------- /texyla/img/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/img/loader.gif -------------------------------------------------------------------------------- /texyla/img/menu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/img/menu.gif -------------------------------------------------------------------------------- /emoticons/silk/grin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/silk/grin.png -------------------------------------------------------------------------------- /emoticons/silk/wink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/silk/wink.png -------------------------------------------------------------------------------- /emoticons/texy/cool.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/cool.gif -------------------------------------------------------------------------------- /emoticons/texy/eek.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/eek.gif -------------------------------------------------------------------------------- /emoticons/texy/mad.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/mad.gif -------------------------------------------------------------------------------- /emoticons/texy/razz.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/razz.gif -------------------------------------------------------------------------------- /emoticons/texy/sad.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/sad.gif -------------------------------------------------------------------------------- /emoticons/texy/wink.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/wink.gif -------------------------------------------------------------------------------- /texyla/icons/center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/center.png -------------------------------------------------------------------------------- /texyla/icons/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/close.png -------------------------------------------------------------------------------- /texyla/icons/codeJs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/codeJs.png -------------------------------------------------------------------------------- /texyla/icons/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/color.png -------------------------------------------------------------------------------- /texyla/icons/files.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/files.png -------------------------------------------------------------------------------- /texyla/icons/flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/flash.png -------------------------------------------------------------------------------- /texyla/icons/indent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/indent.png -------------------------------------------------------------------------------- /texyla/icons/italic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/italic.png -------------------------------------------------------------------------------- /texyla/icons/notexy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/notexy.png -------------------------------------------------------------------------------- /texyla/icons/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/right.png -------------------------------------------------------------------------------- /texyla/icons/submit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/submit.png -------------------------------------------------------------------------------- /texyla/icons/symbol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/symbol.png -------------------------------------------------------------------------------- /texyla/icons/syntax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/syntax.png -------------------------------------------------------------------------------- /texyla/icons/table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/table.png -------------------------------------------------------------------------------- /texyla/icons/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/upload.png -------------------------------------------------------------------------------- /themes/default/menu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/themes/default/menu.gif -------------------------------------------------------------------------------- /emoticons/silk/smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/silk/smile.png -------------------------------------------------------------------------------- /emoticons/silk/tongue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/silk/tongue.png -------------------------------------------------------------------------------- /emoticons/silk/unhappy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/silk/unhappy.png -------------------------------------------------------------------------------- /emoticons/texy/biggrin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/biggrin.gif -------------------------------------------------------------------------------- /emoticons/texy/neutral.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/neutral.gif -------------------------------------------------------------------------------- /emoticons/texy/redface.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/redface.gif -------------------------------------------------------------------------------- /emoticons/texy/smile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/smile.gif -------------------------------------------------------------------------------- /texyla/icons/acronym.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/acronym.png -------------------------------------------------------------------------------- /texyla/icons/codeCss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/codeCss.png -------------------------------------------------------------------------------- /texyla/icons/codeHtml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/codeHtml.png -------------------------------------------------------------------------------- /texyla/icons/codePhp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/codePhp.png -------------------------------------------------------------------------------- /texyla/icons/codeSql.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/codeSql.png -------------------------------------------------------------------------------- /texyla/icons/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/comment.png -------------------------------------------------------------------------------- /texyla/icons/emoticon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/emoticon.png -------------------------------------------------------------------------------- /texyla/icons/gravatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/gravatar.png -------------------------------------------------------------------------------- /texyla/icons/imgUpload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/imgUpload.png -------------------------------------------------------------------------------- /texyla/icons/justify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/justify.png -------------------------------------------------------------------------------- /texyla/icons/olRomans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/olRomans.png -------------------------------------------------------------------------------- /texyla/icons/preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/preview.png -------------------------------------------------------------------------------- /texyla/icons/unindent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/unindent.png -------------------------------------------------------------------------------- /texyla/icons/youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/youtube.png -------------------------------------------------------------------------------- /texyla/img/separator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/img/separator.gif -------------------------------------------------------------------------------- /themes/default/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/themes/default/button.png -------------------------------------------------------------------------------- /themes/default/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/themes/default/loader.gif -------------------------------------------------------------------------------- /emoticons/silk/surprised.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/silk/surprised.png -------------------------------------------------------------------------------- /emoticons/texy/confused.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/emoticons/texy/confused.gif -------------------------------------------------------------------------------- /texyla/icons/blockquote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/blockquote.png -------------------------------------------------------------------------------- /texyla/icons/codeInline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/codeInline.png -------------------------------------------------------------------------------- /texyla/icons/htmlPreview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/htmlPreview.png -------------------------------------------------------------------------------- /texyla/icons/img_gallery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/img_gallery.png -------------------------------------------------------------------------------- /themes/default/separator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/themes/default/separator.gif -------------------------------------------------------------------------------- /examples/php-plain/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/examples/php-plain/favicon.png -------------------------------------------------------------------------------- /texyla/icons/olAlphabetBig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/olAlphabetBig.png -------------------------------------------------------------------------------- /texyla/icons/olRomansSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/olRomansSmall.png -------------------------------------------------------------------------------- /texyla/icons/textTransform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/textTransform.png -------------------------------------------------------------------------------- /themes/default/button-vista.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/themes/default/button-vista.png -------------------------------------------------------------------------------- /texyla/icons/olAlphabetSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/icons/olAlphabetSmall.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/up.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/excel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/excel.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/file.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/flash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/flash.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/pdf.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/word.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/word.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/folder.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/newdir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/newdir.png -------------------------------------------------------------------------------- /texyla/plugins/files/icons/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/files/icons/upload.png -------------------------------------------------------------------------------- /examples/nette/document_root/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/examples/nette/document_root/favicon.png -------------------------------------------------------------------------------- /texyla/plugins/table/table-background.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/table/table-background.gif -------------------------------------------------------------------------------- /texyla/plugins/table/table-selection.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/janmarek/Texyla/HEAD/texyla/plugins/table/table-selection.gif -------------------------------------------------------------------------------- /examples/php-plain/filesplugin/paths.php: -------------------------------------------------------------------------------- 1 | allowed['emoticon'] = true; 8 | 9 | $this->emoticonModule->root = '/emoticons/silk/'; 10 | $this->emoticonModule->fileRoot = dirname(__FILE__); 11 | $this->emoticonModule->icons = array( 12 | ':-)' => 'smile.png', 13 | ':-(' => 'unhappy.png', 14 | ';-)' => 'wink.png', 15 | ':-D' => 'grin.png', 16 | ':-O' => 'surprised.png', 17 | ':-P' => 'tongue.png' 18 | ); -------------------------------------------------------------------------------- /examples/nette/document_root/index.php: -------------------------------------------------------------------------------- 1 | resize(60, 40); 12 | $image->send(); 13 | 14 | } catch (Exception $e) { 15 | header('Content-Type: image/gif'); 16 | echo Image::EMPTY_GIF; 17 | } -------------------------------------------------------------------------------- /texyla/plugins/resizableTextarea/resizableTextarea.js: -------------------------------------------------------------------------------- 1 | // Zvětšovací textarea 2 | jQuery.texyla.initPlugin(function () { 3 | // pokud není načteno jQuery UI resizable, nic se nedělá 4 | if (typeof(this.textarea.resizable) != "function") return; 5 | 6 | var _this = this; 7 | this.textarea.resizable({ 8 | handles: 's', 9 | minHeight: 80, 10 | stop: function () { 11 | _this.textareaHeight = _this.textarea.get(0).offsetHeight; 12 | } 13 | }); 14 | 15 | // fix 16 | this.textarea.parent().css("padding-bottom", 0); 17 | }); -------------------------------------------------------------------------------- /emoticons/texy/cfg.php: -------------------------------------------------------------------------------- 1 | allowed['emoticon'] = true; 8 | 9 | $this->emoticonModule->root = '/emoticons/texy/'; 10 | $this->emoticonModule->fileRoot = dirname(__FILE__); 11 | $this->emoticonModule->icons = array( 12 | ':-)' => 'smile.gif', 13 | ':-(' => 'sad.gif', 14 | ';-)' => 'wink.gif', 15 | ':-D' => 'biggrin.gif', 16 | '8-O' => 'eek.gif', 17 | '8-)' => 'cool.gif', 18 | ':-?' => 'confused.gif', 19 | ':-x' => 'mad.gif', 20 | ':-P' => 'razz.gif', 21 | ':-|' => 'neutral.gif' 22 | ); -------------------------------------------------------------------------------- /examples/php-plain/preview.php: -------------------------------------------------------------------------------- 1 | process($code); 22 | -------------------------------------------------------------------------------- /examples/nette/document_root/css/screen.css: -------------------------------------------------------------------------------- 1 | body { 2 | font: 16px/1.5 "Trebuchet MS", "Geneva CE", lucida, sans-serif; 3 | color: #333; 4 | background-color: #fff; 5 | } 6 | 7 | h1 { 8 | font-size: 150%; 9 | color: #165ca3; 10 | } 11 | 12 | #ajax-spinner { 13 | margin: 15px 0 0 15px; 14 | padding: 13px; 15 | background: white url('../images/spinner.gif') no-repeat 50% 50%; 16 | font-size: 0; 17 | z-index: 123456; 18 | display: none; 19 | } 20 | 21 | div.flash { 22 | color: black; 23 | background: #FFF9D7; 24 | border: 1px solid #E2C822; 25 | padding: 1em; 26 | margin: 1em 0; 27 | } 28 | 29 | a[href^="error:"] { 30 | background: red; 31 | color: white; 32 | } 33 | -------------------------------------------------------------------------------- /texyla/plugins/link/link.js: -------------------------------------------------------------------------------- 1 | jQuery.texyla.addWindow("link", { 2 | dimensions: [330, 180], 3 | 4 | createContent: function () { 5 | return jQuery( 6 | '
' + 7 | '' + 8 | '' + 9 | '' + 10 | '' + 11 | '' + 12 | '
' 13 | ); 14 | }, 15 | 16 | action: function (el) { 17 | var txt = el.find(".link-text").val(); 18 | txt = txt == '' ? '' : '"' + txt + '":'; 19 | this.texy.replace(txt + el.find(".link-url").val()); 20 | } 21 | }); -------------------------------------------------------------------------------- /themes/default/theme.css: -------------------------------------------------------------------------------- 1 | /* texyla vzhled */ 2 | div.texyla { 3 | background: #EEE; 4 | } 5 | 6 | div.texyla ul.toolbar li span:hover { 7 | background: url("button-vista.png") no-repeat 50% 50%; 8 | } 9 | 10 | div.texyla div.preview-wait { 11 | background: url("loader.gif") 10px 10px no-repeat; 12 | } 13 | 14 | /* dialog */ 15 | .ui-dialog-content p.wait { 16 | background: url("loader.gif") 0 50% no-repeat; 17 | } 18 | 19 | /* menu */ 20 | div.texyla ul.toolbar li ul li { 21 | padding: 1px 22 | } 23 | 24 | div.texyla ul.toolbar li ul li.ui-state-hover { 25 | padding: 0px 26 | } 27 | 28 | div.texyla ul.toolbar li.menu { 29 | background-image: url("menu.gif"); 30 | } 31 | 32 | div.texyla ul.toolbar li.separator { 33 | background-image: url("separator.gif"); 34 | } -------------------------------------------------------------------------------- /examples/php-plain/process.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Zpracování formuláře 5 | 6 | 9 | 10 | 11 | 12 |

První textarea

13 | process($text); 18 | ?> 19 | 20 | 21 | 22 |

Druhá textarea

23 | process($text2); 28 | ?> 29 | 30 | -------------------------------------------------------------------------------- /examples/nette/libs/WebLoader/readme.txt: -------------------------------------------------------------------------------- 1 | WebLoader 2 | ========= 3 | 4 | Component for CSS and JS files loading 5 | 6 | Author: Jan Marek 7 | Licence: MIT 8 | 9 | Example: 10 | 11 | addFiles(array( 19 | 'style.css', 20 | WWW_DIR . '/colorbox/colorbox.css', 21 | )); 22 | 23 | $compiler = WebLoader\Compiler::createCssCompiler($files, WWW_DIR . '/temp'); 24 | 25 | $compiler->addFilter(new WebLoader\Filter\VariablesFilter(array('foo' => 'bar')); 26 | $compiler->addFilter(function ($code) { 27 | return cssmin::minify($code, "remove-last-semicolon"); 28 | }); 29 | 30 | $control = new WebLoader\Nette\CssLoader($compiler, '/webtemp'); 31 | $control->setMedia('screen'); 32 | 33 | return $control; 34 | } 35 | 36 | Template: 37 | 38 | {control css} -------------------------------------------------------------------------------- /examples/nette/document_root/.htaccess: -------------------------------------------------------------------------------- 1 | # Apache configuration file (see httpd.apache.org/docs/2.2/mod/quickreference.html) 2 | 3 | # disable directory listing 4 | Options -Indexes 5 | 6 | # enable cool URL 7 | 8 | RewriteEngine On 9 | # RewriteBase / 10 | 11 | # front controller 12 | RewriteCond %{REQUEST_FILENAME} !-f 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ index.php [L] 15 | 16 | 17 | # enable gzip compression 18 | 19 | AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript application/javascript application/json 20 | 21 | 22 | # allow combined JavaScript & CSS. Inside of script.combined.js you could use 23 | 24 | 25 | Options +Includes 26 | SetOutputFilter INCLUDES 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/nette/app/presenters/BasePresenter.php: -------------------------------------------------------------------------------- 1 | context->httpRequest->url->baseUrl; 19 | $filter = new WebLoader\Filter\VariablesFilter(array( 20 | "baseUri" => $baseUri, 21 | "previewPath" => $this->link("Texyla:preview"), 22 | "filesPath" => $this->link("Texyla:listFiles"), 23 | "filesUploadPath" => $this->link("Texyla:upload"), 24 | "filesMkDirPath" => $this->link("Texyla:mkDir"), 25 | "filesRenamePath" => $this->link("Texyla:rename"), 26 | "filesDeletePath" => $this->link("Texyla:delete"), 27 | )); 28 | 29 | $texyla = new TexylaLoader($filter, $baseUri."webtemp"); 30 | return $texyla; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /mit.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Jan Marek, Petr Vaněk 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /examples/nette/app/presenters/HomepagePresenter.php: -------------------------------------------------------------------------------- 1 | addTextarea("text", "Text", 110, 20) 19 | ->getControlPrototype()->class("texyla"); 20 | 21 | $form->addSubmit("s", "Submit"); 22 | $form->onSuccess[] = callback($this, 'exampleFormSubmitted'); 23 | return $form; 24 | } 25 | 26 | 27 | /** 28 | * Get submited data from the form 29 | */ 30 | public function exampleFormSubmitted($form) 31 | { 32 | // Get values from the form 33 | $values = $form->getValues(); 34 | 35 | // Get TEXY service to apply it at raw data 36 | $texy = $this->getService('Texy'); 37 | 38 | // Process data through TEXY 39 | $html = $texy->process($values->text); 40 | 41 | // Here should be action you would like to do with data - save to the DB, etc. 42 | 43 | // Flash message 44 | $this->flashMessage('Data were sucessfuly procesed'); 45 | 46 | // Call redirect 47 | $this->redirect('Homepage:default'); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /texyla/plugins/youtube/youtube.js: -------------------------------------------------------------------------------- 1 | jQuery.texyla.setDefaults({ 2 | youtubeMakro: "[* youtube:%var% *]" 3 | }); 4 | 5 | jQuery.texyla.addWindow("youtube", { 6 | createContent: function () { 7 | var el = jQuery( 8 | "
" + 9 | '

" + 12 | this.lng.youtubePreview + '
' + 13 | '
' + 14 | "
" 15 | ); 16 | 17 | el.find(".key").bind("keyup change", function () { 18 | var val = this.value; 19 | var key = ""; 20 | 21 | if (val.substr(0, 7) == "http://") { 22 | var res = val.match("[?&]v=([a-zA-Z0-9_-]+)"); 23 | if (res) key = res[1]; 24 | } else { 25 | key = val; 26 | } 27 | 28 | jQuery(this).data("key", key); 29 | 30 | el.find(".thumb").html( 31 | '' 32 | ); 33 | }); 34 | 35 | return el; 36 | }, 37 | 38 | action: function (el) { 39 | var txt = this.expand(this.options.youtubeMakro, el.find(".key").data("key")); 40 | this.texy.update().replace(txt); 41 | }, 42 | 43 | dimensions: [320, 300] 44 | }); 45 | 46 | jQuery.texyla.addStrings("cs", { 47 | }); -------------------------------------------------------------------------------- /examples/nette/document_root/js/texyla-init.js: -------------------------------------------------------------------------------- 1 | $.texyla.setDefaults({ 2 | baseDir: '{{$baseUri}}js/texyla', 3 | previewPath: '{{$previewPath}}', 4 | filesPath: '{{$filesPath}}', 5 | filesUploadPath: '{{$filesUploadPath}}', 6 | filesMkDirPath: '{{$filesMkDirPath}}', 7 | filesRenamePath: '{{$filesRenamePath}}', 8 | filesDeletePath: '{{$filesDeletePath}}' 9 | }); 10 | 11 | $(function () { 12 | $(".texyla").texyla({ 13 | toolbar: [ 14 | 'h1', 'h2', 'h3', 'h4', 15 | null, 16 | 'bold', 'italic', 17 | null, 18 | 'center', ['left', 'right', 'justify'], 19 | null, 20 | 'ul', 'ol', ["olAlphabetSmall", "olAlphabetBig", "olRomans", "olRomansSmall"], 21 | null, 22 | { type: "label", text: "Insert"}, 'link', 'img', 'table', 'emoticon', 'symbol', 23 | null, 24 | 'color', 'textTransform', 25 | null, 26 | 'files', 'youtube', 'gravatar', 27 | null, 28 | 'div', ['html', 'blockquote', 'text', 'comment'], 29 | null, 30 | 'code', ['codeHtml', 'codeCss', 'codeJs', 'codePhp', 'codeSql'], 'codeInline', 31 | null, 32 | { type: "label", text: "Other"}, ['sup', 'sub', 'del', 'acronym', 'hr', 'notexy', 'web'] 33 | 34 | ], 35 | texyCfg: "admin", 36 | bottomLeftToolbar: ['edit', 'preview', 'htmlPreview'], 37 | buttonType: "span", 38 | tabs: true 39 | }); 40 | 41 | $.texyla({ 42 | buttonType: "button" 43 | }); 44 | 45 | }); -------------------------------------------------------------------------------- /texyla/plugins/img/img.js: -------------------------------------------------------------------------------- 1 | // Okno obrázku 2 | jQuery.texyla.addWindow("img", { 3 | createContent: function () { 4 | return jQuery( 5 | '
' + 6 | // Adresa 7 | '' + 8 | '' + 9 | '' + 10 | // Alt 11 | '' + 12 | '' + 13 | '' + 14 | // Zobrazit jako popisek 15 | '' + 16 | '' + 17 | '' + 18 | // Zarovnání 19 | '' + 20 | '' + 26 | '
' 27 | ); 28 | }, 29 | 30 | action: function (el) { 31 | this.texy.img( 32 | el.find(".src").val(), 33 | el.find(".alt").val(), 34 | el.find(".align").val(), 35 | el.find(".descr").get(0).checked 36 | ); 37 | }, 38 | 39 | dimensions: [350, 250] 40 | }); -------------------------------------------------------------------------------- /examples/nette/app/bootstrap.php: -------------------------------------------------------------------------------- 1 | enableDebugger(__DIR__ . '/../log'); 20 | 21 | // 2b) Enable RobotLoader - this will load all classes automatically 22 | $configurator->setTempDirectory(__DIR__ . '/../temp'); 23 | $configurator->createRobotLoader() 24 | ->addDirectory(APP_DIR) 25 | ->addDirectory(LIBS_DIR) 26 | ->register(); 27 | 28 | // 2c) Set baseUri for use in config.neon 29 | $baseUri = dirname($_SERVER['SCRIPT_NAME']); 30 | $configurator->addParameters(array('baseUri' => $baseUri)); 31 | 32 | // 2d) Create Dependency Injection container from config.neon file 33 | $configurator->addConfig(__DIR__ . '/config/config.neon'); 34 | 35 | 36 | // Step 3: Create DI container 37 | $container = $configurator->createContainer(); 38 | 39 | 40 | // Step 4: Setup application router 41 | $container->router[] = new Route('index.php', 'Homepage:default', Route::ONE_WAY); 42 | $container->router[] = new Route('/[/]', 'Homepage:default'); 43 | 44 | 45 | // Step 5: Run the application! 46 | $container->application->run(); 47 | -------------------------------------------------------------------------------- /examples/php-plain/ForumTexy.php: -------------------------------------------------------------------------------- 1 | setOutputMode(self::HTML4_TRANSITIONAL); 16 | $this->htmlOutputModule->removeOptional = false; 17 | self::$advertisingNotice = false; 18 | 19 | // safe mode 20 | TexyConfigurator::safeMode($this); 21 | 22 | $this->allowed['heading/surrounded'] = false; 23 | $this->allowed['heading/underlined'] = false; 24 | $this->allowed['link/definition'] = false; 25 | $this->allowed['image/definition'] = false; 26 | 27 | // spojování textu v odstavcích po enteru 28 | $this->mergeLines = true; 29 | 30 | // přidání target="_blank" k odkazům 31 | // $this->addHandler('phrase', array(__CLASS__, 'addTargetHandler')); 32 | } 33 | 34 | 35 | 36 | /** 37 | * @param TexyHandlerInvocation handler invocation 38 | * @param string 39 | * @param string 40 | * @param TexyModifier 41 | * @param TexyLink 42 | * @return TexyHtml|string|FALSE 43 | */ 44 | public static function addTargetHandler($invocation, $phrase, $content, $modifier, $link) 45 | { 46 | // vychozí zpracování Texy 47 | $el = $invocation->proceed(); 48 | 49 | // ověř, že $el je objekt TexyHtml a že jde o element 'a' 50 | if ($el instanceof TexyHtml && $el->getName() === 'a') { 51 | // uprav jej 52 | $el->attrs['target'] = '_blank'; 53 | } 54 | 55 | return $el; 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /texyla/plugins/symbol/symbol.js: -------------------------------------------------------------------------------- 1 | // Výchozí zvláštní znaky 2 | jQuery.texyla.setDefaults({ 3 | symbols: [ 4 | "&", "@", ["<", "<"], [">", ">"], "[", "]", "{", "}", "\\", 5 | "α", "β", "π", "µ", "Ω", "∑", "°", "∞", "≠", "±", "×", "÷", "≥", 6 | "≤", "®", "™", "€", "£", "$", "~", "^", "·", "•" 7 | ] 8 | }); 9 | 10 | jQuery.texyla.addWindow("symbol", { 11 | dimensions: [300, 230], 12 | 13 | createContent: function () { 14 | var _this = this; 15 | 16 | var el = jQuery('
'); 17 | var symbolsEl = jQuery('
').appendTo(el); 18 | 19 | var symbols = this.options.symbols; 20 | 21 | // projít symboly 22 | for (var i = 0; i < symbols.length; i++) { 23 | function clk(text) { 24 | return function () { 25 | _this.texy.replace(text); 26 | 27 | if (el.find("input.close-after-insert").get(0).checked) { 28 | el.dialog("close"); 29 | } 30 | } 31 | }; 32 | 33 | jQuery("") 34 | .hover(function () { 35 | jQuery(this).addClass("ui-state-hover"); 36 | }, function () { 37 | jQuery(this).removeClass("ui-state-hover"); 38 | }) 39 | .text(symbols[i] instanceof Array ? symbols[i][0] : symbols[i]) 40 | .click(clk(symbols[i] instanceof Array ? symbols[i][1] : symbols[i])) 41 | .appendTo(symbolsEl); 42 | } 43 | 44 | // kontrolka na zavření po vložení 45 | el.append( 46 | "
" 48 | ); 49 | 50 | return el; 51 | } 52 | }); -------------------------------------------------------------------------------- /texyla/js/ajaxupload.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Ajax upload plugin 3 | * Odešle formulář a zavolá callback s JSON daty v parametru 4 | */ 5 | 6 | jQuery.fn.extend({ 7 | ajaxUpload: function(callback) { 8 | if (!this.is("form")) return; 9 | 10 | // počítadlo 11 | if (!arguments.callee.count) { 12 | arguments.callee.count = 0; 13 | } 14 | var target = "ajaxUploadFrame" + (++arguments.callee.count); 15 | 16 | // vyrobí rámec 17 | var iframe = jQuery( 18 | '' 20 | ); 21 | iframe.css({ 22 | visibility: "hidden", 23 | position: "absolute", 24 | left: "-1000px", 25 | top: "-1000px" 26 | }); 27 | iframe.appendTo("body"); 28 | 29 | // po načtení stránky zpracuje požadavek 30 | iframe.load(function () { 31 | jQuery.event.trigger("ajaxComplete"); 32 | 33 | var iframeEl = iframe.get(0); 34 | var body; 35 | if (iframeEl.contentDocument) { 36 | body = iframeEl.contentDocument.body; 37 | } else { 38 | body = iframeEl.contentWindow.document.body; 39 | } 40 | var content = jQuery(body).text(); 41 | 42 | if (!content) { 43 | callback(); 44 | } else { 45 | eval("var data = " + content + ";"); 46 | callback(data); 47 | } 48 | 49 | // nechat zmizet iframe 50 | setTimeout(function () { 51 | iframe.remove() 52 | }, 1000); 53 | }); 54 | 55 | // odešle formulář do rámce 56 | this.attr({ 57 | target: target, 58 | method: "post", 59 | enctype: "multipart/form-data" 60 | }).submit(); 61 | 62 | jQuery.event.trigger("ajaxStart"); 63 | } 64 | }); -------------------------------------------------------------------------------- /examples/php-plain/filesplugin/upload.php: -------------------------------------------------------------------------------- 1 | getFile("file"); 10 | $folder = $httpRequest->getPost("folder", ""); 11 | 12 | $state = array(); 13 | 14 | $root = realpath(FILES_BASE_PATH); 15 | $dir = realpath(FILES_BASE_PATH . "/" . $folder); 16 | 17 | // security check 18 | //if (!$allowed) { 19 | // $state["error"] = "You are not allowed to upload files."; 20 | //} 21 | 22 | if (empty($file)) { 23 | $state["error"] = "No file was uploaded"; 24 | } 25 | 26 | // check directory 27 | if ($root === false || $dir === false || !String::startsWith($dir, $root) || !is_dir($dir) || !is_writable($dir)) { 28 | $state["error"] = "Problem with directory to upload."; 29 | } 30 | 31 | if (!empty($state["error"])) { 32 | die(json_encode($state)); 33 | } 34 | 35 | if ($file->isOk()) { 36 | $filename = String::webalize($file->getName(), "."); 37 | $success = @$file->move("$dir/$filename"); 38 | 39 | if ($success) { 40 | // nastavit typ - je to obrázek? 41 | $type = @$file->getImageSize() ? "image" : "file"; 42 | $prefix = $type == "image" ? FILES_IMAGE_INCLUDE_PREFIX : FILES_FILE_INCLUDE_PREFIX; 43 | 44 | $state["filename"] = $prefix . ($folder ? "$folder/" : "") . $filename; 45 | $state["type"] = $type; 46 | } else { 47 | $state["error"] = "Move failed"; 48 | } 49 | 50 | } else { 51 | $state["error"] = "Upload error " . $file->getError(); 52 | } 53 | 54 | // výstup 55 | echo json_encode($state); 56 | -------------------------------------------------------------------------------- /texyla/plugins/emoticon/emoticon.js: -------------------------------------------------------------------------------- 1 | // nastavení 2 | $.texyla.setDefaults({ 3 | emoticonPath: "%texyla_base%/emoticons/texy/%var%.gif", 4 | emoticons: { 5 | ':-)': 'smile', 6 | ':-(': 'sad', 7 | ';-)': 'wink', 8 | ':-D': 'biggrin', 9 | '8-O': 'eek', 10 | '8-)': 'cool', 11 | ':-?': 'confused', 12 | ':-x': 'mad', 13 | ':-P': 'razz', 14 | ':-|': 'neutral' 15 | } 16 | }); 17 | 18 | $.texyla.initPlugin(function () { 19 | this.options.emoticonPath = this.expand(this.options.emoticonPath); 20 | }); 21 | 22 | $.texyla.addWindow("emoticon", { 23 | createContent: function () { 24 | var _this = this; 25 | 26 | var emoticons = $('
'); 27 | var emoticonsEl = $('
').appendTo(emoticons); 28 | 29 | // projít smajly 30 | for (var i in this.options.emoticons) { 31 | function emClk(emoticon) { 32 | return function () { 33 | _this.texy.replace(emoticon); 34 | 35 | if (emoticons.find("input.close-after-insert").get(0).checked) { 36 | emoticons.dialog("close"); 37 | } 38 | } 39 | }; 40 | 41 | $( 42 | "" + i + "" 44 | ) 45 | .hover(function () { 46 | $(this).addClass("ui-state-hover"); 47 | }, function () { 48 | $(this).removeClass("ui-state-hover"); 49 | }) 50 | .click(emClk(i)) 51 | .appendTo(emoticonsEl); 52 | } 53 | 54 | emoticons.append("
"); 55 | 56 | return emoticons; 57 | }, 58 | 59 | dimensions: [192, 170] 60 | }); -------------------------------------------------------------------------------- /texyla/plugins/keys/keys.js: -------------------------------------------------------------------------------- 1 | // ovládání klávesami 2 | 3 | // funkce zavádějící ovládání klávesami 4 | jQuery.texyla.initPlugin(function () { 5 | var _this = this; 6 | 7 | this.textarea.bind(jQuery.browser.opera ? "keypress" : "keydown", function(e) { 8 | _this.keys(e); 9 | }); 10 | }); 11 | 12 | 13 | jQuery.texyla.extend({ 14 | keys: function(e) { 15 | var pressedKey = e.charCode || e.keyCode || -1; 16 | 17 | var action = false; 18 | 19 | // tučně (Ctrl + B nebo např. Shift + Ctrl + B) 20 | if (e.ctrlKey && pressedKey == 66 && !e.altKey) { 21 | this.texy.bold(); 22 | action = true; 23 | } 24 | 25 | // kurzíva (Ctrl + I nebo např. Alt + Ctrl + I) 26 | if (e.ctrlKey && pressedKey == 73) { 27 | this.texy.italic(); 28 | action = true; 29 | } 30 | 31 | // Zrušit odsazení (shift + tab) 32 | if (pressedKey == 9 && e.shiftKey) { 33 | this.texy.unindent(); 34 | action = true; 35 | } 36 | 37 | // tabulátor (tab) 38 | if (pressedKey == 9 && !e.shiftKey) { 39 | if (this.texy.update().text().indexOf(this.texy.lf()) == -1) { 40 | this.texy.tag('\t', ''); 41 | } else { 42 | this.texy.indent(); 43 | } 44 | action = true; 45 | } 46 | 47 | // Odeslat formulář (Ctrl + S nebo např. Shift + Ctrl + S) 48 | if (e.ctrlKey && pressedKey == 83) { 49 | this.submit(); 50 | action = true; 51 | } 52 | 53 | // zruší defaultní akce 54 | if (action) { 55 | // Firefox & Opera (ale ta na to docela sere co se týče klávesových zkratek programu) 56 | if (e.preventDefault && e.stopPropagation) { 57 | e.preventDefault(); 58 | e.stopPropagation(); 59 | 60 | // IE 61 | } else { 62 | window.event.cancelBubble = true; 63 | window.event.returnValue = false; 64 | } 65 | } 66 | } 67 | }); -------------------------------------------------------------------------------- /examples/nette/app/classes/TexylaLoader.php: -------------------------------------------------------------------------------- 1 | addFiles(array( 22 | // core 23 | "texyla/js/texyla.js", 24 | "texyla/js/selection.js", 25 | "texyla/js/texy.js", 26 | "texyla/js/buttons.js", 27 | "texyla/js/dom.js", 28 | "texyla/js/view.js", 29 | "texyla/js/ajaxupload.js", 30 | "texyla/js/window.js", 31 | 32 | // languages 33 | "texyla/languages/cs.js", 34 | "texyla/languages/sk.js", 35 | "texyla/languages/en.js", 36 | 37 | // plugins 38 | "texyla/plugins/keys/keys.js", 39 | "texyla/plugins/resizableTextarea/resizableTextarea.js", 40 | "texyla/plugins/img/img.js", 41 | "texyla/plugins/table/table.js", 42 | "texyla/plugins/link/link.js", 43 | "texyla/plugins/emoticon/emoticon.js", 44 | "texyla/plugins/symbol/symbol.js", 45 | "texyla/plugins/files/files.js", 46 | "texyla/plugins/color/color.js", 47 | "texyla/plugins/textTransform/textTransform.js", 48 | "texyla/plugins/youtube/youtube.js", 49 | "texyla/plugins/gravatar/gravatar.js", 50 | 51 | "js/texyla-init.js", 52 | )); 53 | 54 | $compiler = \WebLoader\Compiler::createJsCompiler($files, WWW_DIR."/webtemp"); 55 | 56 | // setup filter 57 | $compiler->addFilter($filter); 58 | 59 | // minifying JS 60 | $compiler->addFilter("JSMin::minify"); 61 | 62 | parent::__construct($compiler, $tempUri); 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /texyla/plugins/color/color.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Color plugin 3 | * Přidává obarvování textu a/nebo pozadí do Texyly. 4 | * @author Petr Vaněk aka krteczek 5 | */ 6 | 7 | jQuery.texyla.setDefaults({ 8 | colors: [ 9 | 'red', 'blue', 'aqua', 'black', 'fuchsia', 'gray', 'green', 'lime', 10 | 'maroon', 'navy', 'olive', 'orange', 'purple', 'silver', 'teal', 11 | 'white', 'yellow', '#AABBCC' 12 | ] 13 | }); 14 | 15 | jQuery.texyla.addWindow("color", { 16 | createContent: function () { 17 | var _this = this; 18 | var colors = jQuery('
'); 19 | var colorsEl = jQuery('
').appendTo(colors); 20 | 21 | // vloží kód pro obarvení elementu 22 | function colorClk(color) { 23 | return function () { 24 | _this.texy.update(); 25 | 26 | // Přidání obarvovacího kódu do textu 27 | if (_this.texy.isCursor()) { 28 | _this.texy.selectBlock().phrase('' , ' .{color: ' + color + '}'); 29 | } else { 30 | _this.texy.phrase('"' , ' .{color: ' + color + '}"'); 31 | } 32 | 33 | // zavření okna po vložení kódu 34 | if (colors.find("input.close-after-insert").get(0).checked) { 35 | colors.dialog("close"); 36 | } 37 | } 38 | } 39 | 40 | // vytvoření jednotlivých barevných tlačítek 41 | for (var i = 0; i < _this.options.colors.length; i++) { 42 | var color = _this.options.colors[i]; 43 | jQuery( 44 | '' + 45 | ' ' + 46 | '' 47 | ).hover(function () { 48 | jQuery(this).addClass("ui-state-hover"); 49 | }, function() { 50 | jQuery(this).removeClass("ui-state-hover"); 51 | }).click(colorClk(color)).appendTo(colorsEl); 52 | } 53 | 54 | colors.append( 55 | "
" 57 | ); 58 | 59 | return colors; 60 | }, 61 | 62 | dimensions: [200, 150] 63 | }); 64 | -------------------------------------------------------------------------------- /examples/php-plain/filesplugin/files.php: -------------------------------------------------------------------------------- 1 | getQuery("folder", ""); 10 | 11 | $root = realpath(FILES_BASE_PATH); 12 | $dir = realpath($root . "/" . $folder); 13 | 14 | // check directory 15 | if ($root === false || $dir === false || !String::startsWith($dir, $root) || !is_dir($dir)) { 16 | echo json_encode(array( 17 | "error" => "Problem with directory." 18 | )); 19 | exit; 20 | } 21 | 22 | $directories = array(); 23 | $files = array(); 24 | 25 | // up 26 | if ($root !== $dir) { 27 | $dirPieces = explode("/", $folder); 28 | array_pop($dirPieces); 29 | 30 | $directories[] = array( 31 | "type" => "up", 32 | "name" => "..", 33 | "key" => implode("/", $dirPieces) 34 | ); 35 | } 36 | 37 | foreach (new DirectoryIterator($dir) as $fileInfo) { 38 | $filename = $fileInfo->getFileName(); 39 | 40 | // skip hidden files, . and .. 41 | if (String::startsWith($filename, ".")) continue; 42 | 43 | if ($fileInfo->isDir()) { 44 | $directories[] = array( 45 | "type" => "folder", 46 | "name" => $filename, 47 | "key" => ($folder ? "$folder/" : "") . $filename, 48 | ); 49 | 50 | } else { 51 | $isImage = @getImageSize($fileInfo->getPathName()) ? true : false; 52 | 53 | if ($isImage) { 54 | $files[] = array( 55 | "type" => "image", 56 | "name" => $filename, 57 | "insertUrl" => FILES_IMAGE_INCLUDE_PREFIX . ($folder ? "$folder/" : "") . $filename, 58 | "description" => "", 59 | "thumbnailKey" => ($folder ? "$folder/" : "") . $filename, 60 | ); 61 | } else { 62 | $files[] = array( 63 | "type" => "file", 64 | "name" => $filename, 65 | "insertUrl" => FILES_FILE_INCLUDE_PREFIX . ($folder ? "$folder/" : "") . $filename, 66 | "description" => "", 67 | ); 68 | } 69 | } 70 | } 71 | 72 | echo json_encode(array( 73 | "list" => array_merge($directories, $files) 74 | )); -------------------------------------------------------------------------------- /texyla/plugins/textTransform/textTransform.js: -------------------------------------------------------------------------------- 1 | jQuery.texyla.addWindow("textTransform", { 2 | createContent: function () { 3 | return jQuery( 4 | "
" + 5 | "
" + 6 | "
" + 7 | "
" + 8 | "
" + 9 | "" + 10 | "
" 11 | ); 12 | }, 13 | 14 | action: function (el) { 15 | var text = this.texy.update().text(); 16 | var newText = null; 17 | 18 | var transformation = el.find("form input:checked").val(); 19 | 20 | switch (transformation) { 21 | case "lower": 22 | newText = text.toLowerCase(); 23 | break; 24 | case "upper": 25 | newText = text.toUpperCase(); 26 | break; 27 | case "cap": 28 | newText = text.replace(/\S+/g, function (a) { 29 | return a.charAt(0).toUpperCase() + a.substr(1, a.length).toLowerCase(); 30 | }); 31 | break; 32 | case "firstUpper": 33 | newText = text.charAt(0).toUpperCase() + text.substr(1, text.length).toLowerCase(); 34 | break; 35 | case "url": 36 | // (c) Jakub Vrána, http://php.vrana.cz 37 | var nodiac = { 38 | 'á': 'a', 'č': 'c', 'ď': 'd', 'é': 'e', 'ě': 'e', 'í': 'i', 'ň': 'n', 39 | 'ó': 'o', 'ř': 'r', 'š': 's', 'ť': 't', 'ú': 'u', 'ů': 'u', 'ý': 'y', 40 | 'ž': 'z' 41 | }; 42 | 43 | var s = text.toLowerCase(); 44 | var s2 = ''; 45 | for (var i=0; i < s.length; i++) { 46 | s2 += (typeof nodiac[s.charAt(i)] != 'undefined' ? nodiac[s.charAt(i)] : s.charAt(i)); 47 | } 48 | newText = s2.replace(/[^a-z0-9_]+/g, '-').replace(/^-|-$/g, ''); 49 | break; 50 | default: 51 | } 52 | 53 | // replace 54 | if (newText !== null) { 55 | this.texy.replace(newText); 56 | } 57 | }, 58 | 59 | dimensions: [220, 210] 60 | }); -------------------------------------------------------------------------------- /texyla/js/buttons.js: -------------------------------------------------------------------------------- 1 | // Funkce tlačítek 2 | Texyla.prototype.buttons = { 3 | h1: function() {this.texy.heading('#');}, 4 | h2: function() {this.texy.heading('*');}, 5 | h3: function() {this.texy.heading('=');}, 6 | h4: function() {this.texy.heading('-');}, 7 | bold: function() {this.texy.bold();}, 8 | italic: function() {this.texy.italic();}, 9 | del: function() {this.texy.phrase('--');}, 10 | center: function() {this.texy.align('<>');}, 11 | left: function() {this.texy.align('<');}, 12 | right: function() {this.texy.align('>');}, 13 | justify: function() {this.texy.align('=');}, 14 | ul: function() {this.texy.list('ul');}, 15 | ol: function() {this.texy.list('ol');}, 16 | olRomans: function() {this.texy.list('romans');}, 17 | olRomansSmall: function() {this.texy.list('smallRomans');}, 18 | olAlphabetSmall: function() {this.texy.list('smallAlphabet');}, 19 | olAlphabetBig: function() {this.texy.list('bigAlphabet');}, 20 | blockquote: function() {this.texy.list('bq');}, 21 | indent: function() {this.texy.indent();}, 22 | unindent: function() {this.texy.unindent();}, 23 | sub: function() {this.texy.phrase('__');}, 24 | sup: function() {this.texy.phrase('^^');}, 25 | link: function() {this.texy.link(prompt(this.lng.linkUrl, 'http://'));}, 26 | acronym: function() {this.texy.acronym(prompt(this.lng.acronymTitle, ''));}, 27 | hr: function() {this.texy.line();}, 28 | code: function() {this.texy.block('code');}, 29 | codeHtml: function() {this.texy.block('code html');}, 30 | codeCss: function() {this.texy.block('code css');}, 31 | codeJs: function() {this.texy.block('code js');}, 32 | codePhp: function() {this.texy.block('code php');}, 33 | codeSql: function() {this.texy.block('code sql');}, 34 | codeInline: function() {this.texy.phrase('`');}, 35 | html: function() {this.texy.block('html');}, 36 | notexy: function() {this.texy.phrase("''", "''");}, 37 | web: function() {window.open('http://texyla.janmarek.net/');}, 38 | syntax: function() {window.open(this.lng.syntaxUrl);}, 39 | div: function() {this.texy.block('div');}, 40 | comment: function() {this.texy.block('comment');}, 41 | text: function() {this.texy.block('text');}, 42 | preview: function () {this.view("preview");}, 43 | htmlPreview: function () {this.view("htmlPreview");}, 44 | edit: function () {this.view("edit");}, 45 | submit: function () {this.submit();} 46 | }; 47 | -------------------------------------------------------------------------------- /texyla/plugins/table/table.js: -------------------------------------------------------------------------------- 1 | jQuery.texyla.addWindow("table", { 2 | dimensions: [320, 200], 3 | 4 | action: function (cont) { 5 | this.texy.table(cont.find(".cols").val(), cont.find(".rows").val(), cont.find(".header").val()); 6 | }, 7 | 8 | createContent: function () { 9 | var _this = this; 10 | 11 | var cont = jQuery( 12 | "
" + 13 | '' + 14 | '' + 15 | '' + 16 | '
' + 21 | 22 | // vizuální tabulka - html 23 | '
' + 24 | "
" 25 | ); 26 | 27 | // vizuální tabulka 28 | var resizing = true, posX, posY; 29 | 30 | // povolení nebo zakázání změny velikosti po kliku 31 | cont.find(".tab-control").click(function (e) { 32 | resizing = !resizing; 33 | 34 | // změny velikosti apos 35 | }).mousemove(function (e) { 36 | if (resizing) { 37 | posX = e.pageX; 38 | var el = this; 39 | while (el.offsetParent) { 40 | posX -= el.offsetLeft; 41 | el = el.offsetParent; 42 | } 43 | 44 | posY = e.pageY; 45 | el = this; 46 | while (el.offsetParent) { 47 | posY -= el.offsetTop; 48 | el = el.offsetParent; 49 | } 50 | 51 | var cols = Math.ceil(posX / 8); 52 | var rows = Math.ceil(posY / 8); 53 | 54 | cont.find(".tab-selection").css({ 55 | width: cols * 8, 56 | height: rows * 8 57 | }); 58 | 59 | cont.find(".cols").val(cols); 60 | cont.find(".rows").val(rows); 61 | } 62 | 63 | // vložení na dvojklik 64 | }).dblclick(function () { 65 | _this.getWindowAction("table").call(_this, cont); 66 | cont.dialog("close"); 67 | }); 68 | 69 | cont.find(".cols, .rows").bind("change click blur", function () { 70 | var cols = Math.min(cont.find(".cols").val(), 10); 71 | var rows = Math.min(cont.find(".rows").val(), 10); 72 | 73 | cont.find(".tab-selection").css({ 74 | width: cols * 8, 75 | height: rows * 8 76 | }); 77 | }); 78 | 79 | return cont; 80 | } 81 | }); -------------------------------------------------------------------------------- /texyla/js/window.js: -------------------------------------------------------------------------------- 1 | jQuery.texyla.initPlugin(function () { 2 | // seznam otevřených oken 3 | // název: jQuery objekt 4 | this.openedWindows = {}; 5 | }); 6 | 7 | /** 8 | * Přidat okno 9 | * bude možné zavolat $.texyla.addWindow({title: "Okno", ...}); 10 | */ 11 | jQuery.texyla.addWindow = function (name, options) { 12 | Texyla.prototype.windowConfigs[name] = options; 13 | 14 | // nastavit velikosti okna 15 | if (options.dimensions) { 16 | var defaults = {}; 17 | defaults[name + "WindowDimensions"] = options.dimensions; 18 | jQuery.texyla.setDefaults(defaults); 19 | } 20 | 21 | // přidat tlačítko 22 | jQuery.texyla.addButton(name, function () { 23 | this.openWindow(name); 24 | }); 25 | }; 26 | 27 | jQuery.texyla.extend({ 28 | // možná okna 29 | windowConfigs: {}, 30 | 31 | openWindow: function (name) { 32 | // kontrola 33 | if (typeof(jQuery.fn.dialog) != "function") { 34 | this.error("jQuery UI plugin Dialog is not loaded."); 35 | return false; 36 | } 37 | 38 | if (!Texyla.prototype.windowConfigs[name]) { 39 | this.error("Window " + name + " is not defined."); 40 | return false; 41 | } 42 | 43 | // focusovat otevřené 44 | if (this.isWindowOpened(name)) { 45 | return this.getWindow(name).dialog("moveToTop"); 46 | } 47 | 48 | // otevřít nové 49 | var config = Texyla.prototype.windowConfigs[name]; 50 | var el = config.createContent.call(this); 51 | 52 | // přiřadit do otevřených oken 53 | this.openedWindows[name] = el; 54 | 55 | // nastavení dialogu 56 | var options = config.options || {}; 57 | 58 | // titulek 59 | options.title = config.title ? config.title : this.lng["win_" + name]; 60 | 61 | // rozměry 62 | var dimensions = this.options[name + "WindowDimensions"]; 63 | if (dimensions) { 64 | options.width = dimensions[0]; 65 | options.height = dimensions[1]; 66 | } 67 | 68 | // tlačítka 69 | var _this = this; 70 | if (config.action) { 71 | options.buttons = {}; 72 | 73 | // tlačítko OK 74 | options.buttons[this.lng.windowOk] = function () { 75 | config.action.call(_this, el); 76 | if (!config.stayOpened) { 77 | _this.closeWindow(name); 78 | } 79 | }; 80 | 81 | // tlačítko Storno 82 | options.buttons[this.lng.windowCancel] = function () { 83 | _this.closeWindow(name); 84 | }; 85 | } 86 | 87 | // zavření 88 | options.close = function () { 89 | _this.closeWindow(name); 90 | }; 91 | 92 | // vytvořit dialog 93 | el.dialog(options); 94 | 95 | // focus na první input 96 | el.find("input:first").focus(); 97 | 98 | return el; 99 | }, 100 | 101 | closeWindow: function (name) { 102 | // zrušení objektu v domu 103 | this.openedWindows[name].dialog("destroy").remove(); 104 | // vynulování 105 | this.openedWindows[name] = null; 106 | }, 107 | 108 | isWindowOpened: function (name) { 109 | return this.openedWindows[name] ? true : false; 110 | }, 111 | 112 | getWindowAction: function (name) { 113 | return Texyla.prototype.windowConfigs[name].action; 114 | }, 115 | 116 | /** 117 | * Získat objekt okna 118 | * @param string name jméno okna 119 | * @return jQuery|null 120 | */ 121 | getWindow: function (name) { 122 | return this.openedWindows[name] ? this.openedWindows[name] : null; 123 | } 124 | }); -------------------------------------------------------------------------------- /texyla/js/view.js: -------------------------------------------------------------------------------- 1 | // Změnit pohled 2 | Texyla.prototype.view = function(type, first) { 3 | // textarea value 4 | var taVal = this.textarea.val(); 5 | 6 | // prázdná textarea 7 | if (type != "edit" && taVal == "") { 8 | // poprvé nebuzerovat a bez keců přepnout 9 | if (first) { 10 | this.view("edit"); 11 | return; 12 | } 13 | 14 | alert(this.lng.viewEmpty); 15 | this.textarea.focus(); 16 | 17 | return; 18 | } 19 | 20 | // schovávání a odkrývání 21 | switch (type) { 22 | // náhled 23 | case "preview": 24 | this.previewDiv.show(); 25 | this.htmlPreviewDiv.hide(); 26 | this.editDiv.hide(); 27 | this.rightPreviewToolbar.show(); 28 | this.rightEditToolbar.hide(); 29 | break; 30 | 31 | // html náhled 32 | case "htmlPreview": 33 | this.previewDiv.hide(); 34 | this.htmlPreviewDiv.show(); 35 | this.editDiv.hide(); 36 | this.rightPreviewToolbar.show(); 37 | this.rightEditToolbar.hide(); 38 | break; 39 | 40 | // upravovat 41 | case "edit": 42 | this.previewDiv.hide(); 43 | this.htmlPreviewDiv.hide(); 44 | this.editDiv.show(); 45 | this.rightPreviewToolbar.hide(); 46 | this.rightEditToolbar.show(); 47 | break; 48 | } 49 | 50 | // výška náhledů 51 | if (type != "edit") { 52 | var height = this.textarea.get(0).offsetHeight || this.textareaHeight; 53 | if (height) { 54 | var curPrev = this[type == "preview" ? "preview" : "htmlPreview"].parent(); 55 | curPrev.height(height); 56 | var delta = curPrev.get(0).offsetHeight - height; 57 | this.container.find("div.preview-wrapper").height(height - delta); 58 | } else { 59 | this.container.find("div.preview-wrapper").height("auto"); 60 | } 61 | } 62 | 63 | // zvýraznění aktivního tabu 64 | if (this.options.tabs) { 65 | var tabs = this.leftToolbar; 66 | tabs.find(".ui-state-active").removeClass("ui-state-active"); 67 | tabs.find(".btn_" + type).addClass("ui-state-active"); 68 | 69 | // schovávání tlačítka aktivního pohledu 70 | } else { 71 | var views = ["preview", "htmlPreview", "edit"]; 72 | for (var i = 0; i < views.length; i++) { 73 | if (views[i] == type) { 74 | this.container.find(".btn_" + type).hide(); 75 | } else { 76 | this.container.find(".btn_" + views[i]).show(); 77 | } 78 | } 79 | } 80 | 81 | // načtení náhledu 82 | if (type != "edit" && this.lastPreviewedTexy != taVal) { 83 | // při načtení náhledu 84 | var _this = this; 85 | function onLoad(data) { 86 | // náhled 87 | _this.preview.html(data).show(); 88 | 89 | // náhled html 90 | _this.htmlPreview.text(data.replace(new RegExp("\n", "g"), _this.texy.lf())).show(); 91 | 92 | // obarvit html pomocí JUSHe 93 | if (typeof jush != 'undefined') { 94 | _this.htmlPreview.html(jush.highlight("htm", data)); 95 | } 96 | 97 | // schovat čekejte 98 | _this.wait.hide(); 99 | }; 100 | 101 | // kešuje poslední texy 102 | this.lastPreviewedTexy = taVal; 103 | 104 | // zobrazí prosím čekejte 105 | var parent = this[type == "preview" ? "preview" : "htmlPreview"].parent(); 106 | 107 | parent.prepend(this.wait); 108 | 109 | this.wait.show().css({ 110 | marginTop: (parent.get(0).offsetHeight - this.wait.get(0).offsetHeight) / 2, 111 | marginLeft: (parent.get(0).offsetWidth - this.wait.get(0).offsetWidth) / 2 112 | }); 113 | 114 | // a schová staré obsahy náhledů 115 | this.preview.hide(); 116 | this.htmlPreview.hide(); 117 | 118 | // volá ajax 119 | jQuery.post(this.options.previewPath, {texy: taVal, cfg: this.options.texyCfg}, onLoad, "html"); 120 | } 121 | }; -------------------------------------------------------------------------------- /texyla/languages/en.js: -------------------------------------------------------------------------------- 1 | /** 2 | * English translation 3 | */ 4 | jQuery.texyla.addStrings("en", { 5 | // buttons 6 | btn_h1: "The biggest heading", 7 | btn_h2: "Big heading", 8 | btn_h3: "Medium heading", 9 | btn_h4: "The smallest heading", 10 | 11 | btn_bold: "Bold", 12 | btn_italic: "Italic", 13 | btn_del: "Deleted", 14 | 15 | btn_center: "Center", 16 | btn_left: "Align to left", 17 | btn_right: "Align to right", 18 | btn_justify: "Justify", 19 | 20 | btn_ul: "List", 21 | btn_ol: "Numbered list", 22 | btn_olRomans: "Capital roman numbers", 23 | btn_olRomansSmall: "Small roman numbers", 24 | btn_olAlphabetSmall: "Small letters", 25 | btn_olAlphabetBig: "Capital letters", 26 | 27 | btn_blockquote: "Quotation block", 28 | 29 | btn_sub: "Lower index", 30 | btn_sup: "Upper index", 31 | 32 | btn_link: "Link", 33 | btn_acronym: "Acronym", 34 | btn_hr: "Line", 35 | btn_code: "Code", 36 | btn_codeHtml: "HTML code", 37 | btn_codeCss: "CSS code", 38 | btn_codeJs: "Javascript code", 39 | btn_codePhp: "PHP code", 40 | btn_codeSql: "SQL code", 41 | btn_comment: "Comment", 42 | btn_div: "Div block", 43 | btn_text: "Text", 44 | btn_codeInline: "Inline code", 45 | btn_html: "HTML", 46 | btn_notexy: "Inline text", 47 | 48 | btn_edit: "Edit", 49 | btn_preview: "Preview", 50 | btn_htmlPreview: "HTML", 51 | btn_syntax: "Texy help", 52 | btn_submit: "Submit", 53 | 54 | btn_web: "Texyla's web", 55 | 56 | // functions 57 | texyHeadingText: "Heading text", 58 | acronymTitle: "Title", 59 | linkUrl: "Link URL", 60 | 61 | // view 62 | wait: "Wait please", 63 | viewEmpty: "Text area is empty!", 64 | 65 | // window 66 | windowOk: "OK", 67 | windowClose: "Close", 68 | windowCancel: "Cancel", 69 | windowCloseAfterInsert: "Close after insert", 70 | 71 | // url 72 | syntaxUrl: 'http://texy.info/en/syntax', 73 | 74 | /** plugins ***************************************************************/ 75 | 76 | // color 77 | btn_color: "Colors", 78 | win_color: "Choose a color", 79 | colorSelectModeHeading: "Colorize:", 80 | colorSelectModeText: "text", 81 | colorSelectModeBackground: 'background', 82 | 83 | // emoticon 84 | btn_emoticon: "Emoticon", 85 | win_emoticon: "Insert an emoticon", 86 | 87 | // files 88 | btn_files: "Files", 89 | win_files: "Files", 90 | filesUpload: "Upload", 91 | win_upload: "File upload", 92 | filesFilter: "Filter", 93 | filesMkDir: "Create directory", 94 | filesRename: "Rename", 95 | filesDelete: "Delete", 96 | filesReallyDelete: "Really delete", 97 | filesDirectoryName: "Directory name", 98 | 99 | // img 100 | btn_img: "Image", 101 | win_img: "Insert an image", 102 | imgSrc: "Image's address", 103 | imgAlt: "Description", 104 | imgAlign: "Alingment", 105 | imgAlignNone: "none", 106 | imgAlignLeft: "left", 107 | imgAlignRight: "right", 108 | imgAlignCenter: "center", 109 | imgDescription: "Show as a description", 110 | 111 | // link 112 | win_link: "Insert hyperlink", 113 | linkText: "Link text", 114 | 115 | // symbol 116 | btn_symbol: "Symbol", 117 | win_symbol: "Insert a symbol", 118 | 119 | // table 120 | btn_table: "Table", 121 | win_table: "Insert a table", 122 | tableCols: "Number of collumns", 123 | tableRows: "Number of rows", 124 | tableTh: "Header", 125 | tableThNone: "none", 126 | tableThTop: "top", 127 | tableThLeft: "left", 128 | 129 | // text transform 130 | btn_textTransform: "Text transformation", 131 | win_textTransform: "Choose type od transformation", 132 | textTransformLower: "lower case", 133 | textTransformUpper: "UPPER CASE", 134 | textTransformCapitalize: "Capitalize", 135 | textTransformFirstUpper: "First upper", 136 | textTransformUrl: "cool-web-url", 137 | 138 | // youtube 139 | btn_youtube: "YouTube", 140 | win_youtube: "YouTube", 141 | youtubeUrl: "Insert address or ID", 142 | youtubePreview: "Preview", 143 | 144 | // gravatar 145 | btn_gravatar: "Gravatar", 146 | win_gravatar: "Gravatar", 147 | gravatarUrl: "Insert email", 148 | gravatarPreview: "Preview" 149 | }); -------------------------------------------------------------------------------- /texyla/languages/cs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Český překlad 3 | */ 4 | jQuery.texyla.addStrings("cs", { 5 | // popisy tlačítek 6 | btn_h1: "Nejv\u011bt\u0161í nadpis", 7 | btn_h2: "Velký nadpis", 8 | btn_h3: "St\u0159ední nadpis", 9 | btn_h4: "Nejmen\u0161í nadpis", 10 | 11 | btn_bold: "Tu\u010dn\u011b", 12 | btn_italic: "Kurzíva", 13 | btn_del: "P\u0159e\u0161krtnuto", 14 | 15 | btn_center: "Zarovnání na st\u0159ed", 16 | btn_left: "Zarovnání vlevo", 17 | btn_right: "Zarovnání vpravo", 18 | btn_justify: "Zarovnání do bloku", 19 | 20 | btn_ul: "Seznam", 21 | btn_ol: "\u010císlovaný seznam", 22 | btn_olRomans: "\u0158ímské \u010díslování", 23 | btn_olRomansSmall: "Malé \u0159ímské \u010díslování", 24 | btn_olAlphabetSmall: "Malá abeceda", 25 | btn_olAlphabetBig: "Velká abeceda", 26 | 27 | btn_blockquote: "Bloková citace", 28 | 29 | btn_sub: "Dolní index", 30 | btn_sup: "Horní index", 31 | 32 | btn_link: "Odkaz", 33 | btn_acronym: "Vysv\u011btlení zkratky", 34 | btn_hr: "\u010cára", 35 | btn_code: "Kód", 36 | btn_codeHtml: "Kód html", 37 | btn_codeCss: "Kód CSS", 38 | btn_codeJs: "Kód javascript", 39 | btn_codePhp: "Kód php", 40 | btn_codeSql: "Kód SQL", 41 | btn_comment: "Komentá\u0159", 42 | btn_div: "Blok div", 43 | btn_text: "Text", 44 | btn_codeInline: "Inline kód", 45 | btn_html: "HTML", 46 | btn_notexy: "Inline text", 47 | 48 | btn_edit: "Upravit", 49 | btn_preview: "Náhled", 50 | btn_htmlPreview: "HTML", 51 | btn_syntax: "Texy nápov\u011bda", 52 | btn_submit: "Odeslat", 53 | 54 | btn_web: "Web editoru Texyla", 55 | 56 | // funkce 57 | texyHeadingText: "Text nadpisu", 58 | acronymTitle: "Titulek", 59 | linkUrl: "Adresa odkazu", 60 | 61 | // pohledy 62 | wait: "Prosím \u010dekejte", 63 | viewEmpty: "Textové pole je prázdné!", 64 | 65 | // okna 66 | windowOk: "OK", 67 | windowClose: "Zav\u0159ít", 68 | windowCancel: "Storno", 69 | windowCloseAfterInsert: "Zav\u0159ít po vlo\u017eení", 70 | 71 | // adresy 72 | syntaxUrl: "http://texy.info/cs/syntax", 73 | 74 | /** pluginy ***************************************************************/ 75 | 76 | // color 77 | btn_color: "Barvy", 78 | win_color: "Vyberte barvu", 79 | colorSelectModeHeading: "Obarvit:", 80 | colorSelectModeText: "text", 81 | colorSelectModeBackground: 'pozadí', 82 | 83 | // emoticon 84 | btn_emoticon: "Smajlík", 85 | win_emoticon: "Vlo\u017eit smajlík", 86 | 87 | // files 88 | btn_files: "Soubory", 89 | win_files: "Soubory", 90 | filesUpload: "Nahrát soubor", 91 | win_upload: "Nahrát soubor", 92 | filesFilter: "Filtr", 93 | filesMkDir: "Vytvo\u0159it adresá\u0159", 94 | filesRename: "P\u0159ejmenovat", 95 | filesDelete: "Smazat", 96 | filesReallyDelete: "Opravdu smazat", 97 | filesDirectoryName: "Název slo\u017eky", 98 | 99 | // img 100 | btn_img: "Obrázek", 101 | win_img: "Vlo\u017eit obrázek", 102 | imgSrc: "Adresa obrázku", 103 | imgAlt: "Popis", 104 | imgAlign: "Zarovnání", 105 | imgAlignNone: "\u017eádné", 106 | imgAlignLeft: "vlevo", 107 | imgAlignRight: "vpravo", 108 | imgAlignCenter: "na st\u0159ed", 109 | imgDescription: "Zobrazit jako popisek", 110 | 111 | // link 112 | win_link: "Vlo\u017eit odkaz", 113 | linkText: "Text odkazu", 114 | 115 | // symbol 116 | btn_symbol: "Symbol", 117 | win_symbol: "Vlo\u017eit symbol", 118 | 119 | // table 120 | btn_table: "Tabulka", 121 | win_table: "Vlo\u017eit tabulku", 122 | tableCols: "Po\u010det sloupc\u016f", 123 | tableRows: "Po\u010det \u0159ádek", 124 | tableTh: "Hlavi\u010dka", 125 | tableThNone: "\u017eádná", 126 | tableThTop: "naho\u0159e", 127 | tableThLeft: "vlevo", 128 | 129 | // text transform 130 | btn_textTransform: "Transformovat text", 131 | win_textTransform: "Vyberte transformaci", 132 | textTransformLower: "malá písmena", 133 | textTransformUpper: "VELKÁ PÍSMENA", 134 | textTransformCapitalize: "První Velká", 135 | textTransformFirstUpper: "První velké", 136 | textTransformUrl: "tvar-webove-adresy", 137 | 138 | // youtube 139 | btn_youtube: "YouTube", 140 | win_youtube: "YouTube", 141 | youtubeUrl: "Vlo\u017ete adresu videa nebo jeho ID", 142 | youtubePreview: "Náhled videa", 143 | 144 | // gravatar 145 | btn_gravatar: "Gravatar", 146 | win_gravatar: "Gravatar", 147 | gravatarUrl: "Vlo\u017ete email", 148 | gravatarPreview: "Náhled" 149 | }); -------------------------------------------------------------------------------- /texyla/css/style.css: -------------------------------------------------------------------------------- 1 | /* textarea */ 2 | div.texyla div.textarea-container {text-align:center; margin:5px 0; clear:left;} 3 | div.texyla div.textarea-container * {margin: auto !important;} 4 | 5 | /* lišta */ 6 | div.texyla ul.toolbar {margin:0; padding:0 0 0 5px; height:30px;} 7 | div.texyla ul.toolbar li {margin:0; padding:0; list-style:none; float:left; width:30px; height:30px;} 8 | div.texyla ul.toolbar li span {display:block; padding:7px; cursor:pointer;} 9 | div.texyla ul.toolbar li img {display:block;} 10 | div.texyla ul.toolbar li.separator {width:5px; background:url("../img/separator.gif") no-repeat 50% 50%;} 11 | div.texyla ul.toolbar li.label {width:auto; line-height:30px; font-size: 90%; padding: 0 4px 0 7px;} 12 | 13 | /* menu */ 14 | div.texyla ul.toolbar li.menu {z-index:2; background:url("../img/menu.gif") no-repeat 50% 50%; width:15px; position:relative;} 15 | div.texyla ul.toolbar li ul {display:none; top:29px; left:0; position:absolute; margin:0; padding:2px;} 16 | div.texyla ul.toolbar li ul li {padding: 0; height:auto; width:auto; display:block; cursor:pointer; float:none; white-space:nowrap;} 17 | div.texyla ul.toolbar li ul li span {background-position: 2px 50% !important; background-repeat:no-repeat; padding:3px 5px 3px 22px; display:block;} 18 | 19 | /* náhledy */ 20 | div.view-header {line-height:30px; background-repeat:no-repeat; background:no-repeat 5px 50%; padding-left:26px;} 21 | div.preview-wrapper {background:white; overflow:auto; position: relative; margin:5px;} 22 | div.preview, pre.html-preview {padding:10px; margin:0;} 23 | div.preview-wait {border:1px solid #777; padding:10px 10px 10px 36px; background:url("../img/loader.gif") 10px 10px no-repeat; position:absolute; z-index:999;} 24 | 25 | /* tlačítkové lišty */ 26 | div.texyla .bottom-toolbar {position:relative; padding: 0 5px 5px;} 27 | div.texyla .right-toolbar {position:absolute; right:0; top:0; margin-right:5px;} 28 | div.texyla .right-toolbar .btn, div.texyla .right-toolbar button {margin-left:5px;} 29 | div.texyla .span-tb, .twindow .span-tb, div.texyla .tabs {height:30px;} 30 | 31 | /* tlačítka */ 32 | div.texyla .bottom-toolbar .btn, .twindow .btn {display:block; float:left; padding:0 0.5em; line-height:28px; cursor:pointer;} 33 | div.texyla .left-toolbar .btn, div.texyla .left-toolbar button {margin-right:5px;} 34 | div.texyla .btn .icon-span {background: no-repeat 0 50%; padding-left:20px;} 35 | div.texyla .bottom-toolbar button img {vertical-align:middle;} 36 | 37 | /* taby */ 38 | div.texyla .bottom-toolbar .tabs {position:relative; top:-5px;} 39 | div.texyla .bottom-toolbar .tabs .btn {border-top:none; margin-right: 0;} 40 | div.texyla .bottom-toolbar .tabs .btn.ui-state-active {line-height:30px; cursor:default;} 41 | 42 | /* pluginy */ 43 | .ui-dialog-content .tab-background {width:81px; height:81px; position:absolute; top:19px; right:21px; background:url('../plugins/table/table-background.gif');} 44 | .ui-dialog-content .tab-control {width:80px; height:80px; position:absolute; top:0; left:0;} 45 | .ui-dialog-content .tab-selection {width:16px; height:16px; position:absolute; top:0; left:0; background:url('../plugins/table/table-selection.gif');} 46 | 47 | .ui-dialog-content .emoticons {line-height:1em;} 48 | .ui-dialog-content .emoticons img {margin:1px; padding:5px; cursor:pointer; display:inline-block;} 49 | 50 | .ui-dialog-content .colors span {margin:1px; padding: 1px; cursor:pointer; display:inline-block;} 51 | .ui-dialog-content .colors span span {display:block; width: 12px; height:12px;} 52 | 53 | .ui-dialog-content .symbols span {cursor:pointer; padding:0; display:inline-block; text-align:center; width:2em; line-height:2em; margin:1px;} 54 | 55 | .ui-dialog-content p.wait {background:url("../img/loader.gif") 0 50% no-repeat; padding-left:26px; margin:0;} 56 | 57 | .ui-dialog-content .files-gallery .image {width:60px; text-align:center; vertical-align:middle; line-height:0;} 58 | .ui-dialog-content .files-gallery .image img {cursor:pointer;} 59 | .ui-dialog-content .files-gallery .label {display:table-cell; padding-left:5px;} 60 | .ui-dialog-content .files-gallery {padding:0;} 61 | .ui-dialog-content .gallery-item {margin-top:5px; font-size: 90%; width:100%} 62 | .ui-dialog-content .gallery-item td.buttons {font-size: 80%; text-align: right; visibility: hidden;} 63 | .ui-dialog-content .gallery-item:hover td.buttons {visibility: visible;} 64 | .ui-dialog-content div.files-filter {padding-top: 15px;} 65 | 66 | .ui-dialog-content div.clear {font-size:0; height:0; clear:both;} -------------------------------------------------------------------------------- /texyla/languages/sk.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Slovenský překlad 3 | * @author Jod 4 | */ 5 | jQuery.texyla.addStrings("sk", { 6 | // popisy tlačítok 7 | btn_h1: "Najvä\u010d\u0161í nadpis", 8 | btn_h2: "Ve\u013eký nadpis", 9 | btn_h3: "Stredný nadpis", 10 | btn_h4: "Najmen\u0161í nadpis", 11 | 12 | btn_bold: "Tu\u010dne", 13 | btn_italic: "Kurzíva", 14 | btn_del: "Pre\u010diarknuté", 15 | 16 | btn_center: "Zarovnanie na stred", 17 | btn_left: "Zarovnanie v\u013eavo", 18 | btn_right: "Zarovnanie vpravo", 19 | btn_justify: "Zarovnanie do bloku", 20 | 21 | btn_ul: "Zoznam", 22 | btn_ol: "\u010císlovaný zoznam", 23 | btn_olRomans: "Rímske \u010díslovanie", 24 | btn_olRomansSmall: "Malé rímske \u010díslovanie", 25 | btn_olAlphabetSmall: "Malá abeceda", 26 | btn_olAlphabetBig: "Ve\u013eká abeceda", 27 | 28 | btn_blockquote: "Bloková citácia", 29 | 30 | btn_sub: "Dolný index", 31 | btn_sup: "Horný index", 32 | 33 | btn_link: "Odkaz", 34 | btn_acronym: "Vysvetlenie skratky", 35 | btn_hr: "\u010ciara", 36 | btn_code: "Kód", 37 | btn_codeHtml: "Kód html", 38 | btn_codeCss: "Kód CSS", 39 | btn_codeJs: "Kód javascript", 40 | btn_codePhp: "Kód php", 41 | btn_codeSql: "Kód SQL", 42 | btn_comment: "Komentár", 43 | btn_div: "Blok div", 44 | btn_text: "Text", 45 | btn_codeInline: "Inline kód", 46 | btn_html: "HTML", 47 | btn_notexy: "Inline text", 48 | 49 | btn_edit: "Upravi\u0165", 50 | btn_preview: "Náh\u013ead", 51 | btn_htmlPreview: "HTML", 52 | btn_syntax: "Texy nápoveda", 53 | btn_submit: "Odosla\u0165", 54 | 55 | btn_web: "Web editora Texyla", 56 | 57 | // funkcie 58 | texyHeadingText: "Text nadpisu", 59 | acronymTitle: "Titulok", 60 | linkUrl: "Adresa odkazu", 61 | 62 | // pohlady 63 | wait: "Prosím po\u010dkajte", 64 | viewEmpty: "Textové pole je prázdne!", 65 | 66 | // okna 67 | windowOk: "OK", 68 | windowClose: "Zavrie\u0165", 69 | windowCancel: "Zru\u0161i\u0165", 70 | windowCloseAfterInsert: "Zavrie\u0165 po vlo\u017eení", 71 | 72 | // adresy 73 | syntaxUrl: 'http://texy.info/cs/syntax', 74 | 75 | /** pluginy ***************************************************************/ 76 | 77 | // color 78 | btn_color: "Farby", 79 | win_color: "Vyberte farbu", 80 | colorSelectModeHeading: "Ofarbi\u0165:", 81 | colorSelectModeText: "text", 82 | colorSelectModeBackground: 'pozadie', 83 | 84 | // emoticon 85 | btn_emoticon: "Smajlík", 86 | win_emoticon: "Vlo\u017ei\u0165 smajlíka", 87 | 88 | // files 89 | btn_files: "Súbory", 90 | win_files: "Súbory", 91 | filesUpload: "Nahra\u0165", 92 | win_upload: "Nahra\u0165 súbor", 93 | filesFilter: "Filter", 94 | filesMkDir: "Vytvori\u0165 adresár", 95 | filesRename: "Premenova\u0165", 96 | filesDelete: "Zmaza\u0165", 97 | filesReallyDelete: "Naozaj zmaza\u0165", 98 | filesDirectoryName: "Názov zlo\u017eky", 99 | 100 | // img 101 | btn_img: "Obrázok", 102 | win_img: "Vlo\u017ei\u0165 obrázok", 103 | imgSrc: "Adresa obrázka", 104 | imgAlt: "Popis", 105 | imgAlign: "Zarovnanie", 106 | imgAlignNone: "\u017eiadne", 107 | imgAlignLeft: "v\u013eavo", 108 | imgAlignRight: "vpravo", 109 | imgAlignCenter: "na stred", 110 | imgDescription: "Zobrazi\u0165 ako popisok", 111 | 112 | // link 113 | win_link: "Vlo\u017ei\u0165 odkaz", 114 | linkText: "Text odkazu", 115 | 116 | // symbol 117 | btn_symbol: "Symbol", 118 | win_symbol: "Vlo\u017ei\u0165 symbol", 119 | 120 | // table 121 | btn_table: "Tabu\u013eka", 122 | win_table: "Vlo\u017ei\u0165 tabu\u013eku", 123 | tableCols: "Po\u010det stĺpcov", 124 | tableRows: "Po\u010det riadkov", 125 | tableTh: "Hlavi\u010dka", 126 | tableThNone: "\u017eiadna", 127 | tableThTop: "hore", 128 | tableThLeft: "v\u013eavo", 129 | 130 | // text transform 131 | btn_textTransform: "Transformova\u0165 text", 132 | win_textTransform: "Vyberte transformáciu", 133 | textTransformLower: "malé písmena", 134 | textTransformUpper: "VE\u013dKÉ PÍSMENA", 135 | textTransformCapitalize: "Prvé Ve\u013eké", 136 | textTransformFirstUpper: "Prvé ve\u013ekým", 137 | textTransformUrl: "tvar-webovej-adresy", 138 | 139 | // youtube 140 | btn_youtube: "YouTube", 141 | win_youtube: "YouTube", 142 | youtubeUrl: "Vlo\u017ete adresu videa alebo jeho ID", 143 | youtubePreview: "Náh\u013ead videa", 144 | 145 | // Gravatar 146 | btn_gravatar: 'Gravatar', 147 | win_gravatar: 'Gravatar', 148 | gravatarUrl: "Vlo\u017ete email", 149 | gravatarPreview: "Náh\u013ead" 150 | }); -------------------------------------------------------------------------------- /texyla/js/texyla.js: -------------------------------------------------------------------------------- 1 | // Rozšířit jQuery o texylování 2 | jQuery.fn.extend({ 3 | texyla: function (options) { 4 | this.filter("textarea").each(function () { 5 | new Texyla(this, options); 6 | }); 7 | } 8 | }); 9 | 10 | // $.texyla(); 11 | jQuery.extend({ 12 | texyla: function (options) { 13 | jQuery("textarea").texyla(options); 14 | } 15 | }); 16 | 17 | // Texyla konstruktor 18 | function Texyla(textarea, options) { 19 | // uloží nastavení 20 | this.options = jQuery.extend({}, this.defaultOptions, options || {}); 21 | 22 | // uložím jQuery objekt textarey 23 | this.textarea = jQuery(textarea); 24 | 25 | // ochrana proti vícenásobnému ztexylování 26 | if (this.textarea.data("texyla")) return false; 27 | this.textarea.data("texyla", true); 28 | 29 | // nastavím jazyk 30 | var lng = this.options.language; 31 | if (!this.languages[lng]) { 32 | this.error("Language '" + lng + "' is not loaded."); 33 | return false; 34 | } 35 | this.lng = this.languages[lng]; 36 | 37 | // náhrada za %texyla_base% v adresách 38 | this.baseDir = this.options.baseDir || this.baseDir; 39 | this.options.iconPath = this.expand(this.options.iconPath); 40 | this.options.previewPath = this.expand(this.options.previewPath); 41 | 42 | // vytvořím texy pro texylu 43 | this.texy = new Texy(this); 44 | 45 | // obalit ovládacíma blbostma 46 | this.wrap(); 47 | 48 | // spustí pluginy 49 | for (var i = 0; i < this.initPlugins.length; i++) { 50 | this.initPlugins[i].apply(this); 51 | } 52 | }; 53 | 54 | // nahradí v řetězci hodnoty za proměnné 55 | Texyla.prototype.expand = function (text, variable) { 56 | text = text.replace("%texyla_base%", this.baseDir); 57 | if (variable) { 58 | text = text.replace("%var%", variable); 59 | } 60 | 61 | return text; 62 | }; 63 | 64 | // pole funkcí zprovozňující pluginy 65 | Texyla.prototype.initPlugins = []; 66 | 67 | // příkazy 68 | jQuery.texyla.setDefaults = function (defaults) { 69 | jQuery.extend(Texyla.prototype.defaultOptions, defaults); 70 | }; 71 | 72 | jQuery.texyla.initPlugin = function (pluginInit) { 73 | Texyla.prototype.initPlugins.push(pluginInit); 74 | }; 75 | 76 | jQuery.texyla.addButton = function (name, func) { 77 | Texyla.prototype.buttons[name] = func; 78 | }; 79 | 80 | jQuery.texyla.extend = function (extendingObject) { 81 | jQuery.extend(Texyla.prototype, extendingObject); 82 | }; 83 | 84 | jQuery.texyla.addStrings = function (lng, strings) { 85 | if (!Texyla.prototype.languages[lng]) { 86 | Texyla.prototype.languages[lng] = {}; 87 | } 88 | 89 | jQuery.extend(Texyla.prototype.languages[lng], strings); 90 | }; 91 | 92 | jQuery.texyla.setErrorHandler = function (handler) { 93 | Texyla.prototype.error = handler; 94 | }; 95 | 96 | // Odeslat formulář 97 | Texyla.prototype.submit = function () { 98 | var f = this.textarea.get(0).form; 99 | function submitnout() { 100 | if (f.submit.tagName == undefined) { 101 | f.submit(); 102 | } else { 103 | f.submit.click(); 104 | } 105 | } 106 | if (typeof f.onsubmit == 'function') { 107 | if (f.onsubmit() !== false) { 108 | submitnout(); 109 | } 110 | } else { 111 | submitnout(); 112 | } 113 | }; 114 | 115 | // chybový handler 116 | Texyla.prototype.error = function (message) { 117 | alert("Error: " + message); 118 | }; 119 | 120 | // výchozí adresář 121 | Texyla.prototype.baseDir = null; 122 | 123 | // jazyky 124 | Texyla.prototype.languages = {}; 125 | 126 | // výchozí nastavení 127 | Texyla.prototype.defaultOptions = { 128 | // šířka Texyly v pixelech 129 | width: null, 130 | // Odsazení textarey od krajů Texyly 131 | padding: 5, 132 | // výchozí konfigurace Texy: žádná 133 | texyCfg: "", 134 | // lišta 135 | toolbar: ['bold', 'italic', null, 'ul', 'ol', null, 'link', null, 'emoticon', 'symbol', "img", "table", null, ['web']], 136 | // tlačítka vlevo dole 137 | bottomLeftToolbar: ['edit', 'preview'], 138 | // tlačítka vpravo dole při editaci 139 | bottomRightEditToolbar: ['syntax'], 140 | // tlačítka vpravo dole při náhledu 141 | bottomRightPreviewToolbar: ['submit'], 142 | // typ tlačítek (span | button) 143 | buttonType: "span", 144 | // jestli bude levá dolní lišta zobrazena jako taby 145 | tabs: false, 146 | // výchozí pohled 147 | defaultView: "edit", 148 | // šířka ikon 149 | iconWidth: 16, 150 | // výška ikon 151 | iconHeight: 16, 152 | // adresář Texyly. Texyla se to pokusí zjistit automaticky, ale je to vhodné vyplnit. 153 | baseDir: null, 154 | // cesta k ikonkám 155 | iconPath: "%texyla_base%/icons/%var%.png", 156 | // cesta k náhledu 157 | previewPath: null, 158 | // jazyk 159 | language: "cs" 160 | }; 161 | -------------------------------------------------------------------------------- /examples/php-plain/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Texyla 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 104 | 105 | 106 |
107 | 108 |
109 | 124 | 125 |

126 | 127 | 132 |
133 | 134 |

135 |
136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /texyla/js/selection.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Selection 3 | * obsluhuje výběr v textaree 4 | * @author Jan Marek 5 | */ 6 | function Selection(ta) { 7 | this.textarea = ta; 8 | }; 9 | 10 | Selection.prototype = { 11 | 12 | // oddělovač řádků 13 | lineFeedFormat: null, 14 | 15 | // jestli jsme si jisti s formátem oddělovače řádků 16 | lineFeedKnown: false, 17 | 18 | /** 19 | * Zjišťuje, zdali je prohlížeč internet explorer 20 | */ 21 | isIe: function () { 22 | // Opera, Firefox 23 | if (this.textarea.selectionStart || this.textarea.selectionStart === 0) { 24 | return false; 25 | 26 | // IE 27 | } else if (document.selection) { 28 | return true; 29 | } 30 | 31 | return null; 32 | }, 33 | 34 | // obalí výběr (firstTexy + výběr + secondText) 35 | tag: function (firstText, secondText) { 36 | this.update(); 37 | 38 | this.changeSelection(firstText + this.text() + secondText); 39 | 40 | // je li obalen kurzor 41 | if (this.isCursor()) { 42 | this.select(this.start + firstText.length, 0); 43 | 44 | // či výběr 45 | } else { 46 | this.select(this.start, firstText.length + this.length() + secondText.length); 47 | } 48 | 49 | 50 | }, 51 | 52 | // nahradí výběr proměnnou replacement 53 | replace: function (replacement) { 54 | if (replacement === null) return; 55 | 56 | this.update(); 57 | 58 | this.changeSelection(replacement); 59 | 60 | this.select(this.start, replacement.length); 61 | }, 62 | 63 | // odstraní případnou jednu mezeru vpravo z výběru 64 | trimSelect: function () { 65 | this.update(); 66 | 67 | if (this.text().substring(this.length(), this.length() - 1) == " ") { 68 | this.select(this.start, this.length() - 1); 69 | } 70 | 71 | return this.update(); 72 | }, 73 | 74 | // odstraní případnou jednu mezeru vpravo z výběru a zavolá funkci this.tag() 75 | // FF & IE fix (po dvojkliku na slovo vybere i mezeru za ním) 76 | phrase: function (firstText, secondText) { 77 | this.trimSelect().tag(firstText, secondText ? secondText : firstText); 78 | }, 79 | 80 | // změna výběru 81 | changeSelection: function (replacement) { 82 | // Kolik je odrolováno 83 | var scrolled = this.textarea.scrollTop; 84 | 85 | // Změna textu v textaree 86 | var val = this.textarea.value; 87 | this.textarea.value = val.substring(0, this.start) + replacement + val.substring(this.end); 88 | 89 | // Odrolovat na původní pozici 90 | this.textarea.scrollTop = scrolled; 91 | }, 92 | 93 | // Funkce zjistí pravděpodobnou podobu formátu nového řádku. 94 | lf: function() { 95 | if (this.lineFeedKnown) return this.lineFeedFormat; 96 | 97 | // Pokusí se ho nalézt: 98 | var unix = this.textarea.value.indexOf('\n'); 99 | var mac = this.textarea.value.indexOf('\r'); 100 | var win = this.textarea.value.indexOf('\r\n'); 101 | 102 | var lineFeed = null; 103 | if (unix >= 0) lineFeed = '\n'; 104 | if (mac >= 0) lineFeed = '\r'; 105 | if (win >= 0) lineFeed = '\r\n'; 106 | 107 | // V případě úspěchu nastaví proměnnou this.lineFeedKnown na true a funkce již později hledání neopakuje. 108 | if (lineFeed) { 109 | this.lineFeedFormat = lineFeed; 110 | this.lineFeedKnown = true; 111 | return lineFeed; 112 | } 113 | 114 | // Jinak se nový řádek vrátí provizorně podle prohlížeče. (O, IE -> win, FF -> unix) 115 | return document.selection ? '\r\n' : '\n'; 116 | }, 117 | 118 | // Ulož vlastnosti výběru 119 | update: function() { 120 | this.textarea.focus(); 121 | 122 | // IE 123 | if (this.isIe()) { 124 | // Copyright (c) 2005-2007 KOSEKI Kengo 125 | var range = document.selection.createRange(); 126 | var bookmark = range.getBookmark(); 127 | 128 | var contents = this.textarea.value; 129 | var originalContents = contents; 130 | var marker = "[~M~A~R~K~E~R~]"; 131 | while (contents.indexOf(marker) != -1) { 132 | marker = marker + Math.random(); 133 | } 134 | 135 | range.text = marker + range.text + marker; 136 | contents = this.textarea.value; 137 | 138 | this.start = contents.indexOf(marker); 139 | contents = contents.replace(marker, ""); 140 | this.end = contents.indexOf(marker); 141 | 142 | this.textarea.value = originalContents; 143 | range.moveToBookmark(bookmark); 144 | range.select(); 145 | // O, FF 146 | } else { 147 | this.start = this.textarea.selectionStart; 148 | this.end = this.textarea.selectionEnd; 149 | } 150 | 151 | return this; 152 | }, 153 | 154 | length: function () { 155 | return this.end - this.start; 156 | }, 157 | 158 | text: function () { 159 | return this.textarea.value.substring(this.start, this.end); 160 | }, 161 | 162 | isCursor: function () { 163 | return this.start == this.end; 164 | }, 165 | 166 | // vybere od pozice from text o délce length 167 | select: function(from, length) { 168 | if (this.isIe()) { 169 | var lfCount = this.textarea.value.substring(0, from).split("\r\n").length - 1; 170 | from -= lfCount; 171 | this.textarea.focus(); 172 | this.textarea.select(); 173 | var ieSelected = document.selection.createRange(); 174 | ieSelected.collapse(true); 175 | ieSelected.moveStart("character", from); 176 | ieSelected.moveEnd("character", length); 177 | ieSelected.select(); 178 | } else { 179 | this.textarea.selectionStart = from; 180 | this.textarea.selectionEnd = from + length; 181 | } 182 | 183 | this.textarea.focus(); 184 | }, 185 | 186 | // vybrat blok 187 | selectBlock: function() { 188 | this.update(); 189 | 190 | var lf = this.lf(); 191 | var ta = this.textarea; 192 | 193 | // začátek 194 | var workFrom = ta.value.substring(0, this.start).lastIndexOf(lf); 195 | if (workFrom !== -1) workFrom += lf.length; 196 | var from = Math.max(0, workFrom); 197 | 198 | // konec 199 | var len = ta.value.substring(from, this.start).length + this.length(); 200 | var fromSelectionEnd = ta.value.substring(this.end, ta.value.length); 201 | var lineFeedPos = fromSelectionEnd.indexOf(lf); 202 | len += lineFeedPos == -1 ? fromSelectionEnd.length : lineFeedPos; 203 | 204 | this.select(from, len); 205 | return this.update(); 206 | } 207 | }; -------------------------------------------------------------------------------- /examples/nette/app/classes/MyTexy.php: -------------------------------------------------------------------------------- 1 | setOutputMode(self::HTML5); 25 | $this->htmlOutputModule->removeOptional = false; 26 | self::$advertisingNotice = false; 27 | 28 | // headings 29 | $this->headingModule->balancing = TexyHeadingModule::FIXED; 30 | 31 | // phrases 32 | $this->allowed['phrase/ins'] = true; // ++inserted++ 33 | $this->allowed['phrase/del'] = true; // --deleted-- 34 | $this->allowed['phrase/sup'] = true; // ^^superscript^^ 35 | $this->allowed['phrase/sub'] = true; // __subscript__ 36 | $this->allowed['phrase/cite'] = true; // ~~cite~~ 37 | $this->allowed['deprecated/codeswitch'] = true; // `=code 38 | 39 | // images 40 | $this->imageModule->fileRoot = WWW_DIR . "/files"; 41 | $this->imageModule->root = $baseUri . "/files/"; 42 | 43 | // flash, youtube.com, stream.cz, gravatar handlers 44 | $this->addHandler('image', array($this, 'youtubeHandler')); 45 | $this->addHandler('image', array($this, 'streamHandler')); 46 | $this->addHandler('image', array($this, 'flashHandler')); 47 | $this->addHandler("phrase", array($this, "netteLink")); 48 | $this->addHandler('image', array($this, 'gravatarHandler')); 49 | } 50 | 51 | 52 | 53 | /** 54 | * Template factory 55 | * @return Template 56 | */ 57 | private function createTemplate() 58 | { 59 | $template = new FileTemplate; 60 | $template->registerFilter(new Engine); 61 | return $template; 62 | } 63 | 64 | 65 | 66 | /** 67 | * @param TexyHandlerInvocation handler invocation 68 | * @param string 69 | * @param string 70 | * @param TexyModifier 71 | * @param TexyLink 72 | * @return TexyHtml|string|FALSE 73 | */ 74 | public function netteLink($invocation, $phrase, $content, $modifier, $link) 75 | { 76 | // is there link? 77 | if (!$link) return $invocation->proceed(); 78 | 79 | $url = $link->URL; 80 | 81 | if (Strings::startsWith($url, "plink://")) { 82 | $url = substr($url, 8); 83 | list($presenter, $params) = explode("?", $url, 2); 84 | 85 | $arr = array(); 86 | 87 | if ($params) { 88 | parse_str($params, $arr); 89 | } 90 | 91 | $link->URL = $this->presenter->link($presenter, $arr); 92 | } 93 | 94 | return $invocation->proceed(); 95 | } 96 | 97 | 98 | 99 | /** 100 | * YouTube handler for images 101 | * 102 | * @example [* youtube:JG7I5IF6 *] 103 | * 104 | * @param TexyHandlerInvocation handler invocation 105 | * @param TexyImage 106 | * @param TexyLink 107 | * @return TexyHtml|string|FALSE 108 | */ 109 | public function youtubeHandler($invocation, $image, $link) 110 | { 111 | $parts = explode(':', $image->URL, 2); 112 | 113 | if (count($parts) !== 2 || $parts[0] !== "youtube") { 114 | return $invocation->proceed(); 115 | } 116 | 117 | $template = $this->createTemplate()->setFile(APP_DIR . "/templates/inc/@youtube.latte"); 118 | $template->id = $parts[1]; 119 | if ($image->width) $template->width = $image->width; 120 | if ($image->height) $template->height = $image->height; 121 | 122 | return $this->protect((string) $template, Texy::CONTENT_BLOCK); 123 | } 124 | 125 | 126 | 127 | /** 128 | * Flash handler for images 129 | * 130 | * @example [* flash.swf 200x150 .(alternative content) *] 131 | * 132 | * @param TexyHandlerInvocation handler invocation 133 | * @param TexyImage 134 | * @param TexyLink 135 | * @return TexyHtml|string|FALSE 136 | */ 137 | public function flashHandler($invocation, $image, $link) 138 | { 139 | if (!Strings::endsWith($image->URL, ".swf")) { 140 | return $invocation->proceed(); 141 | } 142 | 143 | $template = $this->createTemplate()->setFile(APP_DIR . "/templates/inc/@flash.latte"); 144 | $template->url = Texy::prependRoot($image->URL, $this->imageModule->root); 145 | $template->width = $image->width; 146 | $template->height = $image->height; 147 | if ($image->modifier->title) $template->title = $image->modifier->title; 148 | 149 | return $this->protect((string) $template, Texy::CONTENT_BLOCK); 150 | } 151 | 152 | 153 | 154 | /** 155 | * User handler for images 156 | * 157 | * @example [* stream:98GDAS675G *] 158 | * 159 | * @param TexyHandlerInvocation handler invocation 160 | * @param TexyImage 161 | * @param TexyLink 162 | * @return TexyHtml|string|FALSE 163 | */ 164 | public function streamHandler($invocation, $image, $link) 165 | { 166 | $parts = explode(':', $image->URL, 2); 167 | 168 | if (count($parts) !== 2 || $parts[0] !== "stream") { 169 | return $invocation->proceed(); 170 | } 171 | 172 | $template = $this->createTemplate()->setFile(APP_DIR . "/templates/inc/@stream.latte"); 173 | $template->id = $parts[1]; 174 | if ($image->width) $template->width = $image->width; 175 | if ($image->height) $template->height = $image->height; 176 | 177 | return $this->protect((string) $template, Texy::CONTENT_BLOCK); 178 | } 179 | 180 | 181 | 182 | /** 183 | * Gravatar handler for images 184 | * 185 | * @example [* gravatar:user@example.com *] 186 | * 187 | * @param TexyHandlerInvocation handler invocation 188 | * @param TexyImage 189 | * @param TexyLink 190 | * @return TexyHtml|string|FALSE 191 | */ 192 | public function gravatarHandler($invocation, $image, $link) 193 | { 194 | $parts = explode(':', $image->URL, 2); 195 | 196 | if (count($parts) !== 2 || $parts[0] !== "gravatar") { 197 | return $invocation->proceed(); 198 | } 199 | 200 | $template = $this->createTemplate()->setFile(APP_DIR . "/templates/inc/@gravatar.latte"); 201 | $template->email = $parts[1]; 202 | if ($image->width) $template->width = $image->width; 203 | if ($image->height) $template->height = $image->height; 204 | 205 | return $this->protect((string) $template, Texy::CONTENT_BLOCK); 206 | } 207 | 208 | } -------------------------------------------------------------------------------- /examples/php-plain/AdminTexy.php: -------------------------------------------------------------------------------- 1 | setOutputMode(self::HTML4_TRANSITIONAL); 16 | $this->htmlOutputModule->removeOptional = false; 17 | self::$advertisingNotice = false; 18 | 19 | // headings 20 | $this->headingModule->balancing = TexyHeadingModule::FIXED; 21 | 22 | // phrases 23 | $this->allowed['phrase/ins'] = true; // ++inserted++ 24 | $this->allowed['phrase/del'] = true; // --deleted-- 25 | $this->allowed['phrase/sup'] = true; // ^^superscript^^ 26 | $this->allowed['phrase/sub'] = true; // __subscript__ 27 | $this->allowed['phrase/cite'] = true; // ~~cite~~ 28 | $this->allowed['deprecated/codeswitch'] = true; // `=code 29 | 30 | // images 31 | $this->imageModule->fileRoot = __DIR__ . "/images"; 32 | $this->imageModule->root = "images/"; 33 | 34 | // přidávání youtube.com, stream.cz videa, flash a gravatar 35 | $this->addHandler('image', array(__CLASS__, 'youtubeHandler')); 36 | $this->addHandler('image', array(__CLASS__, 'streamHandler')); 37 | $this->addHandler('image', array(__CLASS__, 'flashHandler')); 38 | $this->addHandler('image', array(__CLASS__, 'gravatarHandler')); 39 | } 40 | 41 | 42 | /** 43 | * User handler for images 44 | * 45 | * @param TexyHandlerInvocation handler invocation 46 | * @param TexyImage 47 | * @param TexyLink 48 | * @return TexyHtml|string|FALSE 49 | */ 50 | public static function youtubeHandler($invocation, $image, $link) 51 | { 52 | $parts = explode(':', $image->URL); 53 | if (count($parts) !== 2) 54 | return $invocation->proceed(); 55 | 56 | switch ($parts[0]) { 57 | case 'youtube': 58 | $video = htmlSpecialChars($parts[1]); 59 | $dimensions = 'width="' . ($image->width ? $image->width : 425) . '" height="' . ($image->height ? $image->height : 350) . '"'; 60 | $code = '
' 61 | . '' 62 | . '
'; 63 | 64 | $texy = $invocation->getTexy(); 65 | return $texy->protect($code, Texy::CONTENT_BLOCK); 66 | } 67 | 68 | return $invocation->proceed(); 69 | } 70 | 71 | 72 | 73 | /** 74 | * User handler for images 75 | * 76 | * @param TexyHandlerInvocation handler invocation 77 | * @param TexyImage 78 | * @param TexyLink 79 | * @return TexyHtml|string|FALSE 80 | */ 81 | public static function flashHandler($invocation, $image, $link) 82 | { 83 | $texy = $invocation->getTexy(); 84 | 85 | if (substr($image->URL, -4) === '.swf') { // accepts only *.swf 86 | $movie = Texy::prependRoot($image->URL, $texy->imageModule->root); 87 | 88 | $dimensions = 89 | ($image->width ? ' width="' . $image->width . '"' : '') 90 | . ($image->height ? ' height="' . $image->height . '"' : ''); 91 | 92 | $movie = htmlSpecialChars($movie); 93 | $altContent = $image->modifier->title ? "

" . htmlSpecialChars($image->modifier->title) . "

" : ""; 94 | 95 | // @see http://phpfashion.com/how-to-correctly-insert-a-flash-into-xhtml 96 | $code = ' 97 | 98 | 99 | 100 | 101 | 106 | 107 | ' . $altContent . ' 108 | 109 | 110 | '; 111 | return $texy->protect($code, Texy::CONTENT_BLOCK); 112 | } 113 | 114 | return $invocation->proceed(); 115 | } 116 | 117 | 118 | 119 | /** 120 | * User handler for images 121 | * 122 | * @param TexyHandlerInvocation handler invocation 123 | * @param TexyImage 124 | * @param TexyLink 125 | * @return TexyHtml|string|FALSE 126 | */ 127 | public static function streamHandler($invocation, $image, $link) 128 | { 129 | $parts = explode(':', $image->URL, 2); 130 | 131 | if (count($parts) != 2 || $parts[0] != "stream") { 132 | return $invocation->proceed(); 133 | } 134 | 135 | $url = 'http://www.stream.cz/object/' . htmlSpecialChars($parts[1]); 136 | $width = $image->width ? $image->width : 450; 137 | $height = $image->height ? $image->height : 354; 138 | $dimensions = 'width="' . $width . '" height="' . $height . '"'; 139 | 140 | $code = '' . 141 | '' . 142 | '' . 143 | '' . 144 | '' . 145 | ''; 148 | 149 | $texy = $invocation->getTexy(); 150 | return $texy->protect($code, Texy::CONTENT_BLOCK); 151 | } 152 | 153 | 154 | /** 155 | * User handler for images 156 | * 157 | * @param TexyHandlerInvocation handler invocation 158 | * @param TexyImage 159 | * @param TexyLink 160 | * @return TexyHtml|string|FALSE 161 | */ 162 | public static function gravatarHandler($invocation, $image, $link) 163 | { 164 | $parts = explode(':', $image->URL); 165 | if (count($parts) !== 2) 166 | return $invocation->proceed(); 167 | 168 | switch ($parts[0]) { 169 | case 'gravatar': 170 | $email = htmlSpecialChars($parts[1]); 171 | $dimensions = 'width="' . ($image->width ? $image->width : 32) . '" height="' . ($image->width ? $image->width : 32) . '"'; 172 | $code = '
'; 173 | 174 | $texy = $invocation->getTexy(); 175 | return $texy->protect($code, Texy::CONTENT_BLOCK); 176 | } 177 | 178 | return $invocation->proceed(); 179 | } 180 | 181 | } -------------------------------------------------------------------------------- /texyla/js/texy.js: -------------------------------------------------------------------------------- 1 | function Texy(texyla) { 2 | this.textarea = texyla.textarea.get(0); 3 | this.texyla = texyla; 4 | }; 5 | 6 | // class Texy extends Selection 7 | Texy.prototype = jQuery.extend({}, Selection.prototype, { 8 | 9 | // tučné písmo 10 | bold: function () { 11 | this.trimSelect(); 12 | 13 | var text = this.text(); 14 | 15 | if (text.match(/^\*\*.*\*\*$/)) { 16 | this.replace(text.substring(2, text.length - 2)); 17 | } else { 18 | this.tag("**", "**"); 19 | } 20 | }, 21 | 22 | // kurzíva 23 | italic: function () { 24 | this.trimSelect(); 25 | 26 | var text = this.text(); 27 | 28 | if (text.match(/^\*\*\*.*\*\*\*$/) || text.match(/^\*[^*]+\*$/)) { 29 | this.replace(text.substring(1, text.length - 1)); 30 | } else { 31 | this.tag("*", "*"); 32 | } 33 | }, 34 | 35 | // blok 36 | block: function(what) { 37 | this.tag('/--' + what + this.lf(), this.lf() + '\\--'); 38 | }, 39 | 40 | // odkaz 41 | link: function(addr) { 42 | if (addr) this.phrase('"', '":' + addr); 43 | }, 44 | 45 | // acronym 46 | acronym: function(title) { 47 | this.update(); 48 | if (title) { 49 | // Nejsou potřeba uvozovky. př.: slovo((titulek)) 50 | if (this.text().match(/^[a-zA-ZěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ]{2,}$/)) { 51 | this.tag('','((' + title + '))'); 52 | 53 | // Jsou potřeba uvozovky. př.: "třeba dvě slova"((titulek)) 54 | } else { 55 | this.phrase('"', '"((' + title + '))'); 56 | } 57 | } 58 | }, 59 | 60 | // čára 61 | line: function() { 62 | this.update(); 63 | var lf = this.lf(); 64 | 65 | // text 66 | var lineText = lf + lf + '-------------------' + lf + lf; 67 | 68 | // vložit 69 | if (this.isCursor()) this.tag(lineText, ''); else this.replace(lineText); 70 | }, 71 | 72 | // zarovnání 73 | align: function(type) { 74 | this.update(); 75 | var lf = this.lf(); 76 | 77 | var start = '.' + type + lf; 78 | var newPar = lf + lf; 79 | var found = this.textarea.value.substring(0, this.start).lastIndexOf(newPar); 80 | var beforePar = found + newPar.length; 81 | 82 | if (found ==- 1) { 83 | this.textarea.value = start + this.textarea.value; 84 | } else { 85 | this.textarea.value = this.textarea.value.substring(0, beforePar) + start + this.textarea.value.substring(beforePar); 86 | } 87 | this.select(this.start + start.length, this.length()); 88 | }, 89 | 90 | // original: Dougie Lawson, http://web.ukonline.co.uk/dougie.lawson/ 91 | _toRoman: function(num) { 92 | num = Math.min(parseInt(num, 10), 5999); 93 | var mill = [ '', 'M', 'MM', 'MMM', 'MMMM', 'MMMMM' ], 94 | cent = [ '', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM' ], 95 | tens = [ '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC' ], 96 | ones = [ '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX' ], 97 | m, c, t, r = function(n) { 98 | n = (num - (num % n)) / n; 99 | return n; 100 | }; 101 | m = r(1000); 102 | num = num % 1000; 103 | c = r(100); 104 | num = num % 100; 105 | t = r(10); 106 | return mill[m] + cent[c] + tens[t] + ones[num % 10]; 107 | }, 108 | 109 | _toLetter: function(n) { 110 | var alphabet = [ 111 | "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", 112 | "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" 113 | ]; 114 | return alphabet[Math.max(0, Math.min(n, alphabet.length) - 1)]; 115 | }, 116 | 117 | // vytvoří seznam - číslovaný (type == "ol"), s odrážkami (type == "ul"), blockquote (type == "bq") 118 | list: function(type) { 119 | this.selectBlock(); 120 | var lf = this.lf(); 121 | var lines = this.text().split(lf); 122 | var lineCt = this.isCursor() ? 3 : lines.length; 123 | var replacement = ''; 124 | 125 | for (var i = 1; i <= lineCt; i++) { 126 | var bullet = { 127 | ul: '-', 128 | ol: i + ')', 129 | bq: '>', 130 | indent: '', 131 | romans: this._toRoman(i) + ')', 132 | smallRomans: this._toRoman(i).toLowerCase() + ')', 133 | smallAlphabet: this._toLetter(i) + ')', 134 | bigAlphabet: this._toLetter(i).toUpperCase() + ')' 135 | }; 136 | 137 | replacement += bullet[type] + ' ' + (!this.isCursor() ? lines[i - 1] : '') + (i != lineCt ? lf : ''); 138 | 139 | // seznam okolo kurzoru - pozice kurzoru 140 | if (this.isCursor() && i === 1) var curPos = replacement.length - 1; 141 | } 142 | 143 | if (this.isCursor()) { 144 | this.tag(replacement.substring(0, curPos), replacement.substring(curPos)); 145 | } else { 146 | this.replace(replacement); 147 | } 148 | }, 149 | 150 | // odsazení o mezeru 151 | indent: function () { 152 | this.list("indent"); 153 | }, 154 | 155 | // zrušit odsazení 156 | unindent: function () { 157 | this.selectBlock(); 158 | var lines = this.text().split(this.lf()); 159 | var replacement = []; 160 | 161 | for (var i = 0; i < lines.length; i++) { 162 | var first = lines[i].substring(0, 1); 163 | if (first == " " || first == "\t") { 164 | replacement.push(lines[i].substring(1, lines[i].length)); 165 | } else { 166 | replacement.push(lines[i]); 167 | } 168 | } 169 | 170 | this.replace(replacement.join(this.lf())); 171 | }, 172 | 173 | // vytvoří nadpis, podtrhne podle type 174 | heading: function(type) { 175 | this.selectBlock(); 176 | var lf = this.lf(); 177 | 178 | // podtržení 179 | function underline(len, type) { 180 | var txt = ''; 181 | for (var i = 0; i < Math.max(3, len); i++) { 182 | txt += type; 183 | } 184 | 185 | return txt; 186 | } 187 | 188 | // Nový nadpis 189 | if (this.isCursor()) { 190 | var headingText = prompt(this.texyla.lng.texyHeadingText, ''); 191 | if (headingText) { 192 | this.tag(headingText + lf + underline(headingText.length, type) + lf, ''); 193 | } 194 | 195 | // Vyrobí nadpis z výběru 196 | } else { 197 | this.tag('', lf + underline(this.length(), type)); 198 | } 199 | }, 200 | 201 | // obrázek 202 | img: function(src, alt, align, descr) { 203 | // Zarovnání na střed 204 | var imgT = ''; 205 | 206 | if (align == '<>') { 207 | imgT += this.lf() + '.<>' + this.lf(); 208 | align = false; 209 | } 210 | 211 | // Začátek 212 | imgT += '[* ' + src + ' '; 213 | 214 | // Popis 215 | imgT += alt ? '.('+ alt +') ' : ''; 216 | 217 | // Zarovnání 218 | imgT += (align ? align : '*') + ']'; 219 | 220 | // Popisek 221 | imgT += descr ? ' *** ' + alt : ''; 222 | 223 | this.replace(imgT); 224 | }, 225 | 226 | // tabulka 227 | table: function(cols, rows, header) { 228 | var lf = this.lf(); 229 | var tabTxt = lf; 230 | 231 | for (var i = 0; i < rows; i++) { 232 | // Hlavička nahoře 233 | if (header === 'n' && i < 2) { 234 | tabTxt += '|'; 235 | for (var j = 0; j < cols; ++j) { 236 | tabTxt += '--------'; 237 | } 238 | tabTxt += lf; 239 | } 240 | 241 | // Buňky 242 | for (j = 0; j < cols; j++) { 243 | // Hlavička vlevo 244 | if (header === 'l' && j === 0) { 245 | tabTxt += "|* \t"; 246 | 247 | // Buňka bez hlavičky 248 | } else { 249 | tabTxt += "| \t"; 250 | } 251 | 252 | // pozice kurzoru 253 | if (i === 0 && j === 0) var curPos = tabTxt.length - 1; 254 | } 255 | tabTxt += '|' + lf; 256 | } 257 | tabTxt += lf; 258 | 259 | // Vloží tabulku 260 | this.tag(tabTxt.substring(0, curPos), tabTxt.substring(curPos)); 261 | } 262 | }); -------------------------------------------------------------------------------- /texyla/js/dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Obalit textareu ovládacíma věcma 3 | */ 4 | Texyla.prototype.wrap = function () { 5 | /* kontejner */ 6 | this.container = this.textarea.wrap('
').parent(); 7 | 8 | var containerWidth = this.options.width || this.textarea.get(0).offsetWidth || this.textarea.width(); 9 | this.container.width(containerWidth); 10 | 11 | /* div s textareou */ 12 | this.editDiv = this.textarea.wrap('
') 13 | .parent().wrap('
').parent(); 14 | 15 | // nastavím šířku 16 | if (this.textarea.get(0).offsetWidth > 0) { // viditelná textarea 17 | this.textarea.width(containerWidth); 18 | var delta = this.textarea.get(0).offsetWidth - containerWidth; 19 | } else { 20 | var delta = 0; 21 | } 22 | 23 | this.textarea.width(containerWidth - delta - 2 * this.options.padding); 24 | 25 | // uložit výšku textarey 26 | this.textareaHeight = this.textarea.get(0).offsetHeight; 27 | 28 | /* div s náhledem */ 29 | this.previewDiv = jQuery('
').insertAfter(this.editDiv); 30 | // hlavička 31 | this.previewDiv.prepend( 32 | '
' + 34 | this.lng.btn_preview + '
' 35 | ); 36 | 37 | this.preview = jQuery('
') 38 | .appendTo(this.previewDiv) 39 | .wrap('
'); 40 | 41 | /* div s html náhledem */ 42 | this.htmlPreviewDiv = jQuery('
').insertAfter(this.previewDiv); 43 | // hlavička 44 | this.htmlPreviewDiv.prepend( 45 | '
' + 47 | this.lng.btn_htmlPreview + '
' 48 | ); 49 | 50 | this.htmlPreview = jQuery('
')
 51 | 		.appendTo(this.htmlPreviewDiv)
 52 | 		.wrap('
'); 53 | 54 | 55 | // čekejte 56 | this.wait = jQuery('
' + this.lng.wait + '
'); 57 | 58 | // vyrobím tlačítka 59 | this.createToolbar(); 60 | this.createBottomToolbar(); 61 | 62 | // zapnu pohled 63 | this.view(this.options.defaultView, true); 64 | }; 65 | 66 | /** 67 | * vyrobí horní lištu 68 | */ 69 | Texyla.prototype.createToolbar = function () { 70 | // lišta 71 | var toolbar = jQuery('
    ').prependTo(this.editDiv); 72 | var item, toolbar2; 73 | 74 | // prochází lištu 75 | for (var i = 0; i < this.options.toolbar.length; i++) { 76 | // aktuální položka 77 | item = this.options.toolbar[i]; 78 | 79 | // tlačítko 80 | if (typeof item == "string") { 81 | jQuery( 82 | "" + 83 | "" + 85 | "" 86 | ) 87 | .click(this.clickButton(item)) 88 | .appendTo("
  • ").parent() 89 | .appendTo(toolbar); 90 | } 91 | 92 | // separator 93 | else if (item === null) { 94 | toolbar.append("
  • "); 95 | } 96 | 97 | // podmenu 98 | else if (jQuery.isArray(item)) { 99 | toolbar2 = jQuery("
      "); 100 | var menuTimeout; 101 | toolbar2.appendTo("").parent().mouseover(function () { 102 | // prevence proti zmizení 103 | clearTimeout(menuTimeout); 104 | // schovat ostatní menu 105 | jQuery(this).siblings().find("ul:visible").fadeOut("fast"); 106 | // zobrazit 107 | jQuery(this).find("ul").show(); 108 | }).mouseout(function () { 109 | // po chvíli zmizí 110 | var _this = this; 111 | menuTimeout = setTimeout(function () { 112 | jQuery(_this).find("ul").fadeOut("fast"); 113 | }, 300); 114 | }).appendTo(toolbar); 115 | 116 | // jednotlivé položky v menu 117 | for (var j = 0; j < item.length; j++) { 118 | jQuery( 119 | "
    • " + 120 | "" + 121 | this.lng["btn_" + item[j]] + "
    • " 122 | ) 123 | .hover(function () { 124 | jQuery(this).addClass("ui-state-hover"); 125 | }, function () { 126 | jQuery(this).removeClass("ui-state-hover"); 127 | }) 128 | .click(this.clickButton(item[j])) 129 | .appendTo(toolbar2); 130 | } 131 | 132 | // label 133 | } else if (typeof(item) == "object" && item.type == "label") { 134 | var text = item.translatedText ? this.lng[item.translatedText] : item.text; 135 | toolbar.append("
    • " + text + "
    • "); 136 | } 137 | } 138 | }; 139 | 140 | /** 141 | * Vrátí funkci, která se přiřadí tlačítkům po kliknutí 142 | * @param string name název funkce 143 | * @return function 144 | */ 145 | Texyla.prototype.clickButton = function (name) { 146 | var _this = this; 147 | 148 | if (name in this.buttons) { 149 | return function (e) { 150 | _this.buttons[name].call(_this, e); 151 | }; 152 | } else { 153 | return function () { 154 | _this.error('Function "' + name + '" is not supported!'); 155 | }; 156 | } 157 | }; 158 | 159 | /** 160 | * Vyrobí spodní lišty 161 | */ 162 | Texyla.prototype.createBottomToolbar = function () { 163 | // vytvořit lišty 164 | var bottomToolbar = jQuery("
      ").appendTo(this.container); 165 | this.leftToolbar = jQuery("
      ").appendTo(bottomToolbar); 166 | var right = jQuery('
      ').appendTo(bottomToolbar); 167 | this.rightEditToolbar = jQuery("
      ").appendTo(right); 168 | this.rightPreviewToolbar = jQuery("
      ").appendTo(right); 169 | 170 | // přidat CSS třídy 171 | 172 | // když to jsou taby 173 | if (this.options.tabs) { 174 | this.leftToolbar.addClass("tabs"); 175 | // nebo jsou tlačítka typu span 176 | } else if (this.options.buttonType == "span") { 177 | this.leftToolbar.addClass("span-tb"); 178 | } 179 | 180 | // pravá lišta s tlačítkami typu span? 181 | if (this.options.buttonType == "span") { 182 | right.addClass("span-tb"); 183 | } 184 | 185 | // přidat tlačítka 186 | var _this = this; 187 | 188 | // vyrobit tlačítko 189 | function createButton(icon, name, func, tabs) { 190 | var iconUrl = _this.expand(_this.options.iconPath, icon); 191 | 192 | // tlačítko typu span 193 | if (_this.options.buttonType == "span" || tabs) { 194 | return jQuery( 195 | "" + 196 | "" + 197 | "" + name + "" + 198 | "" + 199 | "" 200 | ).click(func).hover(function () { 201 | jQuery(this).addClass("ui-state-hover"); 202 | }, function () { 203 | jQuery(this).removeClass("ui-state-hover"); 204 | }); 205 | 206 | // klasické tlačítko 207 | } else { 208 | return jQuery( 209 | "" 212 | ).click(func); 213 | } 214 | }; 215 | 216 | // vyplnit lištu tlačítky 217 | function insertButtons(toolbar, buttons, tabs) { 218 | for (var i = 0; i < buttons.length; i++) { 219 | createButton( 220 | buttons[i], 221 | _this.lng["btn_" + buttons[i]], 222 | _this.clickButton(buttons[i]), 223 | tabs 224 | ).appendTo(toolbar); 225 | } 226 | }; 227 | 228 | // vložit tlačítka 229 | insertButtons(this.leftToolbar, this.options.bottomLeftToolbar, this.options.tabs); 230 | insertButtons(this.rightEditToolbar, this.options.bottomRightEditToolbar); 231 | insertButtons(this.rightPreviewToolbar, this.options.bottomRightPreviewToolbar); 232 | }; -------------------------------------------------------------------------------- /examples/nette/app/presenters/TexylaPresenter.php: -------------------------------------------------------------------------------- 1 | getService('Texy'); 34 | $this->baseFolderPath = $texy->imageModule->fileRoot; 35 | $this->baseFolderUri = $texy->imageModule->root; 36 | $this->tempDir = TEMP_DIR; 37 | $this->tempUri = $this->template->basePath . "/temp"; 38 | } 39 | 40 | 41 | 42 | /** 43 | * Texyla preview 44 | */ 45 | public function actionPreview() 46 | { 47 | $texy = $this->getService('Texy'); 48 | $httpRequest = $this->context->httpRequest; 49 | $html = $texy->process($httpRequest->getPost("texy")); 50 | $this->sendResponse(new TextResponse($html)); 51 | } 52 | 53 | 54 | // files plugin 55 | 56 | 57 | 58 | /** 59 | * Send error message 60 | * @param string $msg 61 | */ 62 | private function sendError($msg) 63 | { 64 | $this->sendResponse(new JsonResponse(array( 65 | "error" => $msg, 66 | ), "text/plain")); 67 | } 68 | 69 | 70 | 71 | /** 72 | * Get and check path to folder 73 | * @param string $folder 74 | */ 75 | protected function getFolderPath($folder) 76 | { 77 | $folderPath = realpath($this->baseFolderPath . ($folder ? "/" . $folder : "")); 78 | 79 | if (!is_dir($folderPath) || !is_writable($folderPath) || !Strings::startsWith($folderPath, realpath($this->baseFolderPath))) { 80 | throw new \Nette\InvalidArgumentException; 81 | } 82 | 83 | return $folderPath; 84 | } 85 | 86 | 87 | 88 | /** 89 | * File name with cached preview image in file browser 90 | * @param string $path 91 | * @return string 92 | */ 93 | protected function thumbnailFileName($path) 94 | { 95 | $path = realpath($path); 96 | return "texylapreview-" . md5($path . "|" . filemtime($path)) . ".jpg"; 97 | } 98 | 99 | 100 | 101 | /** 102 | * File browser - list files 103 | * @param string $folder 104 | */ 105 | public function actionListFiles($folder = "") 106 | { 107 | // check rights 108 | // if (!Environment::getUser()->isAuthenticated()) { 109 | // $this->sendError("Access denied."); 110 | // } 111 | 112 | try { 113 | $folderPath = $this->getFolderPath($folder); 114 | } catch (InvalidArgumentException $e) { 115 | $this->sendError("Folder does not exist or is not writeable."); 116 | } 117 | 118 | // list of files 119 | $folders = array(); 120 | $files = array(); 121 | 122 | // up 123 | if ($folder !== "") { 124 | $lastPos = strrpos($folder, "/"); 125 | $key = $lastPos === false ? "" : substr($folder, 0, $lastPos); 126 | 127 | $folders[] = array("type" => "up", "name" => "..", "key" => $key,); 128 | } 129 | 130 | foreach (new \DirectoryIterator($folderPath) as $fileInfo) { 131 | $fileName = $fileInfo->getFileName(); 132 | 133 | // skip hidden files, . and .. 134 | if (Strings::startsWith($fileName, ".")) 135 | continue; 136 | 137 | // filename with folder 138 | $key = ($folder ? $folder . "/" : "") . $fileName; 139 | 140 | // directory 141 | if ($fileInfo->isDir()) { 142 | $folders[] = array("type" => "folder", "name" => $fileName, "key" => $key,); 143 | 144 | // file 145 | } elseif ($fileInfo->isFile()) { 146 | 147 | // image 148 | if (@getImageSize($fileInfo->getPathName())) { 149 | $thumbFileName = $this->thumbnailFileName($fileInfo->getPathName()); 150 | 151 | if (file_exists($this->tempDir . "/" . $thumbFileName)) { 152 | $thumbnailKey = $this->tempUri . "/" . $thumbFileName; 153 | } else { 154 | $thumbnailKey = $this->link("thumbnail", $key); 155 | } 156 | 157 | $files[] = array( 158 | "type" => "image", 159 | "name" => $fileName, 160 | "insertUrl" => $key, 161 | "description" => $fileName, 162 | "thumbnailKey" => $thumbnailKey, 163 | ); 164 | 165 | // other file 166 | } else { 167 | $files[] = array( 168 | "type" => "file", 169 | "name" => $fileName, 170 | "insertUrl" => $this->baseFolderUri . ($folder ? "$folder/" : "") . $fileName, 171 | "description" => $fileName, 172 | ); 173 | } 174 | } 175 | } 176 | 177 | // send response 178 | $this->sendResponse(new JsonResponse(array( 179 | "list" => array_merge($folders, $files), 180 | ))); 181 | } 182 | 183 | 184 | 185 | /** 186 | * Genarate and show preview of the image in file browser 187 | * @param string $key 188 | */ 189 | public function actionThumbnail($key) 190 | { 191 | try { 192 | $path = $this->baseFolderPath . "/" . $key; 193 | $image = Image::fromFile($path)->resize(60, 40); 194 | $image->save($this->tempDir . "/" . $this->thumbnailFileName($path)); 195 | @chmod($path, 0666); 196 | $image->send(); 197 | } catch (Exception $e) { 198 | Image::fromString(Image::EMPTY_GIF)->send(Image::GIF); 199 | } 200 | 201 | $this->terminate(); 202 | } 203 | 204 | 205 | /** 206 | * File upload 207 | */ 208 | public function actionUpload() 209 | { 210 | $httpRequest = $this->context->httpRequest; 211 | 212 | // check user rights 213 | // if (!Environment::getUser()->isAllowed("files", "upload")) { 214 | // $this->sendError("Access denied."); 215 | // } 216 | 217 | // path 218 | $folder = $httpRequest->getPost("folder"); 219 | 220 | try { 221 | $folderPath = $this->getFolderPath($folder); 222 | } catch (InvalidArgumentException $e) { 223 | $this->sendError("Folder does not exist or is not writeable."); 224 | } 225 | 226 | // file 227 | $file = $httpRequest->getFile("file"); 228 | 229 | // check 230 | if ($file === null || !$file->isOk()) { 231 | $this->sendError("Upload error."); 232 | } 233 | 234 | // move 235 | $fileName = Strings::webalize($file->getName(), "."); 236 | $path = $folderPath . "/" . $fileName; 237 | 238 | if (@$file->move($path)) { 239 | @chmod($path, 0666); 240 | 241 | if ($file->isImage()) { 242 | $this->payload->filename = ($folder ? "$folder/" : "") . $fileName; 243 | $this->payload->type = "image"; 244 | } else { 245 | $this->payload->filename = $this->baseFolderUri . ($folder ? "$folder/" : "") . $fileName; 246 | $this->payload->type = "file"; 247 | } 248 | 249 | $this->sendResponse(new JsonResponse($this->payload, "text/plain")); 250 | } else { 251 | $this->sendError("Move failed."); 252 | } 253 | } 254 | 255 | 256 | 257 | /** 258 | * Make directory 259 | * @param string folder 260 | * @param string new folder name 261 | */ 262 | public function actionMkDir($folder, $name) 263 | { 264 | $name = Strings::webalize($name); 265 | $path = $this->getFolderPath($folder) . "/" . $name; 266 | 267 | if (mkdir($path)) { 268 | $this->sendResponse(new JsonResponse(array( 269 | "name" => $name, 270 | ))); 271 | } else { 272 | $this->sendError("Unable to create directory $path"); 273 | } 274 | } 275 | 276 | 277 | 278 | /** 279 | * Delete file or directory 280 | * @param string folder 281 | * @param string item name 282 | */ 283 | public function actionDelete($folder, $name) 284 | { 285 | $path = $this->getFolderPath($folder) . "/" . $name; 286 | 287 | if (!file_exists($path)) { 288 | $this->sendError("File does not exist."); 289 | } 290 | 291 | if (is_dir($path)) { 292 | if (rmdir($path)) { 293 | $this->sendResponse(new JsonResponse(array( 294 | "deleted" => true, 295 | ))); 296 | } else { 297 | $this->sendError("Unable to delete directory."); 298 | } 299 | } 300 | 301 | if (is_file($path)) { 302 | if (unlink($path)) { 303 | $this->sendResponse(new JsonResponse(array( 304 | "deleted" => true, 305 | ))); 306 | } else { 307 | $this->sendError("Unable to delete file."); 308 | } 309 | } 310 | } 311 | 312 | 313 | 314 | /** 315 | * Rename file or directory 316 | * @param string folder 317 | * @param string old item name 318 | * @param string new item name 319 | */ 320 | public function actionRename($folder, $oldname, $newname) 321 | { 322 | $oldpath = $this->getFolderPath($folder) . "/" . $oldname; 323 | $newpath = $this->getFolderPath($folder) . "/" . Strings::webalize($newname, "."); 324 | 325 | if (!file_exists($oldpath)) { 326 | $this->sendError("File does not exist."); 327 | } 328 | 329 | if (rename($oldpath, $newpath)) { 330 | $this->sendResponse(new JsonResponse(array( 331 | "deleted" => true, 332 | ))); 333 | } else { 334 | $this->sendError("Unable to rename file."); 335 | } 336 | } 337 | 338 | } 339 | -------------------------------------------------------------------------------- /examples/nette/libs/jsmin.php: -------------------------------------------------------------------------------- 1 | 41 | * @copyright 2002 Douglas Crockford (jsmin.c) 42 | * @copyright 2008 Ryan Grove (PHP port) 43 | * @license http://opensource.org/licenses/mit-license.php MIT License 44 | * @version 1.1.1 (2008-03-02) 45 | * @link http://code.google.com/p/jsmin-php/ 46 | */ 47 | 48 | class JSMin { 49 | const ORD_LF = 10; 50 | const ORD_SPACE = 32; 51 | 52 | protected $a = ''; 53 | protected $b = ''; 54 | protected $input = ''; 55 | protected $inputIndex = 0; 56 | protected $inputLength = 0; 57 | protected $lookAhead = null; 58 | protected $output = ''; 59 | 60 | // -- Public Static Methods -------------------------------------------------- 61 | 62 | public static function minify($js) { 63 | $jsmin = new JSMin($js); 64 | return $jsmin->min(); 65 | } 66 | 67 | // -- Public Instance Methods ------------------------------------------------ 68 | 69 | public function __construct($input) { 70 | $this->input = str_replace("\r\n", "\n", $input); 71 | $this->inputLength = strlen($this->input); 72 | } 73 | 74 | // -- Protected Instance Methods --------------------------------------------- 75 | 76 | protected function action($d) { 77 | switch($d) { 78 | case 1: 79 | $this->output .= $this->a; 80 | 81 | case 2: 82 | $this->a = $this->b; 83 | 84 | if ($this->a === "'" || $this->a === '"') { 85 | for (;;) { 86 | $this->output .= $this->a; 87 | $this->a = $this->get(); 88 | 89 | if ($this->a === $this->b) { 90 | break; 91 | } 92 | 93 | if (ord($this->a) <= self::ORD_LF) { 94 | throw new JSMinException('Unterminated string literal.'); 95 | } 96 | 97 | if ($this->a === '\\') { 98 | $this->output .= $this->a; 99 | $this->a = $this->get(); 100 | } 101 | } 102 | } 103 | 104 | case 3: 105 | $this->b = $this->next(); 106 | 107 | if ($this->b === '/' && ( 108 | $this->a === '(' || $this->a === ',' || $this->a === '=' || 109 | $this->a === ':' || $this->a === '[' || $this->a === '!' || 110 | $this->a === '&' || $this->a === '|' || $this->a === '?')) { 111 | 112 | $this->output .= $this->a . $this->b; 113 | 114 | for (;;) { 115 | $this->a = $this->get(); 116 | 117 | if ($this->a === '/') { 118 | break; 119 | } elseif ($this->a === '\\') { 120 | $this->output .= $this->a; 121 | $this->a = $this->get(); 122 | } elseif (ord($this->a) <= self::ORD_LF) { 123 | throw new JSMinException('Unterminated regular expression '. 124 | 'literal.'); 125 | } 126 | 127 | $this->output .= $this->a; 128 | } 129 | 130 | $this->b = $this->next(); 131 | } 132 | } 133 | } 134 | 135 | protected function get() { 136 | $c = $this->lookAhead; 137 | $this->lookAhead = null; 138 | 139 | if ($c === null) { 140 | if ($this->inputIndex < $this->inputLength) { 141 | $c = substr($this->input, $this->inputIndex, 1); 142 | $this->inputIndex += 1; 143 | } else { 144 | $c = null; 145 | } 146 | } 147 | 148 | if ($c === "\r") { 149 | return "\n"; 150 | } 151 | 152 | if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { 153 | return $c; 154 | } 155 | 156 | return ' '; 157 | } 158 | 159 | protected function isAlphaNum($c) { 160 | return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; 161 | } 162 | 163 | protected function min() { 164 | $this->a = "\n"; 165 | $this->action(3); 166 | 167 | while ($this->a !== null) { 168 | switch ($this->a) { 169 | case ' ': 170 | if ($this->isAlphaNum($this->b)) { 171 | $this->action(1); 172 | } else { 173 | $this->action(2); 174 | } 175 | break; 176 | 177 | case "\n": 178 | switch ($this->b) { 179 | case '{': 180 | case '[': 181 | case '(': 182 | case '+': 183 | case '-': 184 | $this->action(1); 185 | break; 186 | 187 | case ' ': 188 | $this->action(3); 189 | break; 190 | 191 | default: 192 | if ($this->isAlphaNum($this->b)) { 193 | $this->action(1); 194 | } 195 | else { 196 | $this->action(2); 197 | } 198 | } 199 | break; 200 | 201 | default: 202 | switch ($this->b) { 203 | case ' ': 204 | if ($this->isAlphaNum($this->a)) { 205 | $this->action(1); 206 | break; 207 | } 208 | 209 | $this->action(3); 210 | break; 211 | 212 | case "\n": 213 | switch ($this->a) { 214 | case '}': 215 | case ']': 216 | case ')': 217 | case '+': 218 | case '-': 219 | case '"': 220 | case "'": 221 | $this->action(1); 222 | break; 223 | 224 | default: 225 | if ($this->isAlphaNum($this->a)) { 226 | $this->action(1); 227 | } 228 | else { 229 | $this->action(3); 230 | } 231 | } 232 | break; 233 | 234 | default: 235 | $this->action(1); 236 | break; 237 | } 238 | } 239 | } 240 | 241 | return $this->output; 242 | } 243 | 244 | protected function next() { 245 | $c = $this->get(); 246 | 247 | if ($c === '/') { 248 | switch($this->peek()) { 249 | case '/': 250 | for (;;) { 251 | $c = $this->get(); 252 | 253 | if (ord($c) <= self::ORD_LF) { 254 | return $c; 255 | } 256 | } 257 | 258 | case '*': 259 | $this->get(); 260 | 261 | for (;;) { 262 | switch($this->get()) { 263 | case '*': 264 | if ($this->peek() === '/') { 265 | $this->get(); 266 | return ' '; 267 | } 268 | break; 269 | 270 | case null: 271 | throw new JSMinException('Unterminated comment.'); 272 | } 273 | } 274 | 275 | default: 276 | return $c; 277 | } 278 | } 279 | 280 | return $c; 281 | } 282 | 283 | protected function peek() { 284 | $this->lookAhead = $this->get(); 285 | return $this->lookAhead; 286 | } 287 | } 288 | 289 | // -- Exceptions --------------------------------------------------------------- 290 | class JSMinException extends Exception {} -------------------------------------------------------------------------------- /texyla/plugins/files/files.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Files plugin 3 | */ 4 | 5 | jQuery.texyla.setDefaults({ 6 | filesPath: null, 7 | filesThumbPath: '%var%', 8 | filesIconPath: "%texyla_base%/plugins/files/icons/%var%.png", 9 | filesUploadPath: null, 10 | filesMkDirPath: null, 11 | filesRenamePath: null, 12 | filesDeletePath: null, 13 | filesAllowUpload: true, 14 | filesAllowMkDir: false, 15 | filesAllowDelete: true, 16 | filesAllowDeleteDir: false, 17 | filesAllowRename: true, 18 | filesAllowRenameDir: false, 19 | filesAllowFilter: true 20 | }); 21 | 22 | jQuery.texyla.initPlugin(function () { 23 | this.options.filesPath = this.expand(this.options.filesPath); 24 | if (this.options.filesThumbPath) 25 | this.options.filesThumbPath = this.expand(this.options.filesThumbPath); 26 | if (this.options.filesUploadPath) 27 | this.options.filesUploadPath = this.expand(this.options.filesUploadPath); 28 | if (this.options.filesMkDirPath) 29 | this.options.filesMkDirPath = this.expand(this.options.filesMkDirPath); 30 | if (this.options.filesRenamePath) 31 | this.options.filesRenamePath = this.expand(this.options.filesRenamePath); 32 | if (this.options.filesDeletePath) 33 | this.options.filesDeletePath = this.expand(this.options.filesDeletePath); 34 | }); 35 | 36 | jQuery.texyla.addWindow("files", { 37 | 38 | dimensions: [400, 350], 39 | 40 | createContent: function () { 41 | var _this = this; 42 | var currentDir = ""; 43 | 44 | var el = jQuery( 45 | '
      ' + 46 | '
      ' + 47 | '' + 48 | '

      ' + this.lng.wait + '

      ' + 49 | '
      ' 50 | ); 51 | 52 | 53 | /** 54 | * upload button 55 | */ 56 | 57 | if (this.options.filesAllowUpload) { 58 | jQuery('' + this.lng.filesUpload + '').button({ 59 | icons: { 60 | primary: "ui-icon-arrowthick-1-n" 61 | } 62 | }).click(function () { 63 | var win = _this.openWindow("upload"); 64 | win.find("form input.folder").val(currentDir); 65 | el.dialog("close"); 66 | return false; 67 | }).appendTo(el.find("div.toolbar")); 68 | } 69 | 70 | 71 | /** 72 | * mkdir button 73 | */ 74 | 75 | if (this.options.filesAllowMkDir) { 76 | jQuery('' + this.lng.filesMkDir + '').button({ 77 | icons: { 78 | primary: "ui-icon-folder-collapsed" 79 | } 80 | }).click(function () { 81 | var name = prompt(_this.lng.filesDirectoryName, ""); 82 | if (!name) return false; 83 | 84 | jQuery.getJSON(_this.options.filesMkDirPath, { 85 | folder: currentDir, 86 | name: name 87 | }, function (data) { 88 | if (data.error) { 89 | _this.error(data.error); 90 | return; 91 | } 92 | 93 | loadList(currentDir); 94 | }); 95 | 96 | return false; 97 | }).appendTo(el.find("div.toolbar")); 98 | } 99 | 100 | 101 | /** 102 | * files quick filter 103 | */ 104 | 105 | if (this.options.filesAllowFilter) { 106 | jQuery('
      ' + this.lng.filesFilter + ':
      ') 107 | .insertAfter(el.find(".toolbar")); 108 | 109 | var gallery = el.find("div.files-gallery"); 110 | 111 | el.find("div.files-filter input").keyup(function () { 112 | var val = this.value; 113 | gallery.find(".gallery-item").each(function () { 114 | var item = $(this); 115 | 116 | if (val === "") { 117 | item.show(); 118 | return; 119 | } 120 | 121 | if (item.find("span.name").text().indexOf(val) !== -1) { 122 | item.show(); 123 | } else { 124 | item.hide(); 125 | } 126 | }); 127 | }); 128 | } 129 | 130 | 131 | function loadList(dir) { 132 | currentDir = dir; 133 | el.find("p.wait").show(); 134 | el.find("div.toolbar, div.files-filter, div.files-gallery").hide(); 135 | 136 | jQuery.ajax({ 137 | type: "GET", 138 | dataType: "json", 139 | cache: false, 140 | url: _this.options.filesPath, 141 | data: {folder: currentDir}, 142 | success: function (data) { 143 | if (data.error) { 144 | _this.error(data.error); 145 | return; 146 | } 147 | 148 | el.find("p.wait").hide(); 149 | el.find("div.toolbar, div.files-filter, div.files-gallery").show(); 150 | gallery.empty(); 151 | 152 | // create files list 153 | 154 | var list = data.list; 155 | 156 | for (var i = 0; i < list.length; i++) { 157 | var type = list[i].type; 158 | 159 | var item = jQuery( 160 | '' + 161 | '' + 162 | '' 163 | ).appendTo(gallery); 164 | 165 | // icon 166 | if (type === "image") { 167 | item.find(".image").append(''); 168 | } else { 169 | item.find(".image").append(''); 170 | } 171 | 172 | // text 173 | item.find(".label").append('' + list[i].name + ''); 174 | if (list[i].description) { 175 | item.find(".label").append('
      ' + list[i].description + ''); 176 | } 177 | 178 | // events 179 | var fnc; 180 | 181 | switch (type) { 182 | case "up": 183 | case "folder": 184 | fnc = function (dir) { 185 | return function () { 186 | loadList(dir.key) 187 | return false; 188 | } 189 | }(list[i]); 190 | break; 191 | case "image": 192 | fnc = function (img) { 193 | return function () { 194 | var winEl = _this.openWindow("img"); 195 | winEl.find(".src").val(img.insertUrl); 196 | winEl.find(".alt").val(img.description).select(); 197 | el.dialog("close"); 198 | return false; 199 | } 200 | }(list[i]); 201 | break; 202 | case "file": 203 | fnc = function (file) { 204 | return function () { 205 | var winEl = _this.openWindow("link"); 206 | winEl.find(".link-url").val(file.insertUrl); 207 | winEl.find(".link-text").val(file.description).select(); 208 | el.dialog("close"); 209 | return false; 210 | } 211 | }(list[i]); 212 | break; 213 | } 214 | 215 | item.find(".image img").click(fnc); 216 | item.find(".label span.name a").click(fnc); 217 | 218 | // buttons 219 | if (type !== "up") { 220 | var buttons = jQuery('').appendTo(item.find("tr")); 221 | 222 | if ((_this.options.filesAllowRename && (type === "file" || type == "image")) || (_this.options.filesAllowRenameDir && type === "folder")) { 223 | jQuery('' + _this.lng.filesRename + '').button({ 224 | icons: { 225 | primary: "ui-icon-pencil" 226 | }, 227 | text: false 228 | }).click(function (file) { 229 | return function () { 230 | var newname = prompt(_this.lng.filesRename, file.name); 231 | 232 | if (!newname) return false; 233 | 234 | jQuery.getJSON(_this.options.filesRenamePath, { 235 | folder: currentDir, 236 | oldname: file.name, 237 | newname: newname 238 | }, function (data) { 239 | if (data.error) { 240 | _this.error(data.error); 241 | return; 242 | } 243 | 244 | loadList(currentDir); 245 | }); 246 | 247 | return false; 248 | } 249 | }(list[i])).appendTo(buttons); 250 | } 251 | 252 | if ((_this.options.filesAllowDelete && (type === "file" || type == "image")) || (_this.options.filesAllowDeleteDir && type === "folder")) { 253 | jQuery('' + _this.lng.filesDelete + '').button({ 254 | icons: { 255 | primary: "ui-icon-closethick" 256 | }, 257 | text: false 258 | }).click(function (file) { 259 | return function () { 260 | if (!confirm(_this.lng.filesReallyDelete + " '" + file.name + "'?")) return false; 261 | 262 | jQuery.getJSON(_this.options.filesDeletePath, { 263 | folder: currentDir, 264 | name: file.name 265 | }, function (data) { 266 | if (data.error) { 267 | _this.error(data.error); 268 | return; 269 | } 270 | 271 | loadList(currentDir); 272 | }); 273 | 274 | return false; 275 | } 276 | }(list[i])).appendTo(buttons); 277 | } 278 | 279 | 280 | } 281 | } 282 | } 283 | }); 284 | } 285 | 286 | loadList(""); 287 | 288 | return el; 289 | } 290 | }); 291 | 292 | 293 | /** 294 | * File upload 295 | */ 296 | jQuery.texyla.addWindow("upload", { 297 | dimensions: [330, 160], 298 | 299 | createContent: function () { 300 | return jQuery( 301 | '
      ' + 302 | '
      ' + 303 | '' + 304 | ' ' + 305 | '
      ' + 306 | '' + 307 | '
      ' 308 | ); 309 | }, 310 | 311 | action: function (el) { 312 | var upload = el.find("form"); 313 | 314 | if (!upload.find(".file").val()) return; 315 | 316 | el.ajaxStart(function () { 317 | upload.hide(); 318 | el.find("p.wait").show(); 319 | }).ajaxComplete(function () { 320 | el.dialog("close"); 321 | }); 322 | 323 | var _this = this; 324 | 325 | upload.ajaxUpload(function (data) { 326 | if (data.error) { 327 | _this.error(data.error); 328 | } else { 329 | if (data.type == "image") { 330 | var imgWin = _this.openWindow("img"); 331 | imgWin.find(".src").val(data.filename); 332 | imgWin.find(".alt").focus(); 333 | } else { 334 | var linkWin = _this.openWindow("link"); 335 | linkWin.find(".link-url").val(data.filename); 336 | linkWin.find(".link-text").focus(); 337 | } 338 | } 339 | }); 340 | } 341 | }); -------------------------------------------------------------------------------- /texyla/plugins/gravatar/gravatar.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Lopo 3 | */ 4 | jQuery.texyla.setDefaults({ 5 | gravatarMakro: '[* gravatar:%var% *]' 6 | }); 7 | 8 | jQuery.texyla.addWindow('gravatar', { 9 | createContent: function () { 10 | var el = jQuery( 11 | '
      ' + 12 | '

      " + 15 | this.lng.gravatarPreview + '
      ' + 16 | '
      ' + 17 | "
      " 18 | ); 19 | 20 | el.find('.key').bind('keyup change', function () { 21 | var val = this.value; 22 | 23 | if (!(/^[^@\s]+@[^@\s]+\.[a-z]{2,10}$/i).test(val)) { 24 | return; 25 | } 26 | 27 | jQuery(this).data('key', val); 28 | 29 | el.find('.thumb').html( 30 | '' 31 | ); 32 | }); 33 | 34 | return el; 35 | }, 36 | 37 | action: function (el) { 38 | var txt = this.expand(this.options.gravatarMakro, el.find('.key').data('key')); 39 | this.texy.update().replace(txt); 40 | }, 41 | 42 | dimensions: [320, 'auto'] 43 | }); 44 | 45 | jQuery.texyla.addStrings('cs', { 46 | }); 47 | 48 | //http://blog.faultylabs.com/?d=md5 49 | if (typeof faultylabs == 'undefined') { 50 | faultylabs = {} 51 | } 52 | faultylabs.MD5 = function(data) { 53 | function to_zerofilled_hex(n) { 54 | var t1 = (n >>> 0).toString(16) 55 | return "00000000".substr(0, 8 - t1.length) + t1 56 | } 57 | 58 | function chars_to_bytes(ac) { 59 | var retval = [] 60 | for (var i = 0; i < ac.length; i++) { 61 | retval = retval.concat(str_to_bytes(ac[i])) 62 | } 63 | return retval 64 | } 65 | 66 | function int64_to_bytes(num) { 67 | var retval = [] 68 | for (var i = 0; i < 8; i++) { 69 | retval.push(num & 0xFF) 70 | num = num >>> 8 71 | } 72 | return retval 73 | } 74 | 75 | function rol(num, places) { 76 | return ((num << places) & 0xFFFFFFFF) | (num >>> (32 - places)) 77 | } 78 | 79 | function fF(b, c, d) { 80 | return (b & c) | (~b & d) 81 | } 82 | 83 | function fG(b, c, d) { 84 | return (d & b) | (~d & c) 85 | } 86 | 87 | function fH(b, c, d) { 88 | return b ^ c ^ d 89 | } 90 | 91 | function fI(b, c, d) { 92 | return c ^ (b | ~d) 93 | } 94 | 95 | function bytes_to_int32(arr, off) { 96 | return (arr[off + 3] << 24) | (arr[off + 2] << 16) | (arr[off + 1] << 8) | (arr[off]) 97 | } 98 | 99 | function str_to_bytes(str) { 100 | var retval = [ ] 101 | for (var i = 0; i < str.length; i++) 102 | if (str.charCodeAt(i) <= 0x7F) { 103 | retval.push(str.charCodeAt(i)) 104 | } else { 105 | var tmp = encodeURIComponent(str.charAt(i)).substr(1).split('%') 106 | for (var j = 0; j < tmp.length; j++) { 107 | retval.push(parseInt(tmp[j], 0x10)) 108 | } 109 | } 110 | return retval 111 | } 112 | 113 | 114 | function int128le_to_hex(a, b, c, d) { 115 | var ra = "" 116 | var t = 0 117 | var ta = 0 118 | for (var i = 3; i >= 0; i--) { 119 | ta = arguments[i] 120 | t = (ta & 0xFF) 121 | ta = ta >>> 8 122 | t = t << 8 123 | t = t | (ta & 0xFF) 124 | ta = ta >>> 8 125 | t = t << 8 126 | t = t | (ta & 0xFF) 127 | ta = ta >>> 8 128 | t = t << 8 129 | t = t | ta 130 | ra = ra + to_zerofilled_hex(t) 131 | } 132 | return ra 133 | } 134 | 135 | function typed_to_plain(tarr) { 136 | var retval = new Array(tarr.length) 137 | for (var i = 0; i < tarr.length; i++) { 138 | retval[i] = tarr[i] 139 | } 140 | return retval 141 | } 142 | 143 | var databytes = null 144 | // String 145 | var type_mismatch = null 146 | if (typeof data == 'string') { 147 | databytes = str_to_bytes(data) 148 | } else if (data.constructor == Array) { 149 | if (data.length === 0) { 150 | databytes = data 151 | } else if (typeof data[0] == 'string') { 152 | databytes = chars_to_bytes(data) 153 | } else if (typeof data[0] == 'number') { 154 | databytes = data 155 | } else { 156 | type_mismatch = typeof data[0] 157 | } 158 | } else if (typeof ArrayBuffer != 'undefined') { 159 | if (data instanceof ArrayBuffer) { 160 | databytes = typed_to_plain(new Uint8Array(data)) 161 | } else if ((data instanceof Uint8Array) || (data instanceof Int8Array)) { 162 | databytes = typed_to_plain(data) 163 | } else if ((data instanceof Uint32Array) || (data instanceof Int32Array) || 164 | (data instanceof Uint16Array) || (data instanceof Int16Array) || 165 | (data instanceof Float32Array) || (data instanceof Float64Array) 166 | ) { 167 | databytes = typed_to_plain(new Uint8Array(data.buffer)) 168 | } else { 169 | type_mismatch = typeof data 170 | } 171 | } else { 172 | type_mismatch = typeof data 173 | } 174 | 175 | if (type_mismatch) { 176 | alert('MD5 type mismatch, cannot process ' + type_mismatch) 177 | } 178 | 179 | function _add(n1, n2) { 180 | return 0x0FFFFFFFF & (n1 + n2) 181 | } 182 | 183 | 184 | return do_digest() 185 | 186 | function do_digest() { 187 | function updateRun(nf, sin32, dw32, b32) { 188 | var temp = d 189 | d = c 190 | c = b 191 | //b = b + rol(a + (nf + (sin32 + dw32)), b32) 192 | b = _add(b, 193 | rol( 194 | _add(a, 195 | _add(nf, _add(sin32, dw32)) 196 | ), b32 197 | ) 198 | ) 199 | a = temp 200 | } 201 | 202 | var org_len = databytes.length 203 | 204 | databytes.push(0x80) 205 | 206 | var tail = databytes.length % 64 207 | if (tail > 56) { 208 | for (var i = 0; i < (64 - tail); i++) { 209 | databytes.push(0x0) 210 | } 211 | tail = databytes.length % 64 212 | } 213 | for (i = 0; i < (56 - tail); i++) { 214 | databytes.push(0x0) 215 | } 216 | databytes = databytes.concat(int64_to_bytes(org_len * 8)) 217 | 218 | var h0 = 0x67452301 219 | var h1 = 0xEFCDAB89 220 | var h2 = 0x98BADCFE 221 | var h3 = 0x10325476 222 | 223 | var a = 0, b = 0, c = 0, d = 0 224 | 225 | for (i = 0; i < databytes.length / 64; i++) { 226 | a = h0 227 | b = h1 228 | c = h2 229 | d = h3 230 | 231 | var ptr = i * 64 232 | 233 | updateRun(fF(b, c, d), 0xd76aa478, bytes_to_int32(databytes, ptr), 7) 234 | updateRun(fF(b, c, d), 0xe8c7b756, bytes_to_int32(databytes, ptr + 4), 12) 235 | updateRun(fF(b, c, d), 0x242070db, bytes_to_int32(databytes, ptr + 8), 17) 236 | updateRun(fF(b, c, d), 0xc1bdceee, bytes_to_int32(databytes, ptr + 12), 22) 237 | updateRun(fF(b, c, d), 0xf57c0faf, bytes_to_int32(databytes, ptr + 16), 7) 238 | updateRun(fF(b, c, d), 0x4787c62a, bytes_to_int32(databytes, ptr + 20), 12) 239 | updateRun(fF(b, c, d), 0xa8304613, bytes_to_int32(databytes, ptr + 24), 17) 240 | updateRun(fF(b, c, d), 0xfd469501, bytes_to_int32(databytes, ptr + 28), 22) 241 | updateRun(fF(b, c, d), 0x698098d8, bytes_to_int32(databytes, ptr + 32), 7) 242 | updateRun(fF(b, c, d), 0x8b44f7af, bytes_to_int32(databytes, ptr + 36), 12) 243 | updateRun(fF(b, c, d), 0xffff5bb1, bytes_to_int32(databytes, ptr + 40), 17) 244 | updateRun(fF(b, c, d), 0x895cd7be, bytes_to_int32(databytes, ptr + 44), 22) 245 | updateRun(fF(b, c, d), 0x6b901122, bytes_to_int32(databytes, ptr + 48), 7) 246 | updateRun(fF(b, c, d), 0xfd987193, bytes_to_int32(databytes, ptr + 52), 12) 247 | updateRun(fF(b, c, d), 0xa679438e, bytes_to_int32(databytes, ptr + 56), 17) 248 | updateRun(fF(b, c, d), 0x49b40821, bytes_to_int32(databytes, ptr + 60), 22) 249 | updateRun(fG(b, c, d), 0xf61e2562, bytes_to_int32(databytes, ptr + 4), 5) 250 | updateRun(fG(b, c, d), 0xc040b340, bytes_to_int32(databytes, ptr + 24), 9) 251 | updateRun(fG(b, c, d), 0x265e5a51, bytes_to_int32(databytes, ptr + 44), 14) 252 | updateRun(fG(b, c, d), 0xe9b6c7aa, bytes_to_int32(databytes, ptr), 20) 253 | updateRun(fG(b, c, d), 0xd62f105d, bytes_to_int32(databytes, ptr + 20), 5) 254 | updateRun(fG(b, c, d), 0x2441453, bytes_to_int32(databytes, ptr + 40), 9) 255 | updateRun(fG(b, c, d), 0xd8a1e681, bytes_to_int32(databytes, ptr + 60), 14) 256 | updateRun(fG(b, c, d), 0xe7d3fbc8, bytes_to_int32(databytes, ptr + 16), 20) 257 | updateRun(fG(b, c, d), 0x21e1cde6, bytes_to_int32(databytes, ptr + 36), 5) 258 | updateRun(fG(b, c, d), 0xc33707d6, bytes_to_int32(databytes, ptr + 56), 9) 259 | updateRun(fG(b, c, d), 0xf4d50d87, bytes_to_int32(databytes, ptr + 12), 14) 260 | updateRun(fG(b, c, d), 0x455a14ed, bytes_to_int32(databytes, ptr + 32), 20) 261 | updateRun(fG(b, c, d), 0xa9e3e905, bytes_to_int32(databytes, ptr + 52), 5) 262 | updateRun(fG(b, c, d), 0xfcefa3f8, bytes_to_int32(databytes, ptr + 8), 9) 263 | updateRun(fG(b, c, d), 0x676f02d9, bytes_to_int32(databytes, ptr + 28), 14) 264 | updateRun(fG(b, c, d), 0x8d2a4c8a, bytes_to_int32(databytes, ptr + 48), 20) 265 | updateRun(fH(b, c, d), 0xfffa3942, bytes_to_int32(databytes, ptr + 20), 4) 266 | updateRun(fH(b, c, d), 0x8771f681, bytes_to_int32(databytes, ptr + 32), 11) 267 | updateRun(fH(b, c, d), 0x6d9d6122, bytes_to_int32(databytes, ptr + 44), 16) 268 | updateRun(fH(b, c, d), 0xfde5380c, bytes_to_int32(databytes, ptr + 56), 23) 269 | updateRun(fH(b, c, d), 0xa4beea44, bytes_to_int32(databytes, ptr + 4), 4) 270 | updateRun(fH(b, c, d), 0x4bdecfa9, bytes_to_int32(databytes, ptr + 16), 11) 271 | updateRun(fH(b, c, d), 0xf6bb4b60, bytes_to_int32(databytes, ptr + 28), 16) 272 | updateRun(fH(b, c, d), 0xbebfbc70, bytes_to_int32(databytes, ptr + 40), 23) 273 | updateRun(fH(b, c, d), 0x289b7ec6, bytes_to_int32(databytes, ptr + 52), 4) 274 | updateRun(fH(b, c, d), 0xeaa127fa, bytes_to_int32(databytes, ptr), 11) 275 | updateRun(fH(b, c, d), 0xd4ef3085, bytes_to_int32(databytes, ptr + 12), 16) 276 | updateRun(fH(b, c, d), 0x4881d05, bytes_to_int32(databytes, ptr + 24), 23) 277 | updateRun(fH(b, c, d), 0xd9d4d039, bytes_to_int32(databytes, ptr + 36), 4) 278 | updateRun(fH(b, c, d), 0xe6db99e5, bytes_to_int32(databytes, ptr + 48), 11) 279 | updateRun(fH(b, c, d), 0x1fa27cf8, bytes_to_int32(databytes, ptr + 60), 16) 280 | updateRun(fH(b, c, d), 0xc4ac5665, bytes_to_int32(databytes, ptr + 8), 23) 281 | updateRun(fI(b, c, d), 0xf4292244, bytes_to_int32(databytes, ptr), 6) 282 | updateRun(fI(b, c, d), 0x432aff97, bytes_to_int32(databytes, ptr + 28), 10) 283 | updateRun(fI(b, c, d), 0xab9423a7, bytes_to_int32(databytes, ptr + 56), 15) 284 | updateRun(fI(b, c, d), 0xfc93a039, bytes_to_int32(databytes, ptr + 20), 21) 285 | updateRun(fI(b, c, d), 0x655b59c3, bytes_to_int32(databytes, ptr + 48), 6) 286 | updateRun(fI(b, c, d), 0x8f0ccc92, bytes_to_int32(databytes, ptr + 12), 10) 287 | updateRun(fI(b, c, d), 0xffeff47d, bytes_to_int32(databytes, ptr + 40), 15) 288 | updateRun(fI(b, c, d), 0x85845dd1, bytes_to_int32(databytes, ptr + 4), 21) 289 | updateRun(fI(b, c, d), 0x6fa87e4f, bytes_to_int32(databytes, ptr + 32), 6) 290 | updateRun(fI(b, c, d), 0xfe2ce6e0, bytes_to_int32(databytes, ptr + 60), 10) 291 | updateRun(fI(b, c, d), 0xa3014314, bytes_to_int32(databytes, ptr + 24), 15) 292 | updateRun(fI(b, c, d), 0x4e0811a1, bytes_to_int32(databytes, ptr + 52), 21) 293 | updateRun(fI(b, c, d), 0xf7537e82, bytes_to_int32(databytes, ptr + 16), 6) 294 | updateRun(fI(b, c, d), 0xbd3af235, bytes_to_int32(databytes, ptr + 44), 10) 295 | updateRun(fI(b, c, d), 0x2ad7d2bb, bytes_to_int32(databytes, ptr + 8), 15) 296 | updateRun(fI(b, c, d), 0xeb86d391, bytes_to_int32(databytes, ptr + 36), 21) 297 | 298 | h0 = _add(h0, a) 299 | h1 = _add(h1, b) 300 | h2 = _add(h2, c) 301 | h3 = _add(h3, d) 302 | } 303 | return int128le_to_hex(h3, h2, h1, h0).toUpperCase() 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /gpl.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------